Programable Logic Devices
William Sandqvist william@kth.se
Programable Logic Devices In the 1970s programmable logic circuits - - PowerPoint PPT Presentation
Programable Logic Devices In the 1970s programmable logic circuits called programmable logic device (PLD) was introduced. They are based on a structure with an AND- OR array that makes it easy to implement SOP expression William Sandqvist
William Sandqvist william@kth.se
William Sandqvist william@kth.se
f
1
AND plane OR plane Input buffers inverters and P
1
P
k
f
m
x
1 x 2
x
n
x
1 x 1
x
n x n
William Sandqvist william@kth.se
f P
1
P
2
f x
1
x
2
x
3
OR plane AND plane P
3
P
4
William Sandqvist william@kth.se
f
1
P
1
P
2
f
2
x
1
x
2
x
3
AND plane P
3
P
4
William Sandqvist william@kth.se
William Sandqvist william@kth.se
f 1 To AND plane D Q Clock Select Enable Flip-flop With a programmable multiplexer one can select the type of
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
PAL-like block I/O block PAL-like block I/O block PAL-like block I/O block PAL-like block I/O block
Interconnection wires
William Sandqvist william@kth.se
(a) CPLD in a Quad Flat Pack (QFP) package P rinte d circuit boa rd To compute r (b) JTAG programming
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
0/1 0/1 0/1 0/1
x1 x2 f Two-input LUT
Programmable cells
1 1 1
A LUT with n inputs can realize all combinational functions with n inputs. The usual size in an FPGA is n=4
William Sandqvist william@kth.se
x1 x2 f Two-input LUT
1 1 1
2 1
William Sandqvist william@kth.se
Out D Q Clock Select Flip-flop In
1
In
2
In
3
LUT
William Sandqvist william@kth.se
1 1 1 1 1 x
1
x
2
x
2
x
3
f 1 f 2 f 1 f 2 f x
1
x
2
x
3
f
connection is programmed
connection is not programmed
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
(3) Total Number of 18x18 Multipliers DE2
William Sandqvist william@kth.se
DE3 Board
William Sandqvist william@kth.se
Nios II Nios II
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
f 1 x
1
x
3
x
2
William Sandqvist william@kth.se
Initial Cost Cost per part Performance Fabrication Time FPGA Low High Low Short Gate Array (ASIC) Standard Cell (ASIC) High Low High Long
William Sandqvist william@kth.se
Design Time Performance
Microprocessor Programmable Logic Gate Array Standard Cell Full Custom
William Sandqvist william@kth.se
William Sandqvist william@kth.se NEXT STATE DECODER STATE REGISTER OUTPUT DECODER State
Input- signals Output- signals
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
COIN RECEIVER
COIN_PRESENT GT_1_EURO EQ_1_EURO LT_1_EURO DEC_ACC CLR_ACC
SYSTEM CONTROL
DROP DROP_READY CHANGER_READY RETURN_10_CENT
DROP BOTTLE COIN RETURN
William Sandqvist william@kth.se
ACCUMU- LATOR
William Sandqvist william@kth.se COIN_PRESENT GT_1_EURO EQ_1_EURO LT_1_EURO DEC_ACC CLR_ACC
SYSTEM CONTROL
DROP DROP_READY CHANGER_READY RETURN_10_CENT Reset_n Clk ENTITY Vending_Machine IS PORT (
coin_present : IN std_logic; gt_1_euro : IN std_logic; eq_1_euro : IN std_logic; lt_1_euro : IN std_logic; drop_ready : IN std_logic; changer_ready : IN std_logic; reset_n : IN std_logic; clk : IN std_logic;
dec_acc : OUT std_logic; clr_acc : OUT std_logic; drop : OUT std_logic; return_10_cent : OUT std_logic); END Vending_Machine;
William Sandqvist william@kth.se
(a) Wait for coin input (b) Register the coin (c) Coin is registered (3 cases) (d) Drop bottle (e) Reset sum (f) Return 10 Cent (g) Decrement sum with 10 Cent
William Sandqvist william@kth.se
William Sandqvist william@kth.se
ARCHITECTURE Moore_FSM OF Vending_Machine IS TYPE state_type IS (a, b, c, d, e, f, g); SIGNAL current_state, next_state : state_type; BEGIN -- Moore_FSM …
William Sandqvist william@kth.se
coding.
dependent on synthesis tool and thus not portable!) ARCHITECTURE Moore_FSM OF Vending_Machine IS TYPE state_type IS (a, b, c, d, e, f, g);
ATTRIBUTE enum_encoding : string; ATTRIBUTE enum_encoding OF state_type : TYPE IS "000 001 011 110 111 100 101"; SIGNAL current_state, next_state : state_type; BEGIN -- Moore_FSM …
William Sandqvist william@kth.se
D D D Next State Decoder
COIN_PRESENT LT_I_EURO EQ_I_EURO GT_I_EURO DROP_READY CHANGER_READY A B C DA DB DC A B C
Output Decoder
DROP CLR_ACC DEC_ACC Clk Clk Clk RETURN_I0_CENT
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
NEXTSTATE : PROCESS (current_state, coin_present, gt_1_euro, eq_1_euro, lt_1_euro, drop_ready, changer_ready) –- Sensitivity List BEGIN -- PROCESS NEXT_STATE …
William Sandqvist william@kth.se
the transition from a state to the next state
… CASE current_state IS WHEN a => IF coin_present = '1' THEN next_state <= b; ELSE next_state <= a; END IF; WHEN b => IF coin_present = '0' THEN next_state <= c; ELSE next_state <= b; END IF;
William Sandqvist william@kth.se
next state
… next_state <= current_state; CASE current_state IS WHEN a => IF coin_present = '1' THEN next_state <= b; END IF; WHEN b => IF coin_present = '0' THEN next_state <= c; END IF; … It is important that we specify all options for the next_state signal. Otherwise, we implicitly gets an expression next_state <= next_state which will genarate a latch!
William Sandqvist william@kth.se
we specify that we should go to a certain state (a) if we end up in a unspecified state
… WHEN g => next_state <= c; WHEN OTHERS => next_state <= a; END CASE; END PROCESS NEXTSTATE;
William Sandqvist william@kth.se
OUTPUT : PROCESS (current_state) BEGIN -- PROCESS OUTPUT drop <= '0'; clr_acc <= '0'; dec_acc <= '0'; return_10_cent <= '0'; CASE current_state IS WHEN d => drop <= '1'; WHEN e => clr_acc <= '1'; WHEN f => return_10_cent <= '1'; WHEN g => dec_acc <= '1'; WHEN OTHERS => NULL; END CASE; END PROCESS OUTPUT;
William Sandqvist william@kth.se
William Sandqvist william@kth.se
CLOCK : PROCESS (clk, reset_n) BEGIN -- PROCESS CLOCK IF reset_n = '0' THEN -- asynchronous reset (active low) current_state <= a; ELSIF clk'event AND clk = '1' THEN -- rising clock edge current_state <= next_state; END IF; END PROCESS CLOCK;
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
William Sandqvist william@kth.se
Power On/Off
William Sandqvist william@kth.se
(If you are preparing code for your Social Security number, then two in a lab group contribute with one half each of the code in the lab).
William Sandqvist william@kth.se