Programable Logic Devices In the 1970s programmable logic circuits - - PowerPoint PPT Presentation

programable logic devices
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Programable Logic Devices

William Sandqvist william@kth.se

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

slide-2
SLIDE 2

PLD structure

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

slide-3
SLIDE 3

Programmable Logic Array (PLA)

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

Both AND and OR arrays are programmable

slide-4
SLIDE 4

Programmable Array Logic (PAL)

William Sandqvist william@kth.se

Only the AND array is programmable

f

1

P

1

P

2

f

2

x

1

x

2

x

3

AND plane P

3

P

4

slide-5
SLIDE 5

Register output

William Sandqvist william@kth.se

In the earlier PLD circuits there were

  • combinatorial outputs
  • register outputs (output with a flip-flop)

For each circuit there were a fixed number of combinational and register outputs To increase flexibility the macrocell where you could choose if an output would be a combinatorial or a register output was introduced.

slide-6
SLIDE 6

Macrocels ia a PLD

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

  • utput
slide-7
SLIDE 7

PAL

William Sandqvist william@kth.se

slide-8
SLIDE 8

Programing of PLDs

William Sandqvist william@kth.se

slide-9
SLIDE 9

Complex PLDs (CPLD)

William Sandqvist william@kth.se

PLD were quite small (PALCE 22V10 had 10 flip-flops) For bigger programmable circuits a structure consisting of several PLD-like block was developed.

slide-10
SLIDE 10

CPLD (MAX)

William Sandqvist william@kth.se

slide-11
SLIDE 11

CPLD structure

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

slide-12
SLIDE 12

Programing with JTAG

William Sandqvist william@kth.se

Modern CPLDs (and FPGAs) can be programmed by downloading programming information via a cable Download will usually use a standard port: JTAG-port

slide-13
SLIDE 13

(a) CPLD in a Quad Flat Pack (QFP) package P rinte d circuit boa rd To compute r (b) JTAG programming

JTAG programing

William Sandqvist william@kth.se

You can program the chips when they are soldered to the circuit board - from inside the programmer you can select which chip you want to program with the JTAG connector.

slide-14
SLIDE 14

FPGA chips

William Sandqvist william@kth.se

CPLD:s are based on the AND-OR array, and it becomes difficult to make really large circuits FPGA (Field Programmable Gate Array) circuits using a different concept based

  • n logical blocks
slide-15
SLIDE 15

FPGA-structure

William Sandqvist william@kth.se

slide-16
SLIDE 16

LUT-LookUp-Table

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

slide-17
SLIDE 17
  • Ex. LUT for XOR-gate

William Sandqvist william@kth.se

1 1

x1 x2 f Two-input LUT

1 1 1

2 1

1 1 1 1 1 1 x x f

slide-18
SLIDE 18

Logic block in FPGA

William Sandqvist william@kth.se

Out D Q Clock Select Flip-flop In

1

In

2

In

3

LUT

A logic block of an FPGA consists of a LUT, a flip- flop, and a mux to select register output.

slide-19
SLIDE 19

Interconnexion matrix in FPGA

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

  • Blue cross:

connection is programmed

  • Black cross:

connection is not programmed

slide-20
SLIDE 20

DE2 University Board

William Sandqvist william@kth.se

Cyclone II EP2C35 FPGA – Datorteknik- course

slide-21
SLIDE 21

Cyclone II logic element

William Sandqvist william@kth.se

slide-22
SLIDE 22

Cyclone II Family

William Sandqvist william@kth.se

(3) Total Number of 18x18 Multipliers DE2

slide-23
SLIDE 23

Stratix III Family

William Sandqvist william@kth.se

DE3 Board

slide-24
SLIDE 24

Multiple processors on an FPGA

William Sandqvist william@kth.se

Nios II Nios II

Very powerful multiprocessor systems can be created on an FPGA!

  • Nios II is a so-called 'soft-

processor' (32-bit) which can be implemented on an Altera FPGA

  • Today's FPGAs are so

large that multiple processors can fit on a single FPGA chip

slide-25
SLIDE 25

ASIC

William Sandqvist william@kth.se

  • An ASIC (Application Specific Integrated

Circuit) is a circuit that is madi in a semiconductor factory

  • In a full custom integrated circuit you in

principle tailors the whole circuit

  • In an ASIC have certain work steps

already been made to reduce design time and cost

slide-26
SLIDE 26

ASIC, gate array

William Sandqvist william@kth.se

In an Gate Array the gates (or transistors) are allready on the silicon.

slide-27
SLIDE 27

ASIC, gate array

William Sandqvist william@kth.se

One only creates links between inputs, gates, and

  • utputs

f 1 x

1

x

3

x

2

slide-28
SLIDE 28

Comparison ASIC, FPGA

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

slide-29
SLIDE 29

Design Trade-Offs

William Sandqvist william@kth.se

Design Time Performance

Microprocessor Programmable Logic Gate Array Standard Cell Full Custom

slide-30
SLIDE 30

William Sandqvist william@kth.se

slide-31
SLIDE 31

Sekvenskretsar med VHDL

William Sandqvist william@kth.se NEXT STATE DECODER STATE REGISTER OUTPUT DECODER State

Clk

Input- signals Output- signals

Moore-machine

slide-32
SLIDE 32

Model a State Machine in VHDL

William Sandqvist william@kth.se

  • In a Moore-machine we have three

blocks

– Next-state-decoder – Output-decoder – State-register

  • These blocks execute in parallel
slide-33
SLIDE 33

Quickie Question …

William Sandqvist william@kth.se

which logic gate corresponds to the following VHDL code

