Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev with master #3712

Merged
merged 31 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cff28b8
Merge pull request #3675 from chipsalliance/dev
jerryz123 Aug 21, 2024
445b5da
Adding support for Litex
leviathanch Aug 19, 2024
50744b3
Merge pull request #3674 from libresilicon/litex2
jerryz123 Aug 22, 2024
d0c6b50
VM disabled: support larger physical addresses (#3682)
ingallsj Sep 1, 2024
e66d617
Add RocketChip Technical Charter
bensternthal Sep 9, 2024
1b9f433
Merge pull request #3683 from chipsalliance/bensternthal-patch-1
sequencer Sep 17, 2024
2c260e2
Fix clock gating bug inside RocketCore when the RoCC is busy
moniriki Nov 11, 2024
2fe6bb5
Merge pull request #3696 from moniriki/moniriki/rocket_cg_rocc_bug_fi…
jerryz123 Nov 11, 2024
c1e2bd4
fix BitPat for Vector Mask-Register Logical Instructions
NewPaulWalker Dec 11, 2024
6b90dc2
fix `hartReset` in DM
wissygh Jan 6, 2025
7ae0c21
ADD: core insn trace ingress generation
iansseijelly Jan 15, 2025
4147a0f
ADD: tacit trace encoder, controller, and sink
iansseijelly Jan 15, 2025
754bf4c
ADD: trace tile instantiation and connection
iansseijelly Jan 15, 2025
c25af3e
ADD: address all PR comments
iansseijelly Jan 16, 2025
7667eae
ADD: Print BlackBox
iansseijelly Jan 16, 2025
b814ad1
REFACTOR: use canhave + traits for sinks for scalability
iansseijelly Jan 20, 2025
8d29be4
ADD: bump TraceSinkDMA to inject node from trait instead of in tiles
iansseijelly Jan 20, 2025
84cbd51
ADD: tail case bug fix
iansseijelly Jan 21, 2025
ab79600
REFACTOR: reorganize code structure
iansseijelly Jan 23, 2025
7acebde
ADD: remove prints, cleanup code
iansseijelly Jan 23, 2025
24cf6fa
ADD: refactor
iansseijelly Jan 24, 2025
f294695
FIX: VCS->NOT SYN
iansseijelly Jan 24, 2025
061c12a
Merge pull request #3705 from OpenXiangShan/fix-dm-hartReset
jerryz123 Jan 27, 2025
32fcff6
Merge pull request #3702 from OpenXiangShan/fix-vm_mm
jerryz123 Jan 27, 2025
96f9850
RM: non-standard components
iansseijelly Jan 28, 2025
8db9f45
FIX: make arbiter not lazy
iansseijelly Jan 28, 2025
d2bddb8
FIX: move arbiter into inner scope
iansseijelly Jan 29, 2025
0b37602
Merge pull request #3706 from iansseijelly/tacit-pr
jerryz123 Jan 29, 2025
0dd7e79
Fix DMCONTROLNxt naming
jerryz123 Jan 29, 2025
b4f0b3b
Merge pull request #3711 from chipsalliance/dmctrl_naming
jerryz123 Jan 29, 2025
f517abb
Merge pull request #3710 from chipsalliance/dev
jerryz123 Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added RocketChip_Technical_Charter_8-23-2024.pdf
Binary file not shown.
64 changes: 63 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,35 @@ trait Emulator extends Cross.Module2[String, String] {
}
}

object litexgenerate extends Module {
def compile = T {
os.proc("firtool",
generator.chirrtl().path,
s"--annotation-file=${generator.chiselAnno().path}",
"--disable-annotation-unknown",
"-dedup",
"-O=debug",
"--split-verilog",
"--preserve-values=named",
"--output-annotation-file=mfc.anno.json",
"--lowering-options=disallowLocalVariables",
s"-o=${T.dest}"
).call(T.dest)
PathRef(T.dest)
}

def rtls = T {
os.read(compile().path / "filelist.f").split("\n").map(str =>
try {
os.Path(str)
} catch {
case e: IllegalArgumentException if e.getMessage.contains("is not an absolute path") =>
compile().path / str.stripPrefix("./")
}
).filter(p => p.ext == "v" || p.ext == "sv").map(PathRef(_)).toSeq
}
}

