SoSe25 Exam Overview

Aufgabe 5 · 6 points · datapath

Aufgabe 5 - Eintakt-Prozessor

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.

Related Concepts and Current Sources

Weak-topic hook

No active weak-topic rows currently map to this Aufgabe.

Subproblem learning view

소문제별 1타 강사식 풀이 교실

문제를 읽은 직후 필요한 개념을 직관적으로 잡고, 같은 순서로 손풀이를 재현하도록 구성했습니다.

Teilaufgabe

5

6 points

Original German

Recalled German

Die Eintakt-Skizze aus der VL war gegeben:

https://md.darmstadt.ccc.de/uploads/f5bedb3e-3adc-4eb8-8727-915149fefd79.png

Zeichne die genutzten Verbindungen der Instruktion lw rd, imm(rs1) in die folgende Skizze ein:

https://md.darmstadt.ccc.de/uploads/4de5544d-135d-4a18-a12f-7811ab148d2c.png

Recall source then gives only Lösung mit Bild:

https://md.darmstadt.ccc.de/uploads/b0bd67a5-2906-402d-9d63-7b0ac18842ed.png

Normalization Note

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. 이 문제의 풀이 루틴

  1. Fetch와 PC+4 경로를 표시한다.
  2. rs1과 sign-extended immediate를 ALU 입력으로 고른다.
  3. ALU 주소를 Data Memory로 보낸다.
  4. read data를 ResultSrc로 골라 rd에 쓴다.
  5. 경로와 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의 RD2ImmExt 중 무엇을 보낼지 정하는 mux 선택. lw는 immediate를 선택한다.
ResultSrc
Register File writeback data를 고르는 mux 선택. lw는 ALU 주소가 아니라 Data Memory의 ReadData를 선택한다.
RegWrite / MemWrite
RegWriterd 갱신 허용, MemWrite는 Data Memory 쓰기 허용이다. load에서는 각각 1과 0이다.
PC+4 path
branch나 jump가 아닌 다음 순차 instruction으로 진행하기 위해 현재 PC에 4를 더해 다시 PC에 넣는 경로.

2. 선생님과 같이 한 칸씩 푸는 과정

  1. 그림에 선을 긋기 전에 의미식을 쓴다: EA=R[rs1]+SignExt(imm), ReadData=Mem[EA], R[rd]=ReadData, PCnext=PC+4.
  2. Instruction fetch를 표시한다. 현재 PC가 Instruction Memory의 address로 들어가고, 출력 Instr가 Register File, Extend Unit, Control Unit으로 갈라진다.
  3. field를 붙인다. Instr[19:15]rs1이므로 Register File의 read address A1, Instr[11:7]rd이므로 write address A3, Instr[31:20]은 I-type immediate다.
  4. Register File에서 RD1=R[rs1]을 읽는다. lw에는 의미 있는 rs2 source가 없으므로 RD2에서 Data Memory write-data로 가는 선은 active path가 아니다.
  5. Instr[31:20]을 Extend Unit에 보내 sign-extension한 ImmExt를 만든다. 현행 강의 표에서 I-type 선택은 ImmSrc=00이다.
  6. ALU의 A 입력에는 RD1, B 입력에는 ALUSrc mux를 통해 ImmExt를 넣는다. ALUSrc=1, ALU operation은 add라서 ALUResult=R[rs1]+ImmExt다.
  7. ALUResult를 Data Memory address input으로 보낸다. load는 읽기이므로 simplified lecture datapath에서 MemWrite=0이며, 별도의 MemRead control은 표시되지 않을 수 있다.
  8. Data Memory의 ReadData를 result mux로 보내고, memory input을 선택해 Register File의 WD3로 연결한다. Instr[11:7]이 가리키는 rd에 써야 하므로 RegWrite=1이다.
  9. writeback 선택은 현행 2-bit 표에서 ResultSrc=01, 구형 1-bit 표에서 memory-select ResultSrc=1이다. 숫자만 외우지 말고 그림에서 ReadData 쪽 mux input을 선택했는지 확인한다.
  10. 정상 순차 실행을 위해 PC → +4 adder → PCNext mux → PC도 표시한다. lw는 branch/jump가 아니므로 branch target이나 jump path는 선택하지 않는다.
  11. 마지막으로 선을 두 색으로 검산한다. 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를 읽는다.
  • I-type lw에서 rs1=Instr[19:15], rd=Instr[11:7], imm=Instr[31:20]이다. instruction의 bits 24:20이 겉으로 rs2 위치처럼 보여도 lw에서는 immediate의 일부다.
  • sign extension은 음수 offset을 올바르게 만든다. 예를 들어 immediate -4는 32-bit에서도 -4가 되어 base보다 4 작은 주소를 계산한다.
  • ALUSrcResultSrc는 서로 다른 질문에 답한다. 전자는 ALU에 무엇을 넣는가, 후자는 register에 무엇을 되돌려 쓰는가를 정한다.
  • ALUResult는 lw의 최종 architectural result가 아니라 중간 주소다. 최종 rd 값은 그 주소에서 Data Memory가 읽은 ReadData다.
  • MemWrite=0은 memory가 사용되지 않는다는 뜻이 아니다. 쓰기만 금지하며, read data는 load 경로에서 사용된다.
  • RegWrite=1lw의 필수 조건이다. load와 store를 구분하는 빠른 기준은 load가 register를 쓰고 store가 memory를 쓴다는 점이다.
  • Eintakt에서는 PC→Instruction Memory→Register File/Extend→ALU→Data Memory→Result mux→Register File가 한 cycle 안에 끝나야 하므로 lw가 긴 critical path의 대표가 된다.
  • control bit의 숫자 encoding은 그림/강의 버전에 따라 달라질 수 있으나 의미는 변하지 않는다. 답안에서 mux의 실제 선택 input을 함께 쓰면 표기 차이에도 강하다.

5. 시험장에서 그대로 쓰는 단계별 풀이

  1. 문제 옆에 R[rd]←Mem[R[rs1]+SignExt(imm)]PCnext=PC+4를 먼저 쓴다.
  2. 그림에서 PC, Instruction Memory, Register File, Extend, ALU, Data Memory, Result mux를 찾아 번호를 붙인다.
  3. instruction field 세 개 rs1, rd, imm의 wire를 먼저 표시하고 rs2 경로는 제외한다.
  4. ALU input A를 RD1, input B를 ImmExt로 선택하고 연산 add를 적는다.
  5. ALUResult를 Data Memory address로 연결하고, memory write enable이 0임을 적는다.
  6. ReadData를 writeback mux를 거쳐 WD3로 연결하고 A3=rd, RegWrite=1을 적는다.
  7. 별도의 정상 next-PC 경로 PC+4를 표시하고 branch/jump 선택이 아님을 확인한다.
  8. 주어진 표가 1-bit인지 2-bit인지 보고 ResultSrc 표기를 결정하되, 반드시 ‘memory ReadData 선택’이라는 의미를 함께 쓴다.
  9. 검산 질문을 한다: 최종 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. 답을 보지 않고 확인하기

  1. lw rd,imm(rs1)의 architectural 의미를 한 줄 식으로 쓰라.
  2. ALU의 두 입력에는 각각 무엇이 들어가며 어떤 연산을 하는가?
  3. ALUResult와 Data Memory의 ReadData는 각각 어떤 역할을 하는가?
  4. MemWrite=0이면서도 Data Memory 경로가 active할 수 있는가?
  5. 현행 2-bit control table에서 RegWrite, ALUSrc, ResultSrc는 각각 얼마이며 무엇을 선택하는가?
  6. rs2/RD2 경로가 lw의 active semantic path가 아닌 이유는 무엇인가?
  7. 이 가이드에서 아직 검증되지 않았다고 명시한 부분은 무엇인가?
확인문제 정답 보기
  1. R[rd] ← DataMemory[R[rs1] + SignExt(imm[11:0])]이며 정상 다음 PC는 PC+4다.
  2. A 입력은 RD1=R[rs1], B 입력은 ImmExt이고 ALU는 두 값을 더해 effective address를 만든다.
  3. ALUResult는 Data Memory 주소이고, ReadData는 그 주소에서 읽어 최종적으로 rd에 쓸 word다.
  4. MemWrite는 쓰기 enable만 제어한다. simplified model의 memory read output은 load에서 사용되면서도 write enable은 0일 수 있다.
  5. RegWrite=1rd 쓰기, ALUSrc=1은 immediate 선택, ResultSrc=01은 Data Memory ReadData 선택이다.
  6. lw는 I-type이라 bits 31:20이 immediate이고 두 번째 source register를 memory에 쓸 필요가 없기 때문이다.
  7. 회상된 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

FieldValue
Aufgabe5
TitelEintakt-Prozessor
Punkte6
Empfohlene Zeit6 Minuten
KonzepteEin-Takt-Prozessor, single-cycle datapath, lw rd, imm(rs1), muxes, ALU, Data Memory, Writeback, Control Unit
Tutor-Modusdatapath
Recall-source confidencemittel: Aufgabenstellung klar, Lösung nur als Bild rekonstruiert
Verification statusneeds_visual_verification for exact drawing; verified_textual_solution for lw path and control signals

Primary current-source checks:

SourceLocatorUsed for
Gedächtnisprotokoll Rechnerorganisation SoSe25.mdaufgabe-5, lines 234-251recalled problem statement and recalled image-only answer
Vorlesung\Rechnerorganisation - Teil 2.pdfpages 25-30official lw single-cycle steps: fetch, register read, sign-extend, address, memory read, PC+4
Vorlesung\Rechnerorganisation - Teil 2.pdfpages 34-36full single-cycle processor, Control Unit, ImmSrc definition for I/S/B immediates
Vorlesung\Rechnerorganisation - Teil 2.pdfpages 40-42ALU decoder and main decoder for lw, sw, R-type, beq
Vorlesung\Rechnerorganisation - Teil 2.pdfpages 46-48updated main decoder with 2-bit ResultSrc; lw row
Uebung\Übung 5.pdfpages 1-3exercise asks for datapath drawing and control table in single-cycle processor
Uebung\Lösung 5.pdfpages 1-3definitions of Instruction Memory, Register File, Control Unit, Data Memory, MemWrite, RegWrite
Uebung\Lösung 5.pdfpages 4-6official style for datapath drawing and control table; sw table used as contrast
Uebung\Übung 6.pdfpages 1-5single-cycle control signals, critical path, defective MemWrite task
Uebung\Lösung 6.pdfpages 1-3ImmSrc, main decoder, ALU decoder, critical path and lw as longest path
Uebung\Lösung 6.pdfpages 4-7MemWrite meaning, ResultSrc/writeback-related signal reasoning
Uebung\RISC-V Reference.pdfpages 1-2lw rd, imm(rs1) semantics and I-type field layout

Original German

Recalled German

Die Eintakt-Skizze aus der VL war gegeben:

https://md.darmstadt.ccc.de/uploads/f5bedb3e-3adc-4eb8-8727-915149fefd79.png

Zeichne die genutzten Verbindungen der Instruktion lw rd, imm(rs1) in die folgende Skizze ein:

https://md.darmstadt.ccc.de/uploads/4de5544d-135d-4a18-a12f-7811ab148d2c.png

Recall source then gives only Lösung mit Bild:

https://md.darmstadt.ccc.de/uploads/b0bd67a5-2906-402d-9d63-7b0ac18842ed.png

Normalization Note

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 경로도 사용된다.

Concept Lesson

Prerequisites

이 문제를 풀려면 세 가지를 알아야 한다.

  1. lw rd, imm(rs1)의 의미: rd = Memory[rs1 + SignExt(imm)]
  2. Eintakt에서는 한 Instruktion이 한 Takt 안에서 끝난다.
  3. Control Unit은 opcode를 보고 mux 선택선과 write-enable 신호를 정한다.

Key Terms

German / SignalKorean meaningIn this task
Eintakt-Prozessor한 명령어가 한 clock cycle에서 완성되는 processorlw도 fetch부터 writeback까지 한 cycle
Datenpfad데이터가 지나가는 component와 wire 전체그려야 하는 핵심
Register File32개 register 저장 장치rs1 읽기, rd 쓰기
Extend Unitimmediate를 32-bit로 확장I-type immediate sign-extension
ALU산술/논리 연산 장치effective address rs1 + imm 계산
Data Memory데이터 메모리주소에서 word 읽기
ResultSrcwriteback mux 선택lw에서는 memory read data 선택
ALUSrcALU 두 번째 operand 선택immediate 선택
RegWriteregister file write enablerd에 쓰므로 1
MemWritedata memory write enableload는 읽기만 하므로 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

Find

그림에 표시해야 할 active datapath:

  1. instruction fetch path
  2. register read path for rs1
  3. immediate extraction and sign-extension path
  4. ALU address calculation path
  5. Data Memory read path
  6. writeback path into rd
  7. PC update path to PC + 4
  8. relevant mux selections and control signals

Constraints

Traps

TrapWhy it is temptingCorrect check
Draw rs2 into Data Memory write-datasw와 헷갈림lw does not store; rs2 irrelevant
Select ALU input B = RD2R-type처럼 보임address uses immediate: ALUSrc = 1
Write ALUResult into rdaddress calculation result looks like resultlw writes memory read data, so ResultSrc = memory
Assert MemWrite = 1memory instruction이라는 말에 속음load reads memory, store writes memory
Forget PC + 4data path만 보다 control flow를 빼먹음every non-branch/jump normal instruction sets next PC to PC + 4

Formula / Rule

EffectiveAddress = R[rs1] + SignExt(imm[11:0])
ReadData = DataMemory[EffectiveAddress]
R[rd] = ReadData
PCnext = PC + 4

Required Hand-Written Intermediate State

시험장에서 그림만 그리지 말고, 여백에 먼저 이 표를 쓰면 부분점수를 잘 얻는다.

Itemlw rd, imm(rs1)
FormatI-type
Read registersrs1 only; rs2 not needed
ImmediateInstr[31:20], sign-extended
ALU operationadd
Memory operationread
WritebackData Memory read data to rd
PC updatePC + 4

Solving Procedure

  1. 명령어 의미를 먼저 한 줄로 쓴다: R[rd] <- Mem[R[rs1] + SignExt(imm)].
  2. Field를 찾는다: rs1 = Instr[19:15], rd = Instr[11:7], imm = Instr[31:20].
  3. 왼쪽에서 오른쪽으로 datapath를 따라간다: PC -> Instruction Memory -> Register File/Extend.
  4. ALU 입력 두 개를 정한다: A는 RD1, B는 ImmExt.
  5. ALU output이 memory address로 간다는 것을 표시한다.
  6. Data Memory의 ReadData가 writeback mux를 통해 WD3로 가는 것을 표시한다.
  7. Control Unit 표를 채운다.
  8. 마지막에 사용하지 않는 경로를 지운다: 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:

