SlideShare a Scribd company logo
1 of 19
Enumerated Types
The first style is used most often to define cases or states
for a state machine
type CAR_STATE is (back, stop, slow, medium, fast);
VHDL also allows users to create subtypes of a type
   The values in the subtype must be a contiguous range of values
   of the base type from start to end
   Subtype GO_KART is CAR_STATE range stop to medium;
VHDL has two predefined integer subtypes
   Subtype natural is integer range 0 to highest integer;
   Subtype positive is integer range 1 to highest integer;


                                                                    1
Enumerated Types
BIT – can be ‘0’ or ‘1’ (note single quotes)
STD_LOGIC            IEEE std_logic_1164 package

   Has NINE legal values:
   ‘U’, ‘X’, ‘0’, ‘1’, ‘Z’, ‘W’, ‘L’, ‘H’, ‘-’
Example Subtype Declarations
   Subtype twoval_logic is std_logic range ‘0’ to ‘1’;
   Subtype fourval_logic is std_logic range ‘X’ to ‘Z’;
   Subtype negint is integer range -2147483647 to -1;
   Subtype bitnum is integer range 31 downto 0;

                                                          2
Constants
They contribute to readability, maintainability and
portability of programs in any language
The syntax is as shown
constant BUS_SIZE: integer := 32; --
  width of component
constant MSB: integer := BUS_SIZE - 1; --
  bit number of MSB
constant Z: character := ‘Z’; -- synonym
  for Hi-Z value
  The value of a constant can be a simple expression
  Constants can be used anywhere the corresponding value
  can be used and they can be put to good use in type
  definitions

                                                           3
Arrays
Another very important category of user-defined types
Ordered set of elements of the same type, where each element is
selected by an array index
Syntax for VHDL array definitions
type type-name is array     (start to end) of element-type;
type type-name is array     (start downto end) of element-
  type;
type type-name is array     (range-type) of element-type;
type type-name is array     (range-type range start to end)
  of element-type;
type type-name is array     (range-type range start downto
  end) of element-type;



                                                             4
Array declarations
type monthly_count is array (1 to 12) of integer;
type byte is array (7 downto 0) of STD_LOGIC;

constant WORD_LEN: integer := 32;
type word is array (WORD_LEN - 1 downto 0) of STD_LOGIC;

constant NUM_REGS: integer := 8;
type reg_file is array ( 1 to NUM_REGS ) of word;

type traffic_light_state is (reset, stop, wait, go);
type statecount is array (traffic_light_state) of integer;
  Array elements are considered to be ordered from left to right in
  the same direction as index range
                                                                5
Array declarations
type monthly_count is array (1 to 12) of integer; 1
type byte is array (7 downto 0) of STD_LOGIC; 7

Constant WORD_LEN: integer := 32;
type word is array (WORD_LEN - 1 downto 0) of STD_LOGIC; 31

Constant NUM_REGS: integer := 8;
type reg_file is array ( 1 to NUM_REGS ) of word; 1

Type traffic_light_state is (reset, stop, wait, go);
type statecount is array (traffic_light_state) of integer;
                                                        reset
  Left most elements of arrays are shown in blue
                                                        6
Array elements and literals
Within VHDL program statements, individual array elements
are accessed using the array name and the element’s index in
parentheses.
If M, B, W, R, and S are signals of variables of the five array
types defined in the previous slides then M(11), B(5),
W(WORD_LEN – 5), R(0,0), R(0) and S(reset) are all valid
elements.
Array literals can be specified by listing the element values in
parentheses. The byte variable B could be set to all ones by the
statement
B := (‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’);

                                                            7
Array elements and literals
VHDL also has a shorthand notation that allows you to specify
values by index.
To set word variable W to all ones except for zeroes in the LSB
of each byte
W := (0 => ‘0’, 8 => ‘0’, 16 => ‘0’, 24 => ‘0’, others => 1);
The methods work for arrays with any element type, but the
easiest way to write a literal of type STD_LOGIC is to use a
“string”
VHDL string is an array of ISO characters enclosed in double
quotes such as “Hello”
                                                                8
