Skip to content

Commit dc3badb

Browse files
committed
Shuffle around files
1 parent 6759a81 commit dc3badb

20 files changed

+74
-43
lines changed

README.md

+41-30
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,52 @@
1-
# riscv-cpu
1+
# riscv-soc
2+
3+
This repository contains the source code for my Minimal RISC-V SoC.
4+
5+
## Author
6+
7+
Matias Wang Silva, 2024/2025
8+
9+
## License
10+
11+
MIT
212

313
## Naming conventions
414

515
The code follows the [lowRISC coding style](https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md) for Verilog for the most part. I wrote this myself in my free time so there will be deviations for no real reason.
616

7-
* signals use snake case
8-
- note: logical word units are joined without underscore
9-
- eg: memwrite expands to memory write (one action)
10-
- eg: mem_to_reg expands to memory to register (no joining)
11-
* parameters use ALL CAPS
12-
* task names, module names are all snake case
13-
* common abbreviations are used where possible (reg for register, mem for memory, ctrl for control, etc)
17+
- signals use snake case
18+
- note: logical word units are joined without underscore
19+
- eg: memwrite expands to memory write (one action)
20+
- eg: mem_to_reg expands to memory to register (no joining)
21+
- parameters use ALL CAPS
22+
- task names, module names are all snake case
23+
- common abbreviations are used where possible (reg for register, mem for memory, ctrl for control, etc)
1424

1525
## Development
1626

1727
While there is a great open source toolset for the iCESugar v1.5, it remains difficult to navigate the web of broken links to find what is really needed to get Verilog synthesized and 'running on' the FPGA. After lots of searching and reading tutorials, I've condensed it to this:
1828

19-
* `yosys` for synthesis
20-
- https://github.com/YosysHQ/yosys
21-
* `nextpnr` for place n route
22-
- https://github.com/YosysHQ/nextpnr
23-
* `iverilog` for Verilog compilation and simulation
24-
- https://github.com/steveicarus/iverilog
25-
* `icestorm` for a few useful tools for the iCE40 family of FPGAs
26-
- https://github.com/YosysHQ/icestorm
27-
* `icesprog` for uploading the bitstream to the iCESugar board specifically
28-
- http://github.com/wuxx/icesugar
29+
- `yosys` for synthesis
30+
- <https://github.com/YosysHQ/yosys>
31+
- `nextpnr` for place n route
32+
- <https://github.com/YosysHQ/nextpnr>
33+
- `iverilog` for Verilog compilation and simulation
34+
- <https://github.com/steveicarus/iverilog>
35+
- `icestorm` for a few useful tools for the iCE40 family of FPGAs
36+
- <https://github.com/YosysHQ/icestorm>
37+
- `icesprog` for uploading the bitstream to the iCESugar board specifically
38+
- <http://github.com/wuxx/icesugar>
2939

30-
I recommend building each of these tools from source to ensure the latest (working) version and in the case of `icesprog` you'll also need to add the binary directory to your `$PATH`. Each of these tools has their own required dependencies so look them up to find them. Then, a standard `make -j4` and `sudo make install` suffices, apart from the odd case when a `./configure` was needed. While I was wrapping my head around this, I found https://f4pga.readthedocs.io/en/latest/flows/index.html quite helpful in explaining each step of the design flow and how that interlinks with these open source tools.
40+
I recommend building each of these tools from source to ensure the latest (working) version and in the case of `icesprog` you'll also need to add the binary directory to your `$PATH`. Each of these tools has their own required dependencies so look them up to find them. Then, a standard `make -j4` and `sudo make install` suffices, apart from the odd case when a `./configure` was needed. While I was wrapping my head around this, I found <https://f4pga.readthedocs.io/en/latest/flows/index.html> quite helpful in explaining each step of the design flow and how that interlinks with these open source tools.
3141

3242
## TODO
3343

34-
* turn instrmem and regfile into BRAM, memory maybe SPRAM
35-
* write a simple linker script
36-
* add pipeline stalls
37-
* rename pc_incr to pc
38-
* double sw hazard, extra pipeline?
39-
* if a clocked module requires the output of a previous stage, it should take it directly from that previous stage, not the pipeline register!
44+
- turn instrmem and regfile into BRAM, memory maybe SPRAM
45+
- write a simple linker script
46+
- add pipeline stalls
47+
- rename pc_incr to pc
48+
- double sw hazard, extra pipeline?
49+
- if a clocked module requires the output of a previous stage, it should take it directly from that previous stage, not the pipeline register!
4050

4151
## Extra steps
4252

@@ -56,7 +66,7 @@ UUID=2702-1974 /mnt/iCELink vfat defaults,auto,users,rw,nofail 0 0
5666

5767
and that was it!
5868

59-
### Homebrew formula for GTKWave for MacOS (M-series)
69+
### Homebrew formula for GTKWave for MacOS (M-series)
6070

6171
GTKWave underwent a complete rewrite and somewhere along the line compatibility with newer Macs was broken. The author does not work on a Mac so couldn't provide correct build instructions. Some nice guy on the internet created a custom Homebrew formula with all the right steps to compile from source. I'm also testing a new waveform visualizer called "surfer".
6272

@@ -80,17 +90,18 @@ Format of the process file: I wasn't able to find any strict documentation on th
8090

8191
### RISC-V toolchain
8292

83-
https://github.com/riscv-software-src/homebrew-riscv?tab=readme-ov-file
93+
<https://github.com/riscv-software-src/homebrew-riscv?tab=readme-ov-file>
8494

8595
### macros
8696

8797
FPGA
8898

8999
### formatting
90100

91-
https://github.com/chipsalliance/verible/blob/master/verilog/tools/formatter/README.md
101+
<https://github.com/chipsalliance/verible/blob/master/verilog/tools/formatter/README.md>
92102

93103
### verification
94104

95-
https://github.com/YosysHQ/riscv-formal
96-
https://github.com/riscv-software-src/riscv-tests/
105+
<https://github.com/YosysHQ/riscv-formal>
106+
<https://github.com/riscv-software-src/riscv-tests/>
107+

docs/conf.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
# Configuration file for the Sphinx documentation builder.
2-
#
3-
# For the full list of built-in configuration values, see the documentation:
4-
# https://www.sphinx-doc.org/en/master/usage/configuration.html
52

63
# -- Project information -----------------------------------------------------
74
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
85

9-
project = 'Minimal RISC-V SoC'
10-
copyright = '2024, Matias Wang Silva'
11-
author = 'Matias Wang Silva'
6+
project = "Minimal RISC-V SoC"
7+
copyright = "2024, Matias Wang Silva"
8+
author = "Matias Wang Silva"
129

1310
# -- General configuration ---------------------------------------------------
1411
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1512

16-
extensions = ["myst_parser", 'sphinx_last_updated_by_git']
13+
extensions = ["myst_parser", "sphinx_last_updated_by_git"]
1714

18-
templates_path = ['_templates']
19-
exclude_patterns = ['build', 'Thumbs.db', '.DS_Store']
15+
templates_path = ["_templates"]
16+
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]
2017

2118
# -- Options for HTML output -------------------------------------------------
2219
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
2320

24-
html_theme = 'furo'
25-
html_static_path = ['_static']
21+
html_theme = "furo"
22+
html_static_path = ["_static"]
2623
html_theme_options = {
2724
"source_edit_link": "https://github.com/matiasilva/riscv-soc/edit/master/docs/src/{filename}",
2825
"source_view_link": "https://github.com/matiasilva/riscv-soc/blob/master/docs/src/{filename}",
@@ -33,5 +30,4 @@
3330
myst_heading_anchors = 3
3431

3532
# LaTeX output
36-
latex_engine = 'lualatex'
37-
33+
latex_engine = "lualatex"

docs/src/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ core
2020
fpgas
2121
testing
2222
log
23+
tools
2324
resources
2425
```
2526

docs/src/tools.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Tools
2+
3+
## Custom scripts
4+
5+
Every design project has its own set of custom scripts, usually to shoehorn
6+
bytes around into the right format.
7+
8+
## Editor
9+
10+
This was the first project I completed fully in (neo)vim, using the LazyVim set
11+
of plugins. I know, I became the very thing I swore to destroy.
12+
13+
If you do happen to go down that route, though, I used the JetBrains Mono Nerd
14+
Font, which gives full icon support in LazyVim, with the
15+
[Monokai Pro](https://github.com/loctvl842/monokai-pro.nvim) theme [^also]. I
16+
also recommend `mini.align` for aligning SystemVerilog and Prettier for
17+
formatting Markdown, which when coupled with LazyVim's native `lang.markdown`
18+
support leads to an incredible documentation writing experience. I suggest
19+
turning on `proseWrap` specifically for Markdown to keep things nicely limited
20+
at 80 chars per row.
21+
22+
[^also]:
23+
I also considered the [Alabaster](https://sr.ht/~p00f/alabaster.nvim/) theme

src/alu.v hdl/alu.v

File renamed without changes.

src/aluctrl.v hdl/aluctrl.v

File renamed without changes.

src/control.v hdl/control.v

File renamed without changes.

src/core.v hdl/core.v

File renamed without changes.

src/instrmem.v hdl/instrmem.v

File renamed without changes.

src/memory.v hdl/memory.v

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/regfile.v hdl/regfile.v

File renamed without changes.

tests/tb/alu_tb.v sim/tb/alu_tb.v

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)