Skip to content

Commit

Permalink
Replace deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Emin017 committed Apr 7, 2024
1 parent dbcb06a commit 542030f
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 34 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/diplomacy/BundleBridge.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
package freechips.rocketchip.diplomacy

import chisel3._
import chisel3.experimental.{DataMirror, SourceInfo}
import chisel3.experimental.DataMirror.internal.chiselTypeClone
import chisel3.experimental.SourceInfo
import chisel3.reflect.DataMirror
import chisel3.reflect.DataMirror.internal.chiselTypeClone
import org.chipsalliance.cde.config.Parameters
import freechips.rocketchip.util.DataToAugmentedData

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/diplomacy/LazyModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
package freechips.rocketchip.diplomacy

import chisel3._
import chisel3.internal.sourceinfo.{SourceInfo, UnlocatableSourceInfo}
import chisel3.{Module, RawModule, Reset, withClockAndReset}
import chisel3.experimental.{ChiselAnnotation, CloneModuleAsRecord}
import chisel3.experimental.{ChiselAnnotation, CloneModuleAsRecord, SourceInfo, UnlocatableSourceInfo}
import firrtl.passes.InlineAnnotation
import org.chipsalliance.cde.config.Parameters

Expand Down
12 changes: 5 additions & 7 deletions src/main/scala/groundtest/TraceGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class TagMan(val logNumTags : Int) extends Module {
io.tagOut := nextTag

// Is the next tag available?
io.available := ~MuxLookup(nextTag, true.B, inUseMap)
io.available := ~MuxLookup(nextTag, true.B)(inUseMap)

// When user takes a tag
when (io.take) {
Expand Down Expand Up @@ -249,8 +249,7 @@ class TraceGenerator(val params: TraceGenParams)(implicit val p: Parameters) ext
val addrBagIndices = (0 to addressBagLen-1).
map(i => i.U(logAddressBagLen.W))

val randAddrFromBag = MuxLookup(randAddrBagIndex, 0.U,
addrBagIndices.zip(bagOfAddrs))
val randAddrFromBag = MuxLookup(randAddrBagIndex, 0.U)(addrBagIndices.zip(bagOfAddrs))

// Random address from the address bag or the extra addresses.

Expand All @@ -268,8 +267,8 @@ class TraceGenerator(val params: TraceGenParams)(implicit val p: Parameters) ext

// A random address from the extra addresses.
val randAddrFromExtra = Cat(0.U,
MuxLookup(randExtraAddrIndex, 0.U,
extraAddrIndices.zip(extraAddrs)), 0.U(3.W))
MuxLookup(randExtraAddrIndex, 0.U)
(extraAddrIndices.zip(extraAddrs)), 0.U(3.W))

Frequency(List(
(1, randAddrFromBag),
Expand All @@ -279,8 +278,7 @@ class TraceGenerator(val params: TraceGenParams)(implicit val p: Parameters) ext
val allAddrs = extraAddrs ++ bagOfAddrs
val allAddrIndices = (0 until totalNumAddrs)
.map(i => i.U(log2Ceil(totalNumAddrs).W))
val initAddr = MuxLookup(initCount, 0.U,
allAddrIndices.zip(allAddrs))
val initAddr = MuxLookup(initCount, 0.U)(allAddrIndices.zip(allAddrs))

// Random opcodes
// --------------
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/jtag/JtagShifter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package freechips.rocketchip.jtag

import chisel3._
import chisel3.experimental.DataMirror
import chisel3.reflect.DataMirror
import chisel3.internal.firrtl.KnownWidth
import chisel3.util.{Cat, Valid}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rocket/BTB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package freechips.rocketchip.rocket

import chisel3._
import chisel3.util._
import chisel3.internal.InstanceId
import chisel3.InstanceId
import org.chipsalliance.cde.config.Parameters
import freechips.rocketchip.subsystem.CacheBlockBytes
import freechips.rocketchip.tile.HasCoreParameters
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rocket/DCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ class DCacheModule(outer: DCache) extends HellaCacheModule(outer) {
val put = edge.Put(a_source, access_address, a_size, a_data)._2
val putpartial = edge.Put(a_source, access_address, a_size, a_data, a_mask)._2
val atomics = if (edge.manager.anySupportLogical) {
MuxLookup(s2_req.cmd, WireDefault(0.U.asTypeOf(new TLBundleA(edge.bundle))), Array(
MuxLookup(s2_req.cmd, WireDefault(0.U.asTypeOf(new TLBundleA(edge.bundle))))(Array(
M_XA_SWAP -> edge.Logical(a_source, access_address, a_size, a_data, TLAtomics.SWAP)._2,
M_XA_XOR -> edge.Logical(a_source, access_address, a_size, a_data, TLAtomics.XOR) ._2,
M_XA_OR -> edge.Logical(a_source, access_address, a_size, a_data, TLAtomics.OR) ._2,
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rocket/NBDcache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class IOMSHR(id: Int)(implicit edge: TLEdgeOut, p: Parameters) extends L1HellaCa
val get = edge.Get(a_source, a_address, a_size)._2
val put = edge.Put(a_source, a_address, a_size, a_data)._2
val atomics = if (edge.manager.anySupportLogical) {
MuxLookup(req.cmd, (0.U).asTypeOf(new TLBundleA(edge.bundle)), Array(
MuxLookup(req.cmd, (0.U).asTypeOf(new TLBundleA(edge.bundle)))(Array(
M_XA_SWAP -> edge.Logical(a_source, a_address, a_size, a_data, TLAtomics.SWAP)._2,
M_XA_XOR -> edge.Logical(a_source, a_address, a_size, a_data, TLAtomics.XOR) ._2,
M_XA_OR -> edge.Logical(a_source, a_address, a_size, a_data, TLAtomics.OR) ._2,
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/rocket/RocketCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ class Rocket(tile: RocketTile)(implicit p: Parameters) extends CoreModule()(p)
val ex_rs = for (i <- 0 until id_raddr.size)
yield Mux(ex_reg_rs_bypass(i), bypass_mux(ex_reg_rs_lsb(i)), Cat(ex_reg_rs_msb(i), ex_reg_rs_lsb(i)))
val ex_imm = ImmGen(ex_ctrl.sel_imm, ex_reg_inst)
val ex_op1 = MuxLookup(ex_ctrl.sel_alu1, 0.S, Seq(
val ex_op1 = MuxLookup(ex_ctrl.sel_alu1, 0.S)(Seq(
A1_RS1 -> ex_rs(0).asSInt,
A1_PC -> ex_reg_pc.asSInt))
val ex_op2 = MuxLookup(ex_ctrl.sel_alu2, 0.S, Seq(
val ex_op2 = MuxLookup(ex_ctrl.sel_alu2, 0.S)(Seq(
A2_RS2 -> ex_rs(1).asSInt,
A2_IMM -> ex_imm,
A2_SIZE -> Mux(ex_reg_rvc, 2.S, 4.S)))
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/rocket/ScratchpadSlavePort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ class ScratchpadSlavePort(address: Seq[AddressSet], coreDataBytes: Int, usingAto

def formCacheReq(a: TLBundleA) = {
val req = Wire(new HellaCacheReq)
req.cmd := MuxLookup(a.opcode, M_XRD, Array(
req.cmd := MuxLookup(a.opcode, M_XRD)(Array(
TLMessages.PutFullData -> M_XWR,
TLMessages.PutPartialData -> M_PWR,
TLMessages.ArithmeticData -> MuxLookup(a.param, M_XRD, Array(
TLMessages.ArithmeticData -> MuxLookup(a.param, M_XRD)(Array(
TLAtomics.MIN -> M_XA_MIN,
TLAtomics.MAX -> M_XA_MAX,
TLAtomics.MINU -> M_XA_MINU,
TLAtomics.MAXU -> M_XA_MAXU,
TLAtomics.ADD -> M_XA_ADD)),
TLMessages.LogicalData -> MuxLookup(a.param, M_XRD, Array(
TLMessages.LogicalData -> MuxLookup(a.param, M_XRD)(Array(
TLAtomics.XOR -> M_XA_XOR,
TLAtomics.OR -> M_XA_OR,
TLAtomics.AND -> M_XA_AND,
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tilelink/AtomicAutomata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class TLAtomicAutomata(logical: Boolean = true, arithmetic: Boolean = true, conc
when (en) {
r.fifoId := a_fifoId
r.bits := in.a.bits
r.lut := MuxLookup(in.a.bits.param(1, 0), 0.U(4.W), Array(
r.lut := MuxLookup(in.a.bits.param(1, 0), 0.U(4.W))(Array(
TLAtomics.AND -> 0x8.U,
TLAtomics.OR -> 0xe.U,
TLAtomics.XOR -> 0x6.U,
Expand Down
7 changes: 3 additions & 4 deletions src/main/scala/tilelink/Edges.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package freechips.rocketchip.tilelink

import chisel3._
import chisel3.util._
import chisel3.internal.sourceinfo.SourceInfo
import chisel3.experimental.SourceInfo
import org.chipsalliance.cde.config.Parameters
import freechips.rocketchip.util._
Expand Down Expand Up @@ -274,17 +273,17 @@ class TLEdge(

// Does the request need T permissions to be executed?
def needT(a: TLBundleA): Bool = {
val acq_needT = MuxLookup(a.param, WireDefault(Bool(), DontCare), Array(
val acq_needT = MuxLookup(a.param, WireDefault(Bool(), DontCare))(Array(
TLPermissions.NtoB -> false.B,
TLPermissions.NtoT -> true.B,
TLPermissions.BtoT -> true.B))
MuxLookup(a.opcode, WireDefault(Bool(), DontCare), Array(
MuxLookup(a.opcode, WireDefault(Bool(), DontCare))(Array(
TLMessages.PutFullData -> true.B,
TLMessages.PutPartialData -> true.B,
TLMessages.ArithmeticData -> true.B,
TLMessages.LogicalData -> true.B,
TLMessages.Get -> false.B,
TLMessages.Hint -> MuxLookup(a.param, WireDefault(Bool(), DontCare), Array(
TLMessages.Hint -> MuxLookup(a.param, WireDefault(Bool(), DontCare))(Array(
TLHints.PREFETCH_READ -> false.B,
TLHints.PREFETCH_WRITE -> true.B)),
TLMessages.AcquireBlock -> acq_needT,
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/tilelink/Fragmenter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class TLFragmenter(val minSize: Int, val maxSize: Int, val alwaysMin: Boolean =
val maxLgHint = Mux1H(find, maxLgHints)

val limit = if (alwaysMin) lgMinSize else
MuxLookup(in_a.bits.opcode, lgMinSize, Array(
MuxLookup(in_a.bits.opcode, lgMinSize)(Array(
TLMessages.PutFullData -> maxLgPutFull,
TLMessages.PutPartialData -> maxLgPutPartial,
TLMessages.ArithmeticData -> maxLgArithmetic,
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/tilelink/Fuzzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ class TLFuzzer(
// Pick a specific message to try to send
val a_type_sel = noiseMaker(3, inc, 0)

val legal = legal_dest && MuxLookup(a_type_sel, glegal, Seq(
val legal = legal_dest && MuxLookup(a_type_sel, glegal)(Seq(
"b000".U -> glegal,
"b001".U -> (pflegal && !noModify.B),
"b010".U -> (pplegal && !noModify.B),
"b011".U -> (alegal && !noModify.B),
"b100".U -> (llegal && !noModify.B),
"b101".U -> hlegal))

val bits = MuxLookup(a_type_sel, gbits, Seq(
val bits = MuxLookup(a_type_sel, gbits)(Seq(
"b000".U -> gbits,
"b001".U -> pfbits,
"b010".U -> ppbits,
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/tilelink/Metadata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ClientMetadata extends Bundle {
import ClientStates._
val c = categorize(cmd)
//assert(c === rd || param === toT, "Client was expecting trunk permissions.")
MuxLookup(Cat(c, param), Nothing, Seq(
MuxLookup(Cat(c, param), Nothing)(Seq(
//(effect param) -> (next)
Cat(rd, toB) -> Branch,
Cat(rd, toT) -> Trunk,
Expand Down Expand Up @@ -137,7 +137,7 @@ class ClientMetadata extends Bundle {
private def cmdToPermCap(cmd: UInt): UInt = {
import MemoryOpCategories._
import TLPermissions._
MuxLookup(cmd, toN, Seq(
MuxLookup(cmd, toN)(Seq(
M_FLUSH -> toN,
M_PRODUCE -> toB,
M_CLEAN -> toT))
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/util/RecordMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ package freechips.rocketchip.util

import chisel3._
import scala.collection.immutable.ListMap
import chisel3.internal.requireIsChiselType
import chisel3.experimental.DataMirror.internal.chiselTypeClone
import chisel3.experimental.requireIsChiselType
import chisel3.reflect.DataMirror.internal.chiselTypeClone

final class RecordMap[T <: Data] (eltMap: ListMap[String, T])
extends Record {

eltMap.foreach { case (name, elt) => requireIsChiselType(elt, name) }

// This is needed for Record
val elements = ListMap[String, T]() ++ eltMap.mapValues(chiselTypeClone(_).asInstanceOf[T]) // mapValues return value is lazy
val elements = ListMap[String, T]() ++ eltMap.view.mapValues(chiselTypeClone(_).asInstanceOf[T]) // mapValues return value is lazy

def apply(x: Int) = elements.values.toSeq(x)
def apply(x: String) = elements.get(x)
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/util/TraceCoreInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package freechips.rocketchip.util

import chisel3._
import chisel3.experimental.ChiselEnum

// Definitions for Trace core Interface defined in RISC-V Processor Trace Specification V1.0
object TraceItype extends ChiselEnum {
Expand Down

0 comments on commit 542030f

Please sign in to comment.