String
A string is just an array of characters.
A STD_LOGIC array of a given length can be
assigned the value of a string of the same length, as
long as the characters in the string are taken from the
set of nine characters defined as the possible values of
the STD_LOGIC elements like ‘0’, ‘1’, ‘U’
 The two previous examples can be rewritten as
B := “11111111”;
W := “11111110111111101111111011111110”;
                                                   9
Example: LogicFcn
                  ports



     A
     B
     C                                   Y




         entity           architecture
                                             10
Entity Declaration for LogicFcn
 library IEEE;
 use IEEE.std_logic_1164.all;
  entity LogicFcn is
   port (
                        A
   A: in std_logic;     B         Y
   B: in std_logic;     C

   C: in std_logic;
   Y: out std_logic
   );
 end entity LogicFcn;
                                      11
Parts of Architecture Body
architecture     ARCH_NAME      of    ENTITY_NAME        is

  <declarative section : list internal signals, variables,
   and components here. For each component used
   show the port map, (unless port map defined is in a
   “package”) >
begin

 <statement section : all concurrent statements and
  components and processes in this section execute at
  the same time, NOT sequentially>
end ARCH_NAME;

                                                              12
Architecture Body
Specifies the internal circuit of an entity, using any
   one of the following modeling styles:
1. As a set of interconnected components, as wired
   (called structural modeling)
2. As a set of concurrent signal assignment
   statements (called dataflow modeling)
3. As a set of sequential assignment statements,
   i.e., a “process” (called behavioral modeling)
4. As any combination of the above (called mixed
   modeling)

                                                         13
Architecture Body (Dataflow)

With a signal assignment statement:

    architecture dataflow of LogicFcn is
    begin
      Y <= (not A and not B) or C;
    end dataflow;




                                           14
Architecture Body (Dataflow)

With a conditional signal assignment statement:
    architecture dataflow of LogicFcn is
    begin
      Y <= '1' when (A = '0' AND B = '0') OR
                    (C = '1')
              else '0';
    end dataflow;




                                                  15
Architecture Body (Behavioral)
             architecture behavioral of LogicFcn is
“Label:”
             begin                               Sensitivity List - The Process will
                                                 be executed anytime there is an
Name of        fcn: process (A,B,C)              EVENT (change of state) on one of
process                                          these signals.
               begin
                 wait on A,B,C;                  WAIT ON statement - has same
                                                 effect as sensitivity list.
                 if (A = '0' and B = '0') then   CANNOT USE BOTH.
                                                 Processes with WAIT statements
                   Y <= '1';                     cannot have sensitivity lists !!

   process       elsif C = '1' then
                   Y <= '1';                     Statements within Processes are
                                                 executed sequentially. (This is a
                 else                            single IF statement)
                                                 The process, however, executes
                   Y <= '0';                     concurrently with other processes
                                                 and concurrent statements in the
                 end if;                         architecture.
               end process;
             end behavioral;
                                       Values are assigned to signals when process suspends
                                                                                              16
Architecture Body (Structural)
Internal signals are LOCAL to the Architecture, and cannot
be seen outside it !
                             signals

                         notA
           A                            andSignal


           B             notB


           C                                            Y




               entity            architecture
                                                             17
Architecture Body (Structural)
               architecture structural of LogicFcn is       LOCAL SIGNALS are
COMPONENT        signal notA, notB, andSignal: std_logic;   declared within the
declarations   begin                                        architecture and they
may go here      i1: inverter port map (i => A,
                                                            have no MODE (IN,
                                                            OUT, etc.)
                                       o => notA);
                 i2: inverter port map (i => B,
                                       o => notB);          These are
                 a1: and2 port map (i1 => notA,             COMPONENT
                                    i2 => notB,             INSTANTIATIONS
                                    y => andSignal);
                 o1: or2 port map (i1 => andSignal,
                                   i2 => C,
                                   y => Y);
               end structural;

                                                                          18
