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

Subversion Repositories risc5x

[/] [risc5x/] [trunk/] [readme.txt] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mikej
--
2
-- Risc5x
3
-- www.OpenCores.Org - November 2001
4
--
5
--
6
-- This library is free software; you can distribute it and/or modify it
7
-- under the terms of the GNU Lesser General Public License as published
8
-- by the Free Software Foundation; either version 2.1 of the License, or
9
-- (at your option) any later version.
10
--
11
-- This library is distributed in the hope that it will be useful, but
12
-- WITHOUT ANY WARRANTY; without even the implied warranty of
13
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
-- See the GNU Lesser General Public License for more details.
15
--
16
-- A RISC CPU core.
17
--
18
-- (c) Mike Johnson 2001. All Rights Reserved.
19
-- mikej@opencores.org for support or any other issues.
20
--
21
-- Revision list
22
--
23
-- version 1.1 bug fix: Used wrong bank select bits in direct addressing mode
24
--                      INDF register returns 0 when indirectly read
25
--                      FSR bit 8 always set
26
--                      (cpu.vhd file changed)
27
--
28
-- version 1.0 initial opencores release
29
--
30
 
31
Risc5x is a small RISC CPU written in VHDL that is compatible with the 12 bit
32
opcode PIC family. Single cycle operation normally, two cycles when the program
33
counter is modified. Clock speeds of over 40Mhz are possible when using the
34
Xilinx Virtex optimisations.
35
 
36
 
37
Legal Stuff
38
 
39
This core is distributed in the hope that it will be useful, but
40
WITHOUT ANY WARRANTY; without even the implied warranty of
41
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
42
 
43
You are responsible for any legal issues arising from the use of this core.
44
 
45
The source files may be used and distributed without restriction provided that
46
all copyright statements are not removed from the files and that any derivative
47
work contains the original copyright notices and the associated disclaimer.
48
 
49
PIC is a trademark of Microchip Technology Inc.
50
 
51
 
52
Features
53
 
54
The core has a single pipeline stage and is run from a single clock, so
55
(ignoring program counter changes) a 40Mhz clock will give 40 MIPS processing
56
speed. Any instruction which modifies the program counter, for example a branch
57
or skip, will result in a pipeline stall and this will only cost one additional
58
clock cycle.
59
 
60
The CPU architecture chosen is not particularly FPGA friendly, for example
61
multiplexers are generally quite expensive. The maximum combinatorial path delay
62
is also long, so to ease the place and route tool's job the core is written at a
63
low level. It instantiates a number of library macros, for example a 4:1 mux.
64
Two versions of these are given, one is generic VHDL and the second is optimised
65
for Xilinx Virtex series (including sparten2's etc). A constraints file locates
66
the data path macros within the device and ensures an easy fit and high clock
67
speed.
68
 
69
Performance & Size
70
 
71
The core builds to around 110 Virtex CLBS (depending on synthesis).
72
 
73
>33 Mhz in a Virtex e - 6
74
>40 Mhz in a Virtex e - 8
75
 
76
There's some good free tools out there including a compiler, simulator and
77
assembler (gusim & guasm for example).
78
 
79
 
80
Synthesis & File description :
81
 
82
Read the files in the following order.
83
 
84
** PACKAGES **
85
pkg_xilinx_prims.vhd    (package containing low level Virtex blocks)
86
                         only required if using Virtex optimised macros)
87
pkg_prims.vhd           (package containing macro components)
88
pkg_risc5x.vhd          (package containing some useful functions)
89
 
90
** MACROS / RTL MODELS **
91
 
92
mux8.vhd                (8 to 1 muxer)
93
mux4.vhd                (4 to 1 muxer)
94
mux2.vhd                (2 to 1 muxer)
95
mux2_add_reg.vhd        (load or +1, used for program counter)
96
alubit.vhd              (ALU bit functions)
97
add_sub.vhd             (add or subtract)
98
 
99
 
