示例#1
0
 public Ram32K(int width)
 {
     r1 = new Ram16K(width);
     r2 = new Ram16K(width);
     r3 = new Ram16K(width);
     r4 = new Ram16K(width);
 }
示例#2
0
        public void RAM16kWorks()
        {
            Ram16K r = new Ram16K(16);
            var input = new bool[] { false, false, false, false, false, false, false, false };

            //no load, the value should just be the same, all false
            TestRam16K(r, Functions.GetBitArrayFromInteger(0, 16), Functions.GetBitArrayFromInteger(0, 16), false, Functions.GetBitArrayFromInteger(0, 16));
            TestRam16K(r, Functions.GetBitArrayFromInteger(0, 16), Functions.GetBitArrayFromInteger(33, 16), false, Functions.GetBitArrayFromInteger(0, 16));
            TestRam16K(r, Functions.GetBitArrayFromInteger(0, 16), Functions.GetBitArrayFromInteger(55, 16), false, Functions.GetBitArrayFromInteger(0, 16));

            for (int i = 0; i < 50; i++)
            {
                TestRam16K(r, Functions.GetBitArrayFromInteger(i, 16), Functions.GetBitArrayFromInteger(i, 16), false, Functions.GetBitArrayFromInteger(0, 16));
            }
            for (int i = 0; i < 50; i++)
            {
                TestRam16K(r, Functions.GetBitArrayFromInteger(i, 16), Functions.GetBitArrayFromInteger(i, 16), true, Functions.GetBitArrayFromInteger(i, 16));
                TestRam16K(r, Functions.GetBitArrayFromInteger(i, 16), Functions.GetBitArrayFromInteger(i + 3, 16), false, Functions.GetBitArrayFromInteger(i, 16));
            }
        }
示例#3
0
 void TestRam16K(Ram16K r, bool[] address, bool[] input, bool load, bool[] compare)
 {
     var output = r.Cycle(input, load, address);
     CompareBitArray(output, compare);
 }
示例#4
0
 public Memory(int width)
 {
     this.width = width;
     ram = new Ram16K(width);
 }