Components for Structural Model
   library IEEE;                       component OR2 port (
   use IEEE.std_logic_1164.all;            i1: in std_logic;
   package primitive is                    i2: in std_logic;
   component AND2 port (                   y: out std_logic
       i1: in std_logic;                   );
       i2: in std_logic;               end component;
       y: out std_logic                component INVERTER port (
       );                                  i: in std_logic;
   end component;                          o: out std_logic
                                           );
                                       end component;
                                       end primitive;



                                  these are component declarations
                                                                   19

More Related Content

What's hot

Jtag presentation
Jtag presentationJtag presentation
Jtag presentationklinetik
 
Asynchronous Sequential Circuit-Unit 4 ppt
Asynchronous Sequential Circuit-Unit 4 pptAsynchronous Sequential Circuit-Unit 4 ppt
Asynchronous Sequential Circuit-Unit 4 pptSIVALAKSHMIPANNEERSE
 
2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verificationUsha Mehta
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptxMemonaMemon1
 
LED Blinking logic on LPC1768
LED Blinking logic on LPC1768LED Blinking logic on LPC1768
LED Blinking logic on LPC1768Omkar Rane
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginnersDr.YNM
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.pptDr.YNM
 
LDPC - Low Density Parity Check Matrix
LDPC - Low Density Parity Check MatrixLDPC - Low Density Parity Check Matrix
LDPC - Low Density Parity Check MatrixKavi
 
RTL-Design for beginners
RTL-Design  for beginnersRTL-Design  for beginners
RTL-Design for beginnersDr.YNM
 
JTAG Interface (Intro)
JTAG Interface (Intro)JTAG Interface (Intro)
JTAG Interface (Intro)Nitesh Bhatia
 
Fpga implementation of utmi with usb 2.O
Fpga implementation of  utmi  with usb 2.O Fpga implementation of  utmi  with usb 2.O
Fpga implementation of utmi with usb 2.O Mathew George
 

What's hot (20)

Jtag presentation
Jtag presentationJtag presentation
Jtag presentation
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
Asynchronous Sequential Circuit-Unit 4 ppt
Asynchronous Sequential Circuit-Unit 4 pptAsynchronous Sequential Circuit-Unit 4 ppt
Asynchronous Sequential Circuit-Unit 4 ppt
 
Pass Transistor Logic
Pass Transistor LogicPass Transistor Logic
Pass Transistor Logic
 
2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification2019 2 testing and verification of vlsi design_verification
2019 2 testing and verification of vlsi design_verification
 
8051 MICROCONTROLLER ARCHITECTURE.pptx
 8051 MICROCONTROLLER ARCHITECTURE.pptx 8051 MICROCONTROLLER ARCHITECTURE.pptx
8051 MICROCONTROLLER ARCHITECTURE.pptx
 
LED Blinking logic on LPC1768
LED Blinking logic on LPC1768LED Blinking logic on LPC1768
LED Blinking logic on LPC1768
 
Behavioral modelling in VHDL
Behavioral modelling in VHDLBehavioral modelling in VHDL
Behavioral modelling in VHDL
 
Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginners
 
Vhdl 1 ppg
Vhdl 1 ppgVhdl 1 ppg
Vhdl 1 ppg
 
dual-port RAM (DPRAM)
dual-port RAM (DPRAM)dual-port RAM (DPRAM)
dual-port RAM (DPRAM)
 
Fpga
FpgaFpga
Fpga
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.ppt
 
LDPC - Low Density Parity Check Matrix
LDPC - Low Density Parity Check MatrixLDPC - Low Density Parity Check Matrix
LDPC - Low Density Parity Check Matrix
 
RTL-Design for beginners
RTL-Design  for beginnersRTL-Design  for beginners
RTL-Design for beginners
 
