Professional Documents
Culture Documents
Saloni Garg (B21AI036) - (Lab 3) Practice Questions
Saloni Garg (B21AI036) - (Lab 3) Practice Questions
Saloni Garg (B21AI036) - (Lab 3) Practice Questions
Using dataflow
Testbench
-- Code your testbench here
library IEEE;
use IEEE.std_logic_1164.all;
entity nand_uni_gate_ts IS
end nand_uni_gate_ts;
component nand_uni_gate
PORT(
a: IN std_logic;
b:IN std_logic;
c:IN std_logic;
y:OUT std_logic);
END COMPONENT;
signal a: std_logic:='0';
signal b: std_logic:='0';
signal c: std_logic:='0';
signal y:std_logic;
BEGIN
uut:nand_uni_gate PORT MAP(
a=>a,
b=>b,
c=>c);
stim_proc:process
begin
a<='0';
b<='0';
c<='0';
wait;
end process;
end dataflow;
Design
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity nand_uni_gate is
Port ( a,b ,c : in std_logic;
y: out std_logic
);
end nand_uni_gate;
end dataflow;
Ep wave
Question 2
Or gate (dataflow)
design
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity nand_uni_gate is
Port ( a,b : in std_logic;
y: out std_logic
);
end nand_uni_gate;
testbench
-- Code your testbench here
library IEEE;
use IEEE.std_logic_1164.all;
entity nand_uni_gate_ts IS
end nand_uni_gate_ts;
ARCHITECTURE dataflow OF nand_uni_gate_ts IS
component nand_uni_gate
PORT(
a: IN std_logic;
b:IN std_logic;
y:OUT std_logic);
END COMPONENT;
signal a: std_logic:='0';
signal b: std_logic:='0';
signal y:std_logic;
BEGIN
uut:nand_uni_gate PORT MAP(
a=>a,
b=>b);
stim_proc:process
begin
a<='0';
b<='0';
wait;
end process;
end dataflow;
epwave
XOR(dataflow)
design
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity nand_uni_gate is
Port ( a,b : in std_logic;
y: out std_logic
);
end nand_uni_gate;
testbench
-- Code your testbench here
library IEEE;
use IEEE.std_logic_1164.all;
entity nand_uni_gate_ts IS
end nand_uni_gate_ts;
component nand_uni_gate
PORT(
a: IN std_logic;
b:IN std_logic;
y:OUT std_logic);
END COMPONENT;
signal a: std_logic:='0';
signal b: std_logic:='0';
signal y:std_logic;
BEGIN
uut:nand_uni_gate PORT MAP(
a=>a,
b=>b);
stim_proc:process
begin
a<='0';
b<='0';
wait;
end process;
end dataflow;
epwave
OR(behavioral)
design
library ieee;
use ieee.std_logic_1164.all;
entity or_E is
port(
a, b: in std_logic;
c: out std_logic
);
end or_e;
architecture arch of or_e is
begin
process(a, b)
begin
if a='1' and b='1' then
c <= '0';
else
c <= '1';
end if;
end process;
end arch;
testbench
-- Code your testbench here
library IEEE;
use IEEE.std_logic_1164.all;
entity or_ts IS
end or_ts;
component or_e
PORT(
a: IN std_logic;
b:IN std_logic;
y:OUT std_logic);
END COMPONENT;
signal a: std_logic:='0';
signal b: std_logic:='0';
signal y:std_logic;
BEGIN
uut:or_e PORT MAP(
a=>a,
b=>b);
stim_proc:process
begin
a<='0';
b<='0';
wait;
end process;
end arch;
epwave
XOR(behavioral)
design
library ieee;
use ieee.std_logic_1164.all;
entity or_E is
port(
a, b: in std_logic;
c: out std_logic
);
end or_e;
architecture arch of or_e is
begin
process(a, b)
begin
if a='0' and b='0' then
c <= '0';
elsif a='1' and b='1' then
c<='0';
else
c <= '1';
end if;
end process;
end arch;
testbench
entity or_ts IS
end or_ts;
ARCHITECTURE arch OF or_ts IS
component or_e
PORT(
a: IN std_logic;
b:IN std_logic;
y:OUT std_logic);
END COMPONENT;
signal a: std_logic:='0';
signal b: std_logic:='0';
signal y:std_logic;
BEGIN
uut:or_e PORT MAP(
a=>a,
b=>b);
stim_proc:process
begin
a<='0';
b<='0';
wait;
end process;
end arch;
epwave