EDA Playground lets you type in and run HDL code (using a selection of free and commercial simulators and synthesizers).
It's great for learning HDLs, it's great for testing out unfamiliar things and it's great for sharing code.
You can start typing straight away. But to run your code, you'll need to sign or log in. Logging in with a Google account gives you access to all non-commercial simulators and some commercial simulators:
To run commercial simulators, you need to register and log in with a username and password. Registration is free, and only pre-approved email's will have access to the commercial simulators.
204
library IEEE;
use IEEE.std_logic_1164.all;
entity TB_cont_3_bits is
end;
architecture beh of TB_cont_3_bits is
signal clk,rst : std_logic:='0';
signal Q2,Q1,Q0: std_logic;
component cont_3_bits is
port( clk: in std_logic;
rst: in std_logic;
Q2: out std_logic;
Q1: out std_logic;
Q0: out std_logic);
end component;
begin
DUT: cont_3_bits port map (clk,rst,Q2,Q1,Q0);
clk <= not clk after 10 ns;
rst <= '0','1' after 5 ns,'0' after 45 ns, '1' after 215 ns, '0' after 235 ns;
end;
xxxxxxxxxx
library IEEE;
use IEEE.std_logic_1164.all;
entity cont_3_bits is
port( clk: in std_logic;
rst: in std_logic;
Q2: out std_logic;
Q1: out std_logic;
Q0: out std_logic);
end;
architecture beh of cont_3_bits is
signal D2,D1,D0 : std_logic;
signal Q2_aux,Q1_aux,Q0_aux : std_logic;
component FF_D is
port( D: in std_logic;
clk: in std_logic;
rst: in std_logic;
Q: out std_logic);
end component;
begin
D2 <= (Q2_aux and not Q1_aux) or (not Q2_aux and Q1_aux and Q0_aux) or(Q2_aux and not Q0_aux);
D1 <= Q1_aux xor Q0_aux;
D0 <= not Q0_aux;
FF2: FF_D port map (D2,clk,rst,Q2_aux);
FF1: FF_D port map (D1,clk,rst,Q1_aux);
FF0: FF_D port map (D0,clk,rst,Q0_aux);
Q2<= Q2_aux;
Q1<= Q1_aux;
Q0<= Q0_aux;
end;
xxxxxxxxxx
library IEEE;
use IEEE.std_logic_1164.all;
entity FF_D is
port( D: in std_logic;
clk: in std_logic;
rst: in std_logic;
Q: out std_logic);
end;
architecture beh of FF_D is
begin
process (clk,rst)
begin
if rst = '1' then
Q <= '0';
elsif rising_edge (clk) then
Q <= D;
end if;
end process;
-- Q <= '0' when rst ='1' else D when rising_edge (clk);
end;
Your account is not validated. If you wish to use commercial simulators, you need a validated account.
If you have already registered (or have recently changed your email address), but have not clicked on the link in the email we sent you, please do so. If you cannot find the email, please check your spam/junk folder. Or click here to resend the email.
If you have not already registered for a full account, you can do so by clicking below. You will then need to provide us with some identification information. You may wish to save your code first.
Creating, deleting, and renaming files is not supported during Collaboration. To encourage development of these features for Collaboration, tweet to @EDAPlayground
This playground may have been modified. Please save or copy before starting collaboration.
Your exercise has been submitted.