Coding of FSM
Coding of FSMCoding of FSM
Coding of FSM
 
JTAG Interface (Intro)
JTAG Interface (Intro)JTAG Interface (Intro)
JTAG Interface (Intro)
 
Fpga implementation of utmi with usb 2.O
Fpga implementation of  utmi  with usb 2.O Fpga implementation of  utmi  with usb 2.O
Fpga implementation of utmi with usb 2.O
 
ARM Architecture
ARM ArchitectureARM Architecture
ARM Architecture
 

Viewers also liked

Sequential Circuits - Flip Flops
Sequential Circuits - Flip FlopsSequential Circuits - Flip Flops
Sequential Circuits - Flip FlopsAbhilash Nair
 
Designing Clocked Synchronous State Machine
Designing Clocked Synchronous State MachineDesigning Clocked Synchronous State Machine
Designing Clocked Synchronous State MachineAbhilash Nair
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in CArpana shree
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDLEutectics
 
Synchronous design process
Synchronous design processSynchronous design process
Synchronous design processAbhilash Nair
 
Sequential Circuits - Flip Flops (Part 1)
Sequential Circuits - Flip Flops (Part 1)Sequential Circuits - Flip Flops (Part 1)
Sequential Circuits - Flip Flops (Part 1)Abhilash Nair
 
State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and SynthesisAbhilash Nair
 
Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Abhilash Nair
 
Static and Dynamic Read/Write memories
Static and Dynamic Read/Write memoriesStatic and Dynamic Read/Write memories
Static and Dynamic Read/Write memoriesAbhilash Nair
 
Analysis of state machines & Conversion of models
Analysis of state machines & Conversion of modelsAnalysis of state machines & Conversion of models
Analysis of state machines & Conversion of modelsAbhilash Nair
 
Analysis of state machines
Analysis of state machinesAnalysis of state machines
Analysis of state machinesAbhilash Nair
 

Viewers also liked (20)

VHDL Part 4
VHDL Part 4VHDL Part 4
VHDL Part 4
 
CPLDs
CPLDsCPLDs
CPLDs
 
Sequential Circuits - Flip Flops
Sequential Circuits - Flip FlopsSequential Circuits - Flip Flops
Sequential Circuits - Flip Flops
 
MSI Shift Registers
MSI Shift RegistersMSI Shift Registers
MSI Shift Registers
 
Designing Clocked Synchronous State Machine
Designing Clocked Synchronous State MachineDesigning Clocked Synchronous State Machine
Designing Clocked Synchronous State Machine
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in C
 
FPLDs
FPLDsFPLDs
FPLDs
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDL
 
Synchronous design process
Synchronous design processSynchronous design process
Synchronous design process
 
CPLDs
CPLDsCPLDs
CPLDs
 
Sequential Circuits - Flip Flops (Part 1)
Sequential Circuits - Flip Flops (Part 1)Sequential Circuits - Flip Flops (Part 1)
Sequential Circuits - Flip Flops (Part 1)
 
State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and Synthesis
 
Basics of Vhdl
Basics of VhdlBasics of Vhdl
Basics of Vhdl
 
CPLD & FPLD
CPLD & FPLDCPLD & FPLD
CPLD & FPLD
 
Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)
 
Static and Dynamic Read/Write memories
Static and Dynamic Read/Write memoriesStatic and Dynamic Read/Write memories
Static and Dynamic Read/Write memories
 
FPGA
FPGAFPGA
FPGA
 
DRAM
DRAMDRAM
DRAM
 
Analysis of state machines & Conversion of models
Analysis of state machines & Conversion of modelsAnalysis of state machines & Conversion of models
Analysis of state machines & Conversion of models
 
Analysis of state machines
Analysis of state machinesAnalysis of state machines
Analysis of state machines
 

Similar to VHDL - Enumerated Types (Part 3)

Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDLYaser Kalifa
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COdinganna university
 
