Upload
nolan-moore
View
43
Download
1
Embed Size (px)
DESCRIPTION
COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O. Montek Singh Apr 11, 2012. Summary of Remaining Labs, etc. HW #2 (last one) assigned later today due Fri April 20 Lab Demos Fri April 20, 1-2:50pm grade by 4/23 Mon April 23, 1-3:30pm grade by 4/25 - PowerPoint PPT Presentation
Citation preview
1
COMP541COMP541
Final Missing Pieces of Final Missing Pieces of MIPS: Adding Memory & MIPS: Adding Memory &
I/OI/O
Montek SinghMontek Singh
Apr 11, 2012Apr 11, 2012
2
Summary of Remaining Labs, etc.Summary of Remaining Labs, etc. HW #2 (last one) assigned later todayHW #2 (last one) assigned later today
due Fri April 20due Fri April 20
Lab DemosLab Demos Fri April 20, 1-2:50pmFri April 20, 1-2:50pm
grade by 4/23grade by 4/23 Mon April 23, 1-3:30pmMon April 23, 1-3:30pm
grade by 4/25grade by 4/25 Wed April 25, 1-2:15pm: final chance for demosWed April 25, 1-2:15pm: final chance for demos
grade by 4/27grade by 4/27
OptionalOptional Take-Home Test #2 Take-Home Test #2 assigned April 20assigned April 20 due anytime up until Apr 30, 3pm (final exam slot)due anytime up until Apr 30, 3pm (final exam slot)
Tasks for Lab Final Project/DemoTasks for Lab Final Project/Demo April 13: Lab 10 CompletedApril 13: Lab 10 Completed
Show:Show:show a complete and working Lab 10show a complete and working Lab 10
I will show you how to:I will show you how to:add keyboard/joystick/mouseadd keyboard/joystick/mouse integrate your VGA display codeintegrate your VGA display code
April 13-20: Demo developmentApril 13-20: Demo development Do:Do:
add any new instructions you needadd any new instructions you needdevelop your game/demo app (keep it simple!)develop your game/demo app (keep it simple!)
April 20, 23, 25:April 20, 23, 25: Show:Show:
show a complete and working final demoshow a complete and working final demo
3
A few tips on finishing up your A few tips on finishing up your MIPSMIPS Sign extension: simpleSign extension: simple
assume all of your I-type assume all of your I-type instructions are signedinstructions are signede.g., lw, sw, addi, beqe.g., lw, sw, addi, beq
thus, simply sign-extend thus, simply sign-extend everyevery immediate operand immediate operand just extend value of bit 15 to just extend value of bit 15 to
upper 16 bitsupper 16 bits
Add any other instrs Add any other instrs neededneeded sltslt could be very useful for could be very useful for
loops!loops! you can do without all you can do without all
“unsigned” instructions“unsigned” instructions
Do everything step-by-Do everything step-by-step!step! 4
This is your single-cycle MIPSThis is your single-cycle MIPS
5
6
MemoriesMemories Word widthWord width
both instruction (IM) and data memories (DM) have both instruction (IM) and data memories (DM) have 32-bit words32-bit wordsbe careful about word vs. byte addressesbe careful about word vs. byte addresses i.e., whether or not to multiply/divide by 4i.e., whether or not to multiply/divide by 4
size IM so it can hold your code (say, 200 instructions)size IM so it can hold your code (say, 200 instructions) size DM so it can hold all your data (say, 100 words)size DM so it can hold all your data (say, 100 words)lwlw and and swsw should suffice should suffice
skip skip lblb and and sbsb they could be done in softwarethey could be done in software
Memory-Mapped I/OMemory-Mapped I/O Simple technique for accessing I/OSimple technique for accessing I/O
give each I/O device a “fake” memory addressgive each I/O device a “fake” memory address i.e., CPU reads and writes a specific range of memory i.e., CPU reads and writes a specific range of memory
locations for I/O deviceslocations for I/O devicesusing using lwlw and and swswpretending I/O devices were simply memory locationspretending I/O devices were simply memory locationsnet effect is reading and writing I/Onet effect is reading and writing I/O
each device is assigned its own range of memoryeach device is assigned its own range of memory““address space”address space”
example:example:data memory from ’h0000_0000 to ’h0000_FFFFdata memory from ’h0000_0000 to ’h0000_FFFFVGA display (screen memory) from ’h1000_0000 to VGA display (screen memory) from ’h1000_0000 to
’h1000_03FF’h1000_03FF joystick status at ’h1100_0000joystick status at ’h1100_0000mouse status at ’h1100_0004mouse status at ’h1100_0004keyboard status at ’h1100_0008 …keyboard status at ’h1100_0008 …
7
8
Memory MapMemory Map
Data Memory
CharacterMemory
0000 0000
0000 FFFF
1000 03FF
1100 0000
Do you test all bits in your memory decoder? Up to you.
Keep in mind:Keep in mind: your character memory your character memory
may have different word may have different word widthswidths
e.g., x1, or x8, etc.e.g., x1, or x8, etc. you may need to do you may need to do
some address and data some address and data conversionconversion
joystick, etc.
gap
gap
Memory MapMemory Map How to do in Verilog?How to do in Verilog?
Let’s do this interactively!Let’s do this interactively!
9
10
Adding I/OAdding I/O Look at memory-mapped I/OLook at memory-mapped I/O Conceptually like thisConceptually like this
11
In RealityIn Reality Isolated from CPUIsolated from CPU On standard busesOn standard buses
PCIPCI
Ours will typically be simplerOurs will typically be simpler Just memory addressesJust memory addresses
12
Joystick, mouse, etc.Joystick, mouse, etc. YouYou’’ll add joystick or keyboard (or both) into ll add joystick or keyboard (or both) into
memory locations that you can readmemory locations that you can read e.g., at two locations right above character memory e.g., at two locations right above character memory
I will show you on FriI will show you on Fri
13
How Does Processor Begin?How Does Processor Begin? One way is to initialize PC to 0One way is to initialize PC to 0
or some other predefined addressor some other predefined address
Another possibility is to have a resetAnother possibility is to have a reset each time you hit a reset button, PC starts again at 0each time you hit a reset button, PC starts again at 0
Make sure to have instructions thereMake sure to have instructions there Modern computers have flash memory to boot CPU or Modern computers have flash memory to boot CPU or
go to configuration utilitygo to configuration utility On (very) old computers had to enter boot program On (very) old computers had to enter boot program
on front panelon front panel
SummarySummary Now we are done with creating a CPU!Now we are done with creating a CPU!
Start creating your final demo!Start creating your final demo!
14