mirror of
https://github.com/handsomezhuzhu/2025-yatcpu.git
synced 2026-02-20 20:10:14 +00:00
finished lab1
This commit is contained in:
@@ -32,16 +32,17 @@ class Top(binaryFilename: String = "say_goodbye.asmbin") extends Module {
|
||||
// val hdmi_display = Module(new HDMIDisplay)
|
||||
// val display = Module(new CharacterDisplay)
|
||||
// val timer = Module(new Timer)
|
||||
val uart = Module(new Uart(frequency = 32_000000, baudRate = 115200)) // 31M or 32M is good, 33M more error
|
||||
// val uart = Module(new Uart(frequency = 32_000000, baudRate = 115200)) // 31M or 32M is good, 33M more error
|
||||
val dummy = Module(new Dummy)
|
||||
|
||||
// display.io.bundle <> dummy.io.bundle
|
||||
mem.io.bundle <> dummy.io.bundle
|
||||
mem.io.debug_read_address := 0.U
|
||||
// timer.io.bundle <> dummy.io.bundle
|
||||
uart.io.bundle <> dummy.io.bundle
|
||||
io.tx := uart.io.txd
|
||||
uart.io.rxd := io.rx
|
||||
// uart.io.bundle <> dummy.io.bundle
|
||||
// io.tx := uart.io.txd
|
||||
// uart.io.rxd := io.rx
|
||||
io.tx := 0.U
|
||||
|
||||
val instruction_rom = Module(new InstructionROM(binaryFilename))
|
||||
val rom_loader = Module(new ROMLoader(instruction_rom.capacity))
|
||||
@@ -68,16 +69,24 @@ class Top(binaryFilename: String = "say_goodbye.asmbin") extends Module {
|
||||
mem.io.instruction_address := cpu.io.instruction_address
|
||||
cpu.io.instruction := mem.io.instruction
|
||||
|
||||
// when(!rom_loader.io.load_finished) {
|
||||
// rom_loader.io.bundle <> mem.io.bundle
|
||||
// cpu.io.memory_bundle.read_data := 0.U
|
||||
// }.otherwise {
|
||||
// rom_loader.io.bundle.read_data := 0.U
|
||||
// when(cpu.io.deviceSelect === 2.U) {
|
||||
// cpu.io.memory_bundle <> uart.io.bundle
|
||||
// }.otherwise {
|
||||
// cpu.io.memory_bundle <> mem.io.bundle
|
||||
// }
|
||||
// }
|
||||
|
||||
when(!rom_loader.io.load_finished) {
|
||||
rom_loader.io.bundle <> mem.io.bundle
|
||||
cpu.io.memory_bundle.read_data := 0.U
|
||||
}.otherwise {
|
||||
rom_loader.io.bundle.read_data := 0.U
|
||||
when(cpu.io.deviceSelect === 2.U) { // deviceSelect = highest 3 bits of address, thus 0x4000_0000 is mapped to UART
|
||||
cpu.io.memory_bundle <> uart.io.bundle
|
||||
}.otherwise {
|
||||
cpu.io.memory_bundle <> mem.io.bundle
|
||||
}
|
||||
cpu.io.memory_bundle <> mem.io.bundle
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user