2012-02-26 02:09:26 +01:00
|
|
|
package rocket
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2012-10-08 05:15:54 +02:00
|
|
|
import Chisel._
|
2013-07-24 05:26:17 +02:00
|
|
|
import Util._
|
2012-10-08 05:15:54 +02:00
|
|
|
import Node._
|
2013-11-08 00:42:03 +01:00
|
|
|
import uncore.HTIFIO
|
2013-07-24 05:26:17 +02:00
|
|
|
import uncore.constants.AddressConstants._
|
2012-10-08 05:15:54 +02:00
|
|
|
import scala.math._
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2013-01-07 22:38:59 +01:00
|
|
|
class DpathBTBIO extends Bundle
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2014-01-14 06:43:56 +01:00
|
|
|
val current_pc = UInt(INPUT, VADDR_BITS)
|
|
|
|
val hit = Bool(OUTPUT)
|
|
|
|
val target = UInt(OUTPUT, VADDR_BITS)
|
|
|
|
val wen = Bool(INPUT)
|
|
|
|
val clr = Bool(INPUT)
|
|
|
|
val invalidate = Bool(INPUT)
|
|
|
|
val correct_pc = UInt(INPUT, VADDR_BITS)
|
|
|
|
val correct_target = UInt(INPUT, VADDR_BITS)
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2012-02-09 10:32:52 +01:00
|
|
|
// fully-associative branch target buffer
|
2013-08-12 19:39:11 +02:00
|
|
|
class rocketDpathBTB(entries: Int) extends Module
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2013-01-07 22:38:59 +01:00
|
|
|
val io = new DpathBTBIO
|
2012-02-09 10:32:52 +01:00
|
|
|
|
|
|
|
var hit_reduction = Bool(false)
|
2012-05-24 19:33:15 +02:00
|
|
|
val hit = Bool()
|
|
|
|
val update = Bool()
|
2012-02-16 06:36:08 +01:00
|
|
|
var update_reduction = Bool(false)
|
2013-08-25 02:33:11 +02:00
|
|
|
val valid = Vec.fill(entries){Reg(init=Bool(false))}
|
2013-08-12 19:39:11 +02:00
|
|
|
val hits = Vec.fill(entries){Bool()}
|
|
|
|
val updates = Vec.fill(entries){Bool()}
|
|
|
|
val targets = Vec.fill(entries){Reg(UInt())}
|
2012-10-12 01:48:51 +02:00
|
|
|
val anyUpdate = updates.toBits.orR
|
2012-02-09 10:32:52 +01:00
|
|
|
|
2013-08-25 02:33:11 +02:00
|
|
|
val random_way = Random(entries, io.wen)
|
|
|
|
val invalid_way = valid.indexWhere((x: Bool) => !x)
|
|
|
|
val repl_way = Mux(valid.contains(Bool(false)), invalid_way, random_way)
|
|
|
|
|
2012-02-09 10:32:52 +01:00
|
|
|
for (i <- 0 until entries) {
|
2013-08-12 19:39:11 +02:00
|
|
|
val tag = Reg(UInt())
|
2013-08-25 02:33:11 +02:00
|
|
|
hits(i) := valid(i) && tag === io.current_pc
|
|
|
|
updates(i) := valid(i) && tag === io.correct_pc
|
2012-02-09 10:32:52 +01:00
|
|
|
|
2013-08-12 19:39:11 +02:00
|
|
|
when (io.wen && (updates(i) || !anyUpdate && UInt(i) === repl_way)) {
|
2013-08-25 02:33:11 +02:00
|
|
|
valid(i) := Bool(false)
|
2012-10-10 06:35:03 +02:00
|
|
|
when (!io.clr) {
|
2013-08-25 02:33:11 +02:00
|
|
|
valid(i) := Bool(true)
|
2012-10-10 06:35:03 +02:00
|
|
|
tag := io.correct_pc
|
2012-10-12 01:48:51 +02:00
|
|
|
targets(i) := io.correct_target
|
2012-10-10 06:35:03 +02:00
|
|
|
}
|
2012-02-09 10:32:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-12 01:48:51 +02:00
|
|
|
io.hit := hits.toBits.orR
|
|
|
|
io.target := Mux1H(hits, targets)
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2012-11-27 10:28:06 +01:00
|
|
|
class Status extends Bundle {
|
2013-03-26 07:26:47 +01:00
|
|
|
val ip = Bits(width = 8)
|
2012-11-27 10:28:06 +01:00
|
|
|
val im = Bits(width = 8)
|
|
|
|
val zero = Bits(width = 7)
|
2013-09-13 07:34:38 +02:00
|
|
|
val er = Bool()
|
2012-11-27 10:28:06 +01:00
|
|
|
val vm = Bool()
|
|
|
|
val s64 = Bool()
|
|
|
|
val u64 = Bool()
|
|
|
|
val ef = Bool()
|
2013-08-24 06:16:28 +02:00
|
|
|
val pei = Bool()
|
|
|
|
val ei = Bool()
|
|
|
|
val ps = Bool()
|
|
|
|
val s = Bool()
|
2012-11-27 10:28:06 +01:00
|
|
|
}
|
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
object CSR
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2012-11-27 10:28:06 +01:00
|
|
|
// commands
|
2013-11-25 13:35:15 +01:00
|
|
|
val SZ = 2
|
|
|
|
val X = Bits("b??", 2)
|
|
|
|
val N = Bits(0,2)
|
|
|
|
val W = Bits(1,2)
|
|
|
|
val S = Bits(2,2)
|
|
|
|
val C = Bits(3,2)
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
class CSRFile(implicit conf: RocketConfiguration) extends Module
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2012-11-27 10:28:06 +01:00
|
|
|
val io = new Bundle {
|
2013-08-02 23:54:16 +02:00
|
|
|
val host = new HTIFIO(conf.tl.ln.nClients)
|
2013-04-02 23:43:01 +02:00
|
|
|
val rw = new Bundle {
|
2013-11-25 13:35:15 +01:00
|
|
|
val addr = UInt(INPUT, 12)
|
|
|
|
val cmd = Bits(INPUT, CSR.SZ)
|
2013-04-10 22:47:30 +02:00
|
|
|
val rdata = Bits(OUTPUT, conf.xprlen)
|
2013-04-02 23:43:01 +02:00
|
|
|
val wdata = Bits(INPUT, conf.xprlen)
|
|
|
|
}
|
2012-11-27 10:28:06 +01:00
|
|
|
|
|
|
|
val status = new Status().asOutput
|
2013-08-12 19:39:11 +02:00
|
|
|
val ptbr = UInt(OUTPUT, PADDR_BITS)
|
2013-08-24 06:16:28 +02:00
|
|
|
val evec = UInt(OUTPUT, VADDR_BITS+1)
|
2012-11-27 10:28:06 +01:00
|
|
|
val exception = Bool(INPUT)
|
2013-11-25 13:35:15 +01:00
|
|
|
val retire = Bool(INPUT)
|
2013-08-12 19:39:11 +02:00
|
|
|
val cause = UInt(INPUT, 6)
|
2012-11-27 10:28:06 +01:00
|
|
|
val badvaddr_wen = Bool(INPUT)
|
2013-08-12 19:39:11 +02:00
|
|
|
val pc = UInt(INPUT, VADDR_BITS+1)
|
2013-11-25 13:35:15 +01:00
|
|
|
val sret = Bool(INPUT)
|
2013-08-24 06:16:28 +02:00
|
|
|
val fatc = Bool(OUTPUT)
|
2012-11-27 10:28:06 +01:00
|
|
|
val replay = Bool(OUTPUT)
|
2013-11-25 13:35:15 +01:00
|
|
|
val time = UInt(OUTPUT, 64)
|
|
|
|
val fcsr_rm = Bits(OUTPUT, FPConstants.RM_SZ)
|
|
|
|
val fcsr_flags = Valid(Bits(width = FPConstants.FLAGS_SZ)).flip
|
2012-11-27 10:28:06 +01:00
|
|
|
}
|
|
|
|
|
2013-08-24 06:16:28 +02:00
|
|
|
val reg_epc = Reg(Bits(width = VADDR_BITS+1))
|
|
|
|
val reg_badvaddr = Reg(Bits(width = VADDR_BITS))
|
|
|
|
val reg_evec = Reg(Bits(width = VADDR_BITS))
|
2013-08-12 19:39:11 +02:00
|
|
|
val reg_compare = Reg(Bits(width = 32))
|
|
|
|
val reg_cause = Reg(Bits(width = io.cause.getWidth))
|
2013-08-16 00:28:15 +02:00
|
|
|
val reg_tohost = Reg(init=Bits(0, conf.xprlen))
|
|
|
|
val reg_fromhost = Reg(init=Bits(0, conf.xprlen))
|
2013-08-24 06:16:28 +02:00
|
|
|
val reg_sup0 = Reg(Bits(width = conf.xprlen))
|
|
|
|
val reg_sup1 = Reg(Bits(width = conf.xprlen))
|
2013-08-12 19:39:11 +02:00
|
|
|
val reg_ptbr = Reg(UInt(width = PADDR_BITS))
|
2013-08-16 00:28:15 +02:00
|
|
|
val reg_stats = Reg(init=Bool(false))
|
2013-08-12 19:39:11 +02:00
|
|
|
val reg_status = Reg(new Status) // reset down below
|
2013-11-25 13:35:15 +01:00
|
|
|
val reg_time = WideCounter(64)
|
|
|
|
val reg_instret = WideCounter(64, io.retire)
|
|
|
|
val reg_fflags = Reg(UInt(width = 5))
|
|
|
|
val reg_frm = Reg(UInt(width = 3))
|
2012-11-27 10:28:06 +01:00
|
|
|
|
2013-08-16 00:28:15 +02:00
|
|
|
val r_irq_timer = Reg(init=Bool(false))
|
|
|
|
val r_irq_ipi = Reg(init=Bool(true))
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
val cpu_req_valid = io.rw.cmd != CSR.N
|
2013-08-12 19:39:11 +02:00
|
|
|
val host_pcr_req_valid = Reg(Bool()) // don't reset
|
2013-11-25 13:35:15 +01:00
|
|
|
val host_pcr_req_fire = host_pcr_req_valid && !cpu_req_valid
|
2013-08-12 19:39:11 +02:00
|
|
|
val host_pcr_rep_valid = Reg(Bool()) // don't reset
|
|
|
|
val host_pcr_bits = Reg(io.host.pcr_req.bits)
|
2012-12-06 23:22:07 +01:00
|
|
|
io.host.pcr_req.ready := !host_pcr_req_valid && !host_pcr_rep_valid
|
|
|
|
io.host.pcr_rep.valid := host_pcr_rep_valid
|
|
|
|
io.host.pcr_rep.bits := host_pcr_bits.data
|
|
|
|
when (io.host.pcr_req.fire()) {
|
|
|
|
host_pcr_req_valid := true
|
|
|
|
host_pcr_bits := io.host.pcr_req.bits
|
|
|
|
}
|
|
|
|
when (host_pcr_req_fire) {
|
|
|
|
host_pcr_req_valid := false
|
|
|
|
host_pcr_rep_valid := true
|
2013-04-02 23:43:01 +02:00
|
|
|
host_pcr_bits.data := io.rw.rdata
|
2012-12-06 23:22:07 +01:00
|
|
|
}
|
|
|
|
when (io.host.pcr_rep.fire()) { host_pcr_rep_valid := false }
|
2013-09-25 10:16:32 +02:00
|
|
|
|
|
|
|
io.host.debug_stats_pcr := reg_stats // direct export up the hierarchy
|
2012-02-20 08:15:45 +01:00
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
val addr = Mux(cpu_req_valid, io.rw.addr, host_pcr_bits.addr | 0x500)
|
|
|
|
val decoded_addr = {
|
|
|
|
val default = List(Bits("b" + ("?"*CSRs.all.size), CSRs.all.size))
|
|
|
|
val outs = for (i <- 0 until CSRs.all.size)
|
|
|
|
yield UInt(CSRs.all(i), addr.getWidth) -> List(UInt(BigInt(1) << i, CSRs.all.size))
|
|
|
|
|
|
|
|
val d = DecodeLogic(addr, default, outs).toArray
|
|
|
|
val a = Array.fill(CSRs.all.max+1)(null.asInstanceOf[Bool])
|
|
|
|
for (i <- 0 until CSRs.all.size)
|
|
|
|
a(CSRs.all(i)) = d(0)(i)
|
|
|
|
a
|
|
|
|
}
|
|
|
|
|
|
|
|
val wen = cpu_req_valid || host_pcr_req_fire && host_pcr_bits.rw
|
|
|
|
val wdata = Mux(cpu_req_valid, io.rw.wdata, host_pcr_bits.data)
|
2012-02-20 08:15:45 +01:00
|
|
|
|
2012-11-27 10:28:06 +01:00
|
|
|
io.status := reg_status
|
2013-03-26 07:27:23 +01:00
|
|
|
io.status.ip := Cat(r_irq_timer, reg_fromhost.orR, r_irq_ipi, Bool(false),
|
2013-03-26 07:26:47 +01:00
|
|
|
Bool(false), Bool(false), Bool(false), Bool(false))
|
2013-11-25 13:35:15 +01:00
|
|
|
io.fatc := wen && decoded_addr(CSRs.fatc)
|
2013-08-24 06:16:28 +02:00
|
|
|
io.evec := Mux(io.exception, reg_evec.toSInt, reg_epc).toUInt
|
2012-11-27 10:28:06 +01:00
|
|
|
io.ptbr := reg_ptbr
|
2013-07-31 01:36:28 +02:00
|
|
|
|
2013-09-13 07:34:38 +02:00
|
|
|
when (io.badvaddr_wen) {
|
|
|
|
val wdata = io.rw.wdata
|
2013-01-06 14:18:33 +01:00
|
|
|
val (upper, lower) = Split(wdata, VADDR_BITS)
|
2013-08-12 19:39:11 +02:00
|
|
|
val sign = Mux(lower.toSInt < SInt(0), upper.andR, upper.orR)
|
|
|
|
reg_badvaddr := Cat(sign, lower).toSInt
|
2012-03-14 22:15:28 +01:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
|
|
|
|
when (io.exception) {
|
2013-01-06 14:18:33 +01:00
|
|
|
reg_status.s := true
|
|
|
|
reg_status.ps := reg_status.s
|
2013-08-24 06:16:28 +02:00
|
|
|
reg_status.ei := false
|
|
|
|
reg_status.pei := reg_status.ei
|
2013-08-12 19:39:11 +02:00
|
|
|
reg_epc := io.pc.toSInt
|
2013-01-06 14:18:33 +01:00
|
|
|
reg_cause := io.cause
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
2011-11-14 22:48:49 +01:00
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
when (io.sret) {
|
2012-11-27 10:28:06 +01:00
|
|
|
reg_status.s := reg_status.ps
|
2013-08-24 06:16:28 +02:00
|
|
|
reg_status.ei := reg_status.pei
|
2012-01-27 04:33:55 +01:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
when (reg_time(reg_compare.getWidth-1,0) === reg_compare) {
|
|
|
|
r_irq_timer := true
|
2011-11-13 09:27:57 +01:00
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
io.time := reg_time
|
|
|
|
io.host.ipi_req.valid := cpu_req_valid && decoded_addr(CSRs.send_ipi)
|
2013-04-02 23:43:01 +02:00
|
|
|
io.host.ipi_req.bits := io.rw.wdata
|
2012-08-04 04:00:34 +02:00
|
|
|
io.replay := io.host.ipi_req.valid && !io.host.ipi_req.ready
|
|
|
|
|
2013-11-25 13:35:15 +01:00
|
|
|
when (host_pcr_req_fire && !host_pcr_bits.rw && decoded_addr(CSRs.tohost)) { reg_tohost := UInt(0) }
|
2012-11-27 10:28:06 +01:00
|
|
|
|
|
|
|
val read_impl = Bits(2)
|
|
|
|
val read_ptbr = reg_ptbr(PADDR_BITS-1,PGIDX_BITS) << PGIDX_BITS
|
|
|
|
val read_cause = reg_cause(reg_cause.getWidth-1) << conf.xprlen-1 | reg_cause(reg_cause.getWidth-2,0)
|
2013-11-25 13:35:15 +01:00
|
|
|
|
|
|
|
val read_mapping = Map[Int,Bits](
|
|
|
|
CSRs.fflags -> (if (conf.fpu) reg_fflags else UInt(0)),
|
|
|
|
CSRs.frm -> (if (conf.fpu) reg_frm else UInt(0)),
|
|
|
|
CSRs.fcsr -> (if (conf.fpu) Cat(reg_frm, reg_fflags) else UInt(0)),
|
|
|
|
CSRs.cycle -> reg_time,
|
|
|
|
CSRs.time -> reg_time,
|
|
|
|
CSRs.instret -> reg_instret,
|
|
|
|
CSRs.sup0 -> reg_sup0,
|
|
|
|
CSRs.sup1 -> reg_sup1,
|
|
|
|
CSRs.epc -> reg_epc,
|
|
|
|
CSRs.badvaddr -> reg_badvaddr,
|
|
|
|
CSRs.ptbr -> read_ptbr,
|
|
|
|
CSRs.asid -> UInt(0),
|
|
|
|
CSRs.count -> reg_time,
|
|
|
|
CSRs.compare -> reg_compare,
|
|
|
|
CSRs.evec -> reg_evec,
|
|
|
|
CSRs.cause -> read_cause,
|
|
|
|
CSRs.status -> io.status.toBits,
|
|
|
|
CSRs.hartid -> io.host.id,
|
|
|
|
CSRs.impl -> read_impl,
|
|
|
|
CSRs.fatc -> read_impl, // don't care
|
|
|
|
CSRs.send_ipi -> read_impl, // don't care
|
|
|
|
CSRs.clear_ipi -> read_impl, // don't care
|
|
|
|
CSRs.stats -> reg_stats,
|
|
|
|
CSRs.tohost -> reg_tohost,
|
|
|
|
CSRs.fromhost -> reg_fromhost)
|
|
|
|
|
|
|
|
io.rw.rdata := Mux1H(for ((k, v) <- read_mapping) yield decoded_addr(k) -> v)
|
|
|
|
|
|
|
|
io.fcsr_rm := reg_frm
|
|
|
|
when (io.fcsr_flags.valid) {
|
|
|
|
reg_fflags := reg_fflags | io.fcsr_flags.bits
|
|
|
|
}
|
2011-11-13 09:27:57 +01:00
|
|
|
|
2012-02-20 08:15:45 +01:00
|
|
|
when (wen) {
|
2013-11-25 13:35:15 +01:00
|
|
|
when (decoded_addr(CSRs.status)) {
|
|
|
|
val sr_wdata = Mux(io.rw.cmd === CSR.S, reg_status.toBits | wdata,
|
|
|
|
Mux(io.rw.cmd === CSR.C, reg_status.toBits & ~wdata,
|
2013-04-02 23:43:01 +02:00
|
|
|
wdata))
|
|
|
|
reg_status := new Status().fromBits(sr_wdata)
|
|
|
|
|
2013-08-24 06:16:28 +02:00
|
|
|
reg_status.s64 := true
|
|
|
|
reg_status.u64 := true
|
2012-11-27 10:28:06 +01:00
|
|
|
reg_status.zero := 0
|
2013-09-24 22:58:23 +02:00
|
|
|
if (!conf.vm) reg_status.vm := false
|
2013-09-13 07:34:38 +02:00
|
|
|
if (conf.rocc.isEmpty) reg_status.er := false
|
2012-11-27 10:28:06 +01:00
|
|
|
if (!conf.fpu) reg_status.ef := false
|
2012-02-12 02:20:33 +01:00
|
|
|
}
|
2013-11-25 13:35:15 +01:00
|
|
|
when (io.rw.cmd != CSR.C && io.rw.cmd != CSR.S) {
|
|
|
|
when (decoded_addr(CSRs.fflags)) { reg_fflags := wdata }
|
|
|
|
when (decoded_addr(CSRs.frm)) { reg_frm := wdata }
|
|
|
|
when (decoded_addr(CSRs.fcsr)) { reg_fflags := wdata; reg_frm := wdata >> reg_fflags.getWidth }
|
|
|
|
when (decoded_addr(CSRs.epc)) { reg_epc := wdata(VADDR_BITS,0).toSInt }
|
|
|
|
when (decoded_addr(CSRs.evec)) { reg_evec := wdata(VADDR_BITS-1,0).toSInt }
|
|
|
|
when (decoded_addr(CSRs.count)) { reg_time := wdata.toUInt }
|
2014-01-14 06:43:56 +01:00
|
|
|
when (decoded_addr(CSRs.compare)) { reg_compare := wdata(31,0).toUInt; r_irq_timer := Bool(false) }
|
2013-11-25 13:35:15 +01:00
|
|
|
when (decoded_addr(CSRs.fromhost)) { when (reg_fromhost === UInt(0) || !host_pcr_req_fire) { reg_fromhost := wdata } }
|
2013-12-10 00:06:13 +01:00
|
|
|
when (decoded_addr(CSRs.tohost)) { when (reg_tohost === UInt(0) || host_pcr_req_fire) { reg_tohost := wdata } }
|
2013-11-25 13:35:15 +01:00
|
|
|
when (decoded_addr(CSRs.clear_ipi)){ r_irq_ipi := wdata(0) }
|
2014-01-14 06:43:56 +01:00
|
|
|
when (decoded_addr(CSRs.sup0)) { reg_sup0 := wdata }
|
|
|
|
when (decoded_addr(CSRs.sup1)) { reg_sup1 := wdata }
|
|
|
|
when (decoded_addr(CSRs.ptbr)) { reg_ptbr := Cat(wdata(PADDR_BITS-1, PGIDX_BITS), Bits(0, PGIDX_BITS)).toUInt }
|
2013-11-25 13:35:15 +01:00
|
|
|
when (decoded_addr(CSRs.stats)) { reg_stats := wdata(0) }
|
|
|
|
}
|
2012-02-12 02:20:33 +01:00
|
|
|
}
|
|
|
|
|
2012-08-04 04:00:34 +02:00
|
|
|
io.host.ipi_rep.ready := Bool(true)
|
|
|
|
when (io.host.ipi_rep.valid) { r_irq_ipi := Bool(true) }
|
|
|
|
|
2013-08-13 05:51:54 +02:00
|
|
|
when(this.reset) {
|
2013-08-24 06:16:28 +02:00
|
|
|
reg_status.ei := false
|
|
|
|
reg_status.pei := false
|
2012-11-27 10:28:06 +01:00
|
|
|
reg_status.ef := false
|
2013-09-13 07:34:38 +02:00
|
|
|
reg_status.er := false
|
2012-11-27 10:28:06 +01:00
|
|
|
reg_status.ps := false
|
|
|
|
reg_status.s := true
|
|
|
|
reg_status.u64 := true
|
|
|
|
reg_status.s64 := true
|
|
|
|
reg_status.vm := false
|
|
|
|
reg_status.zero := 0
|
|
|
|
reg_status.im := 0
|
2013-03-26 07:26:47 +01:00
|
|
|
reg_status.ip := 0
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-05 01:40:14 +01:00
|
|
|
class ioReadPort(d: Int, w: Int) extends Bundle
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2012-11-05 01:40:14 +01:00
|
|
|
override def clone = new ioReadPort(d, w).asInstanceOf[this.type]
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
2012-11-05 01:40:14 +01:00
|
|
|
class ioWritePort(d: Int, w: Int) extends Bundle
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
2013-08-12 19:39:11 +02:00
|
|
|
val addr = UInt(INPUT, log2Up(d))
|
2012-11-05 01:40:14 +01:00
|
|
|
val en = Bool(INPUT)
|
|
|
|
val data = Bits(INPUT, w)
|
|
|
|
override def clone = new ioWritePort(d, w).asInstanceOf[this.type]
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|