VHDL Examples: EE 595 EDA / ASIC Design Lab
VHDL Examples: EE 595 EDA / ASIC Design Lab
VHDL Examples: EE 595 EDA / ASIC Design Lab
Examples
library ieee;
use ieee.std_logic_1164.all ;
use Work.anu.all;
entity Parity_Generator1 is
port ( input_stream : in input;
clk : in std_logic ;
parity :out bit );
end Parity_Generator1;
begin
P1: process
begin
wait until clk'event and clk = '1';
odd := '0';
end odd;
component Parity_Generator1
port (input_stream : in input;
clk : in std_logic;
parity : out bit );
end component;
begin
if clk <= 'U' then clk <= '0' after 1 ns;
else clk <= not clk after 1 ns;
end if;
end process;
entity P_GENERATOR is
port ( CLK : in std_ulogic;
RESET : in std_ulogic;
TRIG : in std_ulogic;
PULSE : out std_ulogic);
end P_GENERATOR;
begin
case CURRENT_STATE is -- case-when statement specifies the following set of
-- statements to execute based on the value of
-- CURRENT_SIGNAL
when IDLE => if TRIG='1' then
NEXT_STATE <= GEN_PULSE_A;
end if;
when GEN_PULSE_A => if COUNT = WIDTH then
NEXT_STATE <= END_PULSE;
elsif TRIG='0' then
NEXT_STATE <= GEN_PULSE_B;
end if;
when END_PULSE => if TRIG ='1' then
NEXT_STATE <= IDLE;
end if;
end case;
begin
end case;
end if;
end process PULSE_PROC;
end STATE_MACHINE;
library IEEE;
use IEEE.std_logic_1164.all;
component P_GENERATOR
U1: P_GENERATOR
port map( CLK, RESET,TRIG,PULSE);
begin
TRIG <= '0' after 10 ns,
'1' after 15 ns,
'0' after 20 ns;
end ARC_STATE_MACHINE_TB;
for ARC_STATE_MACHINE_TB
end for;
end CFG_STATE_MACHINE;
architecture v1 of priority is
begin
process (I)
begin
GS <= '1'; --set default outputs
A <= "000";
if I(7) = '1' then
A <= "111";
elsif I(6) = '1' then
A <= "110";
ENTITY ram16x8 IS
PORT (address : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
csbar, oebar, webar : IN STD_LOGIC;
data : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END ram16x8;
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity incrementer is
generic (width : integer := 8);
port ( datain: in std_logic_vector(width-1 downto 0);
control: in std_logic;
dataout: out std_logic_vector(width-1 downto 0);
flag: out std_logic);
end incrementer;
end behv;
entity tb_inc is
generic (width : integer := 8);
end tb_inc;
begin
P1: process
begin
wait for 2 ns;
control <= '1'; -- increment mode
loop1_260: for i in 0 to 259 loop
datain <= conv_std_logic_vector(i, width);
wait for 10 ns;
end process;
end behv;
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
entity bs_vhdl is
begin
case dir is
end barrel_rotate;
begin
end process;
end behv;
entity tb_bs is
end tb_bs;
component bs_vhdl
port ( datain: in std_logic_vector(31 downto 0);
direction: in std_logic;
rotation : in std_logic;
count: in std_logic_vector(4 downto 0);
dataout: out std_logic_vector(31 downto 0));
end component;
begin
P1: process
begin
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity DISPLAY_DECODER is
port ( VALUE : in bit_vector(3 downto 0); -- Bit 3 is MSB
ZERO_BLANK : in bit;
DISPLAY : out bit_vector(6 downto 0); -- 7 bit signal
ZERO_BLANK_OUT : out bit);
end DISPLAY_DECODER;
begin
process (VALUE, ZERO_BLANK) -- sensitivity list
begin
end case;
end process;
end BEHAVIOUR;
entity DISPLAY_DECODER_TB is
end DISPLAY_DECODER_TB;
component DISPLAY_DECODER
port ( VALUE : in bit_vector(3 downto 0);
ZERO_BLANK : in bit;
DISPLAY : out bit_vector(6 downto 0);
ZERO_BLANK_OUT : out bit);
end component;
INPUT_VALUES: process
begin
U1: DISPLAY_DECODER
port map(VALUE, ZERO_BLANK, DISPLAY, ZERO_BLANK_OUT);
end ARC_DISPLAY_DECODER_TB;
for ARC_DISPLAY_DECODER_TB
for U1:DISPLAY_DECODER use entity
work.DISPLAY_DECODER(BEHAVIOUR);
end for;
end for;
end CFG_DISPLAY_DECODER;
entity TB_MEALY is
end;
component MEALY
Port ( X, CLOCK: in STD_LOGIC;
Z: out STD_LOGIC
);
end component;
-- X input STIMULI
X_Stimuli: process
begin
X <= '0', '1' after 30 ns,
'U' after 60 ns;
wait for 90 ns;
end process;
entity TB_MOORE is
end;
component MOORE
Port (
X, CLOCK: in STD_LOGIC;
Z: out STD_LOGIC
);
end component;
begin
UUT : MOORE
Port Map (X, CLK, Z);
CLOCK: process
begin
CLK <= '0', '1' after 50 ns;
wait for 100 ns;
end process;
X_Stimuli: process
begin
X <= '1', '0' after 1000 ns;
wait for 2000 ns;
end process;
-- Assert Process
check(Z,'1', 50 ns);
check(Z,'0', 150 ns);
check(Z,'1', 250 ns);
check(Z,'0', 450 ns);
end TESTBENCH;