Skip to content

Commit

Permalink
Move dts/resources to new resources subpackage
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Jun 6, 2024
1 parent aea0064 commit a73b797
Show file tree
Hide file tree
Showing 51 changed files with 144 additions and 102 deletions.
3 changes: 2 additions & 1 deletion src/main/scala/amba/ahb/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.chipsalliance.cde.config.Parameters

import org.chipsalliance.diplomacy.nodes.BaseNode

import freechips.rocketchip.diplomacy.{AddressSet, Resource, RegionType, TransferSizes, Device, ResourceAddress, ResourcePermissions}
import freechips.rocketchip.resources.{Resource, Device, ResourceAddress, ResourcePermissions}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes}
import freechips.rocketchip.util.{BundleField, BundleFieldBase, BundleKeyBase}

import scala.math.{max, min}
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/amba/ahb/SRAM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import chisel3.util._
import org.chipsalliance.cde.config.Parameters
import org.chipsalliance.diplomacy.lazymodule.{LazyModule, LazyModuleImp}

import freechips.rocketchip.diplomacy.{AddressSet, DiplomaticSRAM, HasJustOneSeqMem, RegionType, TransferSizes}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes}
import freechips.rocketchip.resources.{DiplomaticSRAM, HasJustOneSeqMem}
import freechips.rocketchip.tilelink.LFSRNoiseMaker
import freechips.rocketchip.util.{MaskGen, DataToAugmentedData, SeqMemToAugmentedSeqMem, PlusArg}

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/amba/apb/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import org.chipsalliance.cde.config.Parameters

import org.chipsalliance.diplomacy.nodes.BaseNode

import freechips.rocketchip.diplomacy.{AddressSet, Resource, Device, RegionType, ResourceAddress, ResourcePermissions}

import freechips.rocketchip.diplomacy.{AddressSet, RegionType}
import freechips.rocketchip.resources.{Resource, Device, ResourceAddress, ResourcePermissions}
import freechips.rocketchip.util.{BundleField, BundleKeyBase, BundleFieldBase}

import scala.math.max
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/amba/apb/SRAM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.chipsalliance.cde.config.Parameters

import org.chipsalliance.diplomacy.lazymodule.{LazyModule, LazyModuleImp}

import freechips.rocketchip.diplomacy.{AddressSet, DiplomaticSRAM, HasJustOneSeqMem, RegionType}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType}
import freechips.rocketchip.resources.{DiplomaticSRAM, HasJustOneSeqMem}
import freechips.rocketchip.tilelink.LFSRNoiseMaker
import freechips.rocketchip.util.SeqMemToAugmentedSeqMem

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/amba/axi4/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.chipsalliance.cde.config.Parameters

import org.chipsalliance.diplomacy.nodes.BaseNode

import freechips.rocketchip.diplomacy.{AddressSet, Resource, RegionType, TransferSizes, Device, ResourceAddress, ResourcePermissions, IdRange, BufferParams, IdMap, IdMapEntry, DirectedBuffers}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes, IdRange, BufferParams, IdMap, IdMapEntry, DirectedBuffers}
import freechips.rocketchip.resources.{Resource, Device, ResourceAddress, ResourcePermissions}
import freechips.rocketchip.util.{BundleField, BundleFieldBase, BundleKeyBase, AsyncQueueParams, CreditedDelay}

import scala.math.max
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/amba/axi4/SRAM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import org.chipsalliance.cde.config.Parameters
import org.chipsalliance.diplomacy.lazymodule.{LazyModule, LazyModuleImp}

import freechips.rocketchip.amba.AMBACorrupt
import freechips.rocketchip.diplomacy.{AddressSet, DiplomaticSRAM, HasJustOneSeqMem, RegionType, TransferSizes}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes}
import freechips.rocketchip.resources.{DiplomaticSRAM, HasJustOneSeqMem}
import freechips.rocketchip.util.{BundleMap, SeqMemToAugmentedSeqMem}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/amba/axis/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import chisel3.util.{isPow2, log2Ceil}
import org.chipsalliance.cde.config.Parameters
import org.chipsalliance.diplomacy.nodes.BaseNode

