introduction to vhdl - university of idaho · design flow rproduce the vhdl model rcompile the vhdl...
TRANSCRIPT
![Page 1: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/1.jpg)
Introduction to VHDL
Coding for Synthesis
Jim Frenzel
![Page 2: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/2.jpg)
VHDLr VHSIC Hardware Description
Language
r NOT a programming language!
r Hierarchical Modeling
r Hardware Abstraction
r Synchronous and Asynchronous Logic
r Combinational and Sequential Logic
![Page 3: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/3.jpg)
Hierarchyr A design consists of components
r Each component has an entity and one or more architectures
r The entity describes the I/O interface
r The architecture models the function of the component
rWhen a component is used in a design (instantiated), an entity-architecture pair is specified.
![Page 4: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/4.jpg)
Design Flowr Produce the VHDL Model
r Compile the VHDL
r Simulate the compiled VHDL to verify function
r Synthesize/Optimize to a technology
r Simulate again to verify timing
![Page 5: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/5.jpg)
Configuration
E1
E2
E3
AX: ...
E1_A1 E1_A2
BX: ...
E2_A1 E2_A2
E3_A1 E3_A2
BX is one instance of entity E3 using architecture E3_A2.
![Page 6: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/6.jpg)
Entity Port Typesr In: value read within entity model
r Out: value updated within entity model; cannot be read.
r Inout: bidirectional port; can be read and updated.
r Buffer: can be read and updated within the entity model. Can only have one source.
Avoid using "Buffer"!!!! Instead, use an internal signal and a concurrent assignment. e.g., my_out <= my_out_internal;
![Page 7: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/7.jpg)
Modeling Stylesr Structural: Used to describe the interconnection of
primitive and user-defined components.
r Dataflow: Provides logical and arithmetic operators.
r Behavioral: Allows modeling using if-then, case statements, etc.
![Page 8: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/8.jpg)
Architecturer Interconnected components (structural)
r Concurrent Statements (dataflow)
Executed in “parallel”. Order independent.
r Sequential Statements (behavioral)
Executed sequentially inside a process. Order dependent.
![Page 9: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/9.jpg)
Identifiersr (A-Z), (a-z), (0-9), underscore.
r First character is a letter, last not an underscore.
r Two consecutive hyphens starts a comment.
r Case insensitive. (except for type values, e.g., 'Z')
![Page 10: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/10.jpg)
Data Objectsr Constants
r Variables
r Signals: Maintain a history. Permits modeling of delays, detection of edges.
![Page 11: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/11.jpg)
Typesr Enumerated Types
r Single bit and bit-vector signals
r Symbolic States
![Page 12: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/12.jpg)
Operatorsr Logical: and, or, nand, nor, xor, not, xnor (VHDL-93)
r Relational: =, /=, <, <=, >, >=
r Adding: +, -
r Concatenation: &
rMultiplying: *, /, mod, rem
rMisc: abs, **
![Page 13: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/13.jpg)
Architecture Revisitedarchitecture [name] of [entity name] is
[declarations]begin
concurrent statements;(e.g., signal assignments, process statements, component instantiations)
end [name];
![Page 14: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/14.jpg)
Concurrent Signal Assignmentsig4 <= (sig1 AND sig2) OR (sig3 AND (not sig2));
Useful for modeling small combinational logic circuits.
![Page 15: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/15.jpg)
With - Selectwith (expression) select
Sig <= (expression) WHEN (choice),(expression) WHEN (choice),(expression) WHEN others;
r The "choices" must be mutually exclusive.
r "Choices" are possible values of the expression.
r "when others" covers any possibilities not listed and avoids latches.
![Page 16: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/16.jpg)
When - ElseSig <= (expression) WHEN (condition) ELSE
(expression) WHEN (condition) ELSE(expression);
Important to finish with ELSE, rather than WHEN, to eliminate the potential for implied latches.
"Conditions" are Boolean (e.g.. X = '0', true or false)
Enforces priority, which may lead to more logic thanwith-select if the conditions are mutually exclusive.
![Page 17: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/17.jpg)
Process Statement[process label:] process [(sensitivity list)]
[process declarations]begin
sequential statements;(signal assignments, if statement, case statement)
end process [process label];
r If modeling combinational logic then all inputs must be in the sensitivity list.
r If modeling sequential logic then usually only the clock is in the sensitivity list.
![Page 18: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/18.jpg)
If Statementif (boolean expression) then
sequential statements;elsif (boolean expression) then
sequential statements;else
sequential statements;end if;
Equivalent to the concurrent conditional signal assignment, when-else
Note the weird spelling of elsif!
![Page 19: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/19.jpg)
Case Statementcase (expression) is
when (choices) => sequential statements;[…]when others => sequential statements;
end case;
Equivalent to the concurrent selected signal assignment, with-select
![Page 20: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/20.jpg)
Tips from the Masterr Think hardware. If you don’t know what it will synthesize
to, don’t write it.
r Specify signal values under all occurrences (end with “else”or “when others”). Specify default at the start of a process.
r Separate out next state logic and output logic (or state flip-flops and combinational logic).
r Partition, partition, partition!
![Page 21: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/21.jpg)
entity FULL_ADDER isport (A, B, CIN: in std_logic; SUM, COUT: out std_logic);
end FULL_ADDER;architecture FA_MIXED of FULL_ADDER is
component XOR2port (P1, P2: in std_logic; PZ: out std_logic);
end component;signal S1: BIT;
beginX1: XOR2 port map (A, B, S1); - structuralprocess (A, B, CIN) - behavioral
variable T1, T2, T3: std_logic;begin
T1 := A and B;T2 := B and CIN;T3 := A and CIN;COUT <= T1 or T2 or T3;
end process;SUM <= S1 xor CIN; - dataflow
end FA_MIXED;
Variables used to model internal wires
![Page 22: Introduction to VHDL - University of Idaho · Design Flow rProduce the VHDL Model rCompile the VHDL rSimulate the compiled VHDL to verify function rSynthesize/Optimize to a …](https://reader031.vdocuments.site/reader031/viewer/2022022009/5aedcf4c7f8b9a572b8bd260/html5/thumbnails/22.jpg)
structure dataflow
S1X1
behavior
COUT
SUMAB
CIN
Figure 2.7 A 1-bit full-adder.
T1
T2
T3