1 comp541 final missing pieces of mips: adding memory & i/o montek singh oct 29, 2014

11
1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

Upload: rodney-morrison

Post on 21-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

1

COMP541

Final Missing Pieces of MIPS: Adding Memory &

I/O

Montek Singh

Oct 29, 2014

Page 2: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

Memory-Mapped I/O Simple technique for accessing I/O

give each I/O device a “fake” memory address i.e., CPU reads and writes a specific range of memory

locations for I/O devicesusing lw and swpretending I/O devices were simply memory locationsnet effect is reading and writing I/O

each device is assigned its own range of memory“address space”

example:data memory from ’h0000_2000 to ’h0000_3FFFVGA display (screen memory) from ’h0000_4000 to

’h0000_40FF joystick status at ’h0000_6000mouse status at ’h0000_6004keyboard status at ’h0000_6008 … etc. 2

Page 3: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

Memory-Mapped I/O Putting data mem at 0x2000 also helps with

MARS“Compact, Text at 0” puts data at 0x2000

datamem

screenmem

0x0000 2000

0x0000 3FFF

0000 0000 0000 0000 0010 0000 0000 0000

0000 0000 0000 0000 0011 1111 1111 1111

0x0000 4000 0000 0000 0000 0000 0100 0000 0000 0000

0x0000 4FFF 0000 0000 0000 0000 0100 1111 1111 1111

joystick/kbd0x0000 6000 0000 0000 0000 0000 0110 0000 0000 0000

gap

gap

gap

0x0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

(the upper limit will depend on your screen size)

Page 4: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

datamem

screenmem

0x0000 2000

0x0000 3FFF

0000 0000 0000 0000 0010 0000 0000 0000

0000 0000 0000 0000 0011 1111 1111 1111

0x0000 4000 0000 0000 0000 0000 0100 0000 0000 0000

0x0000 4FFF 0000 0000 0000 0000 0100 1111 1111 1111

joystick/kbd0x0000 6000 0000 0000 0000 0000 0110 0000 0000 0000

gap

gap

starting at0000 0000 0000 0000 0000 0000 0000 0000

Multicycle MIPS (later) Can combine data and instr memories into one

MARS assumes this type of unified memory

starting at0x0000 0000

instrmem

Page 5: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

The Big Picture CPU, memory and I/O unit, display and joystick

datamem

screenmem

joystick/kbdpass thru

VGA Display Driver

memory mapperMIPS

Memory and I/O Unit

2 read ports1 write port

1 read port1 write port

instrmem

Page 6: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

6

Adding I/O Look at memory-mapped I/O Conceptually like this

Page 7: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

7

In Reality Isolated from CPU On standard buses

PCI Ours will typically be simpler

Just memory addresses

Page 8: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

Memory Mapping How to do in Verilog?

Let’s do this interactively!

8

Page 9: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

9

Joystick, mouse, etc. You’ll add joystick or keyboard (or both) into

memory locations that you can reade.g., at two locations right above character memory

I will show you next week

Page 10: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

10

How Does Processor Begin? One way is to initialize PC to 0

or some other predefined address Another possibility is to have a reset

each time you hit a reset button, PC starts again at 0 Make sure to have instructions there

Modern computers have flash memory to boot CPU or go to configuration utility

On (very) old computers had to enter boot program on front panel

Page 11: 1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014

Summary Add I/O to complete the MIPS processor

I/O is “memory-mapped”shares the address space with memorydifferent regions of memory reserved for data mem,

display, input devices, etc.

Final Project:start thinking about what you want for your demo!

11