100
IMPORTANT : Each of the macros has TWO ARCHITECTURES, the first (VIRTEX) is for
101
Virtex series devices ONLY, including Virtex, Virtexe, Sparten2, Sparten2e etc.
102
The second (RTL) is generic VHDL, and is surrounded by synthesis directives :
103
 
104
 --pragma translate_off
105
 --pragma translate_on
106
 
107
This makes the synthesis tool ignores the second architecture, but the simulator
108
does not, resulting in optimal synthesis and fast simulation.
109
 
110
If you do not wish to target Virtex series devices, YOU MUST remove the --pragma
111
directives, and (optionally) delete the VIRTEX architecture.
112
 
113
 
114
A PROBLEM :  Some of the macros have generic attributes passed to them to define
115
bus width etc. Unfortunately when the same macro is used twice with different
116
generics some synthesis tools do not build a second copy of the macro. The
117
easiest way round this is to generate EDIF's for each macro that is required,
118
and then save it with the 'expected name'.
119
 
120
 
121
For example if the Xilinx tools say they cannot find a mux4_9_0_FALSE then
122
you would edit the default generics in mux4.vhd to
123
 
124
entity MUX4 is
125
  generic (
126
    WIDTH         : in  natural := 9;
127
    SLICE         : in  natural := 0; -- 1 left, 0 right
128
    OP_REG        : in  boolean := FALSE
129
    );
130
  port (
131
 
132
 and build it to mux4_9_0_false.edf.
133
 
134
 You may need to build the files with *'s below :
135
 
136
  MUX2_8_1_FALSE.edf        default so ok
137
  MUX2_7_1_FALSE.edf        *
138
 
139
 
140
  MUX4_8_1_FALSE.edf        default so ok
141
  MUX4_8_0_FALSE.edf        *
142
  MUX4_9_0_FALSE.edf        *
143
  MUX4_11_0_FALSE.edf       *
144
 
145
  MUX8_8_FALSE.edf          default so ok
146
 
147
  ADD_SUB_8.edf             default so ok
148
  ALUBIT_8.edf              default so ok
149
  MUX2_ADD_REG_11.edf       default so ok
150
 
151
If you are using Exemplar then you can analyze the whole lot and it gets it
152
correct. The following works fine :
153
 
154
analyze mux2_add_reg.vhd
155
analyze mux2.vhd
156
analyze mux4.vhd
157
analyze mux8.vhd
158
analyze add_sub.vhd
159
analyze alubit.vhd
160
analyze idec.vhd
161
analyze alu.vhd
162
analyze regs.vhd
163
analyze cpu.vhd
164
analyze risc5x_xil.vhd
165
elaborate risc5x_xil
166
 
167
** CORE **
168
 
169
alu.vhd                 (ALU block)
170
idec.vhd                (instruction decode)
171
regs.vhd                (register file)
172
cpu.vhd                 (CPU top level)
173
 
174
regs.vhd also has two architectures, one optimised for Virtex and a generic one
175
as well. The generic version has a simulation model of a dual port ram,
176
which should be replaced be a synthesizable block.
177
 
178
** TOP LEVELS **
179
risc5x_xil.vhd          (xilinx chip complete with program ram)
180
OR
181
cpu_tb.vhd              (simulation model which loads a .hex program file)
182
 
183
** OTHER **
184
risc5x_xil.ucf          (xilinx constraints file)
185
jumptest.asm            (sanity test program)
186
jumptest.hex            (sanity test binary)
187
 
188
risc5x_xil.VHD is a synthesizable top level that instantiates some Xilinx block
189
rams. For simulation replace risc5x_xil.vhd with cpu_tb.vhd which has extra
190
debug.
191
 
192
Signal inst_string in cpu_tb shows the current instruction being
193
executed, and pc_t1 the address it came from. (t1 signifies one clock later than
194
the PC, due to the delay through the program memory)
195
 
196
 
197
Any questions or interest in customisation /locked / other cores (16x8x?) etc
198
feel free to mail.
199
 
200
mikej@opencores.org
201
 
202
Cheers
203
 
204
Mike.
205
 
206
 

powered by: WebSVN 2.1.0

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