Esempio n. 1
0
        public void Write_AddressBus_NoErrors()
        {
            var mem        = MemoryTestExtensions.NewRom(new byte[] { Value });
            var addressBus = mem.Address.CreateConnection();

            addressBus.IsEnabled = true;
            addressBus.Write(new BusData16(0));
        }
Esempio n. 2
0
        public void Write_DigitalSignals_NoErrors()
        {
            var mem    = MemoryTestExtensions.NewRom(new byte[] { Value });
            var ceProv = mem.ChipEnable.CreateConnection();
            var oeProv = mem.OutputEnable.CreateConnection();

            ceProv.Write(DigitalLevel.Low);
            oeProv.Write(DigitalLevel.Low);
        }
Esempio n. 3
0
        public void Read_NextAddress_CorrectValue()
        {
            var mem        = MemoryTestExtensions.NewRom(new byte[] { 0, Value });
            var addressBus = mem.Address.CreateConnection();
            var dataBus    = mem.Data.CreateConnection();
            var ceProv     = mem.ChipEnable.CreateConnection();
            var oeProv     = mem.OutputEnable.CreateConnection();

            // enable chip and output
            ceProv.Write(DigitalLevel.Low);
            oeProv.Write(DigitalLevel.Low);
            // set address
            addressBus.IsEnabled = true;
            addressBus.Write(new BusData16(1));
            // read data
            dataBus.Value.Equals(new BusData8(Value)).Should().BeTrue();
        }
Esempio n. 4
0
        public void DisableAfterRead_DataBus_IsFloating()
        {
            var mem        = MemoryTestExtensions.NewRom(new byte[] { Value });
            var ceProv     = mem.ChipEnable.CreateConnection();
            var oeProv     = mem.OutputEnable.CreateConnection();
            var addressBus = mem.Address.CreateConnection();
            var dataBus    = mem.Data.CreateConnection();

            ceProv.Write(DigitalLevel.Low);
            oeProv.Write(DigitalLevel.Low);
            addressBus.IsEnabled = true;
            addressBus.Write(new BusData16(0));

            // disable
            oeProv.Write(DigitalLevel.High);
            dataBus.Value.IsFloating.Should().Be(true);
        }
Esempio n. 5
0
        public void Read_Inactive_NoValue()
        {
            var mem        = MemoryTestExtensions.NewRom(new byte[] { Value });
            var addressBus = mem.Address.CreateConnection();
            var dataBus    = mem.Data.CreateConnection();
            var ceProv     = mem.ChipEnable.CreateConnection();
            var oeProv     = mem.OutputEnable.CreateConnection();

            // do not enable chip
            ceProv.Write(DigitalLevel.High);
            oeProv.Write(DigitalLevel.Low);
            // set address
            addressBus.IsEnabled = true;
            addressBus.Write(new BusData16(0));
            // read data
            dataBus.Value.Equals(new BusData8()).Should().BeTrue();
        }
Esempio n. 6
0
        public void Write_Rom_Throws()
        {
            var mem        = MemoryTestExtensions.NewRom(new byte[] { Value });
            var addressBus = mem.Address.CreateConnection();
            var dataBus    = mem.Data.Slave.CreateConnection();
            var ceProv     = mem.ChipEnable.CreateConnection();
            var oeProv     = mem.OutputEnable.CreateConnection();

            ceProv.Write(DigitalLevel.Low);
            oeProv.Write(DigitalLevel.Low);
            // set address
            addressBus.IsEnabled = true;
            addressBus.Write(new BusData16(0));

            Action fn = () => dataBus.Write(new BusData8(0));

            fn.ShouldThrow <InvalidOperationException>();
        }
Esempio n. 7
0
        public void Initialize_NoErrors()
        {
            var mem = MemoryTestExtensions.NewRom(new byte[] { Value });

            mem.Should().NotBeNull();
        }