slide-34
SLIDE 34

Quickie Question …

William Sandqvist william@kth.se

which logic gate corresponds to the following VHDL code

slide-35
SLIDE 35

Quickie Question …

William Sandqvist william@kth.se

which logic gate corresponds to the following VHDL code

slide-36
SLIDE 36

Quickie Question …

William Sandqvist william@kth.se

which logic gate corresponds to the following VHDL code

slide-37
SLIDE 37

Processes in VHDL

William Sandqvist william@kth.se

  • An architecture in VHDL can

consist of several processes

  • Processes are executed in parallel
  • A process is written as a sequential

program

slide-38
SLIDE 38

Moore-machine processes

William Sandqvist william@kth.se

  • For a Moore-machine, we can create

three processes

– Next-state-decoder – Output-decoder – State-register

slide-39
SLIDE 39

Internal signals

William Sandqvist william@kth.se

  • Moore-machine contains internal

signals

– Next state – Present state

  • Theese signals are declared in the

architecture-description

slide-40
SLIDE 40

The vending machine in VHDL

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

We use bottle vending machine (system control) from last lecture as a concrete VHDL example

slide-41
SLIDE 41

Vending machine entity

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 (

  • - Inputs

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;

  • - Outputs

dec_acc : OUT std_logic; clr_acc : OUT std_logic; drop : OUT std_logic; return_10_cent : OUT std_logic); END Vending_Machine;

Clk and Reset (active low) is also needed!

slide-42
SLIDE 42

Vending machine architecture

William Sandqvist william@kth.se

  • The architecture describes the

function of the vending machine

  • We define

– internal signals for present and next state – three processes for next-state- decoder, output-decoder and state- register

slide-43
SLIDE 43

State diagram

(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

slide-44
SLIDE 44

Internal signals

William Sandqvist william@kth.se

  • We need to create a data type for the internal signal
  • Since we describe the states we use an enumeration type

with values a,b,c,d,e,f,g

  • We declare a variable for the current state

(current_state) and one for next state (next_state)

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 …

slide-45
SLIDE 45

We want to keep our "clever” state encoding

William Sandqvist william@kth.se

  • If we do not specify the encoding state then the synthesis tool chooses the

coding.

  • We can force it to a specific encoding with attributes (NOTE Attributes are

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);

  • - We can use state encoding according to BV 8.4.6
  • - to enforce a particular encoding (for Quartus)

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 …

slide-46
SLIDE 46

Block schematic

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

  • Signals A,B,C describes present state
  • Signals DA, DB, DC describes next state
slide-47
SLIDE 47

Quickie Question …

William Sandqvist william@kth.se

which statemachine corresponds to the VHDL code

slide-48
SLIDE 48

William Sandqvist william@kth.se

Quickie Question …

which statemachine corresponds to the VHDL code

slide-49
SLIDE 49

Next-State-Decoder

William Sandqvist william@kth.se

  • Next-State-Decoder describes as a

process

  • Sensitivity list contains all input

signals that 'activates' the process

slide-50
SLIDE 50

Next-State-Decoder

William Sandqvist william@kth.se

  • Usually the sensitivity list contains all the inputs to the

process

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 …

slide-51
SLIDE 51

Next-State-Decoder

William Sandqvist william@kth.se

  • We now use a CASE statement to describe for each state conditions for

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;

slide-52
SLIDE 52

Next-State-Decoder

William Sandqvist william@kth.se

  • We can simplify the description, by specifying a default value for the

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!

slide-53
SLIDE 53

Next-State-Decoder

William Sandqvist william@kth.se

  • We end the CASE statement with a WHEN OTHERS statement. Here

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;

slide-54
SLIDE 54

Output-decoder

William Sandqvist william@kth.se

  • Output-decoder is described as a own

process

  • Sensitivity list contains only the state

as outputs only depend on the state

slide-55
SLIDE 55

Output-decoder

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

slide-56
SLIDE 56

State register

William Sandqvist william@kth.se

  • The State register is modeled as a synchronous process with

asynchronous reset (active low)

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;

slide-57
SLIDE 57

Mealy-machine?

William Sandqvist william@kth.se

  • A Mealy machine can be modeled in the same

way as the Moore machine

  • The difference is that output-decoder is also

dependent on the input signals

  • Process modeling outputs also need to have

the inputs in the sensitivity list!

slide-58
SLIDE 58

More about VHDL

William Sandqvist william@kth.se

  • The sample code for bottle vending

machine available on the course website

  • Look at the study material of "VHDL

synthesis" on the course website

  • Both Brown/Vranesic- and the Hemert-book

includes code samples

slide-59
SLIDE 59

William Sandqvist william@kth.se

slide-60
SLIDE 60

Laboratory - codelock

  • Task: to write VHDL code for a code lock that opens with the

code "the last four digits of your Social Security number”.

  • Hint: a VHDL "template" for a

simplified code lock that opens with the code "number one".

William Sandqvist william@kth.se

slide-61
SLIDE 61

Code lock – classic example!

William Sandqvist william@kth.se

Moore – ”Gedanken Experiments” on Sequential Machines 1956

Code lock 0-1-0 That example is listed in Moore's classic essay from 1956.

slide-62
SLIDE 62

Template-program

William Sandqvist william@kth.se

Templat-program for a simplified code lock that opens for the code "1", a little bit too easy it seems ...!

Power On/Off

slide-63
SLIDE 63

Open the lock with your Social!

William Sandqvist william@kth.se

  • Now it's time to rewrite the VHDL code to open the lock

for the last four digits of your social security number!

(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).

slide-64
SLIDE 64

William Sandqvist william@kth.se