EEL 3705 / 3705L Digital Logic Design - PowerPoint PPT Presentation

1 / 66
About This Presentation
Title:

EEL 3705 / 3705L Digital Logic Design

Description:

Verilog: Most popular, faster sims, better tools, easier to learn, faster to code... Standards bodies Open Verilog International and VHDL International have ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 67
Provided by: Reginal91
Learn more at: https://eng.fsu.edu
Category:
Tags: eel | design | digital | logic | verilog

less

Transcript and Presenter's Notes

Title: EEL 3705 / 3705L Digital Logic Design


1
EEL 3705 / 3705LDigital Logic Design
  • Fall 2006Instructor Dr. Michael FrankModule
    10 Supplemental Topics Hardware Description
    Languages, Reversible Logic

2
Monday, December 4, 2006
  • Announcements
  • Final project demos this Thursday and Friday
  • Sign up for a time slot ASAP, if not already!
  • Last HW (5) due this Wednesday
  • Final project report due this Friday
  • Final Exam Thurs. Dec. 14th, 10-12 am
  • Exam review in class this Wednesday
  • Course evaluations in class Wednesday also
  • Todays lecture Supplemental Topics
  • Hardware description languages
  • Reversible logic (research topic)

3
Hardware Description Languages
  • VHSIC HDL (VHDL) (IEEE standard 1076)
  • See Carpinelli 5.4, misc books
  • Verilog HDL (IEEE std. 1364, see web.)
  • Status of Verilog-VHDL wars...
  • Verilog Most popular, faster sims, better tools,
    easier to learn, faster to code...
  • VHDL More tightly-structured language,
    higher-level, government standard, required for
    all defense contracts, widely supported.
  • VerilogVHDL CAda ?
  • Standards bodies Open Verilog International and
    VHDL International have merged ? accellera.org

4
VHDL (VHSIC HDL)
  • See VHSIC Hardware Description Language", M.R.
    Shahdad et al, IEEE Computer 18(2)94-103 (Feb.
    1985).
  • IEEE Standard 1076 (1987, revised 1993).
  • Resources that we may make available
  • Various web links
  • Carpinelli 01, section 5.4.
  • Murdocca 00, section 6.4.
  • Naylor Jones 97, Rushton 95, Baker 93
  • More document camera stuff...

5
Behavioral vs. Structural Models
  • VHDL is suitable for describing designs using
    descriptions mixing different levels of
    abstraction.
  • Two major types of component models in VHDL
  • Behavioral models specify the abstract functional
    behavior of components, w/o specifying how that
    behavior is implemented.
  • Can be simulated, but cannot always be
    automatically synthesized.
  • Structural models provide an actual
    implementation, or the outline of an
    implementation.
  • Can be simulated or synthesized.
  • VHDL designs can contain a mixture of the two
    types of models.

6
Basic Elements of VHDL
  • entity Specifies a HW interface ( Java
    interface)
  • Think of it as an empty chip package, or as an
    empty circuit board enclosure, w. I/O ports
    already installed
  • Comes with a set of named I/O pins of different
    types
  • architecture Implements an interface, as a set
    of interconnected sub-components. ( Java class)
  • Think of a printed circuit board design, or a
    block diagram of an IC, with blank boxes for
    sub-modules
  • component Template for plugging in
    sub-components into an architecture. ( interface
    variable)
  • Like a type of empty chip socket, that can be
    replicated many times placed on a circuit board
  • continued

7
Elements of VHDL, cont.
  • configuration For a given architecture of an
    entity, selects which entity/architecture pairs
    will be used for each component.
  • a class constructor that assigns class
    instances of specific types to the classs
    interface variables
  • Like going through empty sockets of a board,
    selecting what packaged chip to use in each one.
  • Only a configuration can actually be simulated.
  • package Module, collection of related
    declarations (components, datatypes, etc.). (
    Java package)
  • process Stateful, concurrently running,
    event-driven sequences of operations.

