/// <summary> /// Fetch and get 32-bit instruction /// </summary> /// <param name="instruction">Fetched instruction</param> void IRV32Fetch32B.Fetch32B() { uint pc_addr = reg_pc.Value & 0xFFFFFFFCU; // Simulate word-address memory address bus InstructionStream?.Seek(pc_addr, SeekOrigin.Begin); byte[] buffer = new byte[4]; InstructionStream?.Read(buffer, 0, 4); // Simulate 32-bit memory data bus // Little endian if (!BitConverter.IsLittleEndian) { Array.Reverse(buffer); } fetchRegister.Value = BitConverter.ToUInt32(buffer); }