Assignment3: Single-cycle RISC-V CPU
contributed by < terry23304 >
Hello World in Chisel
Switch the LED output every CNT_MAX
clock cycles.
It is a I/O Bundle that has only one output signal and no input signals. It includes two registers, cntReg
and blkReg
, cntReg
is used to count the number of clock cycles passed. When it reachesCNT_MAX
, which is 24999999
, reset cntReg
to 0 and invert the value of blkReg
. The output will be the same as blkReg
MyCPU
Instruction Fetch
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Using jump_flag_id
to determine next pc will be jump_address_id
or pc + 4
.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
instruction valid
is false only in the beginning. Therefore, the instruction is 0x00000013
, and after that, the instruction will be 0x00000000
.
Instruction Decode
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
The testing instruction would be:
- sw x10, 4(x0)
- lui x5, 2
- add x3, x1, x2
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Set memory_read_enable
to 1
when the instruction is of L type and set memory_write_enable
to 1
when the instruction is of S type. Therefore, memory_write_enable
is set to 1
only when executing the instruction sw x10
, 4(x0).
Execute
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Using aluop_source to determine the values of op1
and op2
. When aluop_source is 0, op will be set to the data in register; otherwise, op will be set to 0 and immediate value.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Run RISC-V assembly code in Homework2
- Move assembly code to csrc directory.
- Modify the makefile in csrc directory to generate corresponding .asmbin file
- Add test in CPUTest.scala
- Run
make update
- Run
sbt "testOnly riscv.singlecycle.BinarizationTest"
Analysis
Execute the following command to generate Verilog file.z
Then, run gtkwave dump.vcd
to check waveform.