diff --git a/.gitignore b/.gitignore index cffe121..2b145df 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ target **/hello_z710-test **/riscv-z710-v2020 .Xil + +# +misc/lab*_ans.yaml diff --git a/docs/docs/better-tut/labs/lab1/assets/.$single_cycle_cpu.drawio.bkp b/docs/docs/better-tut/labs/lab1/assets/.$single_cycle_cpu.drawio.bkp index 69863c4..ad95ab4 100644 --- a/docs/docs/better-tut/labs/lab1/assets/.$single_cycle_cpu.drawio.bkp +++ b/docs/docs/better-tut/labs/lab1/assets/.$single_cycle_cpu.drawio.bkp @@ -1,11 +1,908 @@ - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio b/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio index ad95ab4..63a8dc0 100644 --- a/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio +++ b/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio @@ -1,6 +1,6 @@ - + @@ -226,7 +226,7 @@ - + @@ -267,17 +267,17 @@ - + - + - + @@ -555,7 +555,7 @@ - + @@ -622,27 +622,6 @@ - - - - - - - - - - - - - - - - - - - - - @@ -859,13 +838,13 @@ - + - + - + @@ -891,7 +870,7 @@ - + @@ -899,7 +878,7 @@ - + diff --git a/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio.svg b/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio.svg index b59b95e..2623d4d 100644 --- a/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio.svg +++ b/docs/docs/better-tut/labs/lab1/assets/single_cycle_cpu.drawio.svg @@ -1,4 +1,4 @@ -
InstructionFetch
4
ADD
0
InstAddr
PC
MUX
Reg1RA
Reg1RA
Reg2RA
Reg2RA
ALUOp1Src
ALUOp2Src
1
Immediate
RegWriteSrc
Decoder
Reg1RD
Register
File
ALU
Control
ALU
Jump
Judge
JumpFlag
JumpFlag
Addr
Memory
Control
Instruction
Instruction
Memory
InstAddr
RegWD
Funct3
Opcode
Funct7
ALUFunct
Mux
Mux
RegWE
RegWA
MemoryRE
MemRE
MemoryWE
MemWE
Instruction
Funct3
Reg2RD
Reg2RD
MemAddr
Mux
Opcode
Funct3
1
Reg1RD
Reg2RD
1
JumpAddr
1
2
0
WriteBack
Single-cycle RISC-V Core
Clk_p
WD
WE
Strobe
RD
Character
Display
HDMI
Display
Clk_n
Data_p
Data_n
Addr = Address
Inst = Instruction
Int = Interrupt
Src = Source
RE = ReadEnable
RA = ReadAddress
RD = ReadData
WE = WriteEnable
WA = WriteAddress
WD = WriteData


Data
Control
Execute
RegWE
RegWA
4
ADD
3
\ No newline at end of file +
InstructionFetch
4
ADD
0
InstAddr
PC
MUX
Reg1RA
Reg1RA
Reg2RA
Reg2RA
ALUOp1Src
ALUOp2Src
1
Immediate
RegWriteSrc
Decoder
Reg1RD
Register
File
ALU
Control
ALU
Jump
Judge
JumpFlag
JumpFlag
Addr
Memory
Control
Instruction
Instruction
Memory
InstAddr
RegWD
Funct3
Opcode
Funct7
ALUFunct
Mux
Mux
RegWE
RegWA
MemoryRE
MemRE
MemoryWE
MemWE
Instruction
Funct3
Reg2RD
Reg2RD
MemAddr
Mux
Opcode
Funct3
1
Reg1RD
Reg2RD
1
JumpAddr
1
0
WriteBack
Single-cycle RISC-V Core
Clk_p
WD
WE
Strobe
RD
Character
Display
HDMI
Display
Clk_n
Data_p
Data_n
Addr = Address
Inst = Instruction
Int = Interrupt
Src = Source
RE = ReadEnable
RA = ReadAddress
RD = ReadData
WE = WriteEnable
WA = WriteAddress
WD = WriteData


