Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int setAluControl(int AluOP, int Funct)
- {
- int AluControl = 0;
- if (AluOP == 00)
- { AluControl = 0b010; // Add
- }
- else
- {
- if(AluOP == 0b01)
- {
- AluControl = 0b110; // Sub
- }
- else
- {
- if(AluOP == 0b10)
- {
- switch(Funct)
- {
- case 100000: AluControl = 0b010; break; // Add
- case 100010: AluControl = 0b110; break; // Sub
- case 100100: AluControl = 0b000; break; // And
- case 100101: AluControl = 0b001; break; // Or
- case 101010: AluControl = 0b111; break; // Slt
- }
- }
- else
- {
- AluControl = 0b101; // Undefined
- }
- }
- }
- return AluControl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement