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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [doc/] [manual/] [demosoc.tex] - Blame information for rev 113

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 hellwig
\chapter{Demonstration SoC Project}
2
 
3
This chapter describes a demonstration project that uses the \eco in a SoC design. The project is implemented on an XSA-3S1000 prototyping board form XESS Corp. More information about the prototyping board itself can be found on the XESS homepage, \href{http://www.xess.com}{http://www.xess.com}.
4
 
5
The demonstration project instantiates the \eco inside the Spartan-3 FPGA on the prototyping board and augments it with on-chip controllers for the external hardware on the prototyping board. These controllers are connected to the \eco through the SoC bus. They allow to access the on-board 32 MB SDRAM as the program and data RAM of the \ecox. The flash ROM is connected to the beginning of the peripheral device address space, such that the V bit of the psw selects a base address either in RAM or ROM (see \myref{2}{psw}). Further controllers connected to the SoC bus allow access to a character-based VGA display, PS/2 keyboard, RS232 serial port, and IDE hard disk.
6
 
7
\section{Address Map}
8
 
9
This section describes the mapping of physical addresses to devices in the demonstration project. To access a device directly from a program, direct-mapped virtual addresses can be used that are obtained by adding 0xC0000000 to the physical addresses listed here.
10
 
11
\begin{tabular}{|c|c|c|}
12
\hline
13
Physical Address & Virtual Address & Device\\
14
\hline
15
00000000$_h$ - 01FFFFFF$_h$ & C0000000$_h$ - C1FFFFFF$_h$ & RAM\\
16
02000000$_h$ - 1FFFFFFF$_h$ & C2000000$_h$ - DFFFFFFF$_h$ & (unused)\\
17
20000000$_h$ - 2003FFFF$_h$ & E0000000$_h$ - E003FFFF$_h$ & ROM\\
18
20040000$_h$ - 2FFFFFFF$_h$ & E0040000$_h$ - EFFFFFFF$_h$ & (unused)\\
19
30000000$_h$ - 300FFFFF$_h$ & F0000000$_h$ - F00FFFFF$_h$ & Timer\\
20
30100000$_h$ - 301FFFFF$_h$ & F0100000$_h$ - F01FFFFF$_h$ & Display\\
21
30200000$_h$ - 302FFFFF$_h$ & F0200000$_h$ - F02FFFFF$_h$ & Keyboard\\
22
30300000$_h$ - 303FFFFF$_h$ & F0300000$_h$ - F03FFFFF$_h$ & Terminal\\
23
30400000$_h$ - 304FFFFF$_h$ & F0400000$_h$ - F04FFFFF$_h$ & Disk\\
24
30500000$_h$ - 3FFFFFFF$_h$ & F0500000$_h$ - FFFFFFFF$_h$ & (unused)\\
25
40000000$_h$ - FFFFFFFF$_h$ & (not direct-mapped) & (unused)$^*$\\
26
\hline
27
\end{tabular}
28
 
29
$^*$these addresses are defined to be permanently unused by the SoC bus architecture.
30
 
31
\section{Interrupt Map}
32
 
33
This section describes the mapping of interrupt numbers (0..15) to devices in the demonstration project. The interupt number specifies both the index of the interrupt signal in the interrupt signal group when connecting the soft-core to other devices, and the number that is placed in the $IEN$ field of the \psw when accepting an interrupt.
34
 
35
\begin{tabular}{|c|c|}
36
\hline
37
Interrupt Number & Device\\
38
\hline
39
 
40
1 & Terminal Receiver \#1\\
41
2 & Terminal Sender \#2\\
42
3 & Terminal Receiver \#2\\
43
4 & Keyboard\\
44
5 & (unused)\\
45
6 & (unused)\\
46
7 & (unused)\\
47
8 & Disk\\
48
9 & (unused)\\
49
10 & (unused)\\
50
11 & (unused)\\
51
12 & (unused)\\
52
13 & (unused)\\
53
14 & Timer\\
54
15 & (unused)\\
55
\hline
56
\end{tabular}
57
 
58
\section{RAM and ROM}
59
 
60
The RAM controller connects the \eco to the 32 MB SDRAM chip on the development board. Above 32 MB, the memory map has a hole to allow similar designs with a larger RAM use a compatible memory map. Next comes the ROM controller which connects the \eco to the on-board flash ROM. Only 256 kB of that ROM can be accessed. Note that the ROM also contains the configuration bitstream for the FPGA. The ROM locations for the bit stream are not accessible by the \ecox.
61
 
62
The RAM and ROM are the only devices in the physical address space that may be accessed by half-word and byte transfers. They may contain both program and data. Obviously, the ROM can only contain constant data.
63
 
64
\section{Timer}
65
 
66
The timer is a simple binary counter inside the FPGA that counts clock cycles backwards. Whenever it reaches zero, it is reset to a value specified by a \definition{divisor register} and sets a wrap-around flag. Optionally, this flag generates an interrupt when set. The divisor register thus controls how often the flag is set.
67
 
68
The \definition{control register} of the timer is used to read or write the wrap-around flag as well as an interrupt enable flag. An interrupt is generated when both the wrap-around flag and the interrupt enable flag are set. The interrupt service routine typically resets the wrap-around flag to de-assert the interrupt signal. Note that the interrupt enable flag is distinct from both the global and the channel-specific interrupt enable flags in the \pswx.
69
 
70
\begin{tabular}{|c|c|c|c|}
71
\hline
72
Bits & 31..2 & 1 & 0\\
73
\hline
74
Meaning & (ignored) & Interrupt Enable & Wrap-Around\\
75
\hline
76
\end{tabular}
77
 
78
The control register can be accessed at physical address 30000000$_h$ (virtual address F0000000$_h$). The divisor register can be accessed at physical address 30000004$_h$ (virtual address F0000004$_h$).
79
 
80
\section{Display}
81
 
82
The display controller generates a 640x480x60 VGA signal from a 80x30 character matrix, with 8x16 pixels per character. The signal is sent to the VGA port of the prototyping board and can be viewed on a VGA monitor connected to that port. Characters are generated by taking ASCII-encoded characters from the character matrix, converting them to pixels through a character ROM, and applying attributes stored together with the character matrix.
83
 
84
Although the visible character matrix has a size of 80x30, it uses a 128x32 memory internally. These memory locations can be accessed by 128x32 consecutive word locations, stored line by line, at physical addresses 30100000$_h$ through 30100FFC$_h$ (virtual addresses F0100000$_h$ through F0100FFC$_h$). Each word location contains a character code and attributes:
85
 
86
\begin{tabular}{|c|c|c|c|}
87
\hline
88
Bits & 31..16 & 15..8 & 7..0\\
89
\hline
90
Meaning & (ignored) & Attributes & Character Code\\
91
\hline
92
\end{tabular}
93
 
94
The attributes can be subdivided again:
95
 
96
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}
97
\hline
98
Bits & ... & 15 & 14 & 13 & 12 & 11 & 10 & 9 & 8 & ...\\
99
\hline
100
Meaning & ... & $BL$ & $R_B$ & $G_B$ & $B_B$ & $I$ & $R_F$ & $G_F$ & $B_F$ & ...\\
101
\hline
102
\end{tabular}
103
 
