+ All Categories
Home > Documents > Programable Logic Devices - Amazon Web...

Programable Logic Devices - Amazon Web...

Date post: 13-Jun-2020
Category:
Upload: others
View: 4 times
Download: 0 times
Share this document with a friend
64
Programable Logic Devices William Sandqvist [email protected] 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
Transcript
Page 1: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Programable Logic Devices

William Sandqvist [email protected]

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

Page 2: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

PLD structure

William Sandqvist [email protected]

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

Page 3: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Programmable Logic Array (PLA)

William Sandqvist [email protected]

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

Page 4: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Programmable Array Logic (PAL)

William Sandqvist [email protected]

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

Page 5: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Register output

William Sandqvist [email protected]

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.

Page 6: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Macrocels ia a PLD

William Sandqvist [email protected]

f 1

To AND plane

D Q

Clock

Select Enable

Flip-flop

With a programmable multiplexer one can select the type of output

Page 7: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

PAL

William Sandqvist [email protected]

Page 8: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Programing of PLDs

William Sandqvist [email protected]

Page 9: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Complex PLDs (CPLD)

William Sandqvist [email protected]

PLD were quite small (PALCE 22V10 had 10 flip-flops)

For bigger programmable circuits a structure consisting of several PLD-like block was developed.

Page 10: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

CPLD (MAX)

William Sandqvist [email protected]

Page 11: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

CPLD structure

William Sandqvist [email protected]

PAL-like block

I/O b

lock

PAL-like block

I/O block

PAL-like block

I/O b

lock

PAL-like block

I/O block

Interconnection wires

Page 12: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Programing with JTAG

William Sandqvist [email protected]

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

Page 13: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

(a) CPLD in a Quad Flat Pack (QFP) package

Printed circuit board

To computer

(b) JTAG programming

JTAG programing

William Sandqvist [email protected]

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.

Page 14: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

FPGA chips

William Sandqvist [email protected]

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 on logical blocks

Page 15: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

FPGA-structure

William Sandqvist [email protected]

Page 16: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

LUT-LookUp-Table

William Sandqvist [email protected]

0/1

0/1

0/1

0/1

x1

x2

f

Two-input LUT

Programmable cells 1

0

1

0

1

0

A LUT with n inputs can realize all combinational functions with n inputs. The usual size in an FPGA is n=4

Page 17: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Ex. LUT for XOR-gate

William Sandqvist [email protected]

0

1

1

0

x1

x2

f

Two-input LUT

1

0

1

0

1

0

2 1

1 1 00 1 11 0 10 0 0

x x f

Page 18: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Logic block in FPGA

William Sandqvist [email protected]

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.

Page 19: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Interconnexion matrix in FPGA

William Sandqvist [email protected]

0 1 0 0

0 1 1 1

0 0 0 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

Page 20: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

DE2 University Board

William Sandqvist [email protected]

Cyclone II EP2C35 FPGA – Datorteknik-course

Page 21: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Cyclone II logic element

William Sandqvist [email protected]

Page 22: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Cyclone II Family

William Sandqvist [email protected]

(3) Total Number of 18x18 Multipliers DE2

Page 23: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Stratix III Family

William Sandqvist [email protected]

DE3 Board

Page 24: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Multiple processors on an FPGA

William Sandqvist [email protected]

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

Page 25: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

ASIC

William Sandqvist [email protected]

• 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

Page 26: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

ASIC, gate array

William Sandqvist [email protected]

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

Page 27: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

ASIC, gate array

William Sandqvist [email protected]

One only creates links between inputs, gates, and outputs

f 1

x 1

x 3

x 2

Page 28: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Comparison ASIC, FPGA

William Sandqvist [email protected]

Initial Cost Cost per part Performance Fabrication Time

FPGA Low High Low Short

Gate Array (ASIC)

Standard Cell (ASIC)

High Low High Long

Page 29: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Design Trade-Offs

William Sandqvist [email protected]

Design Time

Performance

Microprocessor

Programmable Logic

Gate Array

Standard Cell

Full Custom

Page 30: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

William Sandqvist [email protected]

Page 31: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Sekvenskretsar med VHDL

William Sandqvist [email protected]

NEXT STATE DECODER STATE REGISTER

OUTPUT DECODER

State

Clk

Input- signals

Output- signals

Moore-machine

Page 32: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Model a State Machine in VHDL

William Sandqvist [email protected]

• In a Moore-machine we have three blocks

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

• These blocks execute in parallel

Page 33: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Quickie Question …

William Sandqvist [email protected]

which logic gate corresponds to the following VHDL code

Page 34: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Quickie Question …

William Sandqvist [email protected]

which logic gate corresponds to the following VHDL code

Page 35: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Quickie Question …

William Sandqvist [email protected]

which logic gate corresponds to the following VHDL code

Page 36: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Quickie Question …

William Sandqvist [email protected]

which logic gate corresponds to the following VHDL code

Page 37: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Processes in VHDL

William Sandqvist [email protected]

• An architecture in VHDL can consist of several processes • Processes are executed in parallel • A process is written as a sequential program

Page 38: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Moore-machine processes

William Sandqvist [email protected]

• For a Moore-machine, we can create three processes

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

Page 39: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Internal signals

William Sandqvist [email protected]

• Moore-machine contains internal signals

– Next state – Present state

• Theese signals are declared in the architecture-description

Page 40: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

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 [email protected]

ACCUMU-LATOR

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

Page 41: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Vending machine entity

William Sandqvist [email protected]

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!

Page 42: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Vending machine architecture

William Sandqvist [email protected]

• 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

Page 43: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

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 [email protected]

Page 44: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Internal signals

William Sandqvist [email protected]

• 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 …

Page 45: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

We want to keep our "clever” state encoding

William Sandqvist [email protected]

• 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 …

Page 46: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Block schematic

William Sandqvist [email protected]

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

Page 47: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Quickie Question …

William Sandqvist [email protected]

which statemachine corresponds to the VHDL code

Page 48: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

William Sandqvist [email protected]

Quickie Question … which statemachine corresponds to the VHDL code

Page 49: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Next-State-Decoder

William Sandqvist [email protected]

• Next-State-Decoder describes as a process • Sensitivity list contains all input signals that 'activates' the process

Page 50: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Next-State-Decoder

William Sandqvist [email protected]

• 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 …

Page 51: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Next-State-Decoder

William Sandqvist [email protected]

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

Page 52: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Next-State-Decoder

William Sandqvist [email protected]

• 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!

Page 53: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Next-State-Decoder

William Sandqvist [email protected]

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

Page 54: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Output-decoder

William Sandqvist [email protected]

• Output-decoder is described as a own process

• Sensitivity list contains only the state as outputs only depend on the state

Page 55: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

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 [email protected]

Page 56: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

State register

William Sandqvist [email protected]

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

Page 57: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Mealy-machine?

William Sandqvist [email protected]

• 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!

Page 58: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

More about VHDL

William Sandqvist [email protected]

• 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

Page 59: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

William Sandqvist [email protected]

Page 60: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

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 [email protected]

Page 61: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Code lock – classic example!

William Sandqvist [email protected]

Moore – ”Gedanken Experiments” on Sequential Machines 1956

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

Page 62: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Template-program

William Sandqvist [email protected]

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

Power On/Off

Page 63: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

Open the lock with your Social!

William Sandqvist [email protected]

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

Page 64: Programable Logic Devices - Amazon Web Serviceskth.s3-website-eu-west-1.amazonaws.com/ie1204_5/... · Programable Logic Devices William Sandqvist william@kth.se In the 1970s programmable

William Sandqvist [email protected]


Recommended