1
0

Suggest sane names for common objects (#369)

* Suggest sane names for common objects frequently instantiated with factory methods

* Suggest names for common primitives using more Scala-esque Options
This commit is contained in:
mwachs5
2016-09-30 16:19:25 -07:00
committed by GitHub
parent 0ebab0976a
commit 9a381e88d1
2 changed files with 22 additions and 6 deletions

View File

@ -147,15 +147,18 @@ object AsyncRWSlaveRegField {
slave_reset: Bool,
width: Int,
init: Int,
name: Option[String] = None,
master_allow: Bool = Bool(true),
slave_allow: Bool = Bool(true)
): (UInt, RegField) = {
val async_slave_reg = Module(new AsyncResetRegVec(width, init))
name.foreach(async_slave_reg.suggestName(_))
async_slave_reg.reset := slave_reset
async_slave_reg.clock := slave_clock
val wr_crossing = Module (new RegisterWriteCrossing(UInt(width = width)))
name.foreach(n => wr_crossing.suggestName(s"${n}_wcrossing"))
val scope = Module (new AsyncScope())
@ -170,6 +173,7 @@ object AsyncRWSlaveRegField {
async_slave_reg.io.d := wr_crossing.io.slave_register
val rd_crossing = Module (new RegisterReadCrossing(UInt(width = width )))
name.foreach(n => rd_crossing.suggestName(s"${n}_rcrossing"))
rd_crossing.io.master_clock := scope.clock
rd_crossing.io.master_reset := scope.reset