forked from PeterAaser/RISCV-FiveStage
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Tile.scala
75 lines (54 loc) · 2.51 KB
/
Tile.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package FiveStage
import chisel3._
import chisel3.util._
import chisel3.core.Input
import chisel3.iotesters.PeekPokeTester
/**
* The top level module. You do not have to change anything here,
* however you are free to route out signals as you see fit for debugging.
*/
class Tile() extends Module{
val io = IO(
new Bundle {
val DMEMWriteData = Input(UInt(32.W))
val DMEMAddress = Input(UInt(32.W))
val DMEMWriteEnable = Input(Bool())
val DMEMReadData = Output(UInt(32.W))
val regsWriteData = Input(UInt(32.W))
val regsAddress = Input(UInt(5.W))
val regsWriteEnable = Input(Bool())
val regsReadData = Output(UInt(32.W))
val regsDeviceWriteEnable = Output(Bool())
val regsDeviceWriteData = Output(UInt(32.W))
val regsDeviceWriteAddress = Output(UInt(5.W))
val memDeviceWriteEnable = Output(Bool())
val memDeviceWriteData = Output(UInt(32.W))
val memDeviceWriteAddress = Output(UInt(32.W))
val IMEMWriteData = Input(UInt(32.W))
val IMEMAddress = Input(UInt(32.W))
val setup = Input(Bool())
val currentPC = Output(UInt())
})
val CPU = Module(new CPU).testHarness
CPU.setupSignals.IMEMsignals.address := io.IMEMAddress
CPU.setupSignals.IMEMsignals.instruction := io.IMEMWriteData
CPU.setupSignals.IMEMsignals.setup := io.setup
CPU.setupSignals.DMEMsignals.writeEnable := io.DMEMWriteEnable
CPU.setupSignals.DMEMsignals.dataAddress := io.DMEMAddress
CPU.setupSignals.DMEMsignals.dataIn := io.DMEMWriteData
CPU.setupSignals.DMEMsignals.setup := io.setup
CPU.setupSignals.registerSignals.readAddress := io.regsAddress
CPU.setupSignals.registerSignals.writeEnable := io.regsWriteEnable
CPU.setupSignals.registerSignals.writeAddress := io.regsAddress
CPU.setupSignals.registerSignals.writeData := io.regsWriteData
CPU.setupSignals.registerSignals.setup := io.setup
io.DMEMReadData := CPU.testReadouts.DMEMread
io.regsReadData := CPU.testReadouts.registerRead
io.regsDeviceWriteAddress := CPU.regUpdates.writeAddress
io.regsDeviceWriteEnable := CPU.regUpdates.writeEnable
io.regsDeviceWriteData := CPU.regUpdates.writeData
io.memDeviceWriteAddress := CPU.memUpdates.writeAddress
io.memDeviceWriteEnable := CPU.memUpdates.writeEnable
io.memDeviceWriteData := CPU.memUpdates.writeData
io.currentPC := CPU.currentPC
}