Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops...

44
Digital Design 2010 DE2 1 1 Modul 3 Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , Flip Flip-Flops & Flops & Counters Counters 2

Transcript of Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops...

Page 1: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 1

1

Modul 3Modul 3

PLD, VHDL, PLD, VHDL, LatchesLatches, , FlipFlip--Flops & Flops & CountersCounters

2

Cou te sCou te s

Page 2: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 2

PLAPLAPALPALPLDPLDCPLDCPLDFPGAFPGA

3

FPGAFPGAASICASIC

PLA contains a 2 level structure of AND and OR gates with userprogrammable connections (sum of the product basically min terms)programmable connections (sum of the product, basically min terms).

PLA structure was enhanced to PAL programmable logic arrays and todaysuch devices are called PLD programmable Logic Devices.

However, PAL lack scalability as the 2 level cannot be scaled to larger sizes,so instead of PLD, CPLD Complex PLD are introduced which basicallycontains large number of PLDs and interconnection structure that is alsoprogrammable so providing a rich design capability.

4

programmable so providing a rich design capability.

The later version of CPLD which contains large number of individual blocksis called FPGA.

Page 3: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 3

Sum of the product: AND gates providethe product and OR gates as sum.

5

Embedded Systems: A Contemporary Design Tool by James K. Peckol

The only limitation here is size of thedevice as the number of input and outputpins and the number of product termsavailable.

6

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Page 4: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 4

7

Embedded Systems: A Contemporary Design Tool by James K. Peckol

To make it more flexible and enhancing the capability of these circuits an inputdriver with true and negated option.

8

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Page 5: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 5

9

Embedded Systems: A Contemporary Design Tool by James K. Peckol

10

Embedded Systems: A Contemporary Design Tool by James K. Peckol

In PAL, only AND gates are programmable where as OR gates are fixed, so there is a limit on producing product terms in sum.

Page 6: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 6

11

Embedded Systems: A Contemporary Design Tool by James K. Peckol

In this case both are programmable, so product terms are re-usable.

12

Embedded Systems: A Contemporary Design Tool by James K. Peckol

This is just the extension of PLA, it contains a flip-flop as a storageelement and typically the output of the flip-flop is fed back to the logic tosupport finite state machine design.

Page 7: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 7