104
The $R_F$, $G_F$, and $B_F$ bits control the base foreground color of the character by enabling the red, green, and blue channels, respectively. If the $I$ bit is set, then all enabled channels are intensified to make the foreground color brighter. The $R_B$, $G_B$, and $B_B$ bits control the color of the background by enabling the red, green, and blue channels, respectively. The $BL$ bit causes the character to \definition{blink}, that is, to become visible and invisible in regular intervals.
105
 
106
The character ROM which contains the pixel patterns for the individual characters cannot be accessed directly.
107
 
108
\section{Keyboard}
109
 
110
The keyboard controller connects the \eco with a keyboard attached to the PS/2 port of the prototyping board. It delivers a stream of \definition{scan codes} from the keyboard which correspond to {\it key press} and {\it key release} events. The decoding of these scan codes is not done by the keyboard controller, but must be done in software instead.
111
 
112
The keyboard controller is accessed by two device registers called the \definition{control register} and the \definition{data register}. When the keyboard controller receives a scancode byte from the keyboard, it stores that byte internally and sets a \definition{ready} flag in the control register. Optionally, the ready flag generates an interrupt: The interrupt signal is asserted if both the ready flag and the interrupt enable flag are set. The corresponding interrupt service routine typically resets the ready flag to de-assert the interrupt signal. The received scancode byte can be read from the data register. Reading from the data register has the side-effect of resetting the ready flag, so the interrupt service routine need not do this manually if it reads from the data register.
113
 
114
The control register can be accessed at physical address 30200000$_h$ (virtual address F0200000$_h$) and has the following layout:
115
 
