OpenCores
URL https://opencores.org/ocsvn/orsoc_graphics_accelerator/orsoc_graphics_accelerator/trunk

Subversion Repositories orsoc_graphics_accelerator

[/] [orsoc_graphics_accelerator/] [trunk/] [doc/] [src/] [gettingstarted.tex] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 maiden
\documentclass[10pt,a4paper]{article}
2
\usepackage[latin1]{inputenc}
3
\usepackage{amsmath}
4
\usepackage{amsfonts}
5
\usepackage{amssymb}
6
\usepackage{graphicx}
7
\usepackage{listings}
8
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
9
\author{Per Lenander, Anton Fosselius}
10
\title{ORGFX - getting started}
11
 
12
\begin{document}
13
 
14
\maketitle
15
 
16
\section{Introduction}
17
This document is intended to make it easier to get started with the ORSoC graphics accelerator component. It contains some useful links and instructions on how to get the example code working.
18
 
19
\newpage
20
 
21
\section{Project structure}
22
 
23
The project source is structured as seen in figure \ref{fig:directory}.
24
 
25
\begin{figure}
26
\begin{center}
27
\includegraphics[scale=0.5]{../pictures/directory}
28
\caption{Directory structure of the ORSoC graphics accelerator.}
29
\label{fig:directory}
30
\end{center}
31
\end{figure}
32
 
33
\section{Hardware}
34
The \textbf{rtl} folder contains all the code needed to instantiate the ORGFX IP Core.
35
 
36
The component has 3 main wishbone interfaces:
37
 
38
\begin{itemize}
39
\item A wishbone slave interface for reading and writing registers. Every registry write will be added to a circular FIFO instruction queue.
40
\item A wishbone master interface for reading from memory (requires at least a read-only memory).
41
\item A wishbone master interface for writing to memory (requires at least a write-only memory).
42
\end{itemize}
43
 
44
All functionality of the component is accessed by writing instructions to the registers. Only writes to the control register can potentially start drawing operations.
45
 
46
Refer to the specification document for a full explanation of all registers, their default values and how they are used.
47
 
48
The component can be modified to extend the size of the instruction queue by changing the \textit{fifo\_depth} parameter. It is not advised to change the other parameters, as their function is not fully tested.
49
 
50
\section{Software}
51
\subsection{Drivers}
52
ORGFX comes with a layered software driver in the \textbf{sw/drivers} folder.
53
 
54
The basic driver consists of:
55
 
56
\begin{lstlisting}
57
orgfx.h
58
orgfx.c
59
orgfx_regs.h
60
\end{lstlisting}
61
 
62
It is possible to set the base bus address of the graphics accelerator in the regs file. The \textbf{orgfx.c} file is the only part of the driver that can interact with the hardware.
63
 
64
The extended driver (convenience functions and better surface management) consists of:
65
 
66
\begin{lstlisting}
67
orgfx_plus.h
68
orgfx_plus.c
69
\end{lstlisting}
70
 
71
The extended driver is required for most of the advanced API. Memory is managed statically in the driver, so the driver must be modified if support for a larger number of surfaces is desired.
72
 
73
There are four sets of advanced API that all build on the functionality of the basic and the extended driver:
74
 
75
\begin{lstlisting}
76
orgfx_3d.h
77
orgfx_3d.c
78
orgfx_tileset.h
79
orgfx_tileset.c
80
orgfx_bitmap_font.h
81
orgfx_bitmap_font.c
82
orgfx_vector_font.h
83
orgfx_vector_font.c
84
\end{lstlisting}
85
 
86
These supply convenience functions for doing more complex operations in a small number of function calls (such as drawing a 3D mesh). Most of these should be used with the output of the \textit{utilities} described below.
87
 
88
\subsection{Examples}
89
In addition to the drivers, the \textbf{sw} folder contains \textbf{examples}  and \textbf{utils}. The examples contain a few sample implementations with some basic functionality. The examples can be built by using the supplied Makefile. By default it builds the examples for hardware (requires or32-elf- toolchain to build for OpenRISC. The Makefile assumes that the or32-elf tool \textbf{bin2binsizeword} is in the path).
90
 
91
\subsection{Utilities}
92
There are four useful utilities supplied with ORGFX: the spritemaker, meshmaker, bitfontmaker and vector font maker programs. Build all the utilities with the Makefile in the \textbf{utils} directory.
93
 
