Skip to content

Commit 37d7f75

Browse files
ucbjrlbqwer
andauthored
fix single port ram code (#160)
Co-authored-by: bqwer <liventsev@gmail.com>
1 parent a1942bc commit 37d7f75

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

doc/tutorial/tutorial-2.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,10 @@ \subsection{Mem}
13391339
\begin{scala}
13401340
val ram1p =
13411341
Mem(UInt(width = 32), 1024, seqRead = true)
1342-
val reg_raddr = Reg(UInt())
1343-
when (wen) { ram1p(waddr) := wdata }
1344-
.elsewhen (ren) { reg_raddr := raddr }
1345-
val rdata = ram1p(reg_raddr)
1342+
val reg_addr = Reg(UInt())
1343+
when (wen) { ram1p(addr) := wdata }
1344+
.elsewhen (ren) { reg_addr := addr }
1345+
val rdata = ram1p(reg_addr)
13461346
\end{scala}
13471347

13481348
If the same \code{Mem} address is both written and sequentially read on the same clock

doc/tutorial/tutorial.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,10 +1278,10 @@ \subsection{Mem}
12781278

12791279
\begin{scala}
12801280
val ram1p = Mem(1024, UInt(32.W))
1281-
val reg_raddr = Reg(UInt())
1282-
when (wen) { ram1p(waddr) := wdata }
1283-
.elsewhen (ren) { reg_raddr := raddr }
1284-
val rdata = ram1p(reg_raddr)
1281+
val reg_addr = Reg(UInt())
1282+
when (wen) { ram1p(addr) := wdata }
1283+
.elsewhen (ren) { reg_addr := addr }
1284+
val rdata = ram1p(reg_addr)
12851285
\end{scala}
12861286

12871287
If the same \code{Mem} address is both written and sequentially read on the same clock

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy