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

Subversion Repositories plasma

[/] [plasma/] [tags/] [arelease/] [tools/] [index.shtml] - Blame information for rev 402

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

Line No. Rev Author Line
1 2 rhoads
<b><font size=+2 face="Helvetica, Arial"
2
color=#bf0000>Project Name: MIPS-lite core</font></b>
3
<p>
4
<font size=+1><b>Description</b></font>
5
<P>
6
MIPS-lite is a "clean room" VHDL implementation of a MIPS CPU.
7
It supports a simplified MIPS III+ instruction set with a two-stage pipeline.
8
Only User Mode instructions are supported.
9
 
10
<p>
11
<font size=+1><b>Block Diagram</b></font>
12
<p>
13
<center>
14
<img src="cpu.gif">
15
</center>
16
<br>
17
<font size=+1><b>Example Instruction</b></font>
18
<p>
19
As an example, an ADD instruction would take the following steps:
20
<ol>
21
<li>The "pc_next" entity would pass the program
22
       counter (PC) to the "mem_ctrl" entity. [First Stage of Pipeline]</li>
23
<li>"Mem_ctrl" passes the opcode to the "control" entity.</li>
24
<li>"Control" converts the 32-bit opcode to a 60-bit VLWI opcode
25
       and sends control signals to the other entities.</li>
26
<li>Based on the rs_index and rt_index control signals, "reg_bank"
27
       sends the 32-bit reg_source and reg_target to "bus_mux".</li>
28
<li>Based on the a_source and b_source control signals, "bus_mux"
29
       multiplexes reg_source onto a_bus and reg_target onto b_bus.</li>
30
<li>Based on the alu_func control signals, "alu" adds the values
31
       from a_bus and b_bus and places the result on c_bus.</li>
32
<li>Based on the c_source control signals, "bus_bux" multiplexes
33
       c_bus onto reg_dest.</li>
34
<li>Based on the rd_index control signal, "reg_bank" saves
35
       reg_dest into the correct register.</li>
36
</ol>
37
<font size=+1><b>Features</b></font>
38
<p>
39
The CPU is implemented as a two-stage pipeline with step #1 in the
40
first stage and steps #2-8 occurring the second stage.
41
Each instruction takes one clock cycle, except memory accesses,
42
which take two clock cycles, and multiplication and division, which
43
can be accessed in 32 clock cycles.
44
<br>
45
<br>
46
There are several control lines not shown in the diagram.
47
A pause (wait-state) line will cause the pipeline to pause
48
if the multiplication results are accessed before the
49
multiplication is complete.
50
 
51
<p>
52
<font size=+1><b>Supporting Documentation</b></font>
53
<p>
54
The implementation is based on information found in:
55
<ul>
56
<li>"MIPS RISC Architecture" by Gerry Kane and Joe Heinrich and</li>
57
<li>"The Designer's Guide to VHDL" by Peter J. Ashenden</li>
58
</ul>
59
 
60
<font size=+1><b>Tools</b></font>
61
<p>
62
The tools used include VHDL Synopsys, ModelTech, and the Microsoft
63
MIPS C compiler.
64
 
65
<p>
66
<font size=+1><b>Registers</b></font>
67
<p>
68
All of the registers are clocked by the single master clock.
69
The registers used in the design are grouped by entity and listed below:
70
<pre width=80>
71
     mem_ctrl
72
     ===========================================
73
     |    Register Name    |   Type    | Width |
74
     ===========================================
75
     | next_opcode_reg_reg | Flip-flop |  32   |
76
     |   opcode_reg_reg    | Flip-flop |  32   |
77
     |   setup_done_reg    | Flip-flop |   1   |
78
     ===========================================
79
 
80
     mult
81
     ===========================================
82
     |    Register Name    |   Type    | Width |
83
     ===========================================
84
     |   answer_reg_reg    | Flip-flop |  32   |
85
     |    count_reg_reg    | Flip-flop |   6   |
86
     |   do_div_reg_reg    | Flip-flop |   1   |
87
     |  do_signed_reg_reg  | Flip-flop |   1   |
88
     |      reg_a_reg      | Flip-flop |  32   |
89
     |      reg_b_reg      | Flip-flop |  64   |
90
     ===========================================
91
 
92
     pc_next
93
     ===========================================
94
     |    Register Name    |   Type    | Width |
95
     ===========================================
96
     |     pc_reg_reg      | Flip-flop |  30   |
97
     ===========================================
98
 
99
     reg_bank
100
     ===========================================
101
     |    Register Name    |   Type    | Width |
102
     ===========================================
103
     |      reg01_reg      | Flip-flop |  32   |
104
     |      reg02_reg      | Flip-flop |  32   |
105
     |      reg03_reg      | Flip-flop |  32   |
106
     |      reg04_reg      | Flip-flop |  32   |
107
     |      reg05_reg      | Flip-flop |  32   |
108
     |      reg06_reg      | Flip-flop |  32   |
