Hardware Reference
In-Depth Information
signal
nI, I_del, nx, x_del:std_logic;
signal
z:std_logic_vector(
1
downto
0
);
signal
ct: tUnsigned(
4
downto
0
);
...
-- Eingabeabtastung
process
(T)
begin
if
rising_edge(T)
then
I_del <=
not
nI;
x_del <=
not
nx;
end if
;
end process
;
-- Uebergangsfunktion
process
(I_del, T)
begin
if
I_del=
'1'
then
z <=
"00"
;
elsif
rising_edge(T)
then
case
z
is
when
"00"
=>
Morse-
U
V
Reset-
tastetaste
f
s
f
y
p
s
err
¯x
x
I
¯
I
I'
T
a)
Operationsablaufgraph
Z¨ahlen
wennct=11111dannct<=ct+1
(1)
x'=0
x'=1
Bereit
Ausgabe
ct<=00000 ct<=00000
(1)
(2)
b)
-- Zustand Bereit
ct <=
"00000"
;
if
x_del='
1'
then
z <=
"01"
;
end if
;
when
"01"
=>
-- Zustand Zählen
if
ct /=
"11111"
then
ct <= ct+
"1"
;
end if
;
if
x_del=
'0'
then
z <=
"10"
;
end if
;
when others
=>
-- Zustand Ausgabe
z <=
"00"
;
end case
;
end if
;
end process
;
-- kombinatorische Aufgabefunktion
process
(z, ct)
variable
vp, vs, verr:std_logic;
begin
vp :=
'0'
; vs :=
'0'
; verr :=
'0'
;
if
z=
"10"
then
case
ct
is
when
"00100"
|
"00101"
|
"00110"
=> vp := '1';
when
"01100"
|
"01101"
|
"01110"
|
"01111"
|
"10000"
|
"10001"
|
"10010"
=> vs :=
'1'
;
when others
=> verr :=
'1'
;
end case
;
end if
;
p <= vp; s <= vs; err <= verr;
end process
;
denZust¨andenzugeordneteAusgaben
p<=0;s<=0;err<=0
(1)
(2)
wennct∈{00100,...,00110}
p<=1;s<=0;err<=0;
sonstwennct∈{01100,...,10010}
p<=0;s<=1;err<=0;
sonst
p<=0;s<=0;err<=1;
c)
⇒
Web-Projekt:P1.6/Morse.vhdl
Abb. 6.6. Lösung zu Aufgabe 1.22