mirror of
https://github.com/handsomezhuzhu/2025-yatcpu.git
synced 2026-02-20 12:00:14 +00:00
Merge branch 'docs'
This commit is contained in:
@@ -288,12 +288,12 @@ CPUBundle 是 CPU 和内存等外设进行数据交换的通道。
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1. `src\test\scala\riscv\singlecycle` 中的测试文件 `ExecuteTest.scala`, `InstructionDecoderTest.scala` 和 `InstructionFetch.scala` 分别对相应部件进行单元测试,以确保单个部件的正确性。请您选择其中至少一个测试,并
|
1. `src\test\scala\riscv\singlecycle` 中的测试文件 `ExecuteTest.scala`, `InstructionDecoderTest.scala`(选择其中一类指令) 和 `InstructionFetch.scala` 分别对相应部件进行单元测试,以确保单个部件的正确性。请您选择其中至少一个测试,并
|
||||||
1. 简述测试文件中的语句是如何测试部件正确性的;
|
1. 简述测试文件中的语句是如何测试部件正确性的;如 `InstructionDecoderTest` 中对各类型指令均进行了测试,那对于 `L` 类指令,为何设置相应的 `expect` 值是那样的?
|
||||||
2. 在测试波形图上说明部件运行过程中关键信号的变化。
|
2. 在测试波形图上说明部件运行过程中关键信号的变化。如 `InstructionDecoderTest` 中的 `L` 类指令测试,找到其在波形图上的位置,并显示相应信号线的值。
|
||||||
2. 测试文件 `CPUTest.scala` 测试了整个 CPU 运行三个程序的正确性。请您选择其中至少一个程序的运行,并
|
2. 测试文件 `CPUTest.scala` 测试了整个 CPU 运行三个程序的正确性。请您选择其中至少一个程序的运行,并
|
||||||
1. 概述该程序做了什么,执行结果如何被检查;
|
1. 查看 `csrc` 文件夹下对应 C 文件的内容,概述该程序做了什么,执行结果如何在 Chisel 测试中被检查;
|
||||||
2. 在测试波形图上简单分析其执行,并说明检查执行结果时的波形。
|
2. 在测试波形图上简单分析其执行,并说明波形图最后几个周期检查执行结果时的波形。
|
||||||
3. 说明您在完成实验的过程中,遇到的实验指导不足或改进建议。
|
3. 说明您在完成实验的过程中,遇到的实验指导不足或改进建议。
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
@@ -177,5 +177,6 @@ Timer 的代码位于 `src/main/scala/peripheral/Timer.scala`
|
|||||||
2. `CPUTest.scala` 中新增了 `SimpleTrapTest`,其执行 `csrc/simpletest.c` 的程序。请您:
|
2. `CPUTest.scala` 中新增了 `SimpleTrapTest`,其执行 `csrc/simpletest.c` 的程序。请您:
|
||||||
1. 简述该测试程序如何测试 CPU 的中断处理正确性。
|
1. 简述该测试程序如何测试 CPU 的中断处理正确性。
|
||||||
2. 在测试波形图上找出说明该程序成功执行的信号。
|
2. 在测试波形图上找出说明该程序成功执行的信号。
|
||||||
3. 说明您在完成实验的过程中,遇到的实验指导不足或改进建议。
|
3. 假如我们的 CPU 上运行着某个操作系统,并在启动后向 `mtvec` 写入了中断处理程序的地址。若在执行程序时发生 定时器中断,CPU 及操作系统会如何协作完成该中断处理?请查阅课本、网络资料或辩证地使用大语言模型,简述这个过程。
|
||||||
|
4. 说明您在完成实验的过程中,遇到的实验指导不足或改进建议。
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Scala 和 Chisel 编程语言
|
# 实验零 Scala 和 Chisel 编程语言
|
||||||
|
|
||||||
Writen By: [Howard Lau](https://github.com/howardlau1999), [Tiger9Tu](), [PurplePower](https://github.com/PurplePower)
|
Writen By: [Howard Lau](https://github.com/howardlau1999), [Tiger9Tu](), [PurplePower](https://github.com/PurplePower)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ nav:
|
|||||||
|
|
||||||
- 基础工程知识与技能:
|
- 基础工程知识与技能:
|
||||||
- docs/better-tut/practice/envvar-and-cmd.md
|
- docs/better-tut/practice/envvar-and-cmd.md
|
||||||
- docs/better-tut/practice/scala-and-chisel.md
|
|
||||||
- docs/better-tut/practice/chisel-test.md
|
- docs/better-tut/practice/chisel-test.md
|
||||||
- docs/better-tut/practice/simulation.md
|
- docs/better-tut/practice/simulation.md
|
||||||
- docs/better-tut/practice/compliance-test.md
|
- docs/better-tut/practice/compliance-test.md
|
||||||
@@ -35,6 +34,7 @@ nav:
|
|||||||
- docs/better-tut/theory/interrupt-and-exception.md
|
- docs/better-tut/theory/interrupt-and-exception.md
|
||||||
- docs/better-tut/theory/bus.md
|
- docs/better-tut/theory/bus.md
|
||||||
- 实验:
|
- 实验:
|
||||||
|
- docs/better-tut/practice/scala-and-chisel.md
|
||||||
- docs/better-tut/labs/lab1/lab1-single-cycle-cpu.md
|
- docs/better-tut/labs/lab1/lab1-single-cycle-cpu.md
|
||||||
- docs/better-tut/labs/lab2/lab2-interrupt.md
|
- docs/better-tut/labs/lab2/lab2-interrupt.md
|
||||||
- docs/better-tut/labs/lab3/lab3-pipelined-cpu.md
|
- docs/better-tut/labs/lab3/lab3-pipelined-cpu.md
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ mkdocs-material
|
|||||||
mkdocs-material-extensions
|
mkdocs-material-extensions
|
||||||
mkdocs-git-revision-date-localized-plugin
|
mkdocs-git-revision-date-localized-plugin
|
||||||
mkdocs-git-authors-plugin
|
mkdocs-git-authors-plugin
|
||||||
mkdocs-glightbox
|
mkdocs-glightbox
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.wb_reg_write_source.expect(RegWriteSource.Memory)
|
c.io.wb_reg_write_source.expect(RegWriteSource.Memory)
|
||||||
c.io.memory_read_enable.expect(true.B)
|
c.io.memory_read_enable.expect(true.B)
|
||||||
c.io.memory_write_enable.expect(false.B)
|
c.io.memory_write_enable.expect(false.B)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// InstructionTypes.S
|
// InstructionTypes.S
|
||||||
@@ -47,6 +48,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.regs_reg2_read_address.expect(10.U)
|
c.io.regs_reg2_read_address.expect(10.U)
|
||||||
c.io.memory_write_enable.expect(true.B)
|
c.io.memory_write_enable.expect(true.B)
|
||||||
c.io.reg_write_enable.expect(false.B)
|
c.io.reg_write_enable.expect(false.B)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// InstructionTypes.I, I-type instructions
|
// InstructionTypes.I, I-type instructions
|
||||||
@@ -58,6 +60,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.reg_write_enable.expect(true.B)
|
c.io.reg_write_enable.expect(true.B)
|
||||||
c.io.reg_write_address.expect(3.U)
|
c.io.reg_write_address.expect(3.U)
|
||||||
c.io.wb_reg_write_source.expect(RegWriteSource.ALUResult)
|
c.io.wb_reg_write_source.expect(RegWriteSource.ALUResult)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// InstructionTypes.B, B-type instructions
|
// InstructionTypes.B, B-type instructions
|
||||||
@@ -67,6 +70,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.ex_immediate.expect(16.U)
|
c.io.ex_immediate.expect(16.U)
|
||||||
c.io.regs_reg1_read_address.expect(2.U)
|
c.io.regs_reg1_read_address.expect(2.U)
|
||||||
c.io.regs_reg2_read_address.expect(4.U)
|
c.io.regs_reg2_read_address.expect(4.U)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// InstructionTypes.RM, R-type instructions
|
// InstructionTypes.RM, R-type instructions
|
||||||
@@ -77,6 +81,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.regs_reg2_read_address.expect(2.U)
|
c.io.regs_reg2_read_address.expect(2.U)
|
||||||
c.io.reg_write_enable.expect(true.B)
|
c.io.reg_write_enable.expect(true.B)
|
||||||
c.io.reg_write_address.expect(3.U)
|
c.io.reg_write_address.expect(3.U)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// lui, U-type
|
// lui, U-type
|
||||||
@@ -88,6 +93,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.reg_write_address.expect(5.U)
|
c.io.reg_write_address.expect(5.U)
|
||||||
c.io.ex_immediate.expect((2 << 12).U)
|
c.io.ex_immediate.expect((2 << 12).U)
|
||||||
c.io.wb_reg_write_source.expect(RegWriteSource.ALUResult)
|
c.io.wb_reg_write_source.expect(RegWriteSource.ALUResult)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// jal, J-type
|
// jal, J-type
|
||||||
@@ -98,6 +104,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.wb_reg_write_source.expect(RegWriteSource.NextInstructionAddress)
|
c.io.wb_reg_write_source.expect(RegWriteSource.NextInstructionAddress)
|
||||||
c.io.reg_write_enable.expect(true.B)
|
c.io.reg_write_enable.expect(true.B)
|
||||||
c.io.reg_write_address.expect(5.U)
|
c.io.reg_write_address.expect(5.U)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// jalr, I-type
|
// jalr, I-type
|
||||||
@@ -109,6 +116,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.wb_reg_write_source.expect(RegWriteSource.NextInstructionAddress)
|
c.io.wb_reg_write_source.expect(RegWriteSource.NextInstructionAddress)
|
||||||
c.io.reg_write_enable.expect(true.B)
|
c.io.reg_write_enable.expect(true.B)
|
||||||
c.io.reg_write_address.expect(5.U)
|
c.io.reg_write_address.expect(5.U)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
|
|
||||||
// auipc, U-type
|
// auipc, U-type
|
||||||
@@ -119,7 +127,7 @@ class InstructionDecoderTest extends AnyFlatSpec with ChiselScalatestTester{
|
|||||||
c.io.reg_write_enable.expect(true.B)
|
c.io.reg_write_enable.expect(true.B)
|
||||||
c.io.reg_write_address.expect(2.U)
|
c.io.reg_write_address.expect(2.U)
|
||||||
c.io.wb_reg_write_source.expect(RegWriteSource.ALUResult)
|
c.io.wb_reg_write_source.expect(RegWriteSource.ALUResult)
|
||||||
|
c.clock.step()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user