import freechips.rocketchip.diplomacy.{TransferSizes, Resource, IdRange}
import freechips.rocketchip.diplomacy.{TransferSizes, IdRange}
import freechips.rocketchip.resources.{Resource}
import freechips.rocketchip.util.{BundleFieldBase, BundleField}


Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/debug/Debug.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import org.chipsalliance.diplomacy.lazymodule._
import freechips.rocketchip.amba.apb.{APBFanout, APBToTL}
import freechips.rocketchip.devices.debug.systembusaccess.{SBToTL, SystemBusAccessModule}
import freechips.rocketchip.devices.tilelink.{DevNullParams, TLBusBypass, TLError}
import freechips.rocketchip.diplomacy.{AddressSet, BufferParams, Description, Device, Resource, ResourceBindings, ResourceString, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet, BufferParams}
import freechips.rocketchip.resources.{Description, Device, Resource, ResourceBindings, ResourceString, SimpleDevice}
import freechips.rocketchip.interrupts.{IntNexusNode, IntSinkParameters, IntSinkPortParameters, IntSourceParameters, IntSourcePortParameters, IntSyncCrossingSource, IntSyncIdentityNode}
import freechips.rocketchip.regmapper.{RegField, RegFieldAccessType, RegFieldDesc, RegFieldGroup, RegFieldWrType, RegReadFn, RegWriteFn}
import freechips.rocketchip.rocket.{CSRs, Instructions}
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/BootROM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.bundlebridge._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, RegionType, Resource, SimpleDevice, TransferSizes}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes}
import freechips.rocketchip.resources.{Resource, SimpleDevice}
import freechips.rocketchip.subsystem._
import freechips.rocketchip.tilelink.{TLFragmenter, TLManagerNode, TLSlaveParameters, TLSlavePortParameters}

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/BusBlocker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import chisel3._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.regmapper.{RegField, RegFieldDesc}
import freechips.rocketchip.tilelink.{TLBusWrapper, TLFragmenter, TLNameNode, TLNode, TLRegisterNode}

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/CLINT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, Resource, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet}
import freechips.rocketchip.resources.{Resource, SimpleDevice}
import freechips.rocketchip.interrupts.{IntNexusNode, IntSinkParameters, IntSinkPortParameters, IntSourceParameters, IntSourcePortParameters}
import freechips.rocketchip.regmapper.{RegField, RegFieldDesc, RegFieldGroup}
import freechips.rocketchip.subsystem.{BaseSubsystem, CBUS, TLBusWrapperLocation}
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/ClockBlocker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import chisel3._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.prci.ClockAdapterNode
import freechips.rocketchip.regmapper.{RegField, RegFieldDesc}
import freechips.rocketchip.tilelink.TLRegisterNode
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/devices/tilelink/Deadlock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package freechips.rocketchip.devices.tilelink
import chisel3._
import org.chipsalliance.cde.config.Parameters
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.resources.{SimpleDevice}

/** Adds a /dev/null slave that does not raise ready for any incoming traffic.
* !!! WARNING: This device WILL cause your bus to deadlock for as long as you
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/DevNull.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ package freechips.rocketchip.devices.tilelink
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, RegionType, SimpleDevice, TransferSizes}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.prci.{HasClockDomainCrossing}
import freechips.rocketchip.tilelink.{TLManagerNode, TLSlaveParameters, TLSlavePortParameters}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/devices/tilelink/Error.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.SimpleDevice
import freechips.rocketchip.resources.SimpleDevice
import freechips.rocketchip.tilelink.{TLArbiter, TLMessages, TLPermissions}

/** Adds a /dev/null slave that generates TL error response messages */
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/MaskROM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, RegionType, SimpleDevice, TransferSizes}
import freechips.rocketchip.diplomacy.{RegionType, AddressSet, TransferSizes}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.subsystem.{Attachable, HierarchicalLocation, TLBusWrapperLocation}
import freechips.rocketchip.tilelink.{TLFragmenter, TLManagerNode, TLSlaveParameters, TLSlavePortParameters, TLWidthWidget}
import freechips.rocketchip.util.{ROMConfig, ROMGenerator}
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/PhysicalFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.regmapper.{RegField, RegFieldDesc, RegFieldGroup, RegFieldWrType, RegReadFn, RegWriteFn}
import freechips.rocketchip.tilelink.{TLAdapterNode, TLMessages, TLPermissions, TLRegisterNode}

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/Plic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, Description, Resource, ResourceBinding, ResourceBindings, ResourceInt, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet}
import freechips.rocketchip.resources.{Description, Resource, ResourceBinding, ResourceBindings, ResourceInt, SimpleDevice}
import freechips.rocketchip.interrupts.{IntNexusNode, IntSinkParameters, IntSinkPortParameters, IntSourceParameters, IntSourcePortParameters}
import freechips.rocketchip.regmapper.{RegField, RegFieldDesc, RegFieldRdAction, RegFieldWrType, RegReadFn, RegWriteFn}
import freechips.rocketchip.subsystem.{BaseSubsystem, CBUS, TLBusWrapperLocation}
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/TestRAM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, MemoryDevice, RegionType, TransferSizes}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType, TransferSizes}
import freechips.rocketchip.resources.{MemoryDevice}
import freechips.rocketchip.tilelink.{TLDelayer, TLFuzzer, TLManagerNode, TLMessages, TLRAMModel, TLSlaveParameters, TLSlavePortParameters}

