Skip to content

Commit

Permalink
Change apply to mem for SRAM shift register implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
milovanovic committed Jan 19, 2023
1 parent e17d91c commit 4f2efb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/chisel3/util/Reg.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ object ShiftRegister {
* @param useDualSRAMPort dual port or single port SRAM based implementation
* @param name name of SyncReadMem object
*/
def apply[T <: Data](in: T, n: Int, en: Bool, useDualSRAMPort: Boolean, name: Option[String]): T =
def mem[T <: Data](in: T, n: Int, en: Bool, useDualSRAMPort: Boolean, name: Option[String]): T =
macro SourceInfoTransform.inNEnUseDualSRAMpNameArg

/** @group SourceInfoTransformMacro */
def do_apply[T <: Data](
def do_mem[T <: Data](
in: T,
n: Int,
en: Bool,
Expand All @@ -146,9 +146,9 @@ object ShiftRegister {
)(
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
): T = _apply_impl_sram(in, n, en, useDualSRAMPort, name)
): T = _apply_impl_mem(in, n, en, useDualSRAMPort, name)

private def _apply_impl_sram[T <: Data](
private def _apply_impl_mem[T <: Data](
in: T,
n: Int,
en: Bool = true.B,
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/chiselTests/Reg.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ShiftTester(n: Int) extends BasicTester {
class ShiftMemTester(n: Int, dp_mem: Boolean) extends BasicTester {
val (cntVal, done) = Counter(true.B, n)
val start = 23.U
val sr = ShiftRegister(cntVal + start, n, true.B, dp_mem, Some("simple_sr"))
val sr = ShiftRegister.mem(cntVal + start, n, true.B, dp_mem, Some("simple_sr"))
when(RegNext(done)) {
assert(sr === start)
stop()
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/chiselTests/util/RegSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ShiftRegisterSpec extends AnyFlatSpec with Matchers {
class MyModule extends Module {
val in = IO(Input(Bool()))
val out = IO(Output(Bool()))
out := ShiftRegister(in, 2, true.B, false, Some("sr"))
out := ShiftRegister.mem(in, 2, true.B, false, Some("sr"))
}
val chirrtl = ChiselStage.emitChirrtl(new MyModule)
val reset = """reset .*RegSpec.scala""".r
Expand Down

0 comments on commit 4f2efb1

Please sign in to comment.