Four instruction words are cut at the six fixed places. Find the registers and the immediate of each.
Hardware context: Real RV32I instruction words from the assembler, cut at the six fixed field positions by test code; one 12-bit field widened by zero extension and by sign extension. Reading instruction words in a trace or a memory dump, and specifying an instruction decoder
Four words of RV32I are given in hex and in binary, cut at the six places that never move. Word A has the opcode of arithmetic on two registers. Word B has the opcode of arithmetic with an immediate. Word C is a store, and word D is a load.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Word | Hex | 31 to 25 | 24 to 20 | 19 to 15 | 14 to 12 | 11 to 7 | 6 to 0 |
|---|---|---|---|---|---|---|---|
| A | 00c58533 | 0000000 | 01100 | 01011 | 000 | 01010 | 0110011 |
| B | ffd38313 | 1111111 | 11101 | 00111 | 000 | 00110 | 0010011 |
| C | 00942a23 | 0000000 | 01001 | 01000 | 010 | 10100 | 0100011 |
| D | ff812783 | 1111111 | 11000 | 00010 | 010 | 01111 | 0000011 |
Enter every value in decimal. A register is entered as its number: 7 for x7. For a yes or no question, enter 1 for yes and 0 for no.
| Entry | Your decision |
|---|---|
| RD_OF_A | Which register does word A write? |
| RS1_OF_A | Which register is rs1 of word A? |
| RS2_OF_A | Which register is rs2 of word A? |
| RD_OF_B | Which register does word B write? |
| RS1_OF_B | Which register is rs1 of word B? |
| B_IS_NEGATIVE | Is the immediate of word B negative? |
| B_SIZE | The immediate of word B is minus what number? |
| RS2_OF_C | Which register does word C store? |
| RS1_OF_C | Which register holds the address in word C? |
| OFFSET_OF_C | What is the immediate of word C? |
| RD_OF_D | Which register does word D write? |
| D_IS_NEGATIVE | Is the immediate of word D negative? |
| D_SIZE | The immediate of word D is minus what number? |
| LOW_FIELD_FOR_K | Word C becomes the store sw x9, K(x8), with K from 0 to 2047. Give the value in bits 11 to 7 of the word, as an expression in K. |
Examples
Example 1
RD OF A- Input
Which register does word A write?
- Output
matches = 1
Bits 11 to 7 are 01010, which is 10.
Example 2
RS1 OF A- Input
Which register is rs1 of word A?
- Output
matches = 1
Bits 19 to 15 are 01011, which is 11.
Example 3
RS2 OF A- Input
Which register is rs2 of word A?
- Output
matches = 1
Bits 24 to 20 are 01100, which is 12.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For LOW_FIELD_FOR_K, enter a constant expression using K. Only this entry changes with the parameter. The supported integer range is 20 through 2047, inclusive.
Hints
Hint 1
Name the format of each word from the text. It says which of the six places hold registers.
Hint 2
Turn each register field from binary into a number.
Hint 3
Collect the immediate bits of the format. If bit 31 is 1, the value is negative: take 4096 away.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
14 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 3 problems on this path