1
0

diplomacy: allow access to sram Device info

This commit is contained in:
Henry Cook 2017-12-21 11:42:12 -08:00
parent d9c5ec4f7b
commit ba6dd160a3

View File

@ -10,9 +10,11 @@ abstract class DiplomaticSRAM(
beatBytes: Int, beatBytes: Int,
devName: Option[String])(implicit p: Parameters) extends LazyModule devName: Option[String])(implicit p: Parameters) extends LazyModule
{ {
protected val resources = devName val device = devName
.map(new SimpleDevice(_, Seq("sifive,sram0")).reg("mem")) .map(new SimpleDevice(_, Seq("sifive,sram0")))
.getOrElse(new MemoryDevice().reg) .getOrElse(new MemoryDevice())
val resources = device.reg("mem")
def bigBits(x: BigInt, tail: List[Boolean] = Nil): List[Boolean] = def bigBits(x: BigInt, tail: List[Boolean] = Nil): List[Boolean] =
if (x == 0) tail.reverse else bigBits(x >> 1, ((x & 1) == 1) :: tail) if (x == 0) tail.reverse else bigBits(x >> 1, ((x & 1) == 1) :: tail)