2011-10-26 08:02:47 +02:00
|
|
|
package Top {
|
|
|
|
|
2011-11-09 23:52:17 +01:00
|
|
|
import Chisel._;
|
2011-10-26 08:02:47 +02:00
|
|
|
import Node._;
|
|
|
|
import Constants._;
|
|
|
|
|
2011-11-10 06:54:11 +01:00
|
|
|
class ioDebug(view: List[String] = null) extends Bundle(view)
|
2011-10-26 08:02:47 +02:00
|
|
|
{
|
|
|
|
val error_mode = Bool('output);
|
|
|
|
val log_control = Bool('output);
|
2011-11-04 23:40:41 +01:00
|
|
|
val id_valid = Bool('output);
|
|
|
|
val ex_valid = Bool('output);
|
|
|
|
val mem_valid = Bool('output);
|
|
|
|
val wb_valid = Bool('output);
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class ioHost(view: List[String] = null) extends Bundle(view)
|
|
|
|
{
|
|
|
|
val start = Bool('input);
|
|
|
|
val from_wen = Bool('input);
|
|
|
|
val from = Bits(32, 'input);
|
|
|
|
val to = Bits(32, 'output);
|
|
|
|
}
|
|
|
|
|
|
|
|
class ioConsole(view: List[String] = null) extends Bundle(view)
|
|
|
|
{
|
|
|
|
val rdy = Bool('input);
|
|
|
|
val valid = Bool('output);
|
|
|
|
val bits = Bits(8, 'output);
|
|
|
|
}
|
|
|
|
|
|
|
|
class ioRocket extends Bundle()
|
|
|
|
{
|
|
|
|
val debug = new ioDebug();
|
|
|
|
val console = new ioConsole();
|
|
|
|
val host = new ioHost();
|
|
|
|
val imem = new ioImem().flip();
|
|
|
|
val dmem = new ioDmem().flip();
|
|
|
|
}
|
|
|
|
|
|
|
|
class rocketProc extends Component
|
|
|
|
{
|
|
|
|
val io = new ioRocket();
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2011-10-26 08:02:47 +02:00
|
|
|
val ctrl = new rocketCtrl();
|
2011-11-02 01:59:27 +01:00
|
|
|
val dpath = new rocketDpath();
|
2011-10-26 08:02:47 +02:00
|
|
|
|
2011-11-10 08:27:29 +01:00
|
|
|
val dtlb = new rocketDTLB(ITLB_ENTRIES);
|
2011-11-09 23:52:17 +01:00
|
|
|
val itlb = new rocketITLB(ITLB_ENTRIES);
|
|
|
|
val ptw = new rocketPTW();
|
|
|
|
val arb = new rocketDmemArbiter();
|
|
|
|
|
2011-11-02 01:59:27 +01:00
|
|
|
ctrl.io.dpath <> dpath.io.ctrl;
|
2011-11-09 23:52:17 +01:00
|
|
|
// ctrl.io.dmem ^^ io.dmem;
|
2011-11-02 01:59:27 +01:00
|
|
|
ctrl.io.host.start ^^ io.host.start;
|
2011-11-09 23:52:17 +01:00
|
|
|
// ctrl.io.imem ^^ io.imem;
|
2011-11-02 07:14:34 +01:00
|
|
|
|
2011-11-09 23:52:17 +01:00
|
|
|
// dpath.io.dmem ^^ io.dmem;
|
|
|
|
// dpath.io.imem.req_addr ^^ io.imem.req_addr;
|
2011-11-02 01:59:27 +01:00
|
|
|
dpath.io.imem.resp_data ^^ io.imem.resp_data;
|
2011-10-26 08:02:47 +02:00
|
|
|
dpath.io.host ^^ io.host;
|
|
|
|
dpath.io.debug ^^ io.debug;
|
2011-11-02 01:59:27 +01:00
|
|
|
|
2011-11-10 08:27:29 +01:00
|
|
|
// FIXME: make this less verbose
|
|
|
|
// connect ITLB to I$, ctrl, dpath
|
2011-11-09 23:52:17 +01:00
|
|
|
itlb.io.cpu.invalidate := Bool(false);
|
|
|
|
itlb.io.cpu.status := dpath.io.ctrl.status;
|
2011-11-10 08:27:29 +01:00
|
|
|
itlb.io.cpu.req_val := ctrl.io.imem.req_val;
|
2011-11-09 23:52:17 +01:00
|
|
|
itlb.io.cpu.req_asid := Bits(0,ASID_BITS); // FIXME: connect to PCR
|
2011-11-10 06:54:11 +01:00
|
|
|
itlb.io.cpu.req_addr := dpath.io.imem.req_addr;
|
2011-11-09 23:52:17 +01:00
|
|
|
io.imem.req_val := itlb.io.cpu.resp_val;
|
2011-11-10 06:54:11 +01:00
|
|
|
io.imem.req_addr := itlb.io.cpu.resp_addr;
|
2011-11-10 08:27:29 +01:00
|
|
|
ctrl.io.imem.req_rdy := itlb.io.cpu.req_rdy && io.imem.req_rdy;
|
2011-11-09 23:52:17 +01:00
|
|
|
ctrl.io.imem.resp_val := io.imem.resp_val;
|
2011-11-10 06:54:11 +01:00
|
|
|
ctrl.io.itlb_xcpt := itlb.io.cpu.exception;
|
2011-11-09 23:52:17 +01:00
|
|
|
|
2011-11-10 08:27:29 +01:00
|
|
|
// connect page table walker to TLBs, page table base register (from PCR)
|
|
|
|
// and D$ arbiter (selects between requests from pipeline and PTW, PTW has priority)
|
|
|
|
|
2011-11-09 23:52:17 +01:00
|
|
|
ptw.io.itlb <> itlb.io.ptw;
|
|
|
|
ptw.io.ptbr := dpath.io.ptbr;
|
|
|
|
arb.io.ptw <> ptw.io.dmem;
|
|
|
|
arb.io.mem ^^ io.dmem
|
|
|
|
|
2011-11-10 08:27:29 +01:00
|
|
|
// FIXME: make this less verbose
|
|
|
|
// connect arbiter to ctrl+dpath
|
2011-11-09 23:52:17 +01:00
|
|
|
arb.io.cpu.req_val := ctrl.io.dmem.req_val;
|
|
|
|
arb.io.cpu.req_cmd := ctrl.io.dmem.req_cmd;
|
|
|
|
arb.io.cpu.req_type := ctrl.io.dmem.req_type;
|
|
|
|
arb.io.cpu.req_addr := dpath.io.dmem.req_addr;
|
|
|
|
arb.io.cpu.req_data := dpath.io.dmem.req_data;
|
|
|
|
arb.io.cpu.req_tag := dpath.io.dmem.req_tag;
|
|
|
|
ctrl.io.dmem.req_rdy := arb.io.cpu.req_rdy;
|
|
|
|
ctrl.io.dmem.resp_miss := arb.io.cpu.resp_miss;
|
|
|
|
ctrl.io.dmem.resp_val := arb.io.cpu.resp_val;
|
|
|
|
dpath.io.dmem.resp_val := arb.io.cpu.resp_val;
|
|
|
|
dpath.io.dmem.resp_tag := arb.io.cpu.resp_tag;
|
|
|
|
dpath.io.dmem.resp_data := arb.io.cpu.resp_data;
|
|
|
|
|
2011-11-02 07:14:34 +01:00
|
|
|
// FIXME: console disconnected
|
2011-11-02 01:59:27 +01:00
|
|
|
// io.console.bits := dpath.io.dpath.rs1(7,0);
|
|
|
|
io.console.bits := Bits(0,8);
|
|
|
|
io.console.valid := ctrl.io.console.valid;
|
|
|
|
ctrl.io.console.rdy := io.console.rdy;
|
2011-10-26 08:02:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|