1
0

Standardize Data.holdUnless and SeqMem.readAndHold

- Make API more idiomatic (x holdUnless y, instead of holdUnless(x, y))
- Add new SeqMem API, readAndHold, which corresponds to most common
  use of holdUnless
This commit is contained in:
Andrew Waterman
2017-02-25 02:54:42 -08:00
parent fd972f5c67
commit dfa61bc487
9 changed files with 25 additions and 22 deletions

View File

@ -5,6 +5,7 @@ package uncore.axi4
import Chisel._
import config._
import diplomacy._
import util._
class AXI4RAM(address: AddressSet, executable: Boolean = true, beatBytes: Int = 4)(implicit p: Parameters) extends LazyModule
{
@ -62,8 +63,7 @@ class AXI4RAM(address: AddressSet, executable: Boolean = true, beatBytes: Int =
}
val ren = in.ar.fire()
def holdUnless[T <: Data](in : T, enable: Bool): T = Mux(!enable, RegEnable(in, enable), in)
val rdata = holdUnless(mem.read(r_addr, ren), RegNext(ren))
val rdata = mem.readAndHold(r_addr, ren)
in.r.bits.id := r_id
in.r.bits.resp := AXI4Parameters.RESP_OKAY