116
\begin{tabular}{|c|c|c|c|}
117
\hline
118
Bits & 31..2 & 1 & 0\\
119
\hline
120
Meaning & (ignored) & Interrupt Enable & Ready\\
121
\hline
122
\end{tabular}
123
 
124
The data register can be accessed at physical address 30200004$_h$ (virtual address F0200004$_h$) and has the following layout:
125
 
126
\begin{tabular}{|c|c|c|}
127
\hline
128
Bits & 31..8 & 7..0\\
129
\hline
130
Meaning & (ignored) & Scancode Byte\\
131
\hline
132
\end{tabular}
133
 
134
\section{Terminal}
135
 
136
The demonstration project supports a serial terminal connected to the RS232 port of the prototyping board. It also supports a second serial terminal if a modified cable is used: The data transfer lines of the second terminal use the flow control lines of the RS232 port. Using a single terminal with hardware flow control instead of a second terminal is not supported. Also, terminals must currently use a transfer speed of 38400 bauds, a transfer size of 8 bits, 1 start bit, 1 stop bit, and no parity bit.
137
 
138
Each terminal is accessed by four registers: The \definition{receiver control register}, the \definition{receiver data register}, the \definition{sender control register}, and the \definition{sender data register}. These registers can be accessed at the following addresses:
139
 
140
\begin{tabular}{|c|c|c|}
141
\hline
142
Register & Physical Address & Virtual Address\\
143
\hline
144
Receiver Control 1 & 30300000$_h$ & F0300000$_h$\\
145
\hline
146
Receiver Data 1 & 30300004$_h$ & F0300004$_h$\\
147
\hline
148
Sender Control 1 & 30300008$_h$ & F0300008$_h$\\
149
\hline
150
Sender Data 1 & 3030000C$_h$ & F030000C$_h$\\
151
\hline
152
Receiver Control 2 & 30300010$_h$ & F0300010$_h$\\
153
\hline
154
Receiver Data 2 & 30300014$_h$ & F0300014$_h$\\
155
\hline
156
Sender Control 2 & 30300018$_h$ & F0300018$_h$\\
157
\hline
158
Sender Data 2 & 3030001C$_h$ & F030001C$_h$\\
159
\hline
160
\end{tabular}
161
 
162
\subsection{Receiver}
163
 
164
The control register of each receiver contains a \definition{ready flag} that indicates whether a character has been received, and an \definition{interrupt enable flag} to indicate whether the ready flag shall cause an interrupt. The interrupt signal is asserted if both flags are set. Typically, the corresponding interrupt service routine resets the ready flag to de-assert the interrupt signal. The receiver control register has the following layout:
165
 
166
\begin{tabular}{|c|c|c|c|}
167
\hline
168
Bits & 31..2 & 1 & 0\\
169
\hline
170
Meaning & (ignored) & Interrupt Enable & Ready\\
171
\hline
172
\end{tabular}
173
 
174
When a character has been received, it can be read from the receiver data register. Reading a character from the receiver data register has the side-effect of resetting the ready flag. The receiver data register has the following layout:
175
 
176
\begin{tabular}{|c|c|c|}
177
\hline
178
Bits & 31..8 & 7..0\\
179
\hline
180
Meaning & (ignored) & Received Character\\
181
\hline
182
\end{tabular}
183
 
184
\subsection{Sender}
185
 
186
The control register of each sender contains a \definition{ready flag} that indicates whether the sender can accept a character to send, and an \definition{interrupt enable flag} to indicate whether the ready flag shall cause an interrupt. The interrupt signal is asserted if both flags are set. Typically, the corresponding interrupt service routine resets the ready flag to de-assert the interrupt signal. The sender control register has the following layout:
187
 
188
\begin{tabular}{|c|c|c|c|}
189
\hline
190
Bits & 31..2 & 1 & 0\\
191
\hline
192
Meaning & (ignored) & Interrupt Enable & Ready\\
193
\hline
194
\end{tabular}
195
 
196
To send a character, the corresponding data byte must be written to the sender data register. Writing to this register has the side-effect of resetting the ready flag. The sender data register has the following layout:
197
 
198
\begin{tabular}{|c|c|c|}
199
\hline
200
Bits & 31..8 & 7..0\\
201
\hline
202
Meaning & (ignored) & Character to Send\\
203
\hline
204
\end{tabular}
205
 
206
\section{Disk}
207
 
