4.48
Take the finger stage
Icode:ifun = m1[pc] = c:0
RA:RB <= M1[pc+1]
Valc <= M4[pc+2]
Valp <= PC + 6
Decoding phase
Valb <= R[RB]
Implementation phase
ValE <= Valb + valc
Setcc
Visit stage
Write Back Stage
R[RB] <= ValE
4.50
Take a finger
BOOL Need_regids =
Icode in {irrmovl, IOPL, IPUSHL, IPOPL,
IIRMOVL, IRMMOVL, IMRMOVL, IADDL
};
BOOL Need_valc =
Icode in {iirmovl, IRMMOVL, IMRMOVL, Ijxx, ICALL, IADDL
};
Decoding and writeback
int Srca = [
Icode in {irrmovl, IRMMOVL, IOPL, IPUSHL}: RA;
Icode in {Ipopl,iret}: RESP;
1:rnone; # Don ' t need register
];
int SrcB = [
Icode in {IOPL, IRMMOVL, IMRMOVL, iaddl}: RB;
Icode in {IPUSHL, IPOPL, ICALL, IRET}: RESP;
Icode in {ileave}: REBP;
1:rnone; # Don ' t need register
];
int dste = [
Icode in {IRRMOVL} && cnd:rb;
Icode in {iirmovl, IOPL, iaddl}: RB;
Icode in {IPUSHL, IPOPL, ICALL, IRET, ileave}: RESP;
1:rnone; # Don ' t write any register
];
int dstm = [
Icode in {imrmovl, Ipopl}:ra;
Icode in {ileave}: REBP;
1:rnone; # Don ' t write any register
];
Perform
int AluA = [
Icode in {IRRMOVL, IOPL}: ValA;
Icode in {iirmovl, IRMMOVL, IMRMOVL, iaddl}: Valc;
Icode in {ICALL, ipushl}:-4;
Icode in {IRET, IPOPL, Ileave}:4;
# Other instructions don ' t need ALU
];
int alub = [
Icode in {irmmovl, IMRMOVL, IOPL, ICALL,IPUSHL, IRET, IPOPL, Ileave, iaddl}: Valb;
Icode in {irrmovl, iirmovl}:0;
# Other instructions don ' t need ALU
];
BOOL SET_CC = Icode in {IOPL, iaddl};
Visit
int mem_addr = [
Icode in {irmmovl, IPUSHL, ICALL, IMRMOVL}: ValE;
Icode in {ipopl, IRET}: ValA;
Icode in {ileave}: valb;
# Other instructions don ' t need address
];
BOOL Mem_read = Icode in {imrmovl, IPOPL, IRET, ileave};
Homework Fourth Chapter