Types of Concurrent Assignment Statements: - Simple Signal Assignments
Types of Concurrent Assignment Statements: - Simple Signal Assignments
A A F B 0 0 1 1
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
B 0 1 0 1
F=AB 0 1 1 0
END Simple_Example;
A A F B 0 0 1 1
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
B 0 1 0 1
F=AB 0 1 1 0
SIGNAL D_bus : STD_LOGIC_VECTOR( 0 TO 3 ); -- MSBit: D_bus(___), LSBit: D_bus(___) SIGNAL Two_Bit_bus : STD_LOGIC_VECTOR( 3 DOWNTO 1 ); -- MSBit: Two_Bit_bus(___), LSBit: Two_Bit_bus(___)
END Simpler_Example;
ENTITY my_entity IS
SIGNAL one_signal : STD_LOGIC; SIGNAL A_bus : STD_LOGIC_VECTOR( 7 DOWNTO 0 ); -- Most Significant Bit: A_bus(7), Least Significant Bit: A_bus(0) SIGNAL D_bus : STD_LOGIC_VECTOR( 0 TO 3 ); -- MSBit: D_bus(0), LSBit: D_bus(3) SIGNAL Thr3_Bit_bus : STD_LOGIC_VECTOR( 3 DOWNTO 1 );
: STD_LOGIC;
one_signal <= 0 ;
-- OK: VHDL does permit intermediate SIGNALs declared inside the -- ARCHITECTURE to be used on the Either Side of signal assignments
Syntax:
_________ select_criterion __________ signal <= expression1 WHEN criterionValue1, expression2 WHEN criterionValue2, expression3 WHEN criterionValue3, expression4 WHEN __________;
Defines what to do if NONE of the criterionValues are present.
A F B
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
A 0 0 1 1
B 0 1 0 1
F=AB 0 1 1 0
A F B
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
A 0 0 1 1
B 0 1 0 1
F=AB 0 1 1 0
END Selected_Example;
END Selected_Example;
A F B
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
A 0 0 1 1
B 0 1 0 1
F=AB 0 1 1 0
Sel(0) 0 1 0 1
F D0 D1 D2 D3
1 1
ENTITY MUX_4_to_1 IS
END Selected_Example;
END MUX_4_to_1;
Sel(1) 0 0 1 Sel 1
Sel(0) 0 1 0 1
F D0 D1 D2 D3
signal <= expression1 WHEN condition1 ELSE expression2 WHEN condition2 ELSE expression3 WHEN condition3 ELSE
END Selected_Mux;
expression4 ;
B 0 1 0 1
F=AB 0 1 1 0
A F B
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
0 0 1 1
END Conditional_Example;
A A F B
ENTITY XOR_Gate IS PORT ( A, B : IN STD_LOGIC ; F : OUT STD_LOGIC ) ; END XOR_Gate ;
B 0 1 0 1
F=AB 0 1 1 0
0 0 1 1
Sel(1) 0 0 1 1 -
Sel(0) 0 1 0 1 -
F D0 D1 D2 D3 0
1
Sel
1 1 0
ENTITY MUX_4_to_1 IS
PORT ( D0, D1, D2, D3, EN: IN STD_LOGIC ; Sel: IN STD_LOGIC_VECTOR( 1 downto 0) ; F : OUT STD_LOGIC ) ; END Conditional_Example; END MUX_4_to_1
EN ENTITY MUX_4_to_1 IS PORT ( D0, D1, D2, D3, EN: IN STD_LOGIC ; Sel: IN STD_LOGIC_VECTOR( 1 downto 0) ; F : OUT STD_LOGIC ) ; END MUX_4_to_1 1 1 1 1 0
Sel(1) 0 0 1 1 -
Sel(0) 0 1 0 1 -
F D0 D1 D2 D3 0
F <=
- - Above takes priority Evaluated 1st
WHEN (Sel=00) ELSE WHEN (Sel=01) ELSE WHEN (Sel=10) ELSE WHEN (Sel=11) ELSE 0 ; END Conditional_Mux;
Binary Decoders
Converts an n bit Binary Code (applied to n inputs) to activate 1 of 2n different output lines. (n-to-2n)
All other outputs inactive (0 if active high) May have a strobe enable input
2 to 4 Decoder
En B1 B0 1 1 1 1 0 0 1 1 0 1 0 1
F3 0 0 0 1
F2 0 0 1 0
F1 0 1 0 0
F0 1 0 0 0
En
Conditional Assignments??
Binary Encoders
Outputs an n bit Binary Code with the Input Channel Number that is active (of 2n different inputs. (2n-to-n Encoder)
All other inputs inactive (0 if active high)
B3 B2 B1 B0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 F1 0 F0 0
Priority Encoders
Outputs the n bit Binary Code with the Highest Priority Input Channel Number that is active
____________________ can be active ____________ Only the _____________ input gets encoded output Usually has a strobe output to indicate if _____________
B0 B1 B2 B3
Y0 Str 1 0 1 0 0 1 1 1 1
Gray Codes
Main Characteristic: Next code in sequence changes from previous code _______________________ position
Just like minterms/Maxterms for adjacent cells in K-Map
Gray Codes
Creating a Reflective Gray Code:
1. Start with a 1 or 2 bit RGC 2. Make a mirror image below it 3. Add leading 0s to upper half; Add leading 1s to lower half 4. Repeat as needed
3-bit Reflective Gray Code:
00 01 11 10
00 01 11 10
(1)
(0)
(1)
(0)
0 0 1
0 1 0 1
0 0 1 1
0 1 1 0
G1 G0 Gray(0) = G0 Gray(1) = G1
(1)
(0)
(1)
(0)
ENTITY Gray_Encoder_2bit IS PORT ( Binary : IN STD_LOGIC_VECTOR(1 downto 0); Gray : OUT STD_LOGIC_VECTOR(1 downto 0); END Gray_Encoder_2bit ; 1
0 0 1 1
0 1 0 1
0 0 1 1
0 1 1 0
(1 = LED ON)
COMMON-ANODE Display
ARCHITECTURE Fancy_Gray_Enc OF Gray_Encoder_2bit IS BEGIN Gray(1) <= Binary(1) ; - - Simple Conc. Assign.
- - Conditional Concurrent Assignment
Gray(0) <= Binary(0) WHEN (Binary(1)=0) ELSE NOT( Binary(0) ) ; END Fancy_Gray_Enc;
0 = Gnd
Nexys Board