8
VHDL Example Majority Function
  • Goal of this block Return majority value of 3
    inputs.
  • Declaring the interface w. an entity statement
  • entity MAJORITY isport (A_IN, B_IN, C_IN in
    BIT F_OUT out BIT)end MAJORITY
  • Instantiating the interface with a behaviorial
    model, using an architecture specification
  • architecture LOGIC_SPEC of MAJORITY
    isbegin F_OUT lt (A_IN and B_IN) or (A_IN
    and C_IN) or (B_IN and C_IN) after 4
    nsend LOGIC_SPEC

9
Structural Model for Majority
  • -- Body (structural model)
  • -- Uses components declared in
  • -- package LOGIC_GATES in WORK
  • -- library.
  • -- Import entire package
  • use WORK.LOGIC_GATES.all
  • architecture LOGIC_SPEC of MAJORITY is
  • -- Declare internal signals
  • signal AB, AC, BC BIT
  • -- Wire together some components
  • begin
  • AND_1 AND2 port map(A_IN,B_IN,AB)
  • AND_2 AND2 port map(A_IN,C_IN,AC)
  • AND_3 AND2 port map(B_IN,C_IN,BC)
  • OR_1 OR3 port map(AB,AC,BC,F_OUT)
  • end LOGIC_SPEC
  • -- Package decl. in WORK library
  • package LOGIC_GATES is
  • component AND2
  • port(A,B in BIT Xout BIT)
  • end component
  • component OR3
  • port(A,B,Cin BITXout BIT)
  • end component
  • -- Interface to our new guy
  • entity MAJORITY is
  • port (A_IN, B_IN, C_IN in BIT
  • F_OUT out BIT)
  • end MAJORITY

10
Defined Signal Types
  • IEEE standard 9-value logic system, IEEE
    1164-1993
  • type STD_ULOGIC is (
  • U, -- Uninitialized
  • X, -- Forcing unknown
  • 0, -- Forcing 0
  • 1, -- Forcing 1
  • Z, -- High impedance
  • W, -- Weak unknown
  • L, -- Weak 0
  • H, -- Weak 1
  • -, -- Dont care
  • )
  • To use it
  • library IEEE
  • use IEEE.std_logic_1164.all

11
Verilog HDL
  • No slides yet.
  • FAQs / standards linked from class website.

12
VHDL Introduction
  • (Slides from Dr. Perry)

13
VHDL Introduction
  • V- VHSIC
  • Very High Speed Integrated Circuit
  • H- Hardware
  • D- Description
  • L- Language

14
VHDL Benefits
  • Public Standard
  • Technology and Process Independent
  • Include technology via libraries
  • Supports a variety of design methodologies
  • Behavioral modeling
  • Dataflow or RTL (Register Transfer Language)
    Modeling
  • Structural or gate level modeling

15
VHDL Benefits (cont)
  • Supports Design Exchange
  • VHDL Code can run on a variety of systems
  • Supports Design Reuse
  • Code objects can be used in multiple designs
  • Supports Design Hierarchy
  • Design can be implemented as interconnected
    submodules

16
VHDL Benefits (cont)
  • Supports Synchronous and Asynchronous Designs
  • Supports Design Simulation
  • Functional (unit delay)
  • Timing (actual delay)
  • Supports Design Synthesis
  • Hardware implementation of the design obtained
    directly from VHDL code.
  • Supports Design Documentation
  • Original purpose for VHDL Department of Defense

17
VHDL Design Units
  • Entity Declaration
  • Describes external view of the design (e.g. I/O)
  • Architecture Body (AB)
  • Describes internal view of the design
  • Configuration Declaration
  • Package Declaration
  • Library Declaration
  • Package Body

18
Architecture Body (AB)
  • The architecture body contains the internal
    description of the design entity. The VHDL
    specification states that a single design entity
    can contain multiple architecture bodies. Each
    AB can be used to describe the design using a
    different level of abstraction.

19
VHDL Statement Terminator
  • Each VHDL Statements is terminated using a
    semicolon

20
VHDL Comment Operator
  • To include a comment in VHDL, use the comment
    operator
  • -- This is a comment
  • -- This is an example of a comment
  • y lt 0 -- can occur at any point

21
Signal Assignment Operator
  • To assign a value to a signal data object in
    VHDL, we use the
  • signal assignment operator
  • lt
  • Example
  • y lt 1 -- signal y is
    assigned the value ONE