Data
Control
Execute
RegWE
RegWA
4
ADD
3
\ No newline at end of file diff --git a/docs/docs/better-tut/labs/lab2/assets/.$single_cycle_cpu_zicsr.drawio.bkp b/docs/docs/better-tut/labs/lab2/assets/.$single_cycle_cpu_zicsr.drawio.bkp new file mode 100644 index 0000000..ad95ab4 --- /dev/null +++ b/docs/docs/better-tut/labs/lab2/assets/.$single_cycle_cpu_zicsr.drawio.bkp @@ -0,0 +1,910 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/docs/better-tut/labs/lab2/assets/single_cycle_cpu_zicsr.drawio b/docs/docs/better-tut/labs/lab2/assets/single_cycle_cpu_zicsr.drawio new file mode 100644 index 0000000..8e7e6c1 --- /dev/null +++ b/docs/docs/better-tut/labs/lab2/assets/single_cycle_cpu_zicsr.drawio @@ -0,0 +1,1333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/docs/better-tut/labs/lab2/assets/single_cycle_cpu_zicsr.drawio.svg b/docs/docs/better-tut/labs/lab2/assets/single_cycle_cpu_zicsr.drawio.svg new file mode 100644 index 0000000..b6a66e5 --- /dev/null +++ b/docs/docs/better-tut/labs/lab2/assets/single_cycle_cpu_zicsr.drawio.svg @@ -0,0 +1,4 @@ + + + +
InstructionFetch
4
ADD
0
InstAddr
PC
MUX
Reg1RA
Reg1RA
Reg2RA
Reg2RA
ALUOp1Src
ALUOp2Src
1
Immediate
RegWriteSrc
Reg1RD
Register
File
ALU
Control
ALU
Jump
Judge
JumpFlag
JumpFlag
Addr
Memory
Control
Instruction
Memory
InstAddr
RegWD
Instruction
Funct3
Opcode
Funct7
ALUFunct
Mux
Mux
RegWE
RegWE
RegWA
RegWA
MemoryRE
MemRE
MemoryWE
MemWE
Instruction
Funct3
Reg2RD
Reg2RD
MemAddr
Mux
Opcode
Funct3
1
Reg1RD
Reg2RD
1
JumpAddr
1
0
WriteBack
Single-cycle RISC-V Core with Interrupt
Clk_p
WD
WE
Strobe
RD
Character
Display
HDMI
Display
Clk_n
Data_p
Data_n
Addr = Address
Inst = Instruction
Int = Interrupt
Src = Source
RE = ReadEnable
RA = ReadAddress
RD = ReadData
WE = WriteEnable
WA = WriteAddress
WD = WriteData


Data
Control
Execute
4
ADD
3
CSRRD
CSR
InterruptAssert
IntAssert
CLINT
Decoder
CSRRA
CSRWE
CSRWA
CSR
ALU
CSRWD
Funct3
Uimm
Reg1RD
mstatus
mepc
mcause
mtvec
mstatusWD
mepcWD
mcauseWD
directWE
InstAddr
Instruction
JumpFlag
JumpAddr
MUX
InterruptHandlerAddr
IntHandlerAddr
2
Timer
UART
SigInt
SigInt
InterruptFlag
RxD
TxD
\ No newline at end of file diff --git a/docs/docs/better-tut/labs/lab2/lab2-interrupt.md b/docs/docs/better-tut/labs/lab2/lab2-interrupt.md index 227bd7c..6d74dd2 100644 --- a/docs/docs/better-tut/labs/lab2/lab2-interrupt.md +++ b/docs/docs/better-tut/labs/lab2/lab2-interrupt.md @@ -160,6 +160,12 @@ Timer 的代码位于 `src/main/scala/riscv/peripheral/Timer.scala` + +## CPU架构图 + +![](assets/single_cycle_cpu_zicsr.drawio.svg) + + *** ## 实验报告 @@ -173,6 +179,3 @@ Timer 的代码位于 `src/main/scala/riscv/peripheral/Timer.scala` 2. 在测试波形图上找出说明该程序成功执行的信号。 3. 说明您在完成实验的过程中,遇到的实验指导不足或改进建议。 -## CPU架构图 - -![](images/single_cycle_CPU_with_interrupt_support.png) diff --git a/misc/test_config.yaml b/misc/test_config.yaml new file mode 100644 index 0000000..e69de29 diff --git a/misc/test_target.scala b/misc/test_target.scala new file mode 100644 index 0000000..e69de29