Esempio n. 1
0
 /// <summary>
 /// Instantiates an instance of the Processor
 /// </summary>
 /// <param name="bus">IOBus used for communication</param>
 /// <param name="pc">Starting ProgramCounter line to start at</param>
 /// <param name="id">Processor ID</param>
 public ThreadedProcessor(IOBus bus, int pc, int id)
     : base(bus, pc)
 {
     thread = new ThreadManager {
         ID        = id,
         Sequencer = new System.Threading.Thread(this.Process)
     };
 }
Esempio n. 2
0
 /// <summary>
 /// Instantiates an instance of the Processor and starts it immediately
 /// </summary>
 /// <param name="bus">IOBus used for communication</param>
 /// <param name="pc">Starting ProgramCounter line to start at</param>
 /// <param name="id">Processor ID</param>
 /// <param name="autorun">Whether the processor should start processing after instantiation</param>
 public ThreadedProcessor(IOBus bus, int pc, int id, bool autorun)
     : this(bus, pc, id)
 {
     if (autorun)
     {
         this.Run(register.ProgramCounter);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Instantiates a new Processor object, and start the Processor thread
 /// </summary>
 /// <remarks>
 /// Contributors:
 /// Caiden K.
 /// Brad V.
 /// </remarks>
 /// <param name="bus">GUI interface for input and output of data</param>
 public Processor(IOBus bus)
 {
     // Internal component instantiation
     register.Status         = 0;
     register.ProgramCounter = 0;
     register.Accumulator    = 0;
     ALU = new ArithmeticLogicUnit();
     Bus = bus;
 }
Esempio n. 4
0
        public System()
        {
            _mem = new PhysicalMemory(1024);
            _io  = new IOBus();
            _cpu = new Processor(_mem, _io);

            // Attach IO devices
            _fdlp = new FDLP(_mem, _cpu);
            _io.RegisterDevice(1, _fdlp);
        }
Esempio n. 5
0
 /// <summary>
 /// Schedules a processor to be run in the scheduler queue
 /// </summary>
 /// <remarks>
 /// Contributors:
 /// Caiden K.
 /// </remarks>
 public static void ScheduleProcessor(IOBus bus, int id)
 {
     if (processorQueue.ContainsKey(id))
     {
         throw new System.ArgumentException($"Processor with id {id} already exists!");
     }
     // Instantiate a new ThreadedProcessor and insert it into the processorQueue.
     // Set PC to 0 until future development allows custom PC value.
     processorQueue.Add(id, new ThreadedProcessor(bus, 0, id));
 }
Esempio n. 6
0
 /// <summary>
 /// Instantiates a new form instance and creates a new IOBus object for use with processors
 /// </summary>
 public MainForm()
 {
     InitializeComponent();
     bus = new IOBus(ExecuteGUIAction,
                     DisplayMemory,
                     PromptUserForInput,
                     PromptUserForSixDigitInput,
                     DisplayRuntimeData,
                     DisplayOutput);
     ResetForm();
 }
Esempio n. 7
0
        public void TestScheduleProcessor()
        {
            List <ThreadedProcessor> EXPECTED = new List <ThreadedProcessor>();
            IOBus bus = new IOBus();

            Scheduler.ScheduleProcessor(bus, 1);
            Scheduler.ScheduleProcessor(bus, 2);

            // Test, it should throw an exception when attempting to add another
            // procesor with the same ID as previous
            Scheduler.ScheduleProcessor(bus, 1);
        }
Esempio n. 8
0
        public RidgeSystem()
        {
            _scheduler = new Scheduler();

            _mem = new Memory.MemoryController(8192);
            _io  = new IOBus();
            _cpu = new Processor(_mem, _io);
            _mem.AttachCPU(_cpu);

            // Attach IO devices
            _fdlp = new FDLP(0x1, this);
            _io.RegisterDevice(0x1, _fdlp);

            _priamController = new PriamDiskController(0x2, this);
            _io.RegisterDevice(0x2, _priamController);

            //_display = new Display(0x4, this);
            //_io.RegisterDevice(0x4, _display);
            //_io.RegisterDevice(0x5, _display);
        }
Esempio n. 9
0
 /// <summary>
 /// Instantiates a new Processor object, and start the Processor thread
 /// </summary>
 /// <remarks>
 /// Contributors:
 /// Caiden K.
 /// Brad V.
 /// </remarks>
 /// <param name="pc">Starting memory address for the processor to run</param>
 /// <param name="bus">GUI interface for input and output of data</param>
 public Processor(IOBus bus, int pc)
     : this(bus)
 {
     register.ProgramCounter = pc;
 }
Esempio n. 10
0
 public BaseBlock()
 {
     this.inputs    = new IOBus(this);
     this.outputs   = new IOBus(this, false);
     this.IsChanged = true;
 }
Esempio n. 11
0
 public Processor(IPhysicalMemory mem, IOBus io)
 {
     _mem = mem;
     _io  = io;
 }