Q1)

A)

from the green card:

codeWidth (bits)Binary
i) opcode (lw)70000011
ii) rd (x14)501110
iii) rs1 (x10)501010
iv) imm[11:0] (16)12000000010000
v) we know its in the format `imm[11:0]rs1funct3
  • 00000001000001010010011100000011

B)

converting from binary to hexadecimal and grouping we get 0x01052703

C)

from part b we get the hex then we get each digit and multiply it by to get the unsigned decimal

    • Unsigned decimal = 17 114 883

Q2)

A)

im going to use the method of dividing by 2 then taking the remainder as the bit and since we are dividing by 2 we read from bottom as msb and top as lsb

StepQuotientRemainder (bit)
28 215 603 ÷ 214 107 8011
14 107 801 ÷ 27 053 9001
7 053 900 ÷ 23 526 9500
3 526 950 ÷ 21 763 4750
1 763 475 ÷ 2881 7371
881 737 ÷ 2440 8681
440 868 ÷ 2220 4340
220 434 ÷ 2110 2170
110 217 ÷ 255 1081
55 108 ÷ 227 5540
27 554 ÷ 213 7770
13 777 ÷ 26 8881
6 888 ÷ 23 4440
3 444 ÷ 21 7220
1 722 ÷ 28610
861 ÷ 24301
430 ÷ 22150
215 ÷ 21071
107 ÷ 2531
53 ÷ 2261
26 ÷ 2130
13 ÷ 261
6 ÷ 230
3 ÷ 211
1 ÷ 201
then reading from msb to lsb we get `00000001 10101110 10001001 00110011
`

B)

for this we can group them into 4 nibbles :) then get their corresponding hex value by knowing each 4 bits giving 16 in length

BinaryHex
00000
00011
1010A
1110E
10008
10019
00113
00113
then adding the 0x telling it the numbers are hex we get 0x01AE8933

C)

i)
  • to find the operation we can look at the last 7 bits first to determine the opcode as its the same for all types of instructions, and then first 7 to determine if its a funct7 or an immediate
    • 00000001 10101110 10001001 00110011 and looking at this we can see the last 7 being indicative of an r type so we check the first 7 bits for operation, which matches add
ii)
  • to find the destination its the rd, and that is the 11th bit to the 7th bit which is 10010 which gives us x18 register
iii)
  • to find the 2 sources we can find using the bits for rs1 19-15 and rs2 24-20 and converting that to decimal gives us x29, x26

iv)

  • thus the full operation is
    • add x18, x29, x26

3-4)

  • i would love to do a full write up for 3-4 but i just dont have time, and since they are not marked im not going to post them sorry </3 if they are supposed to be marked but as a mistake or smth
    • here is my proof if you would like it ill do it :) because practice is good