mips cpu lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/mips_cpu_lab3.pdf ·...

23
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU MIPS CPU Lab 3 MIPS CPU Lab 3 memory,register file & control unit memory,register file & control unit TA:王奕權 2004/5/7

Upload: others

Post on 03-Aug-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB

Graduate Institute of Electronics Engineering, NTU

MIPS CPU Lab 3MIPS CPU Lab 3memory,register file & control unitmemory,register file & control unit

TA:王奕權

2004/5/7

Page 2: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 22004/5/7

A simplified processorA simplified processor

Page 3: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 32004/5/7

MemoryMemory

64 words length of each word:16 bit

Page 4: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 42004/5/7

Memory:writeMemory:writeWriteEnable =1DataIn can be written into the memory synchronously with clk(posedge)The written location is specified by input address DataOut could be arbitrary number during write operation

Page 5: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 52004/5/7

Memory:readMemory:readWriteEnable =0The memory behaves as a combinational logic block. read the data in the memory asynchronouslyThe location to be read is specified by input address.

Page 6: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 62004/5/7

Memory:I/O pinMemory:I/O pin

Page 7: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 72004/5/7

synchronous memorysynchronous memoryModify the above memory to make the read operation synchronously with clksynchronous memory for both read and write operationAlso, compare the simulation waveforms of (1) and (2).

Page 8: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 82004/5/7

Register fileRegister file

length of each word : 16 bit32 registers in the register file. one 16 bit input bus: busW. Two 16 bit output buses: busA and busB.

Page 9: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 92004/5/7

Register file:writeRegister file:writeWriteEnable =1The data on busW will be written into a register synchronously with clk(posedge). RW selects the register(one of 32 registers) to be written. BusA and busB could be arbitrary number during write operation.

Page 10: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 102004/5/7

Register file:readRegister file:readWriteEnable =0The register file behaves as a combinational logic block. read the data in the register file asynchronouslyRA selects one of 32 registers. The content of that register will be output on busA. At the same time, RB selects one of 32 registers. The content of that register will be output on busB.

Page 11: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 112004/5/7

Register file:I/O pinRegister file:I/O pin

Page 12: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 122004/5/7

synchronous register filesynchronous register fileModify the above register file to make the read operation synchronously with clk as you have done in problem 1. Also, compare the simulation waveforms of (1) and (2).

Page 13: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 132004/5/7

Single cycle architectureSingle cycle architecture

Page 14: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 142004/5/7

MultiMulti--cycle architecturecycle architecture

Page 15: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 152004/5/7

Control unitControl unitsingle-cycle:the control unit can be realized with combinational logic. multi-cycle: need a state machine to be our control unit. write a FSM control unit based on the text: Computer Organization & design, The hardware/Software interface, Chapter 5.

Page 16: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 162004/5/7

MultiMulti--cycle architecture control cycle architecture control unitunit

Page 17: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 172004/5/7

State transition diagramState transition diagram

Page 18: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 182004/5/7

Notes(1/2)Notes(1/2)5 different operations in the diagram:

LW, SW, R-type, BEQ, J(jump). You can choose the binary numbers to represent the 5 opcodes by yourself. use “parameter” in Verilog to change binary numbers to ‘LW’, ‘SW’, ‘Rtype’, ‘BEQ’, ‘J’ in your verilog code.

Page 19: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 192004/5/7

Notes(2/2)Notes(2/2)Follow the above graph to use binary number(0000~1001) to represent 10 states. use “parameter” to avoid using a binary number to represent a state in your verilogcode. write verilog code for the control unit and do simulations on each path on the state transition diagram (all 5 operations).

Page 20: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 202004/5/7

State abbreviation tableState abbreviation table

Page 21: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 212004/5/7

I/O pinI/O pin

Page 22: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 222004/5/7

Submission list(due on 5/21)Submission list(due on 5/21)Hardcopy submission only: print out and submit to TA before deadlineTwo memory modules (read synchronous/asynchronous)verilog code and simulation waveforms to verify the two modules. Comment on differences of the two waveforms.Two register file modules (read synchronous/asynchronous)verilog code and simulation waveforms to verify the two modules. Comment on differences of the 2 waveforms.Control unit verilog code and simulation waveforms.

Page 23: MIPS CPU lab3 - 國立臺灣大學access.ee.ntu.edu.tw/course/dsd_92second/ppt/MIPS_CPU_lab3.pdf · MIPS CPU Lab 3 memory,register file & control unit ... 2004/5/7 pp. 2 A simplified

ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU

pp. 232004/5/7

ReferenceReferenceComputer Organization & design, the hardware/Software interface,Chapter 5course slides of prof. 郭斯彥