vhdl
play

VHDL Digital Systems 1 The designers guide to VHDL Peter J. - PowerPoint PPT Presentation

VHDL Digital Systems 1 The designers guide to VHDL Peter J. Andersen Morgan Kaufman Publisher Bring laptop with installed Xilinx 2 HDL Introduction VHDL (DoD project) and Verilog (private project) High level languages for


  1. VHDL Digital Systems 1

  2. «The designer’s guide to VHDL» Peter J. Andersen Morgan Kaufman Publisher Bring laptop with installed Xilinx 2

  3. HDL Introduction • VHDL (DoD project) and Verilog (private project) • High level languages for digital systems simulation but almost always used for the synthesy • The target is to make the design more effective (development time and costs reduction, big and complex systems design etc.) • HDL languages allow to define the hardware behaviour (intrinsic parallelism and delays) • In this course only a small portion of the language will be presented, sometimes with some inaccuracies for a simplified FPGA design • VHDL - Very High-level Design Language • Used for instance for FPGA (Field Programmable Gate Arrays) and ASIC (Application Specific Integrated Circuits) design and test – ( Processors are ASIC)

  4. VHDL • VHDL is a language that uses the structures of C language with all modifications required by the specific context • In this course the Xilinx Vivado software will be used 4

  5. FPGA vs traditional hardware design The FPGA e HDL modern technologies allow to reduce dramatically the time to market : the complete prototype development can be implemented on a computer. The production cost of a FPGA design can be more expensive of an ASIC implementation. But being VHDL a standard, an ASIC based on the same VHDL program used for the FPGA prototype is always possible. A FPGA can be field reconfigured (a new program) in case of bugs or for improved functionality 5

  6. Timing and Concurrency Signals propagation uses wires and is NOT istantaneous because of the physical characteristics of conductors/components (parasite phenomena, gates delays, etc) Consider for instance the following logical network: C Z In order to describe the signal z propagation with a high level language (i.e. C) we could write With these two statements it a <=x; -- assign x to a seems that x=a e z=ac occur at the same time!!!! False!! z will z<=a and c; -- assign z change after the NAND delay 6

  7. Timing and Concurrency • CONCURRENCY: in the traditional programming languages two assigning instructions must be executed one after the other with the same sequence of the program. But physically the electric signal x propagates concurrently towards a and b (NOT towards a and then towards c as the previous C program would implicate). • TIMING: the two assignment statements do not take into consideration the signal propagation delay (never zero !!) and the gates delay Real network: different wires lenghts imply that a and b are not simultaneous. In the FPGA design systems the delays depend on the circuit technology and how the signals are «routed» within the integrated circuit 7

  8. Timing and Concurrency • When a programmer produces high level code (C/C++, Java, etc) he decomposes the problem into an instruction set which will be sequentially executed ( sequential programming paradigm ).. • On the contrary a hardware designer decomposes the project into interconnected blocks which react to «events» and produce in turn «events»; the «events» are the signal transitions. This implies that all blocks whose behaviour depends on those events are parallel evaluated according to the new signals values. In VHDL the statements are parallel (simultaneously) executed as is the case for the real systems (all blocks of a system evolve in parallel and not serially) • The blocks evaluation order must have no ininfluence on the final result (that is no matter which is the blocks evaluation order the overall status of the system once all events have been handled must be always the same). • This programming uses the parallel programming paradigm . Since the result of the computation must be independent from the sequence of the statements execution all statements can be executed in parallel without any statement waiting for the end of another The possibility of “executing” several operations in parallel, Concurrency typical of the hardware behaviour The capacity of modelling the propagation times within a Timing circuit 8

  9. An example Let’s analyse the following combinatorial ciruit and let’s suppose that the delays (gates, wires etc) are identical. The code which describes the behaviour of this circuit must produce a result (the ouptut of each gate) which depends on the input only and not on the order of the AND and OR evaluation The statements which describe the blocks can be coded according to the VHDL paradigm (<= indicates the signal modification): T1 <= A and B; U <= T1 or T2 or T3; T2 <= C and D; T1 <= A and B; Equivalent TN <= E and F; T2 <= C and D; U <= T1 or T2 or T3; TN <= E and F; 9

  10. VHDL Entities In VHDL entities (objects) are available. Each one of them has a data type and a value (strongly typified language). • Constants • Variables • Signals Now we analyse how all these entities must be declared and how a value can be assigned to them 10

  11. Constants Entities which cannot change their values. Useful to make the code well readable Careful: always use the symbol «;» as an end of a statement constant delay: time := 13 ns; Type Value Assignment of a value Careful: VHDL is extremely rigorous for the syntax A «constant» is always defined within an «architecture» (see later) 11

  12. Variables (NOT signals !!!) Objects which can modify their values during the simulation. They can be declared only within a process (see later) and are local to the process (the initial value is optional) variable name: type [:= initial_value]; Example assignment variable IJK: integer := 10; Usage example(IJK variabile) – [N.B «for» clause can be used only within a process (see later)] for IJK in 7 downto 3 loop – execute 5 times (values 7 to 3 included) !!! Double «-» is a comment X(IJK) := Y(IJK ); -- X and Y are variables vectors [arrays (see later)] end loop; -- all loop statements are executed concurrently NB a variable has no hardware meaning and is used only to define the execution flow of the program. IT IS NOT a signal NB variables can be declared or have values to be assigned only within a process – see later – and are local to that block The assignment is performed through the operator := and has immediate effect Examples z:= y; -- z and y variables (not signals!!) 12

  13. Signals Physical entities ( signals, actually…) which can modify their values during the simulation (an initial value is optional) with a delay depending either from the technology or from a synchronism signal (typically the clock signal – see later the synchronous circuits - process). A signal is defined within an «architecture» - (see later). signal name: type [:= initial_value]; Important! Examples signal A : std_logic := ‘1’; -- N.B. single apex signal B : std_logic := ‘0’; signal C : std_logic := ‘1’; C <= A and B; N. B. The assignment is performed with the operator <= and is NOT IMMEDIATE (that is it happens after a delay depending on the technology and the nature of the circuit – sequential, combinatorial etc.). std_logic is a technology type of the signal which defines its electrical behaviour. It is the only type used in this course 13

  14. Predefined data types in VHDL In the VHDL language (Standard Package) the following data types are also defined: • std_logic • bit (‘0’,’1’) -- not used in our context. We use only std_logic • boolean (‘TRUE’,’FALSE’) • integer • positive • time N.B. The use of std_logic is unavoidable in Xilinx if a simulation must be executed when all networks and their interconnections are mapped onto a specific FPGA. The simulation accounts for the specific delays of the circuit 14

  15. std_logic type A std_logic signal can have logical values ‘0’ and ‘1’ It is possible to define vectors of signal signal vector_example : std_logic_vector (7 downto 0) := “ 01001001“; (definition) (name) (type) (size) (initial value – double apex) For binary values of a single bit the single apex «’» symbol is used while for binary configurations of 2 or more bits the double apex «’’» must be used. A hexadecimal notation can be used Important! Double apex!! Examples a <= ‘1’; vector_example <= “10011100”; vector_example <= x“9C” -– (hexadecimal notation) for IJK in 4 to 10 loop -- executes 7 times (values 4 and 10 included) !!! (IJK is an integer variable) A(IJK) <= B(IJK) ; -- A and B are signal vectors (arrays) end loop; -- all loop statements are executed at the same time 15

  16. Integer type Integer range depends on the platform and is [-2 31 -1, +2 31 -1]. Example constant data_bus_width: integer := 32; -- integer constant of decimal value 32 (definition) (name) (type) (value) Positive type Positive are integer numbers from 1 to 2 31 -1. Time type To the time type an attribute is associated (ms, ns, ps, etc). In Xilinx it can be used only for the simulations (testbench programs – see later) . Esempio constant delay: time:= 5 ns; 16

  17. Using indexes the single elements of an array can be accessed. For instance y(2) <= a(1) To a set of contiguous elements a value can be assigned y <= “01”; y(4 downto 2) <= “101” vector - 1 0 1 - - 17

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend