diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-06-28 16:10:11 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-06-28 16:10:11 +0200 |
commit | 04a934987445897a03652aa73e2a5c5088d40ba1 (patch) | |
tree | eb9ecb1cf1a68ef5fa602d0581b8046b39fe8406 | |
parent | 94954f13818a55aae02b660942abd12dab32372d (diff) | |
download | riscv_cpu-04a934987445897a03652aa73e2a5c5088d40ba1.tar.gz riscv_cpu-04a934987445897a03652aa73e2a5c5088d40ba1.zip |
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | prog/src/startup.c | 16 | ||||
-rw-r--r-- | rtl/src/rom.v | 2 |
3 files changed, 11 insertions, 10 deletions
@@ -2,7 +2,7 @@ An attempt at building a simple RISCV CPU in verilog. Currently my CPU implements the RV32I ISA without FENCE/ECALL/EBREAK instructions. The design -is very much based on David and Sarah Harris' book +is very much based on David and Sarah Harris' book "Digital Design and Computer Architecture (RISC-V Edition)". ## FPGA @@ -94,6 +94,7 @@ riscv_cpu * [Operating Systems: Three Easy Pieces by Remzi and Andrea Arpaci-Dusseau](https://pages.cs.wisc.edu/~remzi/OSTEP/) * [Example RISCV Cores](https://github.com/yunchenlo/awesome-RISCV-Cores) * [godbolt (compiler explorer)](https://godbolt.org) +* [DDCA Notes](https://github.com/flavian112/ethz_ddca) ## Design diff --git a/prog/src/startup.c b/prog/src/startup.c index b587a95..ad9b9b6 100644 --- a/prog/src/startup.c +++ b/prog/src/startup.c @@ -5,15 +5,16 @@ extern unsigned int _sbss; // start of .bss section extern unsigned int _ebss; // end of .bss section extern unsigned int _estack; // end of .stack section (stack top) -//void main(void); // main function declaration +extern void main(void); // main function declaration extern void test_prog(void); -void _start(void) __attribute__((section(".text.startup"), naked)); // entry point, cpu starts executing from here - void _start(void) -{ - //test_prog(); + __attribute__((section(".text.startup"), + naked)); // entry point, cpu starts executing from here + +void _start(void) { + // test_prog(); unsigned int *src, *dst; @@ -29,11 +30,12 @@ void _start(void) } // initialize stack pointer - asm volatile ("la sp, _estack"); + asm volatile("la sp, _estack"); // call main function main(); // halt - while (1); + while (1) + ; } diff --git a/rtl/src/rom.v b/rtl/src/rom.v index 9ade9bc..784e50d 100644 --- a/rtl/src/rom.v +++ b/rtl/src/rom.v @@ -18,8 +18,6 @@ module rom #( //(* RAM_STYLE="BLOCK" *) reg [31:0] mem [0:SIZE-1]; -reg [7:0] mem0, mem1, mem2, mem3; - reg [31:0] rd_reg; reg [31:0] addr_reg; |