Skip to content

Commit

Permalink
more robust write mask granularity detection
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeamer committed Aug 19, 2014
1 parent e846517 commit b957336
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/Verilog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,15 @@ class VerilogBackend extends Backend {
def find_gran(x: Node) : Int = {
if (x.isInstanceOf[Literal])
return x.width
else if (x.isInstanceOf[UInt])
return find_gran(x.inputs(0))
else if (x.isInstanceOf[Op])
return (x.inputs.map(find_gran(_))).reduceLeft(_ max _)
else
return -1
return 1
}
val mask_writers = m.writeAccesses.filter(_.isMasked)
val mask_grans = mask_writers.map(x => find_gran(x.mask.inputs(0)))
val mask_grans = mask_writers.map(x => find_gran(x.mask))
val mask_gran = if (!mask_grans.isEmpty && mask_grans.forall(_ == mask_grans(0))) mask_grans(0) else 1
val configStr =
(" depth " + m.n +
Expand Down

0 comments on commit b957336

Please sign in to comment.