109
     |      reg07_reg      | Flip-flop |  32   |
110
     |      reg08_reg      | Flip-flop |  32   |
111
     |      reg09_reg      | Flip-flop |  32   |
112
     |      reg10_reg      | Flip-flop |  32   |
113
     |      reg11_reg      | Flip-flop |  32   |
114
     |      reg12_reg      | Flip-flop |  32   |
115
     |      reg13_reg      | Flip-flop |  32   |
116
     |      reg14_reg      | Flip-flop |  32   |
117
     |      reg15_reg      | Flip-flop |  32   |
118
     |      reg16_reg      | Flip-flop |  32   |
119
     |      reg17_reg      | Flip-flop |  32   |
120
     |      reg18_reg      | Flip-flop |  32   |
121
     |      reg19_reg      | Flip-flop |  32   |
122
     |      reg20_reg      | Flip-flop |  32   |
123
     |      reg21_reg      | Flip-flop |  32   |
124
     |      reg22_reg      | Flip-flop |  32   |
125
     |      reg23_reg      | Flip-flop |  32   |
126
     |      reg24_reg      | Flip-flop |  32   |
127
     |      reg25_reg      | Flip-flop |  32   |
128
     |      reg26_reg      | Flip-flop |  32   |
129
     |      reg27_reg      | Flip-flop |  32   |
130
     |      reg28_reg      | Flip-flop |  32   |
131
     |      reg29_reg      | Flip-flop |  32   |
132
     |      reg30_reg      | Flip-flop |  32   |
133
     |      reg31_reg      | Flip-flop |  32   |
134
     |     reg_epc_reg     | Flip-flop |  32   |
135
     |   reg_status_reg    | Flip-flop |   1   |
136
     ===========================================
137
</pre>
138
 
139
<font size=+1><b>Preliminary Synthesis</b></font>
140
<p>
141
The CPU core was synthesized for 0.13 um line widths with a predicted
142
area less than 0.2 millimeters squared.  The predicted maximum
143
latency was less than 6 ns for a maximum clock speed of 150 MHz.
144
<br>
145
<br>
146
A preliminary synthesis yields the following cells and die area.
147
I think that optimization caused the mips_cpu entity
148
to be smaller than the sum of its
149
components.
150
If one assumes that a standard cell is composed of three gates,
151
then this is approximately a 20K gate design. [Is this correct??]
152
It is interesting to note that the register bank requires over 60% of the area.
153
<pre width=80>
154
     Block    ports   nets  cells cell_area   ~%   delay(ns)
155
     ------   -----   ----  ----- ---------  ---   ---------
156
     alu        101    919    850      7503   12        1.11
157
     bus_mux    283    672    486      4906    8        0.35
158
     control     93    296    263      2250    4        0.29
159
     mem_ctrl   271    455    318      3299    5        0.95
160
     mult       101   1111   1043      9342   15        0.72 ??
161
     pc_next     94    277    215      1756    3        0.15
162
     reg_bank   116   2650   2599     39477   62        1.02
163
     shifter     71    423    384      3026    5        1.51
164
     mips_cpu   201    555     45     63888  100        5.61
165
 
166
     total     1331   7358   6203
167
</pre>
168
 
169
<font size=+1><b>List of Files</b></font>
170
<p>
171
<ul>
172
<table border="2" style="border-color:Black;border-collapse:collapse;">
173
<tr>
174
 <td>FILE</td>
175
 <td>PURPOSE</td>
176
</td><tr>
177
</tr><tr>
178
 <td>makefile</td>
179
 <td>Makefile for the HP workstation for Synopsys</td>
180
</tr><tr>
181
 <td>code.txt</td>
182
 <td>Input opcodes for the test bench -- test.exe "converted"</td>
183
</tr><tr>
184
 <td>alu.vhd</td>
185
 <td>Arithmetic Logic Unit</td>
186
</tr><tr>
187
 <td>bus_mux.vhd</td>
188
 <td>BUS Multiplex Unit</td>
189
</tr><tr>
190
 <td>control.vhd</td>
191
 <td>Opcode Decoder</td>
192
</tr><tr>
193
 <td>mem_ctrl.vhd</td>
194
 <td>Memory Controller</td>
195
</tr><tr>
196
 <td>mips_cpu.vhd</td>
197
 <td>Top Level VHDL for MIPS CPU</td>
198
</tr><tr>
199
 <td>mips_pack.vhd</td>
200
 <td>Constants and Functions Package</td>
201
</tr><tr>
202
 <td>mult.vhd</td>
203
 <td>Multiplication and Division Unit</td>
204
</tr><tr>
205
 <td>pc_next.vhd</td>
206
 <td>Program Counter Unit</td>
207
</tr><tr>
208
 <td>ram.vhd</td>
209
 <td>RAM for the Test Bench</td>
210
</tr><tr>
211
 <td>reg_bank.vhd</td>