22
Complete AND GATE Example
-- behavioral model (yc) process(a,b)
begin yc lt 0 if((a1) and
(b 1)) then yc lt
1 else yc lt 0 end
if end process End architecture test
  • Library altera
  • Use altera.maxplus2.all
  • Library ieee
  • Use ieee.std_logic_1164.all
  • Use ieee.std_logic_arith.all
  • Entity and_example is
  • port(a,b in std_logic
  • ya,yb,yc out std_logic)
  • End entity and_example
  • Architecture test of and_example is
  • begin
  • --- dataflow model (ya)
  • ya lt a and b
  • -- structural model (yb)
  • and2a_7408 port map(a,b,yb)

23
AND GATE Example (cont)
When synthesized, we obtain the following logic
circuit
Synthesis tool creates three AND gates.
Maxplus II Block Diagram
24
VHDL Example - Hardware
  • It is important to remember that VHDL is a
    hardware language, so you must think and code
    in hardware.
  • Statements within the architecture body run
    concurrently. That is, order does not
    matter!!!
  • Well introduce sequential statements later
    when I introduce process blocks

25
VHDL Example Hardware
  • Example Logic Circuit

-- Code Fragment A Architecture test of example
is begin y1 lt a and b y2 lt c and
d y lt y1 or y2 end architecture test
26
VHDL Example Hardware
  • Example Logic Circuit

-- Code Fragment B Architecture test of example
is begin y lt y1 or y2 y2 lt c
and d y1 lt a and b end
architecture test
27
VHDL Example Hardware
  • Example Logic Circuit

-- Code Fragment C Architecture test of example
is begin y2 lt c and d y lt y1
or y2 y1 lt a and b end
architecture test
All three code fragments produce the same result
28
VHDL Syntax
29
VHDL Syntax Entity Declaration
Describes I/O of the design. I/O Signals are
called ports. The syntax is Entity design_name
is port(signal1,signal2,..mode type
signal3,signal4,..mode type) End entity
design_name
30
VHDL Syntax Entity Example
Entity my_example is port( a,b,c in std_logic
s in std_logic_vector(1
downto 0) e,f out std_logic
y out std_logic_vector(4 downto 0))
end entity my_example
Maxplus II Block Diagram
31
Architecture Body Syntax
  • Architecture name of entity_name is
  • internal signal and constant declarations
  • Begin
  • Concurrent statement 1
  • Concurrent statement 2
  • Concurrent statement 3
  • Concurrent statement 4
  • End architecture name

32
VHDL Program Template
  • Architecture name of entity_name is
  • internal signal and constant declarations
  • Begin
  • Concurrent statement 1
  • Concurrent statement 2
  • Concurrent statement 3
  • Concurrent statement 4
  • End architecture name
  • Library altera
  • Use altera.maxplus2.all
  • Library ieee
  • Use ieee.std_logic_1164.all
  • Use ieee.std_logic_arith.all
  • Entity design_name is
  • port(signal1,signal2,..mode type
  • signal3,signal4,..mode type)
  • End entity design_name

33
Simple Concurrent StatementsAssignment Operator
  • Assignment operator lt
  • Ex y lt a and b -- defines a AND gate
  • For simulation purposes only, you may specify a
    delay.
  • Ex y lt a and b after 10 ns
  • This is useful if you want to also use VHDL to
    generate a known test waveform or vector. This
    is known as a test bench. However, we will
    use Maxplus II to generate test vectors. Note,
    you cannot specify a delay for synthesis
    purposes.

34
Simple Concurrent StatementsLogical Operators
  • Logical operators
  • And, or, nand, nor, xor, xnor, not
  • Operates on std_logic or Boolean data objects
  • All operators (except for the not operator)
    require at least two arguments
  • Ex y lt a and b -- AND gate

35
Simple Concurrent StatementsLogical Operators
  • Logical operators
  • Examples y lt a and not b
  • Use parenthesis to define order of execution
  • Ex ylt (a and b) or c y lt a
    and (b or c)

36
Complex Concurrent Statementswith-select-when
  • with-select-when
  • Syntax is
  • with select_signal select
  • signal_name lt value1 when
    value1_of_select_sig,
  • value2 when
    value2_of_select_sig,
  • value3 when
    value3_of_select_sig,
  • value_default
    when others

