Skip to content

Commit fa24244

Browse files
committed
Merge branch 'master' of github.com:darklife/darkriscv
that is a merge for big-endian stuff! :)
2 parents 94de76a + a2058b4 commit fa24244

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Opensource RISC-V implemented from scratch in one night!
55

6-
![darkriscv](https://user-images.githubusercontent.com/42520878/109411184-01075f80-797f-11eb-8932-5b916133561a.jpg)
6+
![darkriscv](https://github.com/darklife/darkriscv/blob/master/doc/boot.png)
77

88
## Quick Start!
99

@@ -54,30 +54,29 @@ RISC-V instruction set.
5454
Although the code is small and crude when compared with other RISC-V
5555
implementations, the *DarkRISCV* has lots of impressive features:
5656

57-
- implements most of the RISC-V RV32E instruction set
58-
- implements most of the RISC-V RV32I instruction set
57+
- implements the UCB RISC-V RV32E and RV32I user space instruction set
5958
- optional CSRs for interrupts and debug
6059
- works up to 250MHz in a ultrascale ku040 (400MHz w/ overclock!)
6160
- up to 100MHz in a cheap spartan-6, fits in small spartan-3E such as XC3S100E!
6261
- can sustain 1 clock per instruction most of time (typically 70% of time)
6362
- flexible harvard architecture (easy to integrate a cache controller, bus bridges, etc)
6463
- works fine in a real xilinx (spartan-3, spartan-6, spartan-7, artix-7, kintex-7 and kintex ultrascale)
65-
- works fine with some real altera and lattice FPGAs
66-
- works fine with gcc 9.0.0 and above for RISC-V (no patches required!)
64+
- works fine with some real Altera and Lattice FPGAs too!
65+
- works fine with gcc 9.0.0 or above for RISC-V (no patches required!)
6766
- uses between 850-1500LUTs (core only with LUT6 technology, depending of enabled features and optimizations)
68-
- optional RV32E support (works better with LUT4 FPGAs)
67+
- optional RV32E support (smaller and faster, works better with LUT4 FPGAs)
6968
- optional 16x16-bit MAC instruction (for digital signal processing)
7069
- optional coarse-grained multi-threading (MT)
71-
- no interlock between pipeline stages!
70+
- DSP-like pipeline: no interlock/stall/forward between pipeline stages!
7271
- optional interrupt handled on machine level
7372
- optional breakpoints handled on supervisor level
7473
- optional instruction and data caches
75-
- optional harvard to von neumann bridge
74+
- optional harvard to von neumann bridge (DarkBridge)
7675
- optional SDRAM controller (from kianRiscV project)
7776
- optional support for big-endian
7877
- BSD license: can be used anywhere with no restrictions!
7978

80-
Some extra features are planned for the future or under development:
79+
Some extra features are planned for the future, under development or tested by some customers:
8180

8281
- ethernet controller (GbE)
8382
- multi-processing (SMP)
@@ -90,7 +89,17 @@ Some extra features are planned for the future or under development:
9089

9190
And much other features!
9291

93-
Feel free to make suggestions and good hacking! o/
92+
The following picture shows the DarkRISCV core block diagram:
93+
94+
![darkriscv core](https://github.com/darklife/darkriscv/blob/master/doc/darkriscv.png)
95+
96+
The caches are added just to make easy to understand, but they are typically external, on the DarkSoCV or DarkBridge. It is easy to see that there is a huge optimization in the instruction path, so it have, in fact 3 stages: PF (pre-fetch), IF (instruction-fetch) and ID (instruction decode). In the EX (execute), there is a single stage, which explain why DarkRISCV does not need forward and does not stall on execution. Also, differently from PF/IF/ID, the EX have four ALUs: one complete ALU for reg/reg and reg/imm operations, one dedicated ALU for branch tests, one dedicated ALU for PC update and one dedicated ALU for memory address calculation, all they working in parallel. Finally, there is the register bank, which is a clocked single-path on write but combinational and multi-path on read, so it is possible feed the ALUs without forward or stall.
97+
98+
Of course, the DarkRISCV needs external blocks around it in order to work, so the following picture shows the DarkSoCV in the mixed Harvard and von Neumann mode, when the core is working around Harvard architecture parallel caches for instruction and data but the rest of SoC is working around a von Neumann architecture, with sequential instructiona and data in the same bus, so it is possible share the main memories (BRAM and SDRAM):
99+
100+
![darkriscv SoC](https://github.com/darklife/darkriscv/blob/master/doc/darksocv.png)
101+
102+
Thanks to BSD license, the project is fully open, so feel free to make suggestions and good hacking! o/
94103

95104
## History
96105

doc/boot.png

30.8 KB
Loading

doc/darkriscv.png

62.7 KB
Loading

doc/darksocv.png

61.5 KB
Loading

rtl/darkriscv.v

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ module darkriscv
145145
//XFCC <= HLT ? XFCC : IDATAX[6:0]==`FCC;
146146
XSYS <= HLT ? XSYS : IDATAX[6:0]==`SYS;
147147

148-
// signal extended immediate, according to the instruction type:
148+
// sign extended immediate, according to the instruction type:
149149

150150
XSIMM <= HLT ? XSIMM :
151151
IDATAX[6:0]==`SCC ? { IDATAX[31] ? ALL1[31:12]:ALL0[31:12], IDATAX[31:25],IDATAX[11:7] } : // s-type
@@ -154,7 +154,8 @@ module darkriscv
154154
IDATAX[6:0]==`LUI||
155155
IDATAX[6:0]==`AUIPC ? { IDATAX[31:12], ALL0[11:0] } : // u-type
156156
{ IDATAX[31] ? ALL1[31:12]:ALL0[31:12], IDATAX[31:20] }; // i-type
157-
// non-signal extended immediate, according to the instruction type:
157+
158+
// zero-extended (unsigned) immediate, according to the instruction type:
158159

159160
XUIMM <= HLT ? XUIMM :
160161
IDATAX[6:0]==`SCC ? { ALL0[31:12], IDATAX[31:25],IDATAX[11:7] } : // s-type
@@ -193,7 +194,7 @@ module darkriscv
193194
//assign XFCC <= IDATAX[6:0]==`FCC;
194195
assign XSYS = IDATAX[6:0]==`SYS;
195196

196-
// signal extended immediate, according to the instruction type:
197+
// sign extended immediate, according to the instruction type:
197198

198199
assign XSIMM =
199200
IDATAX[6:0]==`SCC ? { IDATAX[31] ? ALL1[31:12]:ALL0[31:12], IDATAX[31:25],IDATAX[11:7] } : // s-type
@@ -202,7 +203,8 @@ module darkriscv
202203
IDATAX[6:0]==`LUI||
203204
IDATAX[6:0]==`AUIPC ? { IDATAX[31:12], ALL0[11:0] } : // u-type
204205
{ IDATAX[31] ? ALL1[31:12]:ALL0[31:12], IDATAX[31:20] }; // i-type
205-
// non-signal extended immediate, according to the instruction type:
206+
207+
// zero-extended (unsigned) immediate, according to the instruction type:
206208

207209
assign XUIMM =
208210
IDATAX[6:0]==`SCC ? { ALL0[31:12], IDATAX[31:25],IDATAX[11:7] } : // s-type
@@ -288,7 +290,7 @@ module darkriscv
288290
initial for(i=0;i!=`RLEN;i=i+1) REGS[i] = 0;
289291
`endif
290292

291-
// source-1 and source-1 register selection
293+
// source-1 and source-2 register selection
292294

293295
wire [31:0] U1REG = REGS[S1PTR];
294296
wire [31:0] U2REG = REGS[S2PTR];

0 commit comments

Comments
 (0)