One time: One time: Antifuse (Metal crystalline alloy is created for conduction.

Reprogrammable: Floating Gate.

13

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Floating Gate

14

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Page 8: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 8

15

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Initially, floating gate has no charge so it has no effect on circuitoperation and all transistors are effectively connected, to programthe logic high voltage is applied to the link where no connection isrequired.

16

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Through avalanche injection a negative charge is placed to the floating gateso once you apply a normal 1 logic transistor does not turned on and typicallyit is believed that the charge remains there for 10 years. Ultraviolet light wasused to erase the device, because it becomes conductive under ultravioletlight.

Page 9: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 9

17

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Modern devices are manufactured in a different way using a tunneling effect, the advantage is that one can electronically erase the device.

18

Embedded Systems: A Contemporary Design Tool by James K. Peckol

PLD and CPLD has coarse grain architecture meaning fewer interconnections, where as FPGA has fine grain architecture having a rich inter connection topology. Generic (GAL) Gate Array logic is also a PAL as shown in figure.

Page 10: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 10

19

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Output which contains a flip-flop is called registered output where as the other is obviously called un-registered output.

20

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Contains 6 logic block with each containing 6 macro-cell, interconnection issupported at different levels some may be connected some may be not.

Page 11: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 11

The basic logic blocks are much simpler than the CPLD, but it is fine grain interconnection topology.

21

Embedded Systems: A Contemporary Design Tool by James K. Peckol

22

Embedded Systems: A Contemporary Design Tool by James K. Peckol

Page 12: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 12

23

Embedded Systems: A Contemporary Design Tool by James K. Peckol

24

Output which contains a flip-flop is called registered output .

Page 13: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 13

25

26

Page 14: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 14

27

28

Page 15: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 15

29

tPD : Propogation delaytCO : Propagation delay from the rising edge of the clocktCF : PD from the rising edge of the clock to the macrocell’s outputtSU : Setup time during which signal must be stabletH : Signal at D input must be hold for that period of time

30

It should be remembered that timing parameters in PLDs have longer setup times because ofAND & OR gates, so for critical timing requirements it should be kept in mind forimplementation.

Which gate is faster ?

Page 16: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 16

HDL and HDL and VerilogVerilog are hardware description languages.are hardware description languages.

HDL has its root in PASCAL & ADA HDL has its root in PASCAL & ADA

WhWh V ilV il h it t i Ch it t i C

31

Where as Where as VerilogVerilog has its root in C. has its root in C.

Documentation and Modelling Language

Developed and designed with principles of structured programming in mind (ideas from PASCAL and Ada).

Design is decomposed.Each design element has both well defined interface and precise functional specifications.Concurrency, timing and clocking can be modelled.

32

Logical operations and timing behaviour can be simulated.

VHDL is basically, VHSIC Hardware Description Language, Very High Speed Integrated Circuits HDL.

Page 17: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 17

Entity is declaration of modules input and output. It is like a wrapper hiding h d il f h i i id

33

the details of what is inside.

Where as architecture is more detailed description of the modules internal behavior or structure. This allows a hierarchical design.

34

Page 18: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 18

35

Inside the text file entity and architecture is defined separately.

36

Page 19: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 19

37

38

Page 20: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 20

39

40

Page 21: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 21

41

Before we start going into any language we must understand the overall language in this VHDL d i flcase VHDL design flow.

It is divided into 2 parts, front end and back end.

Typically, large logic designs has the capacity to be divided into blocks of different functionality so one can have a hierarchical structure.

Verification or testing has 2 dimensions, functional verification which is concerned with logical behaviour of the circuit where as timing is concerned with more on gate delays etc, so in this case one test the actual delay verses the estimated delay However in the front end

42

so in this case one test the actual delay verses the estimated delay. However, in the front end it is still limited verification.

In the back end the design is converted into set of primitives which can be assembled into the target technology (PLD/CPLD etc). Fitting is mapping to the technology. Final step is the timing verification due to many things including length of wires etc.

Page 22: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 22

43

For ReferenceFor Reference

44

For ReferenceFor Reference

Page 23: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 23

45

46

Page 24: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 24

47

48

Page 25: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 25

49

A collection of 2 or more D type flip flops with acommon clock is called a register, registers are usedto store collection of related bits. Constraint is that allthe bits gets updated with the same clock.

50

Page 26: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 26

51

52

Page 27: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 27

53

54

If EN_L is asserted then at the rising edge of clock the flip flops are loadedwith the data inputs, otherwise they retain their present values.

Page 28: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 28

55

The reason of having latching the address is that typically address busand data bus are multiplexed in 3 state logic to save pins. ROMCS_L isROM chip select effective low.

56

In this case the higher order bits (12 bits) are used for chip select, where as the20 lower order bits are used for address location of the selected device.

Page 29: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 29

57

It may produce quick chip select for devices, higher order address bits are directlygiven to latching decoder and the address valid is also applied directly to latchingdecoder.

58

Page 30: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 30

59

Most commonly used counter is n bit binary counter. This is a ripple binarycounter as carry is propagated to the next counter, one bit at a time.

T is the toggle flip flop which changes (toggles) its state at each clock pulse.

Ri l t l d i i if it i l i l t th

60

Ripple counters are slow and one can imagine if it is a large ripple counter themost significant output may not be valid because of the propagation delay.

The counter shown is with a Serial Enable, it is called serial counter because thecombinational enable signal propagate serial from LSB to MSB. It can haveproblem if the clock period is two short, it will not have enough time that LSBchange is propagated to MSB

Page 31: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 31

61

The counter with Parallel Enable, which eliminates the problem and this is thefastest binary counter structure

62

Page 32: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 32

63

64

Page 33: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 33

65

If you look at the 4 output signals it can be realised easily that each output isdivided by 2 at each step, so the counter can be used as divide by 2, 4, 8 and 16counter.

66

Page 34: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 34

67

68

Page 35: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 35

69

70

Page 36: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 36

71

72

Page 37: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 37

73

74

Page 38: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 38

75

76

Page 39: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 39

77

78

Page 40: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 40

79

80

Page 41: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 41

81

82

Page 42: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 42

83

84

Page 43: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 43

85

86

Page 44: Modul 3 PLD, VHDL, PLD, VHDL, Latches Latches, , FlipFlip--Flops …homes.et.aau.dk/.../modul-8-2010-new.pdf · 2010. 10. 8. · Embedded Systems: A Contemporary Design Tool by James

Digital Design 2010

DE2 44

87