94
All the utilities take some form of input file and generates a header file containing all the information needed for the drivers. These files also contains a function for initialization specific to the resource contained. Calling this function creates the necessary structure that the drivers can use.
95
 
96
The spritemaker program takes an image \textit{filename.png} and creates an output file \textit{filename.png.h} (the program also support various other file formats\footnote{http://www.libsdl.org/projects/SDL\_image/}).
97
\begin{lstlisting}
98
./spritemaker filename.<jpg/png/bmp> [bpp=16]
99
\end{lstlisting}
100
 
101
The meshmaker program takes a Wavefront .obj file \textit{filename.obj} and generates the file \textit{filename.obj.h}.
102
\begin{lstlisting}
103
./meshmaker filename.obj [bpp=16]
104
\end{lstlisting}
105
 
106
The bitfontmaker program takes an image containing a 256 character bitmap font where each letter is \textit{glyphsize} pixels large. Th program takes an image \textit{filename.png} and generates \textit{filename\_font.h} (supports the same image formats that spritemaker does).
107
\begin{lstlisting}
108
./bitfontmaker filename.<jpg/png/bmp> [bpp=16] [glyphsize=32]
109
\end{lstlisting}
110
 
111
The fonter program takes a vector font \textit{filename.ttf} and generates \textit{filename\_font.h}.
112
\begin{lstlisting}
113
./fonter filename.ttf
114
\end{lstlisting}
115
 
116
\section{Emulator}
117
Along with the hardware implementation, there is a software implementation of the graphics accelerator written in SDL. The software implementation consists of the file:
118
 
119
\begin{lstlisting}
120
orgfx_sw.c
121
\end{lstlisting}
122
 
123
and replaces the files:
124
 
125
\begin{lstlisting}
126
orgfx.c
127
orgfx_plus.c
128
\end{lstlisting}
129
 
130
From the examples folder, type:
131
\begin{lstlisting}
132
make sw
133
\end{lstlisting}
134
 
135
This command will generate a software implementation of all the examples (requires the SDL and SDL\_image libraries). While the implementation is not a cycle-for-cycle perfect emulation, it does make it significantly easier and faster to develop applications for the device.
136
 
137
\section{Example implementation}
138
To follow the instructions you will need to have Xilinx ISE installed and have a Digilent ATLYS board available. You will also need Git and the OpenRISC toolchain. Git can easily be installed in Debian based Linux distributions like Ubuntu with the following command:
139
 
140
\begin{quote}
141
sudo apt-get install git
142
\end{quote}
143
 
144
The example implementation based on ORPSOCv2 can be found on:
145
\begin{quote}
146
https://github.com/maidenone/ORGFXSoC
147
\end{quote}
148
 
149
To build the project you will also need to download the ORGFX project located at:
150
\begin{quote}
151
http://opencores.org/project,orsoc\_graphics\_accelerator
152
\end{quote}
153
 
154
First checkout the code from github with the following command:
155
 
156
\begin{quote}
157
git checkout git://github.com/maidenone/ORGFXSoC.git
158
\end{quote}
159
 
160
Now move into the folder of the ORGFX project and edit the make file located in sw/examples/bare:
161
\begin{quote}
162
cd PATH\_TO/orsoc\_graphics\_accelerator/trunk/sw/examples/bare/
163
\end{quote}
164
Use gedit or a texteditor of your choice to edit the Makefile
165
 
166
\begin{quote}
167
gedit Makefile
168
\end{quote}
169
 
170
Now replace the path to the example implementation from the path:
171
\begin{quote}
172
../../../../orpsocv2/boards/xilinx/atlys/backend/par/run/
173
\end{quote}
174
To the same path in your ORGFXSoC folder.
175
 
176
Now build the example code in sw/examples/bare/ with make
177
\begin{quote}
178
make
179
\end{quote}
180
 
181
Move to the following directory in your ORGFXSoC directory:
182
\begin{quote}
183
cd orpsocv2/boards/xilinx/atlys/backend/par/run
184
\end{quote}
185
 
186
and finally run make
187
\begin{quote}
188
make
189
\end{quote}
190
 
191
Now a .mcs file have been generated, Now program your atlys board with Digilent Adept. Chose the Flash tab and in the "FPGA programming file" field browse for the .mcs file that the makefile generated. The mcs file will be located in the par/run folder.
192
 
193
Hit the program button and you are done.
194
 
195
\end{document}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.