object mfccompiler extends Module {
def compile = T {
os.proc("firtool",
Expand Down Expand Up @@ -233,7 +262,7 @@ trait Emulator extends Cross.Module2[String, String] {
"debug_rob.cc",
"emulator.cc",
"remote_bitbang.cc",
).map(c => PathRef(csrcDir().path / c))
).map(c => PathRef(csrcDir().path / c))
}

def CMakeListsString = T {
Expand Down Expand Up @@ -347,6 +376,39 @@ object emulator extends Cross[Emulator](
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultBConfig"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultRV32BConfig"),

// Litex
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall1x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall1x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall1x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall1x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall2x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall2x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall2x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall2x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall4x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall4x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall4x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall4x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall8x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall8x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall8x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigSmall8x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig1x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig1x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig1x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig1x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig2x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig2x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig2x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig2x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig4x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig4x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig4x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig4x8"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig8x1"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig8x2"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig8x4"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.LitexConfigBig8x8"),
)

object `runnable-riscv-test` extends mill.Cross[RiscvTest](
Expand Down
36 changes: 36 additions & 0 deletions src/main/resources/vsrc/TraceSinkMonitor.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module TraceSinkMonitor
#(
parameter FILE_NAME = "trace_sink_monitor.txt"
)
(
input clk,
input reset,
input in_fire,
input[7:0] in_byte
);

`ifndef SYNTHESIS

integer file;

initial begin
file = $fopen(FILE_NAME, "w");
if (file == 0) begin
$display("Failed to open %s", FILE_NAME);
$finish;
end
end

always @(posedge clk) begin
if (in_fire & ~reset) begin
$fwrite(file, "%c", in_byte);
end
end

final begin
$fclose(file);
end

`endif

endmodule
2 changes: 1 addition & 1 deletion src/main/scala/devices/debug/Debug.scala
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ class TLDebugModuleOuter(device: Device)(implicit p: Parameters) extends LazyMod
val hartResetReg = RegNext(next=hartResetNxt, init=0.U.asTypeOf(hartResetNxt))

for (component <- 0 until nComponents) {
hartResetNxt(component) := DMCONTROLReg.hartreset & hartSelected(component)
hartResetNxt(component) := DMCONTROLNxt.hartreset & hartSelected(component)
io.hartResetReq.get(component) := hartResetReg(component)
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/rocket/ALU.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ abstract class AbstractALU(implicit p: Parameters) extends CoreModule()(p) {
}

class ALU(implicit p: Parameters) extends AbstractALU()(p) {
override def desiredName = "RocketALU"

// ADD, SUB
val in2_inv = Mux(isSub(io.fn), ~io.in2, io.in2)
val in1_xor_in2 = io.in1 ^ in2_inv
Expand Down
Empty file.
5 changes: 3 additions & 2 deletions src/main/scala/rocket/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class PTBR(implicit p: Parameters) extends CoreBundle()(p) {
case 32 => (1, 9)
case 64 => (4, 16)
}
require(modeBits + maxASIdBits + maxPAddrBits - pgIdxBits == xLen)
require(!usingVM || modeBits + maxASIdBits + maxPAddrBits - pgIdxBits == xLen)

val mode = UInt(modeBits.W)
val asid = UInt(maxASIdBits.W)
Expand Down Expand Up @@ -272,8 +272,8 @@ class CSRFileIO(hasBeu: Boolean)(implicit p: Parameters) extends CoreBundle
val csr_stall = Output(Bool()) // stall retire for wfi
val rw_stall = Output(Bool()) // stall rw, rw will have no effect while rw_stall
val eret = Output(Bool())
val trap_return = Output(Bool())
val singleStep = Output(Bool())

val status = Output(new MStatus())
val hstatus = Output(new HStatus())
val gstatus = Output(new MStatus())
Expand Down Expand Up @@ -998,6 +998,7 @@ class CSRFile(
io.hgatp := reg_hgatp
io.vsatp := reg_vsatp
io.eret := insn_call || insn_break || insn_ret
io.trap_return := insn_ret
io.singleStep := reg_dcsr.step && !reg_debug
io.status := reg_mstatus
io.status.sd := io.status.fs.andR || io.status.xs.andR || io.status.vs.andR
Expand Down
Empty file.
16 changes: 8 additions & 8 deletions src/main/scala/rocket/Instructions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ object Instructions {
def VMADC_VXM = BitPat("b0100010??????????100?????1010111")
def VMADD_VV = BitPat("b101001???????????010?????1010111")
def VMADD_VX = BitPat("b101001???????????110?????1010111")
def VMAND_MM = BitPat("b011001???????????010?????1010111")
def VMANDN_MM = BitPat("b011000???????????010?????1010111")
def VMAND_MM = BitPat("b0110011??????????010?????1010111")
def VMANDN_MM = BitPat("b0110001??????????010?????1010111")
def VMAX_VV = BitPat("b000111???????????000?????1010111")
def VMAX_VX = BitPat("b000111???????????100?????1010111")
def VMAXU_VV = BitPat("b000110???????????000?????1010111")
Expand All @@ -605,10 +605,10 @@ object Instructions {
def VMIN_VX = BitPat("b000101???????????100?????1010111")
def VMINU_VV = BitPat("b000100???????????000?????1010111")
def VMINU_VX = BitPat("b000100???????????100?????1010111")
def VMNAND_MM = BitPat("b011101???????????010?????1010111")
def VMNOR_MM = BitPat("b011110???????????010?????1010111")
def VMOR_MM = BitPat("b011010???????????010?????1010111")
def VMORN_MM = BitPat("b011100???????????010?????1010111")
def VMNAND_MM = BitPat("b0111011??????????010?????1010111")
def VMNOR_MM = BitPat("b0111101??????????010?????1010111")
def VMOR_MM = BitPat("b0110101??????????010?????1010111")
def VMORN_MM = BitPat("b0111001??????????010?????1010111")
def VMSBC_VV = BitPat("b0100111??????????000?????1010111")
def VMSBC_VVM = BitPat("b0100110??????????000?????1010111")
def VMSBC_VX = BitPat("b0100111??????????100?????1010111")
Expand Down Expand Up @@ -653,8 +653,8 @@ object Instructions {
def VMV_V_V = BitPat("b010111100000?????000?????1010111")
def VMV_V_X = BitPat("b010111100000?????100?????1010111")
def VMV_X_S = BitPat("b0100001?????00000010?????1010111")
def VMXNOR_MM = BitPat("b011111???????????010?????1010111")
def VMXOR_MM = BitPat("b011011???????????010?????1010111")
def VMXNOR_MM = BitPat("b0111111??????????010?????1010111")
def VMXOR_MM = BitPat("b0110111??????????010?????1010111")
def VNCLIP_WI = BitPat("b101111???????????011?????1010111")
def VNCLIP_WV = BitPat("b101111???????????000?????1010111")
def VNCLIP_WX = BitPat("b101111???????????100?????1010111")
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rocket/PTW.scala
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class PTW(n: Int)(implicit edge: TLEdgeOut, p: Parameters) extends CoreModule()(
val (pte, invalid_paddr, invalid_gpa) = {
val tmp = mem_resp_data.asTypeOf(new PTE())
val res = WireDefault(tmp)
res.ppn := Mux(do_both_stages && !stage2, tmp.ppn(vpnBits.min(tmp.ppn.getWidth)-1, 0), tmp.ppn(ppnBits-1, 0))
res.ppn := Mux(do_both_stages && !stage2, tmp.ppn(vpnBits.min(tmp.ppn.getWidth)-1, 0), tmp.ppn(ppnBits.min(tmp.ppn.getWidth)-1, 0))
when (tmp.r || tmp.w || tmp.x) {
// for superpage mappings, make sure PPN LSBs are zero
for (i <- 0 until pgLevels-1)
Expand Down
31 changes: 30 additions & 1 deletion src/main/scala/rocket/RocketCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import freechips.rocketchip.tile._
import freechips.rocketchip.util._
import freechips.rocketchip.util.property
import scala.collection.mutable.ArrayBuffer
import freechips.rocketchip.trace._

case class RocketCoreParams(
xLen: Int = 64,
Expand Down Expand Up @@ -56,7 +57,8 @@ case class RocketCoreParams(
debugROB: Option[DebugROBParams] = None, // if size < 1, SW ROB, else HW ROB
haveCease: Boolean = true, // non-standard CEASE instruction
haveSimTimeout: Boolean = true, // add plusarg for simulation timeout
vector: Option[RocketCoreVectorParams] = None
vector: Option[RocketCoreVectorParams] = None,
enableTraceCoreIngress: Boolean = false
) extends CoreParams {
val lgPauseCycles = 5
val haveFSDirty = false
Expand Down Expand Up @@ -131,6 +133,8 @@ class CoreInterrupts(val hasBeu: Boolean)(implicit p: Parameters) extends TileIn
trait HasRocketCoreIO extends HasRocketCoreParameters {
implicit val p: Parameters
def nTotalRoCCCSRs: Int
def traceIngressParams = TraceCoreParams(nGroups = 1, iretireWidth = coreParams.retireWidth,
xlen = coreParams.xLen, iaddrWidth = coreParams.xLen)
val io = IO(new CoreBundle()(p) {
val hartid = Input(UInt(hartIdLen.W))
val reset_vector = Input(UInt(resetVectorLen.W))
Expand All @@ -146,6 +150,7 @@ trait HasRocketCoreIO extends HasRocketCoreParameters {
val wfi = Output(Bool())
val traceStall = Input(Bool())
val vector = if (usingVector) Some(Flipped(new VectorCoreIO)) else None
val trace_core_ingress = if (rocketParams.enableTraceCoreIngress) Some(Output(new TraceCoreInterface(traceIngressParams))) else None
})
}

Expand Down Expand Up @@ -301,6 +306,7 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
val wb_reg_raw_inst = Reg(UInt())
val wb_reg_wdata = Reg(Bits())
val wb_reg_rs2 = Reg(Bits())
val wb_reg_br_taken = Reg(Bool())
val take_pc_wb = Wire(Bool())
val wb_reg_wphit = Reg(Vec(nBreakpoints, Bool()))

Expand Down Expand Up @@ -723,6 +729,7 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
wb_reg_hfence_v := mem_ctrl.mem_cmd === M_HFENCEV
wb_reg_hfence_g := mem_ctrl.mem_cmd === M_HFENCEG
wb_reg_pc := mem_reg_pc
wb_reg_br_taken := mem_br_taken
wb_reg_wphit := mem_reg_wphit | bpu.io.bpwatch.map { bpw => (bpw.rvalid(0) && mem_reg_load) || (bpw.wvalid(0) && mem_reg_store) }
wb_reg_set_vconfig := mem_reg_set_vconfig
}
Expand Down Expand Up @@ -825,6 +832,27 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
wb_reg_wdata))))
when (rf_wen) { rf.write(rf_waddr, rf_wdata) }

if (rocketParams.enableTraceCoreIngress) {
val trace_ingress = Module(new TraceCoreIngress(traceIngressParams))
trace_ingress.io.in.valid := wb_valid || wb_xcpt
trace_ingress.io.in.taken := wb_reg_br_taken
trace_ingress.io.in.is_branch := wb_ctrl.branch
trace_ingress.io.in.is_jal := wb_ctrl.jal
trace_ingress.io.in.is_jalr := wb_ctrl.jalr
trace_ingress.io.in.insn := wb_reg_inst
trace_ingress.io.in.pc := wb_reg_pc
trace_ingress.io.in.is_compressed := !wb_reg_raw_inst(1, 0).andR // 2'b11 is uncompressed, everything else is compressed
trace_ingress.io.in.interrupt := csr.io.trace(0).interrupt && csr.io.trace(0).exception
trace_ingress.io.in.exception := !csr.io.trace(0).interrupt && csr.io.trace(0).exception
trace_ingress.io.in.trap_return := csr.io.trap_return

io.trace_core_ingress.get.group(0) <> trace_ingress.io.out
io.trace_core_ingress.get.priv := csr.io.trace(0).priv
io.trace_core_ingress.get.tval := csr.io.tval
io.trace_core_ingress.get.cause := csr.io.cause
io.trace_core_ingress.get.time := csr.io.time
}

// hook up control/status regfile
csr.io.ungated_clock := clock
csr.io.decode(0).inst := id_inst(0)
Expand Down Expand Up @@ -1176,6 +1204,7 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
!div.io.req.ready || // mul/div in flight
usingFPU.B && !io.fpu.fcsr_rdy || // long-latency FPU in flight
io.dmem.replay_next || // long-latency load replaying
id_rocc_busy || // RoCC command in flight
(!long_latency_stall && (ibuf.io.inst(0).valid || io.imem.resp.valid)) // instruction pending

assert(!(ex_pc_valid || mem_pc_valid || wb_pc_valid) || clock_en)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rocket/TLB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class TLB(instruction: Boolean, lgMaxSize: Int, cfg: TLBConfig)(implicit edge: T
val vsatp_mode_mismatch = priv_v && (vstage1_en =/= v_entries_use_stage1) && !io.req.bits.passthrough

// share a single physical memory attribute checker (unshare if critical path)
val refill_ppn = io.ptw.resp.bits.pte.ppn(ppnBits-1, 0)
val refill_ppn = if (usingVM) io.ptw.resp.bits.pte.ppn(ppnBits-1, 0) else 0.U
/** refill signal */
val do_refill = usingVM.B && io.ptw.resp.valid
/** sfence invalidate refill */
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/subsystem/Cluster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import freechips.rocketchip.interrupts.{IntIdentityNode, IntSyncIdentityNode, Nu
import freechips.rocketchip.prci.{ClockCrossingType, NoCrossing, ClockSinkParameters, ClockGroupIdentityNode, BundleBridgeBlockDuringReset}
import freechips.rocketchip.tile.{RocketTile, NMI, TraceBundle}
import freechips.rocketchip.tilelink.TLWidthWidget
import freechips.rocketchip.util.TraceCoreInterface
import freechips.rocketchip.trace.TraceCoreInterface

import scala.collection.immutable.SortedMap

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/subsystem/HasHierarchicalElements.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import freechips.rocketchip.tile.{TileParams, TilePRCIDomain, BaseTile, NMI, Tra
import freechips.rocketchip.tilelink.{TLNode, TLBuffer, TLCacheCork, TLTempNode, TLFragmenter}
import freechips.rocketchip.prci.{ClockCrossingType, ClockGroup, ResetCrossingType, ClockGroupNode, ClockDomain}
import freechips.rocketchip.rocket.TracedInstruction
import freechips.rocketchip.util.TraceCoreInterface
import freechips.rocketchip.trace.TraceCoreInterface

import scala.collection.immutable.SortedMap

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/subsystem/HasTiles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import freechips.rocketchip.tile.{MaxHartIdBits, BaseTile, InstantiableTileParam
import freechips.rocketchip.tilelink.TLWidthWidget
import freechips.rocketchip.prci.{ClockGroup, BundleBridgeBlockDuringReset, NoCrossing, SynchronousCrossing, CreditedCrossing, RationalCrossing, AsynchronousCrossing}
import freechips.rocketchip.rocket.TracedInstruction
import freechips.rocketchip.util.TraceCoreInterface
import freechips.rocketchip.trace.TraceCoreInterface

import scala.collection.immutable.SortedMap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import freechips.rocketchip.interrupts.{IntInwardNode, IntOutwardNode}
import freechips.rocketchip.prci.{ClockCrossingType, ResetCrossingType, ResetDomain, ClockSinkNode, ClockSinkParameters, ClockIdentityNode, FixedClockBroadcast, ClockDomain}
import freechips.rocketchip.tile.{RocketTile, TraceBundle}
import freechips.rocketchip.tilelink.{TLInwardNode, TLOutwardNode}
import freechips.rocketchip.util.TraceCoreInterface
import freechips.rocketchip.trace.TraceCoreInterface

import freechips.rocketchip.tilelink.TLClockDomainCrossing
import freechips.rocketchip.tilelink.TLResetDomainCrossing
Expand Down
53 changes: 53 additions & 0 deletions src/main/scala/subsystem/Litex.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// See LICENSE.SiFive for license details.
// See LICENSE.Berkeley for license details.

package freechips.rocketchip.subsystem

import chisel3.util._

import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.devices.debug.{DebugModuleKey, DefaultDebugModuleParams, ExportDebug, JTAG, APB}
import freechips.rocketchip.devices.tilelink.{
BuiltInErrorDeviceParams, BootROMLocated, BootROMParams, CLINTKey, DevNullDevice, CLINTParams, PLICKey, PLICParams, DevNullParams
}
import freechips.rocketchip.prci.{SynchronousCrossing, AsynchronousCrossing, RationalCrossing, ClockCrossingType}
import freechips.rocketchip.diplomacy.{
AddressSet, MonitorsEnabled,
}
import freechips.rocketchip.resources.{
DTSModel, DTSCompat, DTSTimebase, BigIntHexContext
}
import freechips.rocketchip.tile.{
MaxHartIdBits, RocketTileParams, BuildRoCC, AccumulatorExample, OpcodeSet, TranslatorExample, CharacterCountExample, BlackBoxExample
}
import freechips.rocketchip.util.ClockGateModelFile
import scala.reflect.ClassTag

class WithLitexMemPort extends Config((site, here, up) => {
case ExtMem => Some(MemoryPortParams(MasterPortParams(
base = x"8000_0000",
size = x"8000_0000",
beatBytes = site(MemoryBusKey).beatBytes,
idBits = 4), 1))
})

class WithLitexMMIOPort extends Config((site, here, up) => {
case ExtBus => Some(MasterPortParams(
base = x"1000_0000",
size = x"7000_0000",
beatBytes = site(SystemBusKey).beatBytes,
idBits = 4))
})

class WithLitexSlavePort extends Config((site, here, up) => {
case ExtIn => Some(SlavePortParams(
beatBytes = site(SystemBusKey).beatBytes,
idBits = 8,
sourceBits = 4))
})

class WithNBitMemoryBus(dataBits: Int) extends Config((site, here, up) => {
case MemoryBusKey => up(MemoryBusKey, site).copy(beatBytes = dataBits/8)
})
Loading
Loading