208
The disk controller connects the \eco to an IDE hard disk through the IDE port of the prototyping board. The disk controller simplifies the communication with the disk by hiding the details of the IDE protocol, but in turn allows only simple commands and low transfer speeds.
209
 
210
The disk controller is accessed through the following addresses:
211
 
212
\begin{tabular}{|c|c|c|}
213
\hline
214
Location & Physical Address & Virtual Address\\
215
\hline
216
Control Register & 30400000$_h$ & F0400000$_h$\\
217
\hline
218
Sector Count Register & 30400004$_h$ & F0400004$_h$\\
219
\hline
220
Sector Address Register & 30400008$_h$ & F0400008$_h$\\
221
\hline
222
Capacity Register & 3040000C$_h$ & F040000C$_h$\\
223
\hline
224
(unused) & 30400010$_h$ & F0400010$_h$\\
225
& ..3047FFFC$_h$ & ..F047FFFC$_h$\\
226
\hline
227
Data Buffer & 30480000$_h$ & F0480000$_h$\\
228
& ..30480FFF$_h$ & ..F0480FFF$_h$\\
229
\hline
230
(mirrored data buffer) & 30481000$_h$ & F0481000$_h$\\
231
& ..304FFFFC$_h$ & ..F04FFFFC$_h$\\
232
\hline
233
\end{tabular}
234
 
235
\subsection{Control Register}
236
 
237
The control register is used to read the status of the disk controller, change general control parameters, and initiate actions. It has the following layout:
238
 
239
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
240
\hline
241
Bits & 31 & 30..6 & 5 & 4 & 3 & 2 & 1 & 0\\
242
\hline
243
Meaning & DMARQ & (ignored) & INIT & FIN & ERR & WR & IEN & START\\
244
\hline
245
\end{tabular}
246
 
247
The DMARQ is a read-only bit that indicates whether the attached disk currently sends a DMA request. This flag can be safely ignored. The INIT flag is a read-only bit that is set to 0 after reset, but turns to 1 as soon as the disk controller has finished initialization. Until the disk is initialized, only the control register should be accessed, and it should only be read to check the status of the INIT flag.
248
 
249
The FIN flag is set to 1 each time the disk controller finishes an operation. The IEN flag can be used to specify whether the FIN flag shall cause an interrupt. The interrupt signal is asserted if both flags are set. Both flags can be changed by writing to the control register. Typically, the corresponding interrupt service routine resets FIN to de-assert the interrupt signal.
250
 
251
The ERR flag is a read-only bit that is either set or reset whenever the disk controller has finished an operation. If set, it indicates an error during the operation.
252
 
253
The WR flag can only be changed while no operation is in progress. It is used to specify whether the disk controller shall perform a read or write operation on the disk.
254
 
255
The START bit is not actually a register. When reading from the control register, it always contains the value 0. Writing a value of 0 to this bit has no effect. Writing a value of 1 initiates the action selected by the WR bit, using the arguments from the sector address and sector count registers.
256
 
257
\subsection{Disk Controller Operations}
258
 
259
An action is initiated by writing a value of 1 to the START bit of the control register. While an action is in progress, the WR bit of the control register, as well as the sector address register and the sector count register cannot be modified. An action transfers sectors from the data buffer to the disk (if WR is set), or from the disk to the data buffer (if WR is reset). The number of transferred sectors is specified by the sector count register. The range of transferred sectors starts at the beginning of the data buffer, and on disk at the sector indicated by the sector address register.
260
 
261
When the transfer is complete, the disk controller resets or sets the ERR flag in the control register, depending on whether the transfer was successful or an error occurred. The disk controller also sets the FIN flag of the control register to indicate completion of the transfer, which causes the interrupt signal to be asserted if the IEN flag is also set.
262
 
263
\subsection{Sector Address, Sector Count, and Capacity}
264
 
265
The sector address register must be set to the number of the first sector on disk to take part in a transfer prior to starting the transfer. Likewise, the sector count register must be set to the number of sectors to transfer prior to starting the transfer. The capacity register is a read-only register that contains the total number of sectors on disk.
266
 
267
\subsection{Data Buffer}
268
 
269
The data buffer has a size of 4096 bytes and thus contains up to 8 sectors. Being located in the device address space, it may only be accessed by word-sized transfers. Since the disk buffer conceptually contains bytes, not words, the word units transferred through the SoC bus comprise the corresponding bytes in a big-endian fashion.
270
 
271
The data buffer should not be accessed while a transfer is in progress.

powered by: WebSVN 2.1.0

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