Lecture

CENG 311
Computer Architecture
Lecture Notes
μPabs-3 I/O Connections
Asst. Prof. Tolga Ayav, Ph.D.
Department of Computer Engineering
İzmir Institute of Technology
1
μPabs-3
CLK
RESET
μPabs
INT
INTA
16
Address Bus
16
Data Bus
WR
RD
OPFETCH
2
İzmir Institute of Technology
Computer Architecture
Example1
Connecting 1k ROM and 8255
PIO to provide 24 bit I/O
İzmir Institute of Technology
Computer Architecture
uPabs-3 with 24-bit port
1k x16bit ROM
A9-0
OPFETCH
A9-0
Programming 8255 IC
Address “00” -> Port A
Address “01” -> Port B
Address “02” -> Port C
Address “03” -> Command word
İzmir Institute of Technology
Computer Architecture
Address Decoder Circuits for 8255s
• Partial Address Decoding:
0000H
1k ROM
– We can use one bit A(15)
signal for the first address
decoder and A(15)’ (using
inverter) for the second
address decoder.
8000H
• Full Address Decoding:
8255
– Place the 8255s as seen in
the memory map:
İzmir Institute of Technology
Computer Architecture
Connect 1k RAM
0000H
CS1
Address
Bus
Address
Decoder
03FFH
1k ROM
CS2
CS3
Address
---------------------------------------
0000000000000000
0000000000000001
0000000000000010
.
.
.
.
111111111111111111
CS1 CS2 CS3
------ ----- -----
1
1
1
.
.
.
.
0
0
0
0
.
.
.
.
0
0
0
0
.
.
.
.
1
8000H
8003H
FC00H
FFFFH
8255
1k RAM
(data,ISR,stack)
Programming
• Initializing 8255:
movi a,80h
movi c,0ah
L1: sl a
dec c
jnz L
movi d,82h
// Port A initialized output
// Port B initialized input
write @a,d
• Writing “0”s to Port A (8-bit):
// a still holds 8000h
clr b
write @a,b
•
Question: Instead of “clr b” could we use “movi b,00H”?
İzmir Institute of Technology
Computer Architecture
Example2
• Requirements:
– The clock period of uPabs is 1μs. Assume each command takes 3 clock
cycles to complete (Depends on your design actually!).
– uPabs is supposed to generate a square wave signal at the port pin
PA(0) of 8255. The period will be approx. 100 μs.
– uPabs should also read one bit (from one of PB pins of 8255). If this
bit is “0” uPabs should do nothing. If it is “1”, then uPabs must
immediately set the PA(0) to “1”. PA(0) stays there even if the input
returns to “0”.
• Design the circuit.
• Write an assembly program.
İzmir Institute of Technology
Computer Architecture
Assembly Program for Example 2
Initialize:
movi a,80h
movi c,0ah
L1: sl a
dec c
jnz L
movi d,82h
write @a,d
Square wave:
L2:
Stopping condition:
movi d, ??h
mov c,00h
dec d
jnz L2
not c
movi d, ??h
write @a,c
jmp L2
?
clr b
write @a,b
Is timing (the period of square wave) correct? Would you consider using “nop”?
İzmir Institute of Technology
Computer Architecture
Questions
• Find ??h in movi d,??h command that helps to define
the period of the square wave
• Embed the stopping code into the square wave
generator program provided that the timing satisfies the
requirements.
• Discuss about the timing errors and jitters.
• Convert your assembly code to the machine code.
İzmir Institute of Technology
Computer Architecture