37
Complex Concurrent StatementsWith-select-when
  • Example---- library statements (not shown)
  • entity my_test is port( a3,a2,a1,a0
    in std_logic_vector(3 downto 0)
  • s in
    std_logic_vector(1 downto 0)
  • y out
    std_logic_vector(3 downto 0))
  • end entity my_test architecture behavior
    of my_test is
  • begin
  • with s select
  • y lt a3 when 11,
  • a2 when 10,
  • a1 when 01,
  • a0 when others -- default
    condition
  • end architecture behavior

38
Complex Concurrent StatementsWith-select-when
  • What is the logic expression for y?
  • What is this in hardware?
  • A 4-bit 4X1 MUX

A3
A2
Y
A1
A0
S
39
VHDL Data Objects
  • VHDL is an Object Oriented Programming (OOP)
    Language. Objects can have values, attributes
    and methods. We will primarily use the following
    VHDL data objects
  • Signals
  • Constants
  • Variables

40
Data ObjectsSignals
  • SignalsSignals are data objects in which the
    value of the object can be changed. There is an
    implied or explicit delay between the signal
    assignment and when the signal is updated. We
    will use signals to represent nets (i.e. wires)
    in our circuits. They can be implemented in
    hardware. Signals are defined in port statements
    and architecture declaration blocks.

41
Data ObjectsConstants
  • Constants Constants are data objects in which
    the value of the object cannot be changed. They
    are defined within an architecture or process
    declaration block. They cannot be implemented in
    hardware.

42
Data ObjectsConstants
  • Syntax
  • constant name type value
  • Example
  • constant s0 std_logic_vector(1 downto 0)
    01
  • Notes
  • Use a set of single apostrophes to enclose a
    single bit (e.g. 1).
  • Use a set of quotations to enclose multiple bits
    (e.g. 01).

43
Data ObjectsVariables
  • Variables Variables are data objects in which
    the value of the object can be changed. This
    change occurs instantaneously. Variables can
    only be defined within a process declaration
    block. They cannot be implemented in hardware.

More about variables later
44
Sequential StatementsProcess Statements
In VHDL, sequential statements are executed
within a process block. Syntax is label
process (sensitivity list) constant
or variable declarations begin
sequential statements end
process label
The sensitivity list contains all of the inputs
to the process block.
45
Sequential StatementsProcess Statements (cont)
A process block is considered a single
concurrent statement. Lets review our AND
example
46
Sequential StatementsProcess Statements - Example
---- library statements entity and_example is
port(a,b in std_logic ya,yb,yc out
std_logic) End entity and_example Architecture
test of and_example is begin --- dataflow
model ya lt a and b ---
structural model a_7408 port map(a,b,yb)
-- Process Block process(a,b) begin
yc lt 0 if ((a1) and (b
1)) then yc lt 1 else yc lt 0
end if end process End architecture
test
47
Sequential StatementsProcess Statements
When synthesized, we obtain the following logic
circuit
The process statement synthesizes into an AND
gate just like the dataflow and structural
statements. Note, the process block synthesized
AND gate runs concurrently with the other
synthesized AND gates.
48
Sequential StatementsImplied Registers
Registers
49
Sequential StatementsImplied Registers
Positive edge triggered D-FF with asynchronous
reset
Process (d,clock,reset) begin if
(reset 0) then q lt 0
elsif( clockevent and clock1) then
q lt d end if end process
In hardware, this becomes
A clockevent is a 0 to 1 or 1 to 0 transition on
the clock line.
50
Sequential StatementsImplied Registers
  • How does this produce a register?
  • If reset 0, q is set to 0 (asynchronous
    reset)
  • If clock line makes a transition from 0 to 1
  • Clockevent and clock 1
  • then q is assigned to d
  • But, we have not defined an output for
  • Reset 1,
  • A non Clockevent , or
  • ClockEvent and Clock 0

