1 COMP541 Completing the MIPS Datapath Montek Singh Mar 27, 2007
2 Datapath Lab Last Friday’s lab: Included this Need more: also memory/control
3 Next few labs March 30: lw and sw and branching April 6: Complete CPU (Holiday?) Add VGA, keyboard/joystick Add VGA, keyboard/joystick
4 Next Lab Implement the lw and sw instructions. The address for lw/sw generated by ALU Format Format sw $r1, 100($r2) sw $r1, 100($r2) Store contents of register 1 to Store contents of register 1 to address $r address $r Implement branch instructions
5 Store Word Easier Just disable writing to register Set an address and write to memory Could use second memory port and write on same cycle as next instruction Could use second memory port and write on same cycle as next instruction Let’s look at block diagram…
6 Block Diagram (just lw/sw)
7 R-Type and lw/sw
8 Load Word Need to determine memory address Using ALU Using ALU Then need to read memory and write to register
9Careful If you use one memory port, your instruction will disappear You could use the other memory port You could use the other memory port Could add an instruction register Could add an instruction register More complex control Harvard Architecture another possibility
10 Sign Extension Don’t get sidetracked into complexity Just extend value of bit 15 to upper 16 bits How?
11Branching Add beq (branch on equal) That should give enough breadth to actually write full programs
12 Resulting MIPS Datapath
13 With Control
14Memory Addressing Byte address or word address? Byte address or word address?
15 The MIPS Datapath
16 Expanding Memory Block First let’s look in detail at data memory block See how to add block memories Add I/O
17 Memory Block Signals Address – 32 bits Write Data – 32 bits Read Data – 32 bits Mem Write – 1 bit Mem Read – 1 bit
18 Using 2 Block RAMs Illustration from book Let’s work it out for Block RAMs Specs next
19 Block RAM Specs Try 2 256x16
20 Adding More Memory Illustration from text Could add 2 more block RAMs to increase mem to 512 words
21 Memory Map Refers to how physical memory is populated In our example, memory from 0 to 511 It’s in two blocks, but that’s invisible to programmer It’s in two blocks, but that’s invisible to programmer
22 Another Portion of Memory Let’s see how to add a block of x8 character memory for the VGA Need to make 24 bits be zero
23 Memory Map Instruction and Data Memory Empty Character Memory
24 Adding I/O Look at memory-mapped I/O Conceptually like this
25 In Reality Isolated from CPU On standard buses PCI PCI Ours will be simpler Just memory addresses Just memory addresses
26Later You’ll add joystick or keyboard (or both) into memory locations that you can read
27 How Does Processor Begin? One way is to initialize PC to 0 Make sure to have instructions there Real computers have flash memory to boot CPU or go to configuration utility Real computers have flash memory to boot CPU or go to configuration utility On (very) old computers had to enter boot program on front panel On (very) old computers had to enter boot program on front panel