Beruflich Dokumente
Kultur Dokumente
Lecture 9:
Part 1: State
Machine Charts
Condition
Conditional Output
When X1 = X2 = 0,
machine goes
to next state
via exit path 1
In both blocks, Z2 =1
if X1 = 0; next state
is S2 if X2 = 0 and
S3 if X2 = 1 and
A state consists of 1 state box and all the other boxes coming
from it (until another state box is encountered)
There must be exactly 1 exit path active for a state at any time,
no matter what the input
No internal loops (feedbacks)
All paths are traversed simultaneously
Outputs on active paths or in the state box are asserted; all other
outputs are de-asserted
Feedbacks
X/Z1
A
A 1
X B
X
X/Z1 0 1
B Z1 X Z1
0
X X
C/Z2
C/ Z2
1
0
X
X
Advantage
Why use SM Charts?
A
Some states in State
Diagram get very cluttered 1
SM Charts allow busy states X B
to use more room for clear 0
depiction 1
Z1 X Z1
VHDL code can be written
0
directly from the SM Chart
C/Z2
1
0
X
process (PS, X)
begin A
--set all outputs to inactive state
1
Z1 <='0'; Z2 <= '0'; X B
case PS is 0
when A => ---conditionals 1
Z1 X Z1
if x= '1' then
NS <=B; 0
else C/Z2
Z1 <= '1'; ---encountered Z1
1
NS <= A;
0
end if; X
when B =>
if x='1' then Z1 <='1';
else NS <= C;
when C =>
Z2 <= '1';---moore output
if x= '1' then NS <=C;--conditionals
else NS <=B;
end if
end case;
Add/Shift Multiplier
SM Chart
State Diagram
Ref: http://www2.hawaii.edu/~lucam/EE260/S10/lectures_files/Lecture14.pdf
Part 2:
Microprogramming
Example:Figure
Sort rods9.20
of varying length (+/-10%)
An 8-Word on conveyor
X 4-Bit ROM belt
Inputs: Three sensors A,B,C (light sources and photodiodes)
Outputs: Two arm control signals
A
spec
- 5%
B
C
Example:Figure
Wifi enabled
9.20lighting control inX
An 8-Word a large
4-Bitroom
ROMor a house
Inputs: Three switches in different positions
Outputs: Three different modes of light = three different control
signals
Hardwired Control
Implemented using gates and flip-flops
Microprogram Control
Control Store
22
EE 3610 Digital Systems Suketu Naik
Microcode 23
Multiplier Control
Counter
SM Chart
Two-Address Microcode
Microprogram ROM
VHDL Simulation
Schematic SM Chart
TEST Bits
TEST Inputs
00 St
01 M
10 K
11 1
M: if 0 (NSF) goto S2
if 1 (NST) goto S11
K: if 0 (NSF) goto S1
if 1 (NST) goto S3
library IEEE;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity mult4X4_micro is
port(Clk, St: in std_logic;
Mplier, Mcand: in std_logic_vector(3
downto 0);
Product: out std_logic_vector(7 downto 0);
Done: out std_logic);
end mult4X4_micro;
controller: process(Clk)
begin
if falling_edge(Clk) then
uIR <= control_store(to_integer(uAR));
end if;
if rising_edge(Clk) then
if TMUX = '0' then
uAR <= NSF;--set the index to NSF
else
uAR <= NST;
end if;
if Sh = '1' then
counter <= counter + 1;
end if;
end if; end process;
datapath: process(Clk)
begin
if rising_edge(Clk) then
if Load = '1' then
ACC(8 downto 4) <= "00000";
ACC(3 downto 0) <= Mplier;
end if;
if Ad = '1' then
ACC(8 downto 4) <= '0' & ACC(7
downto 4) + Mcand;
end if;
if Sh = '1' then
ACC <= '0' & ACC(8 downto 1);
end if;
end if; end process; end microprogram;
EE 3610 Digital Systems Suketu Naik
Single-Address Microprogram 31
Schematic SM Chart
TEST Bits
TEST Inputs
00 St'
01 M
10 K'
11 1