For a hypothetical computer (called CRAZY), eachinstruction uses 32 bits (4 byte
ID: 3617274 • Letter: F
Question
For a hypothetical computer (called CRAZY), eachinstruction uses 32 bits (4 bytes). The opcode, which is 8 bitslong, is constructed by concatenating the most significant 4 bitsof the instruction with the least significant 4 bits of theinstruction. As an example, suppose the machine instructionis 8ABCD021 (hex). Notice that the mostsignificant 4 bits are 1000 and the leastsignificant 4 bits are 0001. So, the opcodespecified by the instruction is 10000001(binary),which is 129 in decimal. Write a C functionprint_opcode with the followingheader:
void print_opcode (int instr)
Assume that the int data type is 4-byteslong. The parameter instr to the above functionis an integer that represents a 4-byte instruction for CRAZY. Thefunction must print the opcode specified in the instruction as adecimal integer to stdout.
You need to show only the C code for the abovefunction.
i