Lecture 24
Lecture 24
address
lines
fD ADDRESS
DECODER
r
control
lines
Lecture24
3
• Start by thinking of an address
decoder as a big AND gate.
6
• Once the logic for the address
decoder is established, the SAD
can be implemented using any
method of the logic design e.g.,
HDL or VHDL.
7
Problem Statement
8
• Start with a “big AND gate”
(SAD).
A7 A6 A5 A4 A3 A2 A1 A0
10
• A0 and A5 will be applied to
the “big AND gate” after
inversion.
Control
Line
12
A0
.
.
A5
fD A6
A7
IOW#
Control
Line
13
• The output is a 1 only when the address,
xxxx xxxx 1101 1110 b, is present on the
FALCON-A’s address bus during an I/O
write cycle.
IOW#
Control
Line
15
• For a 16-bit output port, we use two 8-bit
registers to capture data from the
FALCON-A’s data bus.
17
Continued…
Every LED branch is wired in such a way
that when a 1 appears on the particular
data bus bit, it turns the LED on; a 0
turns it off. Which LEDs will be ON when
the instruction
out r2, 222
executes on the CPU? Assume r2
contains 1234h.
18
• r2 contains 1234h.
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
20
• The 8-bit register uses lines D15 .. D8 of the FALCON-
A’s data bus.
21
• D15...D8 will transfer the higher
significance byte using the
address DEh.
24
In first case:
where the CPU does not allow the use of
some part of its data bus in a transfer:
28
• The following instructions will
access the output port at the
address 0FEF2h.
31
; filename: IO2_eg3.asmfa
;
;ALL LEDS ARE turned Off initially
;
movi r1,0
out r1,222
;
;First LED will be turned on each time
;
start: movi r1,1
out r1,222
;
movi r5,15 32
;
;DELAY LOOP
;
delay1: movi r2,0
again1: subi r2,r2,1
jnz r2, [again1]
;
movi r3,0 ; TURN OFF ALL LEDS
out r3,222
;
delay2: movi r2,0
again2: subi r2,r2,1
jnz r2, [again2] 33
;
shiftl r1,r1,1 ; next LED ON
out r1,222
subi r5,r5,1
jnz r5, [delay1]
jump [start]
halt
34
Start
allInitialize
LEDs off at DEh
All LEDs off at DEh
wait
Y leftmost N
LED
lits?
35
• The first two instructions turn all the
LEDs off by sending a 0 to each bit of
the output port.
mov r1,0
out r1,222
40
Execution Time
ET = CPI x IC x T = CPI x IC / f
where
CPI = clocks per instruction
IC = instruction count
T = time period of the clock, and
f = frequency of the clock.