I have seen more excitement and community around these kinds of projects there than here.
phendrenad2 2 days ago [-]
Doing OOO in a one-person project is impressive.
IshKebab 2 days ago [-]
Maybe 6 months ago. Today anyone vaguely familiar with CPU design can do it.
ltbarcly3 2 days ago [-]
Lol it's always cute to see the amount of confidence that people have for AI when they can't tell if the work it did is actually good.
IshKebab 2 days ago [-]
I don't think that's quite fair - this guy is clearly quite familiar with CPU design, it's very easy to run coremark, dhrystone, etc. to get a decent idea of performance, and for verification there's a reference model written in Sail you can compare against (though tbf it sounds like he didn't). AI is good at writing large test corpuses these days too.
So I would say it is relatively easy to tell if a vibe coded RISC-V CPU is actually good today. It's not like non-vibe coded RISC-V CPUs were amazingly well verified before anyway (except Ibex anyway). Even CVA6 has had some embarrassing bugs.
I expect this is a decent RISC-V core, but I also expect I could make one just as easily.
sanxiyn 2 days ago [-]
> for verification there's a reference model written in Sail you can compare against (though tbf it sounds like he didn't)
Can you elaborate on "it sounds like he didn't" because he clearly did? There is a Sail testbench at verification/s1_sail_cosim_tb.cpp.
ltbarcly3 2 days ago [-]
I don't think chip design comes down to knocking out a theoretically correct design. Then you fab it and it can't run at more than 37mhz LOL.
I think you don't know what you don't know here.
beng-nl 2 days ago [-]
I wish you’d use your knowledge to add to the discussion rather than discourage others.
pocksuppet 1 days ago [-]
It's a valid point. Anyone can write the logic - writing the logic so it runs fast is a completely different matter.
IshKebab 1 days ago [-]
It's not that hard. In fact a lot of the work is tedious timing runs and doing pipelining or registering micro-optimisations which is the sort of thing AI is really good at.
What you're saying is applicable to the software world too - anyone can write Python pseudocode that is correct, writing Rust that runs fast is a completely different matter.
Except... AI is really good at that too.
ltbarcly3 1 days ago [-]
So make a chip company and sell a RiscV superscalar chip. It's "not that hard" lol. There's a huge market for it. Do you hate money, or are you just so rich you can't be bothered, or are you talking crap?
IshKebab 22 hours ago [-]
There's so many things wrong with this comment...
1. Only ancient PDKs are open. If you want to actually make a competitive chip you need millions of dollars for commercial software (synthesizers etc.), access to TSMC, masks, etc.
2. The market for RISC-V IP is quite small and massively oversaturated. I used to work for a RISC-V IP vendor. They are doing very badly.
3. AI only got really good in the last 3-6 months. It would be foolish to expect an instant change. The world didn't suddenly all own smart phones when the iPhone came out, even though it was obviously that it would eventually happen.
pocksuppet 19 hours ago [-]
Should be easy to make your own fab with AI
IshKebab 2 days ago [-]
I do know about physical design too. Just because somebody doesn't explain every single thing in a comment doesn't mean you win the argument by highlighting something they didn't mention.
ltbarcly3 2 days ago [-]
I'm sorry, I didn't mean this to be personally critical of you. I'm talking generally about saying to an AI "make a chip don't make any mistakes" and then thinking there is any chance of getting something that isn't trash in return, and being confident of that even though one doesn't have the domain knowledge to know if it's trash or not.
Specifically, for an advanced superscalar chip design, it is unlikely this guy single handedly, with claude or whatever, produced something highly valuable where hundreds of professional chip designers have failed.
remexre 2 days ago [-]
you might even note that the author posted here that they closed timing at 500MHz on nangate45...
varispeed 2 days ago [-]
and a bit of cloude:
"Make me an OOO RISC-V core in SystemVerilog. No mistakes."
I am somewhat of vaguely familiar with CPU design myself.
PowerElectronix 2 days ago [-]
This is really cool. Any chance you'll try to make a few with tiny tap or some service like that?
fursoy 2 days ago [-]
Thanks! Slice-1 is a bit too big for Tiny Tapeout right now.
fursoy 2 days ago [-]
I built Fursoy Slice-1, a 64-bit out-of-order superscalar RISC-V core (RV64IMAFDV + Zba/Zbb/Zicsr/Zifencei) in SystemVerilog, along with a minimal SoC (5-master crossbar, CLINT, PLIC, 16550 UART, and custom SBI v2.0 firmware).
At a high level, the core is 2-wide fetch/decode/rename/retire with a 128-entry ROB, 160-entry integer PRF, 8 branch checkpoints for single-cycle speculative RAT rollback, and separate Int/Mem/FP/Vec issue queues. On the memory side, it has a dual-port Sv39 DTLB (64-entry 4-way Tree-PLRU + 8-entry 2 MiB/1 GiB superpage CAM), ITLB, and a 16 KiB 8-bank non-blocking L1D. Instead of flushing dirty lines on every page-table walk, the hardware PTW snoops dirty L1D sets non-destructively so Linux page-table updates are visible directly, paired with store-queue drain on SFENCE.VMA.
In Verilator, it boots mainline Linux 6.6.50 and BusyBox userspace in ~89.8M cycles (~76.2M retired instructions, 2,255 page faults handled) while checking an 8-bucket single-owner CPI conservation invariant every cycle with 0 cycle leakage. Synthesizing the 8 main core logic blocks standalone with sv2v + Yosys + OpenSTA on Nangate 45nm (SRAMs/PRFs black-boxed, pre-P&R) meets 500 MHz across all 8/8 blocks at ~219 kGE, after rebuilding the ALU and branch unit as Kogge-Stone prefix trees and balancing high-fanout CSR/TLB paths.
I used an AI-agent-assisted workflow for RTL iteration and verification scaffolding while driving the microarchitecture, timing closure, and debugging myself. The nastiest late bug was a Linux boot livelock around ~90M cycles: per RISC-V Priv Spec §3.1.9, CSR read-modify-write instructions on `mip` have to operate on the software-writable `mip_q[9]` bit rather than the live `irq_seip_i` wire—our CSR block was feeding `mip_val` back into RMW, so whenever SBI cleared `STIP` while a PLIC IRQ was high, it permanently latched `SEIP` and trapped the kernel in `plic_handle_irq`.
For folks who have built Sv39 cores or open-source ASIC flows: do you prefer letting the PTW snoop dirty L1D lines directly like this, or forcing a clean/drain path? Also curious what people would tackle next on a single-core tree like this—an inclusive L2 cache or jumping straight to dual-core coherency.
peterfirefly 2 days ago [-]
> the hardware PTW snoops dirty L1D sets non-destructively so Linux page-table updates are visible directly
Neat! Andy Glew has talked about wanting the TLB hardware to snoop on page table updates for a long time. I don't think he ever got to implement it in a shipping CPU, though.
Have you considered doing TLB invalidation on other cores without needing IPIs? Perhaps by extending an MOESI-style cache protocol a bit?
krupan 2 days ago [-]
Very cool. Any plans to have this fabbed? Or built into a bitstream for an FPGA?
fursoy 2 days ago [-]
Thanks! I'm planning to do an FPGA bring-up, though I don't have a suitable board on hand right now. Fabbing is much further down the road.
peterfirefly 2 days ago [-]
Do you know how balanced your design is or are those choices mostly based on napkin estimates and guesses?
The ROB and PRF are bigger than what the K8 had. If I understand you correctly, Slice-1 can decode two instructions per cycle (and they don't expand to multiple internal instructions) and it can retire two per cycle. If I do, then that's less than the K8 (and K7, K6, and P6).
You are not clear about the ALU/AGU/branch resources that the OOO engine has. If it can execute two instructions per cycle then it's less than the K8. It doesn't say what limitations there are -- can it handle more than 1 branch per cycle? Can it handle more than 1 load/store per cycle?
I'm asking because I'm really curious, both about your choices and about how practical it is to estimate these things as an amateur. Do you have a performance model for your architecture or is the Verilog code everything, including the performance model? Do you have the ability to execute instruction traces to compare different microarchitectural choices?
Do you know if conflict misses are much of a problem? And if so, if a small victim cache would help enough to be worth it?
Do you know why the CSR block is so slow? Too much fanout because it needs to handle access to many CSRs? Would it make sense to make it a two-cycle block instead? Or split it into a single-cycle block for common CSRs and a two-cycle block for the rest (if you are really ambitious)?
Do you know why the AGU block is so slow? Isn't it just at most two numbers that need to be added together? Your ALU block can do it twice as fast. Is it sign extension for offsets? If so, can't you sign extend them before that block (parallel with register reads, perhaps)? Or because it doesn't use the fancy adder?
Why are the TLBs so slow? Is it partly because they are single-cycle? I mean, they are only 4-way so I'm a bit surprised.
I should make clear that I am not complaining, I'm just surprised at the relative estimated speeds of the blocks you have synthesized.
A block diagram in the style of chips and cheese would help a lot, btw. It doesn't need to have the fancy pastel colours, black and white is fine.
---
There are some pages you forgot to have the AI translate from Turkish:
This is the place to look for anybody wanting to know more about the microarchitecture. It's out of sync with the README but it has a lot more meat (details).
peterfirefly 2 days ago [-]
> Do you know why the AGU block is so slow? Isn't it just at most two numbers that need to be added together? Your ALU block can do it twice as fast. Is it sign extension for offsets? If so, can't you sign extend them before that block (parallel with register reads, perhaps)? Or because it doesn't use the fancy adder?
It doesn't use the fancy adder. I also noticed that there are two implementations of the fancy adder (they are different) and they are inlined into rtl/core/fursoy_s1_alu.sv and rtl/core/fursoy_s1_branch_unit.sv
That one was easy!
> Do you have a performance model for your architecture or is the Verilog code everything, including the performance model?
The Verilog code is indeed everything, including the performance model. There's a module that handles performance counters: rtl/core/fursoy_s1_hpm.sv
The Verilator test bench(es) dump(s) the performance counters at the end of a run.
> Do you have the ability to execute instruction traces to compare different microarchitectural choices?
Seemingly not. There's only real execution using real memory/IO access and real interrupts from real devices.
---
If anybody else is following along at home: there are apparently two RISC-V implementations: Slice-0 and Slice-1. Slice-0 is a dead simple single-scalar in-order CPU with two stages (fetch and execute). It does have TLB(s?) and caches so it's not entirely simple. Slice-1 is the OOO CPU (fetch/decode/execute/retire widths: 2/2/3/2, 10 stages). They are sometimes abbreviated as s0 and s1.
There are Verilator test benches but there's no model checking.
It looks like Slice-1 is still quite early in its development. I bet the code will be cleaned up (with the two Kogge-Stone adders merged into one and moved to a separate module, for example, or the ITLB being in a module of its own but the DTLB dumped inside the load-store unit module) and optimized further. Also tested further, of course. It doesn't seem like floating-point and vectors have received much testing love yet, for example.
The code seems very straightforward and readable (as much as Verilog can be readable -- I have seen far worse code do far less) but not well-commented. The doc files for each module are a bit too short and assume too much knowledge about the microarchitecture to be known already. Perfectly fine for a solo project, too cryptic for others to read.
fursoy 1 days ago [-]
Thanks for digging into the RTL and flagging the leftover Turkish snippets, the GitHub LaTeX underscore issue, and slice1-core-v1.md drifting from the README. I cleaned those up in the repo and added an ASCII pipeline diagram along with an explicit execution-port breakdown in the README. (And yes, fursoy_s1_dtlb sitting inside fursoy_s1_lsu.sv and the duplicated Kogge-Stone adders in alu.sv / branch_unit.sv are genuine rough edges I haven't factored out yet.)
On microarchitecture balance and performance modeling: there is no standalone cycle-accurate C++ simulator, mainly because once the Verilator RTL was running fast enough to boot Linux in minutes, maintaining a separate C++ timing model for a solo project would have just created model-vs-RTL drift. Early sizing came from static BusyBox disassembly register-pressure checks and an offline trace-driven sweep (tools/analysis/slice1_arch_model.py, starting from a 48-entry ROB / 80 Int PRFs), and once the pipeline was up, Stage 2/3 parameters were tuned directly in RTL using fursoy_s1_hpm.sv (mcycle, minstret, and 8 mutually exclusive CPI buckets). Expanding to 160 Int PRFs (32 architectural + 128 speculative) and a 128-entry ROB was mainly to preserve the invariant that the free list can never exhaust before the ROB fills. It is admittedly ROB/PRF-heavy for a 2-wide fetch/decode/retire core compared to something like K8, and on the 89.86M-cycle Linux 6.6.50 boot, branch/flush recovery (C_br_recover at 16.72%) matters much more than rename capacity (C_be_rename at 6.35%).
For execution resources: the 2-wide frontend feeds five scalar issue ports across three OoO queues (IntIQ -> Port 0 ALU0/BRU/CSR/I2F + Port 1 ALU1/MUL/DIV; MemIQ -> Port 2 AGU0 for loads/stores/AMOs/fences + Port 3 AGU1 for loads only; FPIQ -> Port 4 FMA/FDIV/FSQRT/FCONV), plus vecq_q[8] executing fetched RVV instructions sequentially over the VRF via a core FSM. That limits it to max 1 branch/cycle (Port 0 only) and up to 2 loads/cycle or 1 load + 1 store AGU/cycle across an 8-bank (PA[5:3]) L1D. Linux boot also barely exercises RVV/FP compared to the integer and Sv39 paths, though those instructions are now checked against sail-riscv differential cosim.
On conflict misses: fursoy_s1_hpm doesn't split conflict misses out from capacity misses yet, so I don't have an exact conflict fraction. What we measure on the Linux + BusyBox boot is total memory stalls (C_mem_stall, combining L1D misses, bank conflicts, and DTLB/PTW) at 6.18% of cycles and frontend starvation (C_fe_starve) at 0.56%. Since L1I and L1D are already 16 KiB 4-way VIPT with 4 MSHRs and 2 writeback buffers, a victim cache didn't seem worth the extra tag/bypass complexity for that slice of stalls.
On the standalone STA numbers:
- fursoy_s1_agu.sv (1.901 ns): as you noticed in your follow-up, it just writes base_i + imm_i, which Yosys maps to a plain 64-bit ripple-carry chain (~30 AOI/OAI logic levels) instead of the Kogge-Stone adders in alu.sv (1.133 ns) and branch_unit.sv (0.629 ns). Once it cleared 500 MHz (+0.099 ns slack) I left it alone, though sharing one Kogge-Stone adder across all three is an obvious cleanup.
- fursoy_s1_csr.sv (1.663 ns): the critical path is mstatus_i feeding a ~25-level combinational trap/privilege/delegation cone (1,790 DFFs, 26.75 kGE). Splitting fast vs. slow CSRs or going 2-cycle would easily buy headroom if pushing frequency higher; at 500 MHz (+0.298 ns slack), single-cycle kept trap/CSR serialization straightforward.
- fursoy_s1_itlb / fursoy_s1_dtlb (1.198 ns / 1.249 ns): because Nangate45 open synthesis here uses standard-cell flip-flops instead of compiled SRAM macros (6,304 / 6,515 DFFs, 77 / 100 kGE), STA sees a wide VA buffer tree feeding a 4-level MUX2 set-read plus 4-way tag compare, 8-entry 2M/1G superpage CAM, and hit-way mux—on top of a 0.40 ns (0.20 ns input + 0.20 ns output) standalone port budget.
If you want a visual block diagram, there is also an interactive version on the project page at https://cpu.fursoy.com — though the README diagram and tables remain the primary reference in the repo.
peterfirefly 1 days ago [-]
Thank you!
The README is much better now. I see now that I misunderstood both the pipeline length (fetch takes more stages than I thought) and the width of the OOO part.
I did see some mentions of SRAM and that it wasn't done yet but I hadn't caught on to it affecting the way the TLBs were handled. Of course they are slow at the moment! That also explains why you haven't bothered to show the synthesis of the caches (and I guess the load/store queues -- well, all queues, really).
cpu.fursoy.com looks pretty (and very AI generated) and there is indeed a link to it on the github page, but I had no idea there would be anything useful there. It should probably also be mentioned in the README.
I'm going to play around a bit with cpu.fursoy.com and maybe report back later.
Good luck with the project!
(Your post was flagged and dead for some reason, btw.)
pocksuppet 1 days ago [-]
It was flagged and dead because it's pure AI output
peterfirefly 1 days ago [-]
It clearly isn't.
pocksuppet 19 hours ago [-]
It clearly is. Why do you think it isn't?
peterfirefly 1 days ago [-]
> the GitHub LaTeX underscore issue,
There are still some LaTeX issues, for example section 2.2.3 in slice1-core-v1.md.
At least it doesn't error out, it's just a rendering thing. I don't know why the rendering is wrong, it looks to me like you did it correctly in the markdown file.
> and slice1-core-v1.md drifting from the README. I cleaned those up in the repo and added an ASCII pipeline diagram along with an explicit execution-port breakdown in the README
There's a bit more to sync up in slice1-core-v1.md. It only mentions F1 and F2, for example, and it also says "10-stage". Of course, you can always claim that the word "conceptual" covers you there.
peterfirefly 1 days ago [-]
Will slice-2 have idiom recognition to break dependency chains?
iberator 2 days ago [-]
[flagged]
krupan 2 days ago [-]
True, just writing some SystemVerilog that can be simulated does not guarantee working hardware. The OP does point out that he took it all the way to a netlist targeting a real hardware library. Place and route and actual fabrication, or building it for an FPGA and testing there are still needed to fully prove the design, but if the synthesis tools he used are reliable then there's not a lot of room for it to fail at this point. The clock speed is based on the netlist only, so it'll probably not be that fast after actual place and route, so it'll probably have to be clocked a little slower than 500 MHz, but it should work
thijson 2 days ago [-]
I'm not sure what you consider real. Verilog or System Verilog is used industry wide to describe hardware that then becomes chips.
2 days ago [-]
fedpost 2 days ago [-]
YoU wOuLdN'T dOwNlOaD a CpU!1!!
pezezin 2 days ago [-]
My MiSTer thinks otherwise...
(yes, I know that your comment is sarcasm)
matthewfcarlson 2 days ago [-]
Who hurt you? This is a fantastic project with effort put into simulating the RTL against a PDK. I don’t understand why you would gate your approval. If someone showed off a game on HN would you say it wasn’t a real game until you could buy it at your local Best Buy or GameStop?
I have seen more excitement and community around these kinds of projects there than here.
So I would say it is relatively easy to tell if a vibe coded RISC-V CPU is actually good today. It's not like non-vibe coded RISC-V CPUs were amazingly well verified before anyway (except Ibex anyway). Even CVA6 has had some embarrassing bugs.
I expect this is a decent RISC-V core, but I also expect I could make one just as easily.
Can you elaborate on "it sounds like he didn't" because he clearly did? There is a Sail testbench at verification/s1_sail_cosim_tb.cpp.
I think you don't know what you don't know here.
What you're saying is applicable to the software world too - anyone can write Python pseudocode that is correct, writing Rust that runs fast is a completely different matter.
Except... AI is really good at that too.
1. Only ancient PDKs are open. If you want to actually make a competitive chip you need millions of dollars for commercial software (synthesizers etc.), access to TSMC, masks, etc.
2. The market for RISC-V IP is quite small and massively oversaturated. I used to work for a RISC-V IP vendor. They are doing very badly.
3. AI only got really good in the last 3-6 months. It would be foolish to expect an instant change. The world didn't suddenly all own smart phones when the iPhone came out, even though it was obviously that it would eventually happen.
Specifically, for an advanced superscalar chip design, it is unlikely this guy single handedly, with claude or whatever, produced something highly valuable where hundreds of professional chip designers have failed.
"Make me an OOO RISC-V core in SystemVerilog. No mistakes."
I am somewhat of vaguely familiar with CPU design myself.
At a high level, the core is 2-wide fetch/decode/rename/retire with a 128-entry ROB, 160-entry integer PRF, 8 branch checkpoints for single-cycle speculative RAT rollback, and separate Int/Mem/FP/Vec issue queues. On the memory side, it has a dual-port Sv39 DTLB (64-entry 4-way Tree-PLRU + 8-entry 2 MiB/1 GiB superpage CAM), ITLB, and a 16 KiB 8-bank non-blocking L1D. Instead of flushing dirty lines on every page-table walk, the hardware PTW snoops dirty L1D sets non-destructively so Linux page-table updates are visible directly, paired with store-queue drain on SFENCE.VMA.
In Verilator, it boots mainline Linux 6.6.50 and BusyBox userspace in ~89.8M cycles (~76.2M retired instructions, 2,255 page faults handled) while checking an 8-bucket single-owner CPI conservation invariant every cycle with 0 cycle leakage. Synthesizing the 8 main core logic blocks standalone with sv2v + Yosys + OpenSTA on Nangate 45nm (SRAMs/PRFs black-boxed, pre-P&R) meets 500 MHz across all 8/8 blocks at ~219 kGE, after rebuilding the ALU and branch unit as Kogge-Stone prefix trees and balancing high-fanout CSR/TLB paths.
I used an AI-agent-assisted workflow for RTL iteration and verification scaffolding while driving the microarchitecture, timing closure, and debugging myself. The nastiest late bug was a Linux boot livelock around ~90M cycles: per RISC-V Priv Spec §3.1.9, CSR read-modify-write instructions on `mip` have to operate on the software-writable `mip_q[9]` bit rather than the live `irq_seip_i` wire—our CSR block was feeding `mip_val` back into RMW, so whenever SBI cleared `STIP` while a PLIC IRQ was high, it permanently latched `SEIP` and trapped the kernel in `plic_handle_irq`.
For folks who have built Sv39 cores or open-source ASIC flows: do you prefer letting the PTW snoop dirty L1D lines directly like this, or forcing a clean/drain path? Also curious what people would tackle next on a single-core tree like this—an inclusive L2 cache or jumping straight to dual-core coherency.
Neat! Andy Glew has talked about wanting the TLB hardware to snoop on page table updates for a long time. I don't think he ever got to implement it in a shipping CPU, though.
Have you considered doing TLB invalidation on other cores without needing IPIs? Perhaps by extending an MOESI-style cache protocol a bit?
The ROB and PRF are bigger than what the K8 had. If I understand you correctly, Slice-1 can decode two instructions per cycle (and they don't expand to multiple internal instructions) and it can retire two per cycle. If I do, then that's less than the K8 (and K7, K6, and P6).
You are not clear about the ALU/AGU/branch resources that the OOO engine has. If it can execute two instructions per cycle then it's less than the K8. It doesn't say what limitations there are -- can it handle more than 1 branch per cycle? Can it handle more than 1 load/store per cycle?
I'm asking because I'm really curious, both about your choices and about how practical it is to estimate these things as an amateur. Do you have a performance model for your architecture or is the Verilog code everything, including the performance model? Do you have the ability to execute instruction traces to compare different microarchitectural choices?
Do you know if conflict misses are much of a problem? And if so, if a small victim cache would help enough to be worth it?
Do you know why the CSR block is so slow? Too much fanout because it needs to handle access to many CSRs? Would it make sense to make it a two-cycle block instead? Or split it into a single-cycle block for common CSRs and a two-cycle block for the rest (if you are really ambitious)?
Do you know why the AGU block is so slow? Isn't it just at most two numbers that need to be added together? Your ALU block can do it twice as fast. Is it sign extension for offsets? If so, can't you sign extend them before that block (parallel with register reads, perhaps)? Or because it doesn't use the fancy adder?
Why are the TLBs so slow? Is it partly because they are single-cycle? I mean, they are only 4-way so I'm a bit surprised.
I should make clear that I am not complaining, I'm just surprised at the relative estimated speeds of the blocks you have synthesized.
A block diagram in the style of chips and cheese would help a lot, btw. It doesn't need to have the fancy pastel colours, black and white is fine.
There are some pages you forgot to have the AI translate from Turkish:https://github.com/FURSOY/fursoy-cpu/blob/main/docs/architec...
https://github.com/FURSOY/fursoy-cpu/blob/main/docs/architec...
(probably more)
This one has an error (at least when shown in github) in section 3.3:
https://github.com/FURSOY/fursoy-cpu/blob/main/docs/architec...
And this one in section 2.2.3:https://github.com/FURSOY/fursoy-cpu/blob/main/docs/architec...
https://github.com/FURSOY/fursoy-cpu/blob/main/docs/architec...
This is the place to look for anybody wanting to know more about the microarchitecture. It's out of sync with the README but it has a lot more meat (details).
It doesn't use the fancy adder. I also noticed that there are two implementations of the fancy adder (they are different) and they are inlined into rtl/core/fursoy_s1_alu.sv and rtl/core/fursoy_s1_branch_unit.sv
That one was easy!
> Do you have a performance model for your architecture or is the Verilog code everything, including the performance model?
The Verilog code is indeed everything, including the performance model. There's a module that handles performance counters: rtl/core/fursoy_s1_hpm.sv
The Verilator test bench(es) dump(s) the performance counters at the end of a run.
> Do you have the ability to execute instruction traces to compare different microarchitectural choices?
Seemingly not. There's only real execution using real memory/IO access and real interrupts from real devices.
If anybody else is following along at home: there are apparently two RISC-V implementations: Slice-0 and Slice-1. Slice-0 is a dead simple single-scalar in-order CPU with two stages (fetch and execute). It does have TLB(s?) and caches so it's not entirely simple. Slice-1 is the OOO CPU (fetch/decode/execute/retire widths: 2/2/3/2, 10 stages). They are sometimes abbreviated as s0 and s1. There are Verilator test benches but there's no model checking.It looks like Slice-1 is still quite early in its development. I bet the code will be cleaned up (with the two Kogge-Stone adders merged into one and moved to a separate module, for example, or the ITLB being in a module of its own but the DTLB dumped inside the load-store unit module) and optimized further. Also tested further, of course. It doesn't seem like floating-point and vectors have received much testing love yet, for example.
The code seems very straightforward and readable (as much as Verilog can be readable -- I have seen far worse code do far less) but not well-commented. The doc files for each module are a bit too short and assume too much knowledge about the microarchitecture to be known already. Perfectly fine for a solo project, too cryptic for others to read.
On microarchitecture balance and performance modeling: there is no standalone cycle-accurate C++ simulator, mainly because once the Verilator RTL was running fast enough to boot Linux in minutes, maintaining a separate C++ timing model for a solo project would have just created model-vs-RTL drift. Early sizing came from static BusyBox disassembly register-pressure checks and an offline trace-driven sweep (tools/analysis/slice1_arch_model.py, starting from a 48-entry ROB / 80 Int PRFs), and once the pipeline was up, Stage 2/3 parameters were tuned directly in RTL using fursoy_s1_hpm.sv (mcycle, minstret, and 8 mutually exclusive CPI buckets). Expanding to 160 Int PRFs (32 architectural + 128 speculative) and a 128-entry ROB was mainly to preserve the invariant that the free list can never exhaust before the ROB fills. It is admittedly ROB/PRF-heavy for a 2-wide fetch/decode/retire core compared to something like K8, and on the 89.86M-cycle Linux 6.6.50 boot, branch/flush recovery (C_br_recover at 16.72%) matters much more than rename capacity (C_be_rename at 6.35%).
For execution resources: the 2-wide frontend feeds five scalar issue ports across three OoO queues (IntIQ -> Port 0 ALU0/BRU/CSR/I2F + Port 1 ALU1/MUL/DIV; MemIQ -> Port 2 AGU0 for loads/stores/AMOs/fences + Port 3 AGU1 for loads only; FPIQ -> Port 4 FMA/FDIV/FSQRT/FCONV), plus vecq_q[8] executing fetched RVV instructions sequentially over the VRF via a core FSM. That limits it to max 1 branch/cycle (Port 0 only) and up to 2 loads/cycle or 1 load + 1 store AGU/cycle across an 8-bank (PA[5:3]) L1D. Linux boot also barely exercises RVV/FP compared to the integer and Sv39 paths, though those instructions are now checked against sail-riscv differential cosim.
On conflict misses: fursoy_s1_hpm doesn't split conflict misses out from capacity misses yet, so I don't have an exact conflict fraction. What we measure on the Linux + BusyBox boot is total memory stalls (C_mem_stall, combining L1D misses, bank conflicts, and DTLB/PTW) at 6.18% of cycles and frontend starvation (C_fe_starve) at 0.56%. Since L1I and L1D are already 16 KiB 4-way VIPT with 4 MSHRs and 2 writeback buffers, a victim cache didn't seem worth the extra tag/bypass complexity for that slice of stalls.
On the standalone STA numbers:
- fursoy_s1_agu.sv (1.901 ns): as you noticed in your follow-up, it just writes base_i + imm_i, which Yosys maps to a plain 64-bit ripple-carry chain (~30 AOI/OAI logic levels) instead of the Kogge-Stone adders in alu.sv (1.133 ns) and branch_unit.sv (0.629 ns). Once it cleared 500 MHz (+0.099 ns slack) I left it alone, though sharing one Kogge-Stone adder across all three is an obvious cleanup. - fursoy_s1_csr.sv (1.663 ns): the critical path is mstatus_i feeding a ~25-level combinational trap/privilege/delegation cone (1,790 DFFs, 26.75 kGE). Splitting fast vs. slow CSRs or going 2-cycle would easily buy headroom if pushing frequency higher; at 500 MHz (+0.298 ns slack), single-cycle kept trap/CSR serialization straightforward. - fursoy_s1_itlb / fursoy_s1_dtlb (1.198 ns / 1.249 ns): because Nangate45 open synthesis here uses standard-cell flip-flops instead of compiled SRAM macros (6,304 / 6,515 DFFs, 77 / 100 kGE), STA sees a wide VA buffer tree feeding a 4-level MUX2 set-read plus 4-way tag compare, 8-entry 2M/1G superpage CAM, and hit-way mux—on top of a 0.40 ns (0.20 ns input + 0.20 ns output) standalone port budget.
If you want a visual block diagram, there is also an interactive version on the project page at https://cpu.fursoy.com — though the README diagram and tables remain the primary reference in the repo.
The README is much better now. I see now that I misunderstood both the pipeline length (fetch takes more stages than I thought) and the width of the OOO part.
I did see some mentions of SRAM and that it wasn't done yet but I hadn't caught on to it affecting the way the TLBs were handled. Of course they are slow at the moment! That also explains why you haven't bothered to show the synthesis of the caches (and I guess the load/store queues -- well, all queues, really).
cpu.fursoy.com looks pretty (and very AI generated) and there is indeed a link to it on the github page, but I had no idea there would be anything useful there. It should probably also be mentioned in the README.
I'm going to play around a bit with cpu.fursoy.com and maybe report back later.
Good luck with the project!
(Your post was flagged and dead for some reason, btw.)
There are still some LaTeX issues, for example section 2.2.3 in slice1-core-v1.md. At least it doesn't error out, it's just a rendering thing. I don't know why the rendering is wrong, it looks to me like you did it correctly in the markdown file.
> and slice1-core-v1.md drifting from the README. I cleaned those up in the repo and added an ASCII pipeline diagram along with an explicit execution-port breakdown in the README
There's a bit more to sync up in slice1-core-v1.md. It only mentions F1 and F2, for example, and it also says "10-stage". Of course, you can always claim that the word "conceptual" covers you there.
(yes, I know that your comment is sarcasm)