Title: Hardware Simulations
1Hardware Simulations
2What does a hardware interface do?
- Takes values originating in software, and affects
hardware
Java
Main program
Interface method
Driver
Byte value 0x04
0000 0100
int myValue 4
3Another way
all drivers for this Interface produce identical
data
HW
ID 4675 Location 06 11082005 121600
Mary Smith SW Exit 11/08/05 121600
0146750206031108200504121600..
Interface interprets driver values
Hardware
Driver turns raw hardware values into useable
values
4Multiple Input Devices
ID 4675 Location 06 11082005 121600
card
0146750206031108200504121600..
Mary Smith SW Exit 11/08/05 121600
ID 4675 Location 06 11082005 121600
file employee6.txt 0206031108200504121600..
Hardware
Interface interprets driver values
Driver turns raw hardware values into useable
values
5Simulation
its own thread
Mary Smith SW Exit 11/08/05 121600
ID 4675 Location 06 11082005 121600
Pretend software that acts like a fingerprint
file employee6.txt 0206031108200504121600..
Interface this does not change
A real driver, OR a driver that is targeted at
the fake hardware
SW acting like Hardware
6Simulated drivers
all drivers for this Interface produce identical
data
HW (port)
ID 4675 Location 06 11082005 121600
all drivers for this Interface produce identical
data
no HW
ID 4675 Location 06 11082005 121600
SW
7Typical I/O
sensor
Software
motor
8Typical I/O
driver takes on or off command, turns on
motor via hardware interface
Software
interface takes left to mean activate motor 2
Sensor detection changes 0 to 1 in driver
provided by interface manufacturer
interface notes presence or absense
Your software decides to avoid barrier by going
left
9Hardware should not limit progress
- Write your control software, gui, data handling
- Write clean interface modules to the drivers.
Define data in these modules the way the control
software needs them. - Write fake drivers, or drivers to SW-simulated
HW, or drivers to interim hardware.
10Inputs
Fake Driver - faking hardware
Your Main Code
Interface - Convert Driver Signals
Real Driver
sensor
11Outputs
Fake Driver - faking hardware
Interface - Convert to Driver Signals
Your Main Code
Real Driver
12hardware setup
13Interfacing hardware to a Tablet PC
- from Measurement
- Computing
14..to AC power
15to Lights and Sound
16Memory Mapped I/O
- A simple scheme where an area of memory
"parallels" an I/O port - Write to the memory, change the bits on the port.
- Inputs to the port are reflected in real time in
memory.
17I/0 Memory
Data Memory
Program Memory
Fast Specialty Memory
18Memory Mapped I/O
- A hardware scheme that requires wiring memory to
the outside of the computer
19Words in Memory
Memory Mapped I/O
FF
C4
01
A2
4
5
6
7
A2
01
C4
FF
0
1
2
3
Hardware Interface
Terminal for External HW Connections
20Advantages
- Hardware treated as bytes in memory
- Manufacturers provide drivers that do no more
than accept / provide bytes
21The Computer Memory Model
- The memory map STILL provides the basic
addressable structure for the hardware designer - We will explore the memory map after Spring break
(with small assignment 3)