Question: Simulate the following program by converting each instruction to corresponding machine code. Then store the machine code in memory starting from location 1 0 :
Simulate the following program by converting each instruction to corresponding machine code. Then store the
machine code in memory starting from location : module SIMCOMP clock PC IR MBR AC MAR;
input clock;
output PC IR MBR AC MAR;
reg : IR MBR AC;
reg : PC MAR;
reg : Memory :;
reg : state;
parameter load b storeb addb;
initial begin
program
Memory h;
Memory h;
Memory hB;
data at byte addres
Memory d;
Memory d;
set the program counter to the start of
PC ; state ;
end
always @posedge clock begin
case state
: begin
MAR PC;
state;
end
: begin fetch the instruction from mem
IR MemoryMAR;
PC PC ;
state; next state
end
: begin Instruction decode
MAR IR:;
state;
end
: begin Operand fetch
state;
case IR:
load : MBR MemoryMAR ;
add : MBR MemoryMAR ;
store: MBRAC;
endcase
end
: begin execute
if IR:h begin
AC ACMBR;
state ;
end
else if IR :h begin
AC MBR;
state ; next state
end
else if IR:hB begin
Memory MAR MBR;
state ;
end
end
endcase
end
endmodule
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
