From 8f3c7d357fd6c97121d5adbb0ca09ce34f763374 Mon Sep 17 00:00:00 2001 From: Colin Schmidt Date: Mon, 13 Feb 2017 15:09:28 -0800 Subject: Emit memories larger than 512 MB with a sparse annotation (#438) This comment causes vcs to treat this as a spare memory, so it will dynamically allocate the required memory, and can support very large reg constructs this way. This is useful for test bench memories that might be simulating back DRAM or the like. --- src/main/scala/firrtl/Emitter.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/scala/firrtl/Emitter.scala b/src/main/scala/firrtl/Emitter.scala index 36e4929a..eb219b6d 100644 --- a/src/main/scala/firrtl/Emitter.scala +++ b/src/main/scala/firrtl/Emitter.scala @@ -454,7 +454,9 @@ class VerilogEmitter extends Emitter with PassBased { instdeclares += Seq(");") sx case sx: DefMemory => - declare("reg", sx.name, VectorType(sx.dataType, sx.depth)) + val fullSize = sx.depth * (sx.dataType match { case GroundType(IntWidth(width)) => width }) + val decl = if (fullSize > (1 << 29)) "reg /* sparse */" else "reg" + declare(decl, sx.name, VectorType(sx.dataType, sx.depth)) initialize_mem(sx) if (sx.readLatency != 0 || sx.writeLatency != 1) throw EmitterException("All memories should be transformed into " + -- cgit v1.2.3