Lecture 12
Memory-Mapped I/O (MMIO)
Lecture
Outline
- I/O devices
- Direct memory access (DMA)
- Memory-mapped I/O (MMIO)
- Drivers
- RARS MMIO device emulators
Examples
Workshop
- Input a floating-point number, round it to one digit to the left of decimal point (e.g.
3.5
) and display it in the Digital Sim Lab display. User digit_lab1.s as a starting program.
Homework
Solve the following tasks:
-
Modify the digit_lab2.s program to display keys pressed in the hexadecimal keyword in the digital display (as decimal values, e.g.
F
==15
). Use the workshop task as a basis. -
Write a program (based on
digit_lab2.s
) that inputs an integer valueX
(with theReadInt
system call) and then usesDigital Sim Lab
to enter 32-bit integers (8 hexadecimal digits)Y
. It repeats entering integers until the enteredY
is not equal toX
. Then it printsFOUND
and exits. IfY
equals0
the program must printSTOPPED
and exit. -
Write a program that draws a square with size 64×64 dots in the middle of
Bitmap Display
(see theTools
menu of RARS) with size 128×128 dots. The color and the thickness of lines in dots is specified by the user (use theReadInt
system call). See bitmap_display.s as an example. -
Bonus task (2 bonus points). EightSectors
Commit the programs to your private GitHub account. Place them into the folder ca/lab08
.
References
- Memory-mapped I/O (Wikipedia).
- Direct memory access (Wikipedia).