FieldBitsUsed as
opcodeInstr[6:0]Control Unit recognizes load opcode 0000011
rdInstr[11:7]Register File write address A3
funct3Instr[14:12]010 for lw in RV32I
rs1Instr[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.

Step 7: Writeback

lw writes the loaded word to rd:

ReadData -> Result mux -> WD3
Instr[11:7] -> A3
RegWrite = 1

Control:

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:

SignalValue for lwReason
Op0000011load opcode
RegWrite1write loaded data to rd
ImmSrc00I-type immediate Instr[31:20]
ALUSrc1ALU B input is immediate
MemWrite0load reads memory, does not write
ResultSrc01writeback comes from Data Memory read data
Branch0not a branch
ALUOp00add for address calculation
ALUControl000concrete add operation
Jump0not jal
PCSrc0select 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

Sanity Check With a Concrete Example

Suppose:

rs1 = x8
rd  = x5
imm = 12
R[x8] = 0x1000
DataMemory[0x100C] = 0xDEADBEEF

Then:

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 itemResult
What the file claimsA lecture Eintakt sketch and an empty sketch were given; draw used connections for lw rd, imm(rs1); a solution image is included.
Correct partsThe task topic matches current Vorlesung Teil 2 and Übung 5: single-cycle lw datapath drawing.
Incomplete partsThe recall answer is only an external image, with no official textual explanation or control table.
First possible errorTreating the recalled image as official. It is not official and not enough for verification.
Violated rule if copied blindlyRecall solution must remain unverified unless cross-checked against current sources.
Corrected answerTextual path and control table above.
Source verification statuslw 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.

Corrected approach: Assert RegWrite = 1 and connect ReadData -> WD3.

Wrong Answer 5: Draw Branch Path

Why a student chooses it: The diagram contains a branch target adder and PC mux, so it feels like every instruction uses the PC mux logic.

Why it is wrong: lw has no conditional branch decision and no branch target.

Violated rule: only branch/jump instructions select a non-PC+4 next PC.

Fast check: Does lw contain a label or jump target? No.

Corrected approach: next PC is PC + 4.

Exam-Room Method

Time budget: 6 minutes.

First 45 seconds:

lw: rd <- Mem[rs1 + SignExt(imm)]
PC <- PC + 4

Then draw in this order:

  1. PC -> Instruction Memory
  2. Instr[19:15] -> Register File -> RD1
  3. Instr[31:20] -> Extend -> ImmExt
  4. RD1 + ImmExt -> ALUResult
  5. ALUResult -> Data Memory address
  6. ReadData -> Result mux -> WD3 -> rd
  7. PC -> +4 -> PC

Partial-credit work:

If time is lowWrite this
Cannot finish drawingGive control table plus formula
Unsure about ResultSrc encodingWrite "select Data Memory read data"; add both convention notes if needed
Unsure about exact mux labelsLabel source and destination of each active value

Last check:

Does rd receive memory data? yes
Does memory write? no
Does ALU add rs1 + imm? yes
Does PC go to PC+4? yes

Active Recall

Questions

  1. Concept check: In one sentence, why does lw need both the ALU and Data Memory?
  2. Hand trace: If R[x10] = 0x2000, imm = -4, rd = x6, and Memory[0x1FFC] = 0x12345678, what are ALUResult, R[x6] after the instruction, and PCNext?
  3. Control check: Fill the signals for lw: RegWrite, ImmSrc, ALUSrc, MemWrite, ResultSrc, Branch, ALUOp.
  4. Transfer variant: How do the paths differ for sw rs2, imm(rs1)?
  5. Error diagnosis: A student draws ALUResult -> WD3 for lw. What value will the register receive and why is that wrong?

Answers

  1. The ALU computes the effective address rs1 + imm; Data Memory uses that address to produce the word that is written to rd.
  2. ALUResult = 0x2000 - 4 = 0x1FFC; R[x6] = 0x12345678; PCNext = PC + 4.
  3. 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.
  4. 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.
  5. The register receives the effective address, not the memory word. For lw, the address is intermediate state; the architectural destination must receive Memory[address].

Sources

Completion Check

RequirementStatus
Metadata includeddone
Original German includeddone
Korean translation includeddone
Beginner concept lesson includeddone
Problem interpretation includeddone
Repeatable solving procedure includeddone
Detailed lw datapath solution includeddone
Mux, ALU, memory, writeback covereddone
Control signals covereddone
Recall-answer audit includeddone
At least three wrong answers includeddone
Exam-room method includeddone
Active recall includeddone
Current-source citations includeddone
Visual verification of exact hosted drawingneeds_visual_verification