So, VHDL assumes we want to retain the current
value of q for these conditions and synthesizes a
D-FF for us.
51
Sequential StatementsImplied Registers
We can easily extend this to a register block by
using a std_logic_vector datatype instead of a
std_logic datatype.
. Signal ns,psstd_logic_vector(7 downto
0) .. Process (ns,clock,reset) begin
if (reset 0) then ps lt
00000000 elsif( clockevent and
clock1) then ps lt ns
end if end process
In hardware, this becomes
52
Sequential StatementsImplied Registers
We can also define a S0 (reset state) and use it
to reset the register.
. Signal ns,psstd_logic_vector(7 downto
0) Constant S0std_logic_vector(7 downto 0)
00000000 .. Process (ns,clock,reset)
begin if (reset 0) then
ps lt s0 --- use reset state elsif(
clockevent and clock1) then ps
lt ns end if end process
53
Sequential StatementsCase -When Statement
Use a CASE-WHEN statement when priority is not
needed. All FSMs will be implemented using
Case-when statements. Syntax is
Case expression is when choice_1 gt
sequential statements when choice_2 gt
sequential statements
. when choice_n gt sequential
statements when others gt -- default
condition sequential statements end
case
54
VHDL FSM Example 1 2-bit Up Counter
  • State Diagram

55
VHDL FSM Example 1
  • State Table

S0 00
S1 01
S2 10
S3 11
Let
ps ns y
S0 S1 0
S1 S2 1
S2 S3 2
S3 S0 3
Let S0 reset state
56
Recall Moore FSM
Next State
Present State
Output Vector
Input Vector
Clock
Feedback Path
Reset
Use a case statement to implement the
design since priority is not needed
57
VHDL Code - Header Info
  • --------------------------------------------------
    --------------
  • --
  • -- Program fsm1.vhd
  • --
  • -- Description 2-bit up counter.
  • --
  • -- Author R.J. Perry
  • -- Date
  • -- Revisions
  • --------------------------------------------------
    -------------
  • -- Signal I/O
  • --------------------------------------------------
    --------------
  • -- Signal name Direction
    Description
  • -- clock,reset in
    clock,reset
  • -- count out
    output count
  • --------------------------------------------------
    --------------

58
VHDL Code - Entity Declaration
  • -- Call Altera and IEEE packages
  • library altera
  • use altera.maxplus2.all
  • library ieee
  • use ieee.std_logic_1164.all
  • use ieee.std_logic_arith.all
  • use ieee.std_logic_unsigned.all
  • -- define entity
  • entity fsm1 is
  • port ( clk,reset in std_logic
  • count out std_logic_vector(1 downto 0)
  • )
  • end entity fsm1

59
VHDL Code - Architecture Dec
  • -- define architecture
  • architecture fsm of fsm1 is
  • -- define constants
  • constant s0 std_logic_vector(1 downto 0)
    "00"
  • constant s1 std_logic_vector(1 downto 0)
    "01"
  • constant s2 std_logic_vector(1 downto 0)
    "10"
  • constant s3 std_logic_vector(1 downto 0)
    "11"
  • signal ns,ps std_logic_vector(1 downto 0)
  • begin

60
VHDL Code -- F Logic
  • --
  • -- this process executes the F logic
  • --
  • process ( ps)
  • begin
  • ns lt s0 -- This is the default
    output
  • case ps is
  • when s0 gt ns lt s1
  • when s1 gt ns lt s2
  • when s2 gt ns lt s3
  • when s3 gt ns lt s0
  • when others gt ns lt s0 --
    default condition
  • end case
  • end process

State Diagram for F Logic
Input into F logic
Note we only need to describe the
behavior VHDL will figure out the functional
relationships
61
VHDL Code -- Register Logic
  • --
  • -- This process includes the registers
    implicitly
  • --
  • reg process (clk, reset, ns)
  • begin
  • if(reset '0') then
  • ps lt s0
  • elsif (clk'event and clk '1') then
  • ps lt ns
  • end if
  • end process reg

Inputs to reg logic
62
VHDL Code -- H Logic
  • --
  • -- Use concurrent statement to implement H Logic
  • --
  • count lt ps
  • end architecture fsm

63
Recall Gate Level Logic Diagram
64
Maxplus II Produces
65
Is this correct?
T Toggle FF
We have,
OK, same as before
OK, same as before
T input
How does this code fit into our Moore FSM
architecture?
66
System Design Example
Write a Comment
User Comments (0)
About PowerShow.com