Exemplo n.º 1
0
        public void Init(string inPath, string outPath = "output.txt")
        {
            Mem = new Memory(CodeStart + CodeMaxLen);
            StreamReader IStream = new StreamReader(inPath);
            BinaryReader reader = new BinaryReader(IStream.BaseStream);
            CodeLen = reader.Read(Mem.Data, CodeStart, CodeMaxLen);
            IStream.Close();

            writer = File.CreateText(outPath);

            Circle = 0;

            CL = new ControlLogic();
            CC = new ControlCode();
            rf = new Registerfile();

            f = new FetchStage();
            d = new DecodeStage();
            e = new ExecuteStage();
            m = new MemoryStage();

            F = new FetchRegister();
            D = new DecodeRegister();
            E = new ExecuteRegister();
            M = new MemoryRegister();
            W = new WritebackRegister();

            F.predPC = CodeStart;
            rf.Data[ConstVar.RESP] = CodeStart;

            f.F = F;
            f.Mem = Mem;
            d.D = D;
            d.rf = rf;
            e.E = E;
            e.CC = CC;
            m.M = M;
            m.Mem = Mem;

            CL.set(D, d, E, e, M);
        }
Exemplo n.º 2
0
 public void set(DecodeRegister D, DecodeStage d, ExecuteRegister E, ExecuteStage e, MemoryRegister M)
 {
     this.D = D;
     this.E = E;
     this.M = M;
     this.d = d;
     this.e = e;
 }