Exemplo n.º 1
0
 public Ram64(int width)
 {
     r1 = new Ram8(width);
     r2 = new Ram8(width);
     r3 = new Ram8(width);
     r4 = new Ram8(width);
     r5 = new Ram8(width);
     r6 = new Ram8(width);
     r7 = new Ram8(width);
     r8 = new Ram8(width);
 }
Exemplo n.º 2
0
        public void RAM8Works()
        {
            Ram8 r = new Ram8(8);
            var input = new bool[]{false, false, false, false, false, false, false, false};

            //no load, the value should just be the same, all false
            var output = r.Cycle(input, false, new bool[] { false, false, false });
            CompareBitArray(output, input);
            output = r.Cycle(new bool[] { true, false, false, true, false, true, false, false }, false, new bool[] { false, false, false });
            CompareBitArray(output, input);
            output = r.Cycle(new bool[] { false, true, true, false, true, false, true, false }, false, new bool[] { false, false, false });
            CompareBitArray(output, input);

            //load, the value should be the input which is the same as default, all false
            output = r.Cycle(input, false, new bool[] { false, false, false });
            CompareBitArray(output, input);

            //no load, the value should be the default, not the input
            input = new bool[] { false, false, false, true, true, false, true, true };
            output = r.Cycle(input, false, new bool[] { false, false, false });
            CompareBitArray(output, new bool[] { false, false, false, false, false, false, false, false });

            //load, the value should be the input
            input = new bool[] { false, false, false, true, true, false, true, true };
            output = r.Cycle(input, true, new bool[] { false, false, false });
            CompareBitArray(output, new bool[] { false, false, false, true, true, false, true, true });

            //load, a different address, should still be all false
            output = r.Cycle(input, false, new bool[] { false, false, true });
            CompareBitArray(output, new bool[] { false, false, false, false, false, false, false, false });

            //put whatever in whatever address and it should be the same
            output = r.Cycle(new bool[] { false, true, false, true, false, true, false, true }, true, new bool[] { false, false, true });
            CompareBitArray(output, new bool[] { false, true, false, true, false, true, false, true });

            output = r.Cycle(new bool[] { false, true, false, true, false, true, false, true }, true, new bool[] { false, true, true });
            CompareBitArray(output, new bool[] { false, true, false, true, false, true, false, true });
        }