Ejemplo n.º 1
0
        public ALU(int iSize)
        {
            Size      = iSize;
            InputX    = new WireSet(Size);
            InputY    = new WireSet(Size);
            ZeroX     = new Wire();
            ZeroY     = new Wire();
            NotX      = new Wire();
            NotY      = new Wire();
            F         = new Wire();
            NotOutput = new Wire();
            Output    = new WireSet(Size);
            Zero      = new Wire();
            Negative  = new Wire();

            ZeroX.ConnectOutput(this);
            ZeroY.ConnectOutput(this);
            NotX.ConnectOutput(this);
            NotY.ConnectOutput(this);
            F.ConnectOutput(this);
            NotOutput.ConnectOutput(this);

            InputX.ConnectOutput(this);
            InputY.ConnectOutput(this);
        }
 public BitwiseNotGate(int iSize)
 {
     Size   = iSize;
     Input  = new WireSet(Size);
     Output = new WireSet(Size);
     Input.ConnectOutput(this);
 }
Ejemplo n.º 3
0
 public BitwiseBooleanGate(int iSize)
 {
     Size   = iSize;
     Input1 = new WireSet(iSize);
     Input2 = new WireSet(iSize);
     Output = new WireSet(iSize);
     Input1.ConnectOutput(this);
     Input2.ConnectOutput(this);
 }
Ejemplo n.º 4
0
 public BitwiseDemux(int iSize)
 {
     Size    = iSize;
     Control = new Wire();
     Input   = new WireSet(Size);
     Output1 = new WireSet(Size);
     Output2 = new WireSet(Size);
     Input.ConnectOutput(this);
 }
Ejemplo n.º 5
0
        public BitwiseMultiwayDemux(int iSize, int cControlBits)
        {
            Size    = iSize;
            Input   = new WireSet(Size);
            Control = new WireSet(cControlBits);
            Outputs = new WireSet[(int)Math.Pow(2, cControlBits)];

            for (int i = 0; i < Outputs.Length; i++)
            {
                Outputs[i] = new WireSet(Size);
            }

            Input.ConnectOutput(this);
            Control.ConnectOutput(this);
        }
Ejemplo n.º 6
0
Archivo: Memory.cs Proyecto: boaz23/ECS
        public Memory(int iAddressSize, int iWordSize)
        {
            AddressSize = iAddressSize;
            WordSize    = iWordSize;

            Input   = new WireSet(WordSize);
            Output  = new WireSet(WordSize);
            Address = new WireSet(AddressSize);
            Load    = new Wire();

            Size          = (int)Math.Pow(2, Address.Size);
            m_aiRegisters = new int[Size];

            Address.ConnectOutput(this);
        }
        public void ConnectInput(WireSet wIn)
        {
            if (InputConected)
            {
                throw new InvalidOperationException("Cannot connect a wire to more than one inputs");
            }
            if (wIn.Size != Size)
            {
                throw new InvalidOperationException("Cannot connect two wiresets of different sizes.");
            }

            wIn.ConnectOutput(this);

            InputConected = true;
        }
        public BitwiseMultiwayMux(int iSize, int cControlBits)
        {
            ControlBits = cControlBits;//bug fix

            Size    = iSize;
            Output  = new WireSet(Size);
            Control = new WireSet(cControlBits);
            Inputs  = new WireSet[(int)Math.Pow(2, cControlBits)];

            for (int i = 0; i < Inputs.Length; i++)
            {
                Inputs[i] = new WireSet(Size);
                Inputs[i].ConnectOutput(this);
            }
            Control.ConnectOutput(this);
        }