212
 <td>Register Bank for 32, 32-bit Registers</td>
213
</tr><tr>
214
 <td>shifter.vhd</td>
215
 <td>Shifter Unit</td>
216
</tr><tr>
217
 <td>tbench.vhd</td>
218
 <td>Test Bench that uses mips_vpu.vhd and ram.vhd</td>
219
</tr><tr>
220
</tr><tr>
221
 <td>makefile</td>
222
 <td>Makefile for the PC for creating "code.txt"</td>
223
</tr><tr>
224
 <td>convert.c</td>
225
 <td>Converts test.exe to code.txt</td>
226
</tr><tr>
227
 <td>mips.c</td>
228
 <td>Simulates a MIPS CPU in software</td>
229
</tr><tr>
230
 <td>test.c</td>
231
 <td>Test program (opcodes) for the MIPS CPU</td>
232
</tr><tr>
233
 <td>output.txt</td>
234
 <td>Output from the test bench</td>
235
</tr><tr>
236
 <td>index.shtml</td>
237
 <td>This help file</td>
238
</tr><tr>
239
 <td>cpu.gif</td>
240
 <td>Block Diagram</td>
241
</tr>
242
</table>
243
</ul>
244
 
245
<p>
246
<font size=+1><b>ZIP File</b></font>
247
<p>
248
CVS is the only way to download the latest files.  However
249
for a quick look at an old version you can download
250
<a href="mipslite.zip">MIPSlite.zip</a>.
251
 
252
<p>
253
<font size=+1><b>Convert</b></font>
254
<p>
255
The program "convert" changes the file "test.exe" into the HEX file "code.txt".
256
The opcodes in "test.exe" are changed to Big Endian.
257
All absolute jumps are changed to relative jumps.
258
The first opcode is also changed to set up the stack pointer.
259
 
260
<p>
261
<font size=+1><b>Big/Little Endian</b></font>
262
<p>
263
The MIPS CPU operates in Big Endian mode by default.  To operate in
264
Little Endian mode, change "little_endian" from "00" to "11" in
265
the file mem_ctrl.vhd.
266
 
267
<p>
268
<font size=+1><b>Legal Notice</b></font>
269
<p>
270
<font color="#FF0000">
271
MIPS is a registered trademark of MIPS Technologies, Inc.
272
If you use this core you are responsible for all legal issues.
273
This "clean room" implementation of a MIPS CPU does not negate
274
MIPS Technologies, Inc. of their trademark, copyrights, or patents....
275
<p>
276
Free for commercial and non-commercial use as long as the author and
277
warning notices are maintained.
278
<br>
279
<br>
280
This software is provided by Steve Rhoads "as is" and
281
any express or implied warranties, including, but not limited to, the
282
implied warranties of merchantability and fitness for a particular purpose
283
are disclaimed.  In no event shall the author or contributors be liable
284
for any direct, indirect, incidental, special, exemplary, or consequential
285
damages (including, but not limited to, procurement of substitute goods
286
or services; loss of use, data, or profits; or business interruption)
287
however caused and on any theory of liability, whether in contract, strict
288
liability, or tort (including negligence or otherwise) arising in any way
289
out of the use of this software, even if advised of the possibility of
290
such damage.
291
</font>
292
<p>
293
<p><b><font size="+1">Bus Interface</font></b></p>
294
<p>
295
<pre width=80>
296
   port(clk         : in std_logic;
297
        reset_in    : in std_logic;
298
        intr_in     : in std_logic;  --interrupt line
299
 
300
        --memory access buses
301
        mem_address : out std_logic_vector(31 downto 0);
302
        mem_data_w  : out std_logic_vector(31 downto 0); --avoided tri-state
303
        mem_data_r  : in std_logic_vector(31 downto 0);
304
        mem_sel     : out std_logic_vector(3 downto 0);  --byte lines
305
        mem_write   : out std_logic;
306
        mem_pause   : in std_logic
307
        );
308
</pre>
309
 
310
<p>
311
<font size=+1><b>Current Status</b></font>
312
<ul>
313
 <li>The test bench needs to be strengthened.</li>
314
 <li>Need feedback on the design.</li>
315
 <li>Need feedback on the tools.</li>
316
 <li>Need to add simulation of a cache.</li>
317
</ul>
318
 
319
<p>
320
<font size=+1><b>Maintainer</b></font>
321
<ul>Steve Rhoads,
322
<a href="mailto:rhoads@opencores.org_NOSPAM">rhoads@opencores.org_NOSPAM</a></ul>
323
<p>
324
<ul>*** I am not an experienced VHDL designer ***
325
Please let me know of any incorrect statements in this document.</ul>
326
<p>
327
<font size=+1><b>Mailing-list</b></font>
328
<p>
329
<ul><a href=mailto:cores@opencores.org_NOSPAM>cores@opencores.org_NOSPAM</A></ul>
330
 

powered by: WebSVN 2.1.0

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