Esempio n. 1
0
        public void AddInputPort_CpuMemory_ConnectedAndAddedToModel()
        {
            var uut = new SimulationModelBuilder();

            uut.AddCpuMemory();
            var inputPort = uut.AddInputPort(0x10, "Test");

            uut.Model.Components.Should().HaveCount(3); // decoder/invertor/or
            uut.Model.InputPorts.Should().HaveCount(1);

            inputPort.Output.IsConnected.Should().BeTrue();
            inputPort.PortEnable.IsConnected.Should().BeTrue();
        }
Esempio n. 2
0
        public void AddInputPort_AddedToModel()
        {
            var uut = new SimulationModelBuilder();

            var name = "Test";

            uut.AddInputPort(new InputPort()
            {
                Name = name
            });

            uut.Model.InputPorts.Should().HaveCount(1);
            uut.Model.InputPorts[name].Should().NotBeNull();
        }
Esempio n. 3
0
        public void AddInputPort_InitialState_IsPropegated()
        {
            var uut = new SimulationModelBuilder();

            uut.AddCpuMemory();
            ((IDirectMemoryAccess <BusData8>)uut.Model.Memory)[0] = new BusData8(0); // nop
            uut.AddCpuClockGen();
            var inputPort = uut.AddInputPort(0x10, "Test");

            uut.AddLogicAnalyzer();

            inputPort.DataBuffer.Write(new BusData8(0xFF));

            uut.Model.ClockGen.SquareWave(4);

            Console.WriteLine(uut.Model.LogicAnalyzer.ToWaveJson());

            inputPort.DataBuffer.Read().ToByte().Should().Be(0xFF);
        }