aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/APPNOTE_011_Design_Investigation/memdemo.v
diff options
context:
space:
mode:
authorKrystalDelusion <93062060+KrystalDelusion@users.noreply.github.com>2022-11-25 03:56:44 +1300
committerGitHub <noreply@github.com>2022-11-24 15:56:44 +0100
commitb9b5899cceb392c0069345c5b43c37bfe8346116 (patch)
tree557cb31d96b2224891c7ed37a9b25d3d8caa7d2e /docs/source/APPNOTE_011_Design_Investigation/memdemo.v
parentfc2f622a27dbc604a4acce68bea8c20b208c1742 (diff)
downloadyosys-b9b5899cceb392c0069345c5b43c37bfe8346116.tar.gz
yosys-b9b5899cceb392c0069345c5b43c37bfe8346116.tar.bz2
yosys-b9b5899cceb392c0069345c5b43c37bfe8346116.zip
Remove docs dependency on yosys repo (#3558)
* Copies guidelines files into docs/ for website * Copying manual/CHAPTER_Prog for new docs * Copying manual/APPNOTE_011... for new docs Also adding faketime to list of packages for website build. Co-authored-by: KrystalDelusion <krystinedawn@yosyshq.com>
Diffstat (limited to 'docs/source/APPNOTE_011_Design_Investigation/memdemo.v')
-rw-r--r--docs/source/APPNOTE_011_Design_Investigation/memdemo.v19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/source/APPNOTE_011_Design_Investigation/memdemo.v b/docs/source/APPNOTE_011_Design_Investigation/memdemo.v
new file mode 100644
index 000000000..b39564ddc
--- /dev/null
+++ b/docs/source/APPNOTE_011_Design_Investigation/memdemo.v
@@ -0,0 +1,19 @@
+module memdemo(clk, d, y);
+
+input clk;
+input [3:0] d;
+output reg [3:0] y;
+
+integer i;
+reg [1:0] s1, s2;
+reg [3:0] mem [0:3];
+
+always @(posedge clk) begin
+ for (i = 0; i < 4; i = i+1)
+ mem[i] <= mem[(i+1) % 4] + mem[(i+2) % 4];
+ { s2, s1 } = d ? { s1, s2 } ^ d : 4'b0;
+ mem[s1] <= d;
+ y <= mem[s2];
+end
+
+endmodule