Lecture 8 Flashcards
VHDL data types: BOOLEAN
Returned by comparisons and used in conditional statements
True and false
Y <= d1 when (s=‘1st) else d0;
VHDL data types: INTEGER
Represents both positive and negative integers
-2^31 to (2^31)-1
Y <= a(3) and a(2) and a(1) and a(0);
CONV_INTEGER
Converts from STD_LOGIC_VECTOR to INTEGER for positive (unsigned) values
Defined in library IEEE.STD_LOGIC_UNSIGNED
Y <= d(CONV_INTEGER(s));
VHDL is strict about out port being exclusively for output
Has a buffer port type that solves this
Buffer port
Signals behave as outputs but may alone be used within the module
Enumeration
An abstract way of representing information without assigning specific binary encodings
Structural modeling
Describes a module in terms of how it is composed of simpler modules
Prevents errors caused by changing the entity but not the instance
Allows multiple architectures (implementations) for the same entity
VHDL process statements
Used to describe sequential circuits because they remember the old state when no new state prescribed
Can be used to describe combinatorial logic
Process statements can be used to describe combinatorial logic if:
The sensitivity list is written to respond to changes in all of the inputs
The body prescribes the output value for every possible input combination
Process statement: <=
Non-blocking assignment
Non-blocking assignment
Evaluated concurrently before any of the signals on left side are updates
Made to outputs and to signals
Process statements: :=
Blocking assignment
Blocking assignment
Evaluated in order that they appear in the code
Made to variables
Best for intermediate variables in combinatorial logic (must be variable not signal)
Case statements
Checks the value of data
Must appear within always statement
(Non-)Blocking Assignment Guidelines
- Use process (clk) and nonblocking assignments to model synchronous sequential logic
- Use concurrent assignments outside process statements to model simple combinatorial logic
- Use process (in1,in2,…) and blocking assignments to model more complicated combinatorial logic
- Do not make assignments to the same signal in more than one process statement or concurrent assignment statement