From a03781c606df8abfe4e43bc09979639d3939d679 Mon Sep 17 00:00:00 2001 From: hneemann Date: Sat, 19 Jan 2019 11:49:19 +0100 Subject: [PATCH] adds 64 bit test for masked dual-port multi-byte RAM; see #231 --- .../digital/integration/TestExamples.java | 4 +- .../resources/dig/test/RAM/maskedRAM64.dig | 188 ++++++++++++++++++ 2 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/dig/test/RAM/maskedRAM64.dig diff --git a/src/test/java/de/neemann/digital/integration/TestExamples.java b/src/test/java/de/neemann/digital/integration/TestExamples.java index d91721068..e89ca1c65 100644 --- a/src/test/java/de/neemann/digital/integration/TestExamples.java +++ b/src/test/java/de/neemann/digital/integration/TestExamples.java @@ -43,8 +43,8 @@ public class TestExamples extends TestCase { */ public void testTestExamples() throws Exception { File examples = new File(Resources.getRoot(), "/dig/test"); - assertEquals(147, new FileScanner(this::check).scan(examples)); - assertEquals(139, testCasesInFiles); + assertEquals(148, new FileScanner(this::check).scan(examples)); + assertEquals(140, testCasesInFiles); } /** diff --git a/src/test/resources/dig/test/RAM/maskedRAM64.dig b/src/test/resources/dig/test/RAM/maskedRAM64.dig new file mode 100644 index 000000000..2ceacb73b --- /dev/null +++ b/src/test/resources/dig/test/RAM/maskedRAM64.dig @@ -0,0 +1,188 @@ + + + 1 + + + + RAMDualPortMasked + + + AddrBits + 8 + + + Bits + 64 + + + + + + Out + + + Label + D + + + Bits + 64 + + + + + + In + + + Label + A + + + Bits + 8 + + + + + + In + + + Label + Din + + + Bits + 64 + + + + + + In + + + Label + str + + + + + + Clock + + + Label + C + + + + + + In + + + Label + ld + + + + + + In + + + Label + mask + + + Bits + 8 + + + + + + Testcase + + + Testdata + + C A Din str ld mask D + +# no write at all, mask is zero +C 0 0xffffffffffffffff 1 0 0b00000000 x +0 0 0 0 1 0b00000000 0 + +# write bytes + +C 0 0xffffffffffffffff 1 0 0b00000001 x +0 0 0 0 1 0b00000000 0xff + +C 0 0xffffffffffffff00 1 0 0b00000010 x +0 0 0 0 1 0b00000000 0xffff + +C 0 0xffffffffffff0000 1 0 0b00000100 x +0 0 0 0 1 0b00000000 0xffffff + +C 0 0xffffffffff000000 1 0 0b00001000 x +0 0 0 0 1 0b00000000 0xffffffff + +C 0 0xffffffff00000000 1 0 0b00010000 x +0 0 0 0 1 0b00000000 0xffffffffff + +C 0 0xffffff0000000000 1 0 0b00100000 x +0 0 0 0 1 0b00000000 0xffffffffffff + +C 0 0xffff000000000000 1 0 0b01000000 x +0 0 0 0 1 0b00000000 0xffffffffffffff + +C 0 0xff00000000000000 1 0 0b10000000 x +0 0 0 0 1 0b00000000 0xffffffffffffffff + +# write 32 bit words + +C 1 0xffffffff 1 0 0b00001111 x +0 1 0 0 1 0b00000000 0xffffffff + +C 1 0xaaaaaaaa00000000 1 0 0b11110000 x +0 1 0 0 1 0b00000000 0xaaaaaaaaffffffff + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file