Ee1D21: Digital Systems B: Bsc. Ee, 1 Year, 2020-2021, 2 VHDL Lecture
Ee1D21: Digital Systems B: Bsc. Ee, 1 Year, 2020-2021, 2 VHDL Lecture
Ee1D21: Digital Systems B: Bsc. Ee, 1 Year, 2020-2021, 2 VHDL Lecture
Delft
University of
Technology
output <=
not input after 10 ns;
equivalent
output <=
reject 10 ns
This is more flexible, but not
inertial not input
used often! after 10 ns;
architecture my_half_adder_arch of Half_Adder is • How does the simulator deal with all events? In
begin other words: how is the concurrency intertwined in
carry <= a and b after 5 ns; the discrete event simulator?
sum <= a xor b after 5 ns; By ordering the event list and executing
end my_half_adder_arch; subsequent SIMULTANEOUS events concurrently.
2ns
Assumptions:
5ns • All signals are
initialized to ‘0’
5ns • In1 and In2
remain stable
5ns after change
2ns
Time 0 ns: Time 2 ns: Time 5 ns: Time 10 ns:
- In1 (1, 0ns) - s1 (0, 2ns) - s4 (1, 5ns) - z (0, 10ns)
- In2 (1, 0ns) - s2 (0, 2ns) - s3 (1, 5ns)
- s4 (1, 5ns) What to do now?
- s3 (1, 5ns) Stop
- s1 (0, 2ns)
- s2 (0, 2ns) Where is the precision of
- s4 (1, 5ns) - s3 (1, 7ns) the model?
- s3 (1, 5ns) - s4 (1, 7ns) - z (0, 10ns) Ex. in time steps and detail
entity mux is
port ( In0,In1,In2,In3: in std_logic_vector(7 downto 0);
Sel: in std_logic_vector(1 downto 0);
Z: out std_logic_vector(7 downto 0)); Sensitivity list
end mux;
Process starts execution from
architecture behavioral of mux is ‘begin’ to’ end’ when a signal in
begin the sensitivity lists changes!
process (Sel,In0,In1,In2,In3) is -- sensitivity list
-- declarative region of process
variable Zout : std_logic_vector(7 downto 0); -- variable instantiation, no time
component
begin
-- process body
if (Sel = “00”) then Zout := In0; -- variable assignment
elsif (Sel = “01”) then Zout := In1;
elsif (Sel = “10”) then Zout := In2;
elsif (Sel = “11”) then Zout := In3;
else Zout := In3;
Keyword “is” introduced in ’93 standard and is optional!
Z <= Zout;
end if;
end process;
end behavioral;
• For-loops:
for INDEX in 1 to 32 loop
<loop body>
end loop;
• While-loops:
while j < 32 loop
<loop body> …
j := j + 1;
end loop;
Assumption à at time t=0, both processes are executed AND the following
signals have the following values:
x=0 (t=0)
y=1 (t=0)
z=1 (t=0)
sig_s1=1 (t=0)
sig_s2=1 (t=0)
à Do res1 and res2 have the same value after the “calculation”?
2 basic components:
• Combinational component: output and “next state” generation
• Sequential component
• Example is a Mealy machine (output depends on previous state and input)
process (clk) is
begin
if (clk’event and clk =‘1’) then
if (reset = '0') then --reset checked only at the rising edge
output <= input;
else
output <= '0';
end if;
end if;
end process;
---------------------------------------------------------------------------------------------------------------------
-- write the VHDL code for the asynchronous reset
process (clk,reset) is
begin
if (reset =‘1’) then
output <= '0';
else
if (clk’event and clk =‘1’) then
output <= input;
end if;
end if;
end process;
Binding Rules:
• What architecture
description to use??
1. Find the entity with the
same name
2. “bind” the last compiled
architecture-description
to that entity
Configurations: • How can we exert more
• An entity can have several different controle on this “binding”
architecture descriptions ?ààà
• The configuration describes what architecture
description to use
EE1D21 – Digital Systems (VHDL) 38
Configuration specification Slide updated in 2019-2020
library name
| entity name
| | architecture name
for HA1: half_adder use entity WORK.half_adder(behavioral);
for HA2: half_adder use entity WORK.half_adder(structural);
for OR2: or_gate use entity POWER.lpo2(behavioral)
generic map (gate_delay => gate_delay) -- (re-)specifying gate_delay
port map (I1 => a, I2 => b, Z => z); -- remapping the port names
begin
HA1: half_adder port map (a=>a,b=>b,sum=>s1,cout=>s3);
HA2: half_adder port map (a=>s1,b=>cin,sum=>sum,cout=>s2);
OR2: or_gate port map (a=>s2,b=>s3,z=>cout);
end abc;