Original German, Korean translation, method, source-grounded solution, recall-answer audit, wrong-answer explanations, active recall, and source citations are separated below.
visual check
needs_visual_verification: Aufgabe 5 exact diagram overlay remains unverified; textual datapath path and signals are source-checked.
Eintakt-Skizze means the complete single-cycle datapath from Vorlesung Teil 2. The instruction is the RISC-V load word, normalized as lw rd, imm(rs1): load the 32-bit word at address rs1 + SignExt(imm[11:0]) into register rd.
The recalled solution image is not an official solution. Use it only as a visual memory aid after verifying the datapath independently.
한국어 문제
Vorlesung의 Eintakt-Prozessor 스케치가 주어져 있었다.
그 다음 빈 스케치에 lw rd, imm(rs1) 명령어가 실제로 사용하는 연결선을 그려 넣어야 한다.
즉, PC로 Instruktion을 가져오고, rs1을 Register File에서 읽고, I-type immediate를 sign-extend한 뒤, ALU에서 rs1 + imm을 계산하고, 그 주소로 Data Memory를 읽고, 읽은 데이터를 rd로 writeback하는 경로를 표시해야 한다. 동시에 다음 명령어를 위해 PC + 4 경로도 사용된다.
한 줄 핵심
lw의 active datapath는 Instr fetch → rs1/imm → ALU address → Data Memory read → rd writeback이며 PC+4도 갱신한다.
0. 초보자 개념 다리
lw는 주소(rs1+imm)를 만들고 Data Memory에서 값을 가져와 rd 서랍에 넣는 경로다.
1. 이 문제의 풀이 루틴
Fetch와 PC+4 경로를 표시한다.
rs1과 sign-extended immediate를 ALU 입력으로 고른다.
ALU 주소를 Data Memory로 보낸다.
read data를 ResultSrc로 골라 rd에 쓴다.
경로와 control signal을 대조한다.
2. 왜 이 방법이 맞을까?
데이터 흐름을 먼저 그리면 각 control이 어떤 mux 선택/write enable인지 인과적으로 결정된다.
3. 시험장 실수 방지
lw는 MemWrite=0이며 writeback 값은 memory read data다.
최대 상세 해설 · Aufgabe 5 깊이 학습: `lw`를 Eintakt-Datenpfad 위에 그리기
이 강의의 도착점
lw rd,imm(rs1)의 architectural 의미를 instruction fetch, register read, immediate extension, address calculation, memory read, writeback, PC update로 분해하고, single-cycle sketch에서 실제로 쓰는 연결과 mux/control 선택을 독립적으로 설명한다.
0. 정말 아무것도 모른다면 여기서 시작
이 문제는 그림을 암기하는 문제가 아니라 한 줄의 명령 의미를 데이터의 여행 경로로 번역하는 문제다. 먼저 R[rd] ← DataMemory[R[rs1]+SignExt(imm)]를 쓰고, 식의 각 부분이 어느 회로 블록에서 만들어지는지 연결한다.
lw는 memory instruction이지만 끝점은 Data Memory가 아니다. memory에서 읽은 word가 writeback mux를 지나 Register File의 rd에 기록되어야 명령이 끝난다.
SoSe25 문제와 solution image는 공식 Klausur·공식 Lösung이 아닌 Gedächtnisprotokoll의 회상 자료다. 아래의 textual datapath와 control 값은 현행 Vorlesung Teil 2와 Übung/Lösung 5–6으로 검증했지만, 당시 주어진 빈 그림 위에서 선이 지나가는 정확한 위치는 아직 visual verification이 필요하다.
강의자료 버전에 따라 ResultSrc 표기가 다르다. 구형 1-bit 표에서는 memory 선택을 1, 현행 2-bit 표에서는 ReadData 선택을 01로 쓴다. 답안에서는 주어진 그림의 mux 입력 label을 우선하고 표기 체계를 함께 밝힌다.
1. 문제에 나오는 말부터 하나씩
Eintakt-Prozessor
한 instruction의 fetch부터 writeback까지를 한 clock cycle 안의 combinational path로 완료하는 processor.
Datenpfad
PC, memories, Register File, ALU, mux, extender와 이들을 잇는 wire처럼 데이터가 실제로 흐르는 구조.
lw rd,imm(rs1)
주소 R[rs1]+SignExt(imm)에서 32-bit word를 읽어 R[rd]에 쓰는 RV32I load instruction.
effective address
Data Memory에 전달할 실제 주소. ALU가 base register R[rs1]과 sign-extended immediate를 더해 만든다.
Extend Unit / ImmSrc
instruction의 immediate field를 32 bit로 sign-extend하는 블록과 format 선택 신호. lw는 I-type immediate를 선택한다.
ALUSrc
ALU의 두 번째 입력으로 Register File의 RD2와 ImmExt 중 무엇을 보낼지 정하는 mux 선택. lw는 immediate를 선택한다.
ResultSrc
Register File writeback data를 고르는 mux 선택. lw는 ALU 주소가 아니라 Data Memory의 ReadData를 선택한다.
RegWrite / MemWrite
RegWrite는 rd 갱신 허용, MemWrite는 Data Memory 쓰기 허용이다. load에서는 각각 1과 0이다.
PC+4 path
branch나 jump가 아닌 다음 순차 instruction으로 진행하기 위해 현재 PC에 4를 더해 다시 PC에 넣는 경로.
2. 선생님과 같이 한 칸씩 푸는 과정
그림에 선을 긋기 전에 의미식을 쓴다: EA=R[rs1]+SignExt(imm), ReadData=Mem[EA], R[rd]=ReadData, PCnext=PC+4.
Instruction fetch를 표시한다. 현재 PC가 Instruction Memory의 address로 들어가고, 출력 Instr가 Register File, Extend Unit, Control Unit으로 갈라진다.
Register File에서 RD1=R[rs1]을 읽는다. lw에는 의미 있는 rs2 source가 없으므로 RD2에서 Data Memory write-data로 가는 선은 active path가 아니다.
Instr[31:20]을 Extend Unit에 보내 sign-extension한 ImmExt를 만든다. 현행 강의 표에서 I-type 선택은 ImmSrc=00이다.
ALU의 A 입력에는 RD1, B 입력에는 ALUSrc mux를 통해 ImmExt를 넣는다. ALUSrc=1, ALU operation은 add라서 ALUResult=R[rs1]+ImmExt다.
ALUResult를 Data Memory address input으로 보낸다. load는 읽기이므로 simplified lecture datapath에서 MemWrite=0이며, 별도의 MemRead control은 표시되지 않을 수 있다.
Data Memory의 ReadData를 result mux로 보내고, memory input을 선택해 Register File의 WD3로 연결한다. Instr[11:7]이 가리키는 rd에 써야 하므로 RegWrite=1이다.
writeback 선택은 현행 2-bit 표에서 ResultSrc=01, 구형 1-bit 표에서 memory-select ResultSrc=1이다. 숫자만 외우지 말고 그림에서 ReadData 쪽 mux input을 선택했는지 확인한다.
정상 순차 실행을 위해 PC → +4 adder → PCNext mux → PC도 표시한다. lw는 branch/jump가 아니므로 branch target이나 jump path는 선택하지 않는다.
마지막으로 선을 두 색으로 검산한다. data result 경로는 rs1/imm→ALU→Data Memory→rd, instruction progress 경로는 PC→PC+4→PC다.
3. 그래서 정답은 무엇인가?
lw rd,imm(rs1)에서 표시해야 할 textual active path는 다음과 같다.
PC → Instruction Memory → Instr
Instr[19:15] → Register File A1 → RD1 → ALU SrcA
Instr[31:20] → Extend Unit → ImmExt → ALUSrc mux → ALU SrcB
ALU(add) → ALUResult → Data Memory Address
Data Memory ReadData → ResultSrc mux → Register File WD3
Instr[11:7] → Register File A3
PC → +4 adder → PCNext mux → PC
현행 2-bit 제어표 기준 핵심은 RegWrite=1, ImmSrc=00, ALUSrc=1, MemWrite=0, ResultSrc=01, Branch=0, ALUOp=00, Jump=0, PCSrc=0이며 add를 나타내는 구체 ALU control은 현행 3-bit 표에서 000이다. 구형 1-bit ResultSrc 그림이면 memory input 선택을 1로 표기한다. RD2→Data Memory WriteData, ALUResult→WD3, branch target path는 active lw 경로가 아니다. 이 텍스트 답은 현행 자료로 검증됐지만, 회상된 SoSe25 빈 그림 위의 정확한 overlay는 아직 공식적으로/시각적으로 검증되지 않았다.
4. 이제 정확한 개념으로 한 단계 더 깊게
lw의 datapath는 식을 왼쪽에서 오른쪽으로 구현한다. base와 immediate가 주소를 만들고, 주소가 memory word를 고르며, 그 word가 destination register에 들어간다.
Instruction Memory와 Data Memory는 역할이 다르다. 전자는 PC로 instruction을 읽고, 후자는 ALU가 만든 effective address로 program data를 읽는다.
ALUResult를 Data Memory address로 연결하고, memory write enable이 0임을 적는다.
ReadData를 writeback mux를 거쳐 WD3로 연결하고 A3=rd, RegWrite=1을 적는다.
별도의 정상 next-PC 경로 PC+4를 표시하고 branch/jump 선택이 아님을 확인한다.
주어진 표가 1-bit인지 2-bit인지 보고 ResultSrc 표기를 결정하되, 반드시 ‘memory ReadData 선택’이라는 의미를 함께 쓴다.
검산 질문을 한다: 최종 rd에는 주소가 들어가는가, memory word가 들어가는가? 정답은 memory word다.
6. 예시와 변형 문제 연결
R[x8]=0x1000, imm=12, DataMemory[0x100C]=0xDEADBEEF, rd=x5라면 ALU는 0x100C를 만든다. Data Memory가 0xDEADBEEF를 내보내고 최종 R[x5]에는 0xDEADBEEF가 기록된다.
R[x8]=0x2000, imm=-4라면 sign-extension 뒤 ALU B 입력은 32-bit -4이고 effective address는 0x1FFC다. zero-extension하면 잘못된 큰 양수 주소가 되므로 sign-extension 경로가 중요하다.
같은 base와 immediate라도 sw x5,12(x8)이면 ALU 주소 계산까지는 비슷하지만 RD2=R[x5]가 Data Memory write-data로 가고 MemWrite=1, RegWrite=0이다. 이 대비로 load/store를 구분할 수 있다.
잘못해서 result mux가 ALUResult를 선택하면 앞의 첫 예에서 x5=0x100C가 된다. 이는 주소를 register에 쓴 것이므로 lw 의미 x5=0xDEADBEEF와 다르다.
그림에 별도 MemRead 신호가 없다면 임의로 하나를 추가하지 않는다. 이 강의의 simplified model에서는 read output이 combinationally 제공되고 MemWrite가 쓰기만 제어한다.
7. 독일어 만점 답안 템플릿
Für lw rd,imm(rs1) lese ich rs1 aus dem Register File und erweitere das I-Typ-Immediate mit Vorzeichen. Die ALU addiert RD1 und ImmExt; ihr Ergebnis adressiert den Datenspeicher. Dessen ReadData wird über den Result-Multiplexer nach WD3 geführt und mit RegWrite=1 in rd geschrieben. Gleichzeitig wird der PC über den PC+4-Pfad aktualisiert. Im aktuellen 2-Bit-Schema gilt: RegWrite=1, ImmSrc=00, ALUSrc=1, MemWrite=0, ResultSrc=01, Branch=0, ALUOp=00, Jump=0; bei einem älteren 1-Bit-ResultSrc-Schema bedeutet ResultSrc=1 die Auswahl von ReadData. Die exakte Linienlage auf dem erinnerten SoSe25-Bild ist weiterhin nicht offiziell verifiziert.
8. 자주 나오는 오답과 교정
RD2를 Data Memory write-data에 active하게 연결하기: 이것은 sw 경로이며 lw에는 의미 있는 rs2 operand가 없다.
ALUSrc=0으로 두기: 그러면 ALU B에 immediate가 아니라 RD2가 들어가 effective address가 틀린다.
ALUResult를 그대로 rd에 쓰기: ALUResult는 주소이고, lw의 최종 값은 Data Memory의 ReadData다.
memory instruction이라는 이유로 MemWrite=1 쓰기: lw는 읽기이고 memory write는 하지 않는다.
RegWrite=0 쓰기: load의 목적은 읽은 word를 destination register에 기록하는 것이다.
immediate를 zero-extend하기: 음수 offset을 사용하는 load에서 주소가 완전히 달라진다.
PC+4 경로를 빼먹기: data access와 별도로 다음 순차 instruction으로 진행해야 한다.
모든 자료에서 ResultSrc 숫자가 같다고 단정하기: 구형 1-bit와 현행 2-bit 표기를 구분하고 mux input 의미로 확인해야 한다.
회상 solution image의 선을 공식 정답으로 간주하기: 현행 자료로 검증된 것은 textual path와 control 의미이며 exact overlay는 아직 visual verification 대상이다.
9. 답을 보지 않고 확인하기
lw rd,imm(rs1)의 architectural 의미를 한 줄 식으로 쓰라.
ALU의 두 입력에는 각각 무엇이 들어가며 어떤 연산을 하는가?
ALUResult와 Data Memory의 ReadData는 각각 어떤 역할을 하는가?
왜 MemWrite=0이면서도 Data Memory 경로가 active할 수 있는가?
현행 2-bit control table에서 RegWrite, ALUSrc, ResultSrc는 각각 얼마이며 무엇을 선택하는가?
rs2/RD2 경로가 lw의 active semantic path가 아닌 이유는 무엇인가?
이 가이드에서 아직 검증되지 않았다고 명시한 부분은 무엇인가?
확인문제 정답 보기
R[rd] ← DataMemory[R[rs1] + SignExt(imm[11:0])]이며 정상 다음 PC는 PC+4다.
A 입력은 RD1=R[rs1], B 입력은 ImmExt이고 ALU는 두 값을 더해 effective address를 만든다.
ALUResult는 Data Memory 주소이고, ReadData는 그 주소에서 읽어 최종적으로 rd에 쓸 word다.
MemWrite는 쓰기 enable만 제어한다. simplified model의 memory read output은 load에서 사용되면서도 write enable은 0일 수 있다.
lw는 I-type이라 bits 31:20이 immediate이고 두 번째 source register를 memory에 쓸 필요가 없기 때문이다.
회상된 SoSe25 빈 datapath 그림 위에서 정확히 어느 선을 어떤 위치로 그렸는지에 대한 visual overlay다. Textual path와 control 의미는 현행 자료로 검증됐다.
Interactive practice
lw active datapath
Next로 lw의 data flow를 따라가거나 component를 눌러 역할을 확인하세요.
Intro
Status note: This page is built from an unverified recall reconstruction, not official exam material and not an official solution. The textual datapath and control-signal answer is verified against current SS26 sources; the exact hosted recall images still need visual verification.
Metadata
Field
Value
Aufgabe
5
Titel
Eintakt-Prozessor
Punkte
6
Empfohlene Zeit
6 Minuten
Konzepte
Ein-Takt-Prozessor, single-cycle datapath, lw rd, imm(rs1), muxes, ALU, Data Memory, Writeback, Control Unit
Tutor-Modus
datapath
Recall-source confidence
mittel: Aufgabenstellung klar, Lösung nur als Bild rekonstruiert
Verification status
needs_visual_verification for exact drawing; verified_textual_solution for lw path and control signals
Primary current-source checks:
Source
Locator
Used for
Gedächtnisprotokoll Rechnerorganisation SoSe25.md
aufgabe-5, lines 234-251
recalled problem statement and recalled image-only answer
Eintakt-Skizze means the complete single-cycle datapath from Vorlesung Teil 2. The instruction is the RISC-V load word, normalized as lw rd, imm(rs1): load the 32-bit word at address rs1 + SignExt(imm[11:0]) into register rd.
The recalled solution image is not an official solution. Use it only as a visual memory aid after verifying the datapath independently.
Korean Translation
Vorlesung의 Eintakt-Prozessor 스케치가 주어져 있었다.
그 다음 빈 스케치에 lw rd, imm(rs1) 명령어가 실제로 사용하는 연결선을 그려 넣어야 한다.
즉, PC로 Instruktion을 가져오고, rs1을 Register File에서 읽고, I-type immediate를 sign-extend한 뒤, ALU에서 rs1 + imm을 계산하고, 그 주소로 Data Memory를 읽고, 읽은 데이터를 rd로 writeback하는 경로를 표시해야 한다. 동시에 다음 명령어를 위해 PC + 4 경로도 사용된다.
Control Unit은 opcode를 보고 mux 선택선과 write-enable 신호를 정한다.
Key Terms
German / Signal
Korean meaning
In this task
Eintakt-Prozessor
한 명령어가 한 clock cycle에서 완성되는 processor
lw도 fetch부터 writeback까지 한 cycle
Datenpfad
데이터가 지나가는 component와 wire 전체
그려야 하는 핵심
Register File
32개 register 저장 장치
rs1 읽기, rd 쓰기
Extend Unit
immediate를 32-bit로 확장
I-type immediate sign-extension
ALU
산술/논리 연산 장치
effective address rs1 + imm 계산
Data Memory
데이터 메모리
주소에서 word 읽기
ResultSrc
writeback mux 선택
lw에서는 memory read data 선택
ALUSrc
ALU 두 번째 operand 선택
immediate 선택
RegWrite
register file write enable
rd에 쓰므로 1
MemWrite
data memory write enable
load는 읽기만 하므로 0
What Ability Is Tested
이 문제는 "명령어 의미를 회로 경로로 번역할 수 있는가"를 본다. Assembler로 lw를 외우는 것과, lw가 datapath에서 어느 mux를 통과하고 어떤 component를 활성화하는지 아는 것은 다르다.
Why Students Get It Wrong
가장 흔한 실수는 lw를 "memory instruction"이라고만 보고 register writeback을 빼먹는 것이다. lw는 memory를 읽는 명령이지만 최종 결과는 반드시 rd에 써야 한다. 반대로 sw는 memory에 쓰지만 register에는 쓰지 않는다.
Problem Interpretation
Given
Single-cycle datapath sketch from the lecture.
Instruction: lw rd, imm(rs1).
Need to draw used connections.
Find
그림에 표시해야 할 active datapath:
instruction fetch path
register read path for rs1
immediate extraction and sign-extension path
ALU address calculation path
Data Memory read path
writeback path into rd
PC update path to PC + 4
relevant mux selections and control signals
Constraints
Eintakt이므로 모든 것이 한 Takt 안에 combinationally 흘러야 한다.
lw는 I-type load instruction이다.
rs2는 lw에서 source operand로 쓰이지 않는다.
Data Memory는 write하지 않는다.
rd는 반드시 write된다.
Traps
Trap
Why it is tempting
Correct check
Draw rs2 into Data Memory write-data
sw와 헷갈림
lw does not store; rs2 irrelevant
Select ALU input B = RD2
R-type처럼 보임
address uses immediate: ALUSrc = 1
Write ALUResult into rd
address calculation result looks like result
lw writes memory read data, so ResultSrc = memory
Assert MemWrite = 1
memory instruction이라는 말에 속음
load reads memory, store writes memory
Forget PC + 4
data path만 보다 control flow를 빼먹음
every non-branch/jump normal instruction sets next PC to PC + 4
왼쪽에서 오른쪽으로 datapath를 따라간다: PC -> Instruction Memory -> Register File/Extend.
ALU 입력 두 개를 정한다: A는 RD1, B는 ImmExt.
ALU output이 memory address로 간다는 것을 표시한다.
Data Memory의 ReadData가 writeback mux를 통해 WD3로 가는 것을 표시한다.
Control Unit 표를 채운다.
마지막에 사용하지 않는 경로를 지운다: RD2 -> WriteData, branch target, ALUResult writeback 등은 lw 답이 아니다.
Detailed Solution
Step 1: Instruction Fetch
PC가 Instruction Memory의 address input으로 들어간다. Instruction Memory는 현재 instruction word를 combinationally 출력한다. Vorlesung Teil 2 states that the lw example begins with fetching the instruction, and that Instruction Memory reads combinationally.
Active path:
PC -> Instruction Memory -> Instr
At the same time, the normal next-PC path is active:
PC -> +4 adder -> PCNext mux -> PC
For lw, no branch/jump target is selected, so PCSrc = 0 in the usual single-cycle drawing.
Step 2: Decode Fields
For lw rd, imm(rs1), the fields are:
Field
Bits
Used as
opcode
Instr[6:0]
Control Unit recognizes load opcode 0000011
rd
Instr[11:7]
Register File write address A3
funct3
Instr[14:12]
010 for lw in RV32I
rs1
Instr[19:15]
Register File read address A1
imm[11:0]
Instr[31:20]
I-type immediate to Extend Unit
rs2 bits are not a meaningful source operand for lw.
Step 3: Register Read
Register File reads rs1:
Instr[19:15] -> A1
Register File RD1 -> ALU SrcA
A2/RD2 may physically produce some value because the register file has read ports, but it is not semantically used by lw. Do not draw RD2 into memory write-data as an active lw path.
Step 4: Immediate Extension
The immediate is I-type:
Instr[31:20] -> Extend Unit -> ImmExt = SignExt(Instr[31:20])
Control:
ImmSrc = 00
This is verified by Vorlesung Teil 2 pages 34-36: I-type ImmExt = {{20{Instr[31]}}, Instr[31:20]}.
Step 5: Effective Address Calculation
The ALU calculates:
ALUResult = RD1 + ImmExt
Active mux/control:
ALUSrc = 1 # select ImmExt, not RD2
ALUOp = 00 # add
ALUControl = 000 # add, in the 3-bit lecture table
Vorlesung Teil 2 pages 25-30 describe this exact lw sequence: read source operand, sign-extend immediate, compute effective memory address, read memory, write register, and compute PC + 4.
Step 6: Data Memory Read
The address input of Data Memory receives ALUResult.
ALUResult -> Data Memory Address
Data Memory ReadData -> Result mux
Control:
MemWrite = 0
There is no explicit MemRead signal in the lecture's simplified single-cycle datapath table because data memory read is combinational / always available in the model. MemWrite controls only writing. Lösung 5 pages 1-3 and Lösung 6 pages 4-7 both emphasize that MemWrite enables writing to Data Memory; lw is not a write.
ResultSrc = 1 # in the older 1-bit table: select Data Memory
ResultSrc = 01 # in the updated 2-bit table: select ReadData
The current Vorlesung Teil 2 pages 46-48 use the updated 2-bit ResultSrc; the lw row selects memory read data and enables RegWrite.
Step 8: Complete Control Table
Using the updated lecture table with 2-bit ResultSrc:
Signal
Value for lw
Reason
Op
0000011
load opcode
RegWrite
1
write loaded data to rd
ImmSrc
00
I-type immediate Instr[31:20]
ALUSrc
1
ALU B input is immediate
MemWrite
0
load reads memory, does not write
ResultSrc
01
writeback comes from Data Memory read data
Branch
0
not a branch
ALUOp
00
add for address calculation
ALUControl
000
concrete add operation
Jump
0
not jal
PCSrc
0
select PC + 4
If a table still uses the older 1-bit ResultSrc, write ResultSrc = 1 for memory read data. If it uses the updated 2-bit lecture table, write ResultSrc = 01.
Step 9: What To Draw
Draw or highlight these paths:
PC
-> Instruction Memory
-> Instr[19:15] -> Register File A1 -> RD1
-> Instr[31:20] -> Extend Unit -> ImmExt
RD1 -> ALU SrcA
ImmExt -> ALUSrc mux -> ALU SrcB
ALU(add) -> ALUResult -> Data Memory Address
Data Memory ReadData -> ResultSrc mux -> Register File WD3
Instr[11:7] -> Register File A3
PC -> +4 adder -> PCNext mux -> PC
Do not highlight:
RD2 -> Data Memory WriteData
ALUResult -> Register File WD3
Branch target adder -> PC
Zero/Branch decision path
EffectiveAddress = 0x1000 + 12 = 0x100C
ReadData = 0xDEADBEEF
R[x5] <- 0xDEADBEEF
PC <- PC + 4
If your drawn path writes 0x100C into x5, you selected ALUResult instead of ReadData. That is the classic lw writeback error.
Recall-Answer Audit
Audit item
Result
What the file claims
A lecture Eintakt sketch and an empty sketch were given; draw used connections for lw rd, imm(rs1); a solution image is included.
Correct parts
The task topic matches current Vorlesung Teil 2 and Übung 5: single-cycle lw datapath drawing.
Incomplete parts
The recall answer is only an external image, with no official textual explanation or control table.
First possible error
Treating the recalled image as official. It is not official and not enough for verification.
Violated rule if copied blindly
Recall solution must remain unverified unless cross-checked against current sources.
Corrected answer
Textual path and control table above.
Source verification status
lw semantics, mux/control choices, ALU add, memory read, writeback, and PC+4 are verified against current Vorlesung Teil 2 plus Übung/Lösung 5-6. Exact drawing layout remains needs_visual_verification.
Wrong-Answer Explanations
Wrong Answer 1: ResultSrc = ALUResult
Why a student chooses it: The ALU produces the computed address, and many non-load instructions write ALU output to rd.
Why it is wrong: In lw, the ALU output is only the address. The value written to rd is the data read from memory.
Violated rule: lw rd, imm(rs1) means rd = Memory[rs1 + SignExt(imm)], not rd = rs1 + imm.
Fast check: Ask, "Should rd contain an address or the word stored at that address?"
Corrected approach: Select Data Memory ReadData at the Result mux: updated table ResultSrc = 01.
Wrong Answer 2: MemWrite = 1
Why a student chooses it: lw is a memory instruction, so they activate a memory signal.
Why it is wrong: MemWrite enables writing into Data Memory. Load reads memory; store writes memory.
Violated rule: Only store instructions such as sw, sh, sb assert MemWrite.
Fast check: If MemWrite = 1, what value would be stored? lw has no useful rs2 store value.
Corrected approach: MemWrite = 0; Data Memory read data goes to writeback.
Wrong Answer 3: ALUSrc = 0
Why a student chooses it: R-type instructions use two register operands, and the datapath physically has RD2.
Why it is wrong: lw address calculation uses base register plus immediate, not two registers.
Violated rule: Load/store address form is rs1 + SignExt(imm).
Fast check: Where did imm(rs1) go? If the immediate is not in the ALU, you cannot calculate the effective address.
Corrected approach: ALUSrc = 1, selecting ImmExt as ALU input B.
Wrong Answer 4: Forget RegWrite
Why a student chooses it: They focus on memory access and stop once Data Memory is read.
Why it is wrong: lw is useful only because it loads the word into rd.
Violated rule: All load instructions write a destination register.
Fast check: After instruction execution, which architectural state changes? rd and PC.
Updated lecture table: RegWrite=1, ImmSrc=00, ALUSrc=1, MemWrite=0, ResultSrc=01, Branch=0, ALUOp=00. If using older 1-bit ResultSrc, write memory-select as 1.
sw reads both rs1 and rs2; ALU still computes rs1 + imm; RD2 goes to Data Memory write-data; MemWrite=1; RegWrite=0; no memory read-data writeback.
The register receives the effective address, not the memory word. For lw, the address is intermediate state; the architectural destination must receive Memory[address].