// Do not use this for synthesis! Only for simulation.
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/devices/tilelink/Zero.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import chisel3.util._
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, RegionType, SimpleDevice}
import freechips.rocketchip.diplomacy.{AddressSet, RegionType}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.tilelink.TLMessages

/** This /dev/null device accepts single beat gets/puts, as well as atomics.
Expand Down
18 changes: 0 additions & 18 deletions src/main/scala/diplomacy/AddressRange.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,3 @@ object AddressRange
def subtract(from: Seq[AddressRange], take: Seq[AddressRange]): Seq[AddressRange] =
take.foldLeft(from) { case (left, r) => left.flatMap { _.subtract(r) } }
}

case class AddressMapEntry(range: AddressRange, permissions: ResourcePermissions, names: Seq[String]) {
val ResourcePermissions(r, w, x, c, a) = permissions

def toString(aw: Int) = s"\t%${aw}x - %${aw}x %c%c%c%c%c %s".format(
range.base,
range.base+range.size,
if (a) 'A' else ' ',
if (r) 'R' else ' ',
if (w) 'W' else ' ',
if (x) 'X' else ' ',
if (c) 'C' else ' ',
names.mkString(", "))

def toJSON = s"""{"base":[${range.base}],"size":[${range.size}],""" +
s""""r":[$r],"w":[$w],"x":[$x],"c":[$c],"a":[$a],""" +
s""""names":[${names.map('"'+_+'"').mkString(",")}]}"""
}
26 changes: 0 additions & 26 deletions src/main/scala/diplomacy/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,6 @@ package object diplomacy {
}
}

implicit class BigIntHexContext(private val sc: StringContext) extends AnyVal {
def x(args: Any*): BigInt = {
val orig = sc.s(args: _*)
BigInt(orig.replace("_", ""), 16)
}
}

type PropertyOption = Option[(String, Seq[ResourceValue])]
type PropertyMap = Iterable[(String, Seq[ResourceValue])]

implicit class IntToProperty(x: Int) {
def asProperty: Seq[ResourceValue] = Seq(ResourceInt(BigInt(x)))
}

implicit class BigIntToProperty(x: BigInt) {
def asProperty: Seq[ResourceValue] = Seq(ResourceInt(x))
}

implicit class StringToProperty(x: String) {
def asProperty: Seq[ResourceValue] = Seq(ResourceString(x))
}

implicit class DeviceToProperty(x: Device) {
def asProperty: Seq[ResourceValue] = Seq(ResourceReference(x.label))
}

// TODO - Remove compatibility layer for deprecated diplomacy api once all local references are moved to standalone diplomacy lib.
// package.scala
@deprecated("Diplomacy has been split to a standalone library", "rocketchip 2.0.0")
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/groundtest/Tile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.bundlebridge._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{SimpleDevice}
import freechips.rocketchip.resources.{SimpleDevice}
import freechips.rocketchip.prci.{ClockCrossingType}
import freechips.rocketchip.interrupts._
import freechips.rocketchip.rocket.{BuildHellaCache, DCache, DCacheModule, ICacheParams, NonBlockingDCache, NonBlockingDCacheModule, RocketCoreParams}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/interrupts/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import chisel3.experimental.SourceInfo
import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.nodes._

import freechips.rocketchip.diplomacy.Resource
import freechips.rocketchip.resources.Resource

// A potentially empty half-open range; [start, end)
case class IntRange(start: Int, end: Int)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/interrupts/RegisterRouter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import chisel3._

import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.Resource
import freechips.rocketchip.resources.Resource

import freechips.rocketchip.regmapper._

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/prci/ClockGroup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.chipsalliance.diplomacy._
import org.chipsalliance.diplomacy.lazymodule._
import org.chipsalliance.diplomacy.nodes._

import freechips.rocketchip.diplomacy.FixedClockResource
import freechips.rocketchip.resources.FixedClockResource

case class ClockGroupingNode(groupName: String)(implicit valName: ValName)
extends MixedNexusNode(ClockGroupImp, ClockImp)(
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/prci/ClockNodes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.chipsalliance.diplomacy._
import org.chipsalliance.diplomacy.lazymodule._
import org.chipsalliance.diplomacy.nodes._

import freechips.rocketchip.diplomacy.FixedClockResource
import freechips.rocketchip.resources.FixedClockResource

object ClockImp extends SimpleNodeImp[ClockSourceParameters, ClockSinkParameters, ClockEdgeParameters, ClockBundle]
{
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/regmapper/RegisterRouter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.chipsalliance.cde.config._
import org.chipsalliance.diplomacy.bundlebridge._
import org.chipsalliance.diplomacy.lazymodule._

import freechips.rocketchip.diplomacy.{AddressSet, Description, Device, SimpleDevice, ResourceBindings, ResourceValue}
import freechips.rocketchip.diplomacy.{AddressSet}
import freechips.rocketchip.resources.{Description, Device, SimpleDevice, ResourceBindings, ResourceValue}
import freechips.rocketchip.prci.{HasClockDomainCrossing}


Expand Down
21 changes: 21 additions & 0 deletions src/main/scala/resources/AddressMapEntry.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package freechips.rocketchip.resources

import freechips.rocketchip.diplomacy.{AddressRange}

case class AddressMapEntry(range: AddressRange, permissions: ResourcePermissions, names: Seq[String]) {
val ResourcePermissions(r, w, x, c, a) = permissions

def toString(aw: Int) = s"\t%${aw}x - %${aw}x %c%c%c%c%c %s".format(
range.base,
range.base+range.size,
if (a) 'A' else ' ',
if (r) 'R' else ' ',
if (w) 'W' else ' ',
if (x) 'X' else ' ',
if (c) 'C' else ' ',
names.mkString(", "))

def toJSON = s"""{"base":[${range.base}],"size":[${range.size}],""" +
s""""r":[$r],"w":[$w],"x":[$x],"c":[$c],"a":[$a],""" +
s""""names":[${names.map('"'+_+'"').mkString(",")}]}"""
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// See LICENSE.SiFive for license details.

package freechips.rocketchip.diplomacy
package freechips.rocketchip.resources

import org.chipsalliance.cde.config.Field
import sys.process._
import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
import freechips.rocketchip.diplomacy.{AddressRange}

case object DTSModel extends Field[String]
case object DTSCompat extends Field[Seq[String]] // -dev, -soc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// See LICENSE.SiFive for license details.

package freechips.rocketchip.diplomacy
package freechips.rocketchip.resources

class FixedClockResource(val name: String, val freqMHz: Double, val prefix: String = "soc/")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// See LICENSE.SiFive for license details.

package freechips.rocketchip.diplomacy
package freechips.rocketchip.resources

import scala.collection.immutable.SortedMap
import freechips.rocketchip.diplomacy.{AddressRange}

object JSON
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// See LICENSE.SiFive for license details.

package freechips.rocketchip.diplomacy
package freechips.rocketchip.resources

import chisel3.util.log2Ceil

import scala.collection.immutable.{ListMap, SortedMap}
import scala.collection.mutable.HashMap
import freechips.rocketchip.diplomacy.{AddressSet, AddressRange}
import org.chipsalliance.diplomacy.lazymodule.{LazyModule}

sealed trait ResourceValue

Expand Down Expand Up @@ -275,8 +277,8 @@ trait BindingScope
BindingScope.add(this)

private val parentScope = BindingScope.find(parent)
protected[diplomacy] var resourceBindingFns: Seq[() => Unit] = Nil // callback functions to resolve resource binding during elaboration
protected[diplomacy] var resourceBindings: Seq[(Resource, Option[Device], ResourceValue)] = Nil
protected[resources] var resourceBindingFns: Seq[() => Unit] = Nil // callback functions to resolve resource binding during elaboration
protected[resources] var resourceBindings: Seq[(Resource, Option[Device], ResourceValue)] = Nil

private case class ExpandedValue(path: Seq[String], labels: Seq[String], value: Seq[ResourceValue])
private lazy val eval: Unit = {
Expand Down Expand Up @@ -387,8 +389,8 @@ trait BindingScope

object BindingScope
{
protected[diplomacy] var active: Option[BindingScope] = None
protected[diplomacy] def find(m: Option[LazyModule] = LazyModule.getScope): Option[BindingScope] = m.flatMap {
protected[resources] var active: Option[BindingScope] = None
protected[resources] def find(m: Option[LazyModule] = LazyModule.getScope): Option[BindingScope] = m.flatMap {
case x: BindingScope => find(x.getParent).orElse(Some(x))
case x => find(x.getParent)
}
Expand Down
Loading

0 comments on commit a73b797

Please sign in to comment.