Vec considered harmful; use isOneOf instead (#64)
Vec is heavyweight and really should only be used for I/O and dynamic indexing. A recurring pattern in uncore is Vec(const1, const2, const3) contains x which is nice but has a deleterious effect on simulation copilation and execution time. This patch proposes an alternative: x isOneOf (const1, const2, const3) x isOneOf seqOfThings I think it's also more idiomatic. This is just a prototype; I'm not wed to the name or implementation.
This commit is contained in:
@ -6,6 +6,7 @@ import Chisel._
|
||||
import uncore.coherence._
|
||||
import uncore.tilelink._
|
||||
import uncore.constants._
|
||||
import uncore.Util._
|
||||
import cde.Parameters
|
||||
|
||||
class L2BroadcastHub(implicit p: Parameters) extends HierarchicalCoherenceAgent()(p) {
|
||||
@ -155,7 +156,7 @@ class BufferedBroadcastAcquireTracker(trackerId: Int)(implicit p: Parameters)
|
||||
// and/or write back dirty data, and may be unexpected voluntary releases
|
||||
def irel_can_merge = io.irel().conflicts(xact_addr_block) &&
|
||||
io.irel().isVoluntary() &&
|
||||
!Vec(s_idle, s_meta_write).contains(state) &&
|
||||
!state.isOneOf(s_idle, s_meta_write) &&
|
||||
!all_pending_done &&
|
||||
!io.outer.grant.fire() &&
|
||||
!io.inner.grant.fire() &&
|
||||
|
@ -9,6 +9,7 @@ import uncore.util.AMOALU
|
||||
import uncore.coherence._
|
||||
import uncore.tilelink._
|
||||
import uncore.constants._
|
||||
import uncore.Util._
|
||||
import cde.{Parameters, Field}
|
||||
|
||||
case object CacheName extends Field[String]
|
||||
@ -807,7 +808,7 @@ class CacheAcquireTracker(trackerId: Int)(implicit p: Parameters)
|
||||
|
||||
|
||||
// Setup IOs used for routing in the parent
|
||||
val before_wb_alloc = Vec(s_meta_read, s_meta_resp, s_wb_req).contains(state)
|
||||
val before_wb_alloc = state isOneOf (s_meta_read, s_meta_resp, s_wb_req)
|
||||
|
||||
routeInParent(
|
||||
iacqMatches = inSameSet(_, xact_addr_block),
|
||||
@ -899,7 +900,7 @@ class CacheAcquireTracker(trackerId: Int)(implicit p: Parameters)
|
||||
|
||||
def irel_can_merge = io.irel().conflicts(xact_addr_block) &&
|
||||
io.irel().isVoluntary() &&
|
||||
!Vec(s_idle, s_meta_read, s_meta_resp, s_meta_write).contains(state) &&
|
||||
!state.isOneOf(s_idle, s_meta_read, s_meta_resp, s_meta_write) &&
|
||||
!all_pending_done &&
|
||||
!io.outer.grant.fire() &&
|
||||
!io.inner.grant.fire() &&
|
||||
|
@ -6,6 +6,7 @@ import Chisel._
|
||||
import uncore.coherence._
|
||||
import uncore.tilelink._
|
||||
import uncore.util._
|
||||
import uncore.Util._
|
||||
import cde.{Field, Parameters}
|
||||
import scala.math.max
|
||||
|
||||
@ -275,7 +276,7 @@ trait AcceptsVoluntaryReleases extends HasVoluntaryReleaseMetadataBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
io.inner.grant.valid := Vec(s_wb_req, s_wb_resp, s_inner_probe, s_busy).contains(state) &&
|
||||
io.inner.grant.valid := state.isOneOf(s_wb_req, s_wb_resp, s_inner_probe, s_busy) &&
|
||||
vol_ignt_counter.pending &&
|
||||
!(pending_irel_data.orR || block_vol_ignt)
|
||||
|
||||
|
Reference in New Issue
Block a user