A load, a store, a branch and a jump run on the full datapath. Say which wires each one uses, and what they carry.
Hardware context: The datapath of ap_rv32_sc for an arithmetic instruction: a PC, the real register file and the real ALU of ap_rv32, an operand select and a write back, with given control signals. Reading the datapath of any processor core
The program below starts at address 0, with 0 in every register. The first two instructions put 8000_0000 into x10. The data memory starts there, and its word at 8000_0004 holds 9. The program runs on the full datapath of the lesson. Addresses of instructions are in decimal here.
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
| Address, in decimal | Instruction |
|---|---|
| 0 | addi x10, x0, 1 |
| 4 | slli x10, x10, 31 |
| 8 | lw x6, 4(x10) |
| 12 | addi x7, x6, 3 |
| 16 | sw x7, 8(x10) |
| 20 | beq x6, x7, 32 |
| 24 | jal x1, 32 |
| 28 | addi x7, x7, 1 |
| 32 | ebreak |
Enter every value in decimal. A control signal is 0 or 1, and result_select is 0, 1 or 2, as in the table of the lesson. For a yes or no question, enter 1 for yes and 0 for no.
| Entry | Your decision |
|---|---|
| LW_ALU_B_SELECT | What is alu_b_select for the lw at address 8? |
| LW_OPERAND_B | What value is on alu_operand_b for that lw? |
| LW_RESULT_SELECT | What is result_select for that lw? |
| LW_MEM_READ | What is mem_read for that lw? |
| LW_ADDRESS_LOW | What are the low 8 bits of dmem_addr for that lw, as a number? |
| LW_USES_RS2_DATA | Does the value on rs2_data reach a register or the memory during that lw? |
| LW_USES_TARGET | Does the PC take the output of the target adder after that lw? |
| SW_REG_WRITE | What is reg_write for the sw at address 16? |
| SW_WDATA | What value is on dmem_wdata for that sw? |
| SW_ADDRESS_LOW | What are the low 8 bits of dmem_addr for that sw? |
| BEQ_CONDITION | What is the output of the branch compare for the beq at address 20? |
| PC_AFTER_BEQ | What is the address of the instruction that runs after that beq? |
| X1_AT_STOP | What does x1 hold when the program stops? |
| JAL_RESULT_SELECT | What is result_select for the jal at address 24? |
| INSTRUCTIONS_RUN | How many instructions run before the ebreak? |
| WORD_FOR_K | The word at 8000_0004 holds K at the start. Give the word at 8000_0008 when the program stops, as an expression in K. |
Examples
Example 1
LW ALU B SELECT- Input
What is alu_b_select for the lw at address 8?
- Output
matches = 1
The address is rs1_data plus the immediate. So the second operand is the immediate.
Example 2
LW OPERAND B- Input
What value is on alu_operand_b for that lw?
- Output
matches = 1
The immediate of lw x6, 4(x10).
Example 3
LW RESULT SELECT- Input
What is result_select for that lw?
- Output
matches = 1
The value for rd comes from the load unit: select 1.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For WORD_FOR_K, enter a constant expression using K. Only this entry changes with the parameter. The supported integer range is 9 through 200, inclusive.
Hints
Hint 1
Name the class of each instruction: load, store, branch or jump. The class fixes the control signals.
Hint 2
For each instruction that writes rd, ask which of three values goes there.
Hint 3
After each instruction, the PC takes the PC plus 4 or the target. Decide which, and why.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
16 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