-
Notifications
You must be signed in to change notification settings - Fork 18
/
ConstRegBlock.scala
36 lines (26 loc) · 1.02 KB
/
ConstRegBlock.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
package AXIChisel
import Chisel._
import Literal._
import Node._
import AXILiteDefs._
// a simple read-only register block AXI lite slave example
// returns a constant value for all addresses
// TODO reading causes processor to freeze - what can be wrong?
class ConstRegBlock(addrBits: Int, dataBits: Int) extends Module {
val io = new AXILiteSlaveIF(addrBits, dataBits)
io.renameSignals()
// as this is a read-only block, write response logic and such is constant
// -- we do acknowledge writes and don't signal any errors, but writes have
// simply no effect
io.writeAddr.ready := Bool(true)
io.writeData.ready := Bool(true)
io.writeResp.bits := UInt(0)
io.writeResp.valid := Bool(true)
io.readAddr.ready := Bool(true)
// loopback request address as data
//io.readData.bits.data := Reg(next = io.readAddr.bits.addr)
io.readData.bits.data := UInt(0xdeadbeef)
io.readData.valid := Bool(true)
// read response always returns OK in our case
io.readData.bits.resp := UInt(0)
}