VHDL Control Questions
VHDL Control Questions
(control questions)
entity a2of3 is
port (a0 : in std_logic;
a1 : in std_logic;
a2 : in std_logic;
y : out std_logic);
end a2of3;
architecture a1 of a2of3 is architecture a2 of a2of3 is
signal g0, g1, g2 : std_logic; signal g0, g1, g2 : std_logic;
begin begin
g0 <= a0 and a1; g2 <= a2 and a0;
g1 <= a1 and a2; y <= g0 or (g1 or g2);
g2 <= a2 and a0; g1 <= a1 and a2;
y <= g0 or g1 or g2; g0 <= a0 and a1;
end; end;
carr: a2of3
port map(
... => ...,
... => ...,
... => ...,
... => ...);
port signal
1) =>
name name
signal port
2) => Which one is correct?
name name
a) b) c)
...
carr: a2of3 ...
...
port map( carr: a2of3
carr: a2of3
a0 => a, port map(a, cin, b, cout);
port map(a, b, cin, cout);
a1 => b, ...
...
a2 => cin,
y => cout);
...
Y <= not C;
Y <= A or B;
end;
This code is
1) OK, the first assignment will be just ignored;
2) not allowed;
3) allowed, but represents an inverter and an
or-gate with outputs shorted together
1) std_logic
2) std_ulogic
3) bit
1) This code is OK
loop
The range must be exactly the same
incl. the direction (downto) as in the
declaration of c() and a()
?
The index i of c(i) and a(i) must be within
the limits 0..N-1
5 6 4
6 8 7
sint := 150;
word := -1;
word := 1000**2;
word := 16#1000#;
process(clk) q2
variable q1v, q2v : std_logic; clk C Q
q1
begin d D
FD
if rising_edge(clk) then
end if; q1
q1 <= q1v;
C Q q2
q2 <= q2v;
D
end process;
clk C Q FD
d D
FD
CLK
D Q
D Q CLK
CLK
D Q
CLK
y[n] y[n]
x[n] x[n]
plot the
response
y[n] y[n]
1 1 1) FIR
8 8 2) IIR
y[n]
6
8
x[n]
y[n]