digital system design using verilog Module 5 ppt.pptx
digital system design using verilog Module 5 ppt.pptxdigital system design using verilog Module 5 ppt.pptx
digital system design using verilog Module 5 ppt.pptxssuser6d9a04
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESkarthik kadava
 
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdfSantoshDeshmukh36
 
COMPILER_DESIGN_CLASS 2.ppt
COMPILER_DESIGN_CLASS 2.pptCOMPILER_DESIGN_CLASS 2.ppt
COMPILER_DESIGN_CLASS 2.pptssuserebb9821
 
COMPILER_DESIGN_CLASS 1.pptx
COMPILER_DESIGN_CLASS 1.pptxCOMPILER_DESIGN_CLASS 1.pptx
COMPILER_DESIGN_CLASS 1.pptxssuserebb9821
 
Kroening et al, v2c a verilog to c translator
Kroening et al, v2c   a verilog to c translatorKroening et al, v2c   a verilog to c translator
Kroening et al, v2c a verilog to c translatorsce,bhopal
 
the-vhsic-.pptx
the-vhsic-.pptxthe-vhsic-.pptx
the-vhsic-.pptxjpradha86
 
Digital Electronics .
Digital Electronics                                              .Digital Electronics                                              .
Digital Electronics .inian2
 

Similar to VHDL - Enumerated Types (Part 3) (20)

Hd2
Hd2Hd2
Hd2
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COding
 
digital system design using verilog Module 5 ppt.pptx
digital system design using verilog Module 5 ppt.pptxdigital system design using verilog Module 5 ppt.pptx
digital system design using verilog Module 5 ppt.pptx
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLES
 
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
3CA949D5-0399-46AE-8A97-F01C8599B2DA.pdf
 
VHDL
VHDLVHDL
VHDL
 
Vhdl
VhdlVhdl
Vhdl
 
COMPILER_DESIGN_CLASS 2.ppt
COMPILER_DESIGN_CLASS 2.pptCOMPILER_DESIGN_CLASS 2.ppt
COMPILER_DESIGN_CLASS 2.ppt
 
COMPILER_DESIGN_CLASS 1.pptx
COMPILER_DESIGN_CLASS 1.pptxCOMPILER_DESIGN_CLASS 1.pptx
COMPILER_DESIGN_CLASS 1.pptx
 
Kroening et al, v2c a verilog to c translator
Kroening et al, v2c   a verilog to c translatorKroening et al, v2c   a verilog to c translator
Kroening et al, v2c a verilog to c translator
 
Spdas2 vlsibput
Spdas2 vlsibputSpdas2 vlsibput
Spdas2 vlsibput
 
Vhdl introduction
Vhdl introductionVhdl introduction
Vhdl introduction
 
Vhdl lab manual
Vhdl lab manualVhdl lab manual
Vhdl lab manual
 
the-vhsic-.pptx
the-vhsic-.pptxthe-vhsic-.pptx
the-vhsic-.pptx
 
Ddhdl 17
Ddhdl 17Ddhdl 17
Ddhdl 17
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
Programs of VHDL
Programs of VHDLPrograms of VHDL
Programs of VHDL
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
Digital Electronics .
Digital Electronics                                              .Digital Electronics                                              .
Digital Electronics .
 

More from Abhilash Nair

More from Abhilash Nair (12)

Feedback Sequential Circuits
Feedback Sequential CircuitsFeedback Sequential Circuits
Feedback Sequential Circuits
 
Designing State Machine
Designing State MachineDesigning State Machine
Designing State Machine
 
CPLDs
CPLDsCPLDs
CPLDs
 
Documentation Standards of an IC
Documentation Standards of an ICDocumentation Standards of an IC
Documentation Standards of an IC
 
Shift Registers
Shift RegistersShift Registers
Shift Registers
 
MSI Counters
MSI CountersMSI Counters
MSI Counters
 
EPROM, PROM & ROM
EPROM, PROM & ROMEPROM, PROM & ROM
EPROM, PROM & ROM
 
Counters
CountersCounters
Counters
 
Trends Of Televisions
Trends Of TelevisionsTrends Of Televisions
Trends Of Televisions
 
Core java slides
Core java slidesCore java slides
Core java slides
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 

Recently uploaded

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningMarc Dusseiller Dusjagr
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 

Recently uploaded (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

VHDL - Enumerated Types (Part 3)

  • 1. Enumerated Types The first style is used most often to define cases or states for a state machine type CAR_STATE is (back, stop, slow, medium, fast); VHDL also allows users to create subtypes of a type The values in the subtype must be a contiguous range of values of the base type from start to end Subtype GO_KART is CAR_STATE range stop to medium; VHDL has two predefined integer subtypes Subtype natural is integer range 0 to highest integer; Subtype positive is integer range 1 to highest integer; 1
  • 2. Enumerated Types BIT – can be ‘0’ or ‘1’ (note single quotes) STD_LOGIC IEEE std_logic_1164 package Has NINE legal values: ‘U’, ‘X’, ‘0’, ‘1’, ‘Z’, ‘W’, ‘L’, ‘H’, ‘-’ Example Subtype Declarations Subtype twoval_logic is std_logic range ‘0’ to ‘1’; Subtype fourval_logic is std_logic range ‘X’ to ‘Z’; Subtype negint is integer range -2147483647 to -1; Subtype bitnum is integer range 31 downto 0; 2
  • 3. Constants They contribute to readability, maintainability and portability of programs in any language The syntax is as shown constant BUS_SIZE: integer := 32; -- width of component constant MSB: integer := BUS_SIZE - 1; -- bit number of MSB constant Z: character := ‘Z’; -- synonym for Hi-Z value The value of a constant can be a simple expression Constants can be used anywhere the corresponding value can be used and they can be put to good use in type definitions 3
  • 4. Arrays Another very important category of user-defined types Ordered set of elements of the same type, where each element is selected by an array index Syntax for VHDL array definitions type type-name is array (start to end) of element-type; type type-name is array (start downto end) of element- type; type type-name is array (range-type) of element-type; type type-name is array (range-type range start to end) of element-type; type type-name is array (range-type range start downto end) of element-type; 4
  • 5. Array declarations type monthly_count is array (1 to 12) of integer; type byte is array (7 downto 0) of STD_LOGIC; constant WORD_LEN: integer := 32; type word is array (WORD_LEN - 1 downto 0) of STD_LOGIC; constant NUM_REGS: integer := 8; type reg_file is array ( 1 to NUM_REGS ) of word; type traffic_light_state is (reset, stop, wait, go); type statecount is array (traffic_light_state) of integer; Array elements are considered to be ordered from left to right in the same direction as index range 5
  • 6. Array declarations type monthly_count is array (1 to 12) of integer; 1 type byte is array (7 downto 0) of STD_LOGIC; 7 Constant WORD_LEN: integer := 32; type word is array (WORD_LEN - 1 downto 0) of STD_LOGIC; 31 Constant NUM_REGS: integer := 8; type reg_file is array ( 1 to NUM_REGS ) of word; 1 Type traffic_light_state is (reset, stop, wait, go); type statecount is array (traffic_light_state) of integer; reset Left most elements of arrays are shown in blue 6
  • 7. Array elements and literals Within VHDL program statements, individual array elements are accessed using the array name and the element’s index in parentheses. If M, B, W, R, and S are signals of variables of the five array types defined in the previous slides then M(11), B(5), W(WORD_LEN – 5), R(0,0), R(0) and S(reset) are all valid elements. Array literals can be specified by listing the element values in parentheses. The byte variable B could be set to all ones by the statement B := (‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’); 7
  • 8. Array elements and literals VHDL also has a shorthand notation that allows you to specify values by index. To set word variable W to all ones except for zeroes in the LSB of each byte W := (0 => ‘0’, 8 => ‘0’, 16 => ‘0’, 24 => ‘0’, others => 1); The methods work for arrays with any element type, but the easiest way to write a literal of type STD_LOGIC is to use a “string” VHDL string is an array of ISO characters enclosed in double quotes such as “Hello” 8
  • 9. String A string is just an array of characters. A STD_LOGIC array of a given length can be assigned the value of a string of the same length, as long as the characters in the string are taken from the set of nine characters defined as the possible values of the STD_LOGIC elements like ‘0’, ‘1’, ‘U’ The two previous examples can be rewritten as B := “11111111”; W := “11111110111111101111111011111110”; 9
  • 10. Example: LogicFcn ports A B C Y entity architecture 10
  • 11. Entity Declaration for LogicFcn library IEEE; use IEEE.std_logic_1164.all; entity LogicFcn is port ( A A: in std_logic; B Y B: in std_logic; C C: in std_logic; Y: out std_logic ); end entity LogicFcn; 11
  • 12. Parts of Architecture Body architecture ARCH_NAME of ENTITY_NAME is <declarative section : list internal signals, variables, and components here. For each component used show the port map, (unless port map defined is in a “package”) > begin <statement section : all concurrent statements and components and processes in this section execute at the same time, NOT sequentially> end ARCH_NAME; 12
  • 13. Architecture Body Specifies the internal circuit of an entity, using any one of the following modeling styles: 1. As a set of interconnected components, as wired (called structural modeling) 2. As a set of concurrent signal assignment statements (called dataflow modeling) 3. As a set of sequential assignment statements, i.e., a “process” (called behavioral modeling) 4. As any combination of the above (called mixed modeling) 13
  • 14. Architecture Body (Dataflow) With a signal assignment statement: architecture dataflow of LogicFcn is begin Y <= (not A and not B) or C; end dataflow; 14
  • 15. Architecture Body (Dataflow) With a conditional signal assignment statement: architecture dataflow of LogicFcn is begin Y <= '1' when (A = '0' AND B = '0') OR (C = '1') else '0'; end dataflow; 15
  • 16. Architecture Body (Behavioral) architecture behavioral of LogicFcn is “Label:” begin Sensitivity List - The Process will be executed anytime there is an Name of fcn: process (A,B,C) EVENT (change of state) on one of process these signals. begin wait on A,B,C; WAIT ON statement - has same effect as sensitivity list. if (A = '0' and B = '0') then CANNOT USE BOTH. Processes with WAIT statements Y <= '1'; cannot have sensitivity lists !! process elsif C = '1' then Y <= '1'; Statements within Processes are executed sequentially. (This is a else single IF statement) The process, however, executes Y <= '0'; concurrently with other processes and concurrent statements in the end if; architecture. end process; end behavioral; Values are assigned to signals when process suspends 16
  • 17. Architecture Body (Structural) Internal signals are LOCAL to the Architecture, and cannot be seen outside it ! signals notA A andSignal B notB C Y entity architecture 17
  • 18. Architecture Body (Structural) architecture structural of LogicFcn is LOCAL SIGNALS are COMPONENT signal notA, notB, andSignal: std_logic; declared within the declarations begin architecture and they may go here i1: inverter port map (i => A, have no MODE (IN, OUT, etc.) o => notA); i2: inverter port map (i => B, o => notB); These are a1: and2 port map (i1 => notA, COMPONENT i2 => notB, INSTANTIATIONS y => andSignal); o1: or2 port map (i1 => andSignal, i2 => C, y => Y); end structural; 18
  • 19. Components for Structural Model library IEEE; component OR2 port ( use IEEE.std_logic_1164.all; i1: in std_logic; package primitive is i2: in std_logic; component AND2 port ( y: out std_logic i1: in std_logic; ); i2: in std_logic; end component; y: out std_logic component INVERTER port ( ); i: in std_logic; end component; o: out std_logic ); end component; end primitive; these are component declarations 19