CompOrg Fall 2002 Homework #5 FAQ


Homework #5 FAQ

Question:

For the HCL definitions, I want to use something like RESP, but for register %ebp. What should I use?

Answer:

Assume that REBP is the code for register %ebp

   
Question:

Where are the HCL expressions you want us to change defined?

Answer:

Most are from the lecture notes (or text), some are exercises found in the text (the answers are also in the text). I've gathered them all together - here they are:

NameHCL
need_regids
bool need_regids =
        icode in { IRRMOVL, IOPL, IPUSHL, IPOPL, 
                     IIRMOVL, IRMMOVL, IMRMOVL };
srcA
int srcA = [
        icode in { IRRMOVL, IRMMOVL, IOPL, IPUSHL  } : rA;
        icode in { IPOPL, IRET } : RESP;
        1 : RNONE; # Don't need register
];
srcB
int srcB = [
        icode in { IOPL, IRMMOVL, IMRMOVL  } : rB;
        icode in { IPUSHL, IPOPL, ICALL, IRET } : RESP;
        1 : RNONE;  # Don't need register
];
dstE
int dstE = [
        icode in { IRRMOVL, IIRMOVL, IOPL} : rB;
        icode in { IPUSHL, IPOPL, ICALL, IRET } : RESP;
        1 : RNONE;  # Don't need register
];
aluA
int aluA = [
        icode in { IRRMOVL, IOPL } : valA;
        icode in { IIRMOVL, IRMMOVL, IMRMOVL } : valC;
        icode in { ICALL, IPUSHL } : -4;
        icode in { IRET, IPOPL } : 4;
];
aluB
int aluB = [
        icode in { IRMMOVL, IMRMOVL, IOPL, ICALL, 
                      IPUSHL, IRET, IPOPL } : valB;
        icode in { IRRMOVL, IIRMOVL } : 0;
];
alufun
int alufun = [
        icode == IOPL : ifun;
        1 : ALUADD;
];
mem_addr
int mem_addr = [
        icode in { IRMMOVL, IPUSHL, ICALL, IMRMOVL } : valE;
        icode in { IPOPL, IRET } : valA;
];
new_pc
int new_pc = [
        icode == ICALL : valC;
        icode == IJXX && Bch : valC;
        icode == IRET : valM;
        1 : valP;
];