mirror of
https://github.com/gryf/tagbar.git
synced 2026-02-19 07:55:54 +01:00
Add tests to repository
This commit is contained in:
306
tests/vhdl/gcd2.vhd
Normal file
306
tests/vhdl/gcd2.vhd
Normal file
@@ -0,0 +1,306 @@
|
||||
----------------------------------------------------------------------
|
||||
-- GCD CALCULATOR (ESD book figure 2.11)
|
||||
-- Weijun Zhang, 04/2001
|
||||
--
|
||||
-- we can put all the components in one document(gcd2.vhd)
|
||||
-- or put them in separate files
|
||||
-- this is the example of RT level modeling (FSM + DataPath)
|
||||
-- the code is synthesized by Synopsys design compiler
|
||||
----------------------------------------------------------------------
|
||||
|
||||
-- Component: MULTIPLEXOR --------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity mux is
|
||||
port( rst, sLine: in std_logic;
|
||||
load, result: in std_logic_vector( 3 downto 0 );
|
||||
output: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end mux;
|
||||
|
||||
architecture mux_arc of mux is
|
||||
begin
|
||||
process( rst, sLine, load, result )
|
||||
begin
|
||||
if( rst = '1' ) then
|
||||
output <= "0000"; -- do nothing
|
||||
elsif sLine = '0' then
|
||||
output <= load; -- load inputs
|
||||
else
|
||||
output <= result; -- load results
|
||||
end if;
|
||||
end process;
|
||||
end mux_arc;
|
||||
|
||||
-- Component: COMPARATOR ---------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity comparator is
|
||||
port( rst: in std_logic;
|
||||
x, y: in std_logic_vector( 3 downto 0 );
|
||||
output: out std_logic_vector( 1 downto 0 )
|
||||
);
|
||||
end comparator;
|
||||
|
||||
architecture comparator_arc of comparator is
|
||||
begin
|
||||
process( x, y, rst )
|
||||
begin
|
||||
if( rst = '1' ) then
|
||||
output <= "00"; -- do nothing
|
||||
elsif( x > y ) then
|
||||
output <= "10"; -- if x greater
|
||||
elsif( x < y ) then
|
||||
output <= "01"; -- if y greater
|
||||
else
|
||||
output <= "11"; -- if equivalance.
|
||||
end if;
|
||||
end process;
|
||||
end comparator_arc;
|
||||
|
||||
-- Component: SUBTRACTOR ----------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity subtractor is
|
||||
port( rst: in std_logic;
|
||||
cmd: in std_logic_vector( 1 downto 0 );
|
||||
x, y: in std_logic_vector( 3 downto 0 );
|
||||
xout, yout: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end subtractor;
|
||||
|
||||
architecture subtractor_arc of subtractor is
|
||||
begin
|
||||
process( rst, cmd, x, y )
|
||||
begin
|
||||
if( rst = '1' or cmd = "00" ) then -- not active.
|
||||
xout <= "0000";
|
||||
yout <= "0000";
|
||||
elsif( cmd = "10" ) then -- x is greater
|
||||
xout <= ( x - y );
|
||||
yout <= y;
|
||||
elsif( cmd = "01" ) then -- y is greater
|
||||
xout <= x;
|
||||
yout <= ( y - x );
|
||||
else
|
||||
xout <= x; -- x and y are equal
|
||||
yout <= y;
|
||||
end if;
|
||||
end process;
|
||||
end subtractor_arc;
|
||||
|
||||
-- Component: REGISTER ---------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity regis is
|
||||
port( rst, clk, load: in std_logic;
|
||||
input: in std_logic_vector( 3 downto 0 );
|
||||
output: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end regis;
|
||||
|
||||
architecture regis_arc of regis is
|
||||
begin
|
||||
process( rst, clk, load, input )
|
||||
begin
|
||||
if( rst = '1' ) then
|
||||
output <= "0000";
|
||||
elsif( clk'event and clk = '1') then
|
||||
if( load = '1' ) then
|
||||
output <= input;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
end regis_arc;
|
||||
|
||||
-- component: FSM controller --------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
|
||||
entity fsm is
|
||||
port( rst, clk, proceed: in std_logic;
|
||||
comparison: in std_logic_vector( 1 downto 0 );
|
||||
enable, xsel, ysel, xld, yld: out std_logic
|
||||
);
|
||||
end fsm;
|
||||
|
||||
architecture fsm_arc of fsm is
|
||||
|
||||
type states is ( init, s0, s1, s2, s3, s4, s5 );
|
||||
signal nState, cState: states;
|
||||
|
||||
begin
|
||||
process( rst, clk )
|
||||
begin
|
||||
if( rst = '1' ) then
|
||||
cState <= init;
|
||||
elsif( clk'event and clk = '1' ) then
|
||||
cState <= nState;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
process( proceed, comparison, cState )
|
||||
begin
|
||||
case cState is
|
||||
|
||||
when init => if( proceed = '0' ) then
|
||||
nState <= init;
|
||||
else
|
||||
nState <= s0;
|
||||
end if;
|
||||
|
||||
when s0 => enable <= '0';
|
||||
xsel <= '0';
|
||||
ysel <= '0';
|
||||
xld <= '0';
|
||||
yld <= '0';
|
||||
nState <= s1;
|
||||
|
||||
when s1 => enable <= '0';
|
||||
xsel <= '0';
|
||||
ysel <= '0';
|
||||
xld <= '1';
|
||||
yld <= '1';
|
||||
nState <= s2;
|
||||
|
||||
when s2 => xld <= '0';
|
||||
yld <= '0';
|
||||
if( comparison = "10" ) then
|
||||
nState <= s3;
|
||||
elsif( comparison = "01" ) then
|
||||
nState <= s4;
|
||||
elsif( comparison = "11" ) then
|
||||
nState <= s5;
|
||||
end if;
|
||||
|
||||
when s3 => enable <= '0';
|
||||
xsel <= '1';
|
||||
ysel <= '0';
|
||||
xld <= '1';
|
||||
yld <= '0';
|
||||
nState <= s2;
|
||||
|
||||
when s4 => enable <= '0';
|
||||
xsel <= '0';
|
||||
ysel <= '1';
|
||||
xld <= '0';
|
||||
yld <= '1';
|
||||
nState <= s2;
|
||||
|
||||
when s5 => enable <= '1';
|
||||
xsel <= '1';
|
||||
ysel <= '1';
|
||||
xld <= '1';
|
||||
yld <= '1';
|
||||
nState <= s0;
|
||||
|
||||
when others => nState <= s0;
|
||||
|
||||
end case;
|
||||
|
||||
end process;
|
||||
|
||||
end fsm_arc;
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- GCD Calculator: top level design using structural modeling
|
||||
-- FSM + Datapath (mux, registers, subtracter and comparator)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.std_logic_arith.all;
|
||||
use IEEE.std_logic_unsigned.all;
|
||||
use work.all;
|
||||
|
||||
entity gcd is
|
||||
port( rst, clk, go_i: in std_logic;
|
||||
x_i, y_i: in std_logic_vector( 3 downto 0 );
|
||||
d_o: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end gcd;
|
||||
|
||||
architecture gcd_arc of gcd is
|
||||
|
||||
component fsm is
|
||||
port( rst, clk, proceed: in std_logic;
|
||||
comparison: in std_logic_vector( 1 downto 0 );
|
||||
enable, xsel, ysel, xld, yld: out std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component mux is
|
||||
port( rst, sLine: in std_logic;
|
||||
load, result: in std_logic_vector( 3 downto 0 );
|
||||
output: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end component;
|
||||
|
||||
component comparator is
|
||||
port( rst: in std_logic;
|
||||
x, y: in std_logic_vector( 3 downto 0 );
|
||||
output: out std_logic_vector( 1 downto 0 )
|
||||
);
|
||||
end component;
|
||||
|
||||
component subtractor is
|
||||
port( rst: in std_logic;
|
||||
cmd: in std_logic_vector( 1 downto 0 );
|
||||
x, y: in std_logic_vector( 3 downto 0 );
|
||||
xout, yout: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end component;
|
||||
|
||||
component regis is
|
||||
port( rst, clk, load: in std_logic;
|
||||
input: in std_logic_vector( 3 downto 0 );
|
||||
output: out std_logic_vector( 3 downto 0 )
|
||||
);
|
||||
end component;
|
||||
|
||||
signal xld, yld, xsel, ysel, enable: std_logic;
|
||||
signal comparison: std_logic_vector( 1 downto 0 );
|
||||
signal result: std_logic_vector( 3 downto 0 );
|
||||
|
||||
signal xsub, ysub, xmux, ymux, xreg, yreg: std_logic_vector( 3 downto 0 );
|
||||
|
||||
begin
|
||||
|
||||
-- doing structure modeling here
|
||||
|
||||
-- FSM controller
|
||||
TOFSM: fsm port map( rst, clk, go_i, comparison,
|
||||
enable, xsel, ysel, xld, yld );
|
||||
-- Datapath
|
||||
X_MUX: mux port map( rst, xsel, x_i, xsub, xmux );
|
||||
Y_MUX: mux port map( rst, ysel, y_i, ysub, ymux );
|
||||
X_REG: regis port map( rst, clk, xld, xmux, xreg );
|
||||
Y_REG: regis port map( rst, clk, yld, ymux, yreg );
|
||||
U_COMP: comparator port map( rst, xreg, yreg, comparison );
|
||||
X_SUB: subtractor port map( rst, comparison, xreg, yreg, xsub, ysub );
|
||||
OUT_REG: regis port map( rst, clk, enable, xsub, result );
|
||||
|
||||
d_o <= result;
|
||||
|
||||
end gcd_arc;
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
91
tests/vhdl/test_multpipe.vhdl
Normal file
91
tests/vhdl/test_multpipe.vhdl
Normal file
@@ -0,0 +1,91 @@
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
--* * * * * * * * * * * * * * * * VHDL Source Code * * * * * * * * * * * * * *
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
--* Title : Test_MultPipe
|
||||
--* Filename & Ext : test_multpipe.vhdl
|
||||
--* Author : David Bishop <dbishop@vhdl.org> X-XXXXX
|
||||
--* Created : 1999/03/12
|
||||
--* Last modified : $Date: 1999-03-12 16:41:40-05 $
|
||||
--* WORK Library : testchip_lib
|
||||
--* Description : A pipline multiplier with lots of redundant logic
|
||||
--* Known Bugs :
|
||||
--* :
|
||||
--* RCS Summary : $Id: test_multpipe.vhdl,v 1.1 1999-03-12 16:41:40-05 bishop Exp bishop $
|
||||
--* :
|
||||
--* Mod History : $Log: test_multpipe.vhdl,v $
|
||||
--* Mod History : Revision 1.1 1999-03-12 16:41:40-05 bishop
|
||||
--* Mod History : Initial revision
|
||||
--* Mod History :
|
||||
--* :
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity test_multpipe is
|
||||
generic ( width : integer := 7 );
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
enable : in std_ulogic;
|
||||
inp1, inp2 : in std_logic_vector ( width downto 0);
|
||||
sum : out std_logic_vector ( (width * 2 ) downto 0) );
|
||||
end test_multpipe;
|
||||
|
||||
architecture rtl of test_multpipe is
|
||||
subtype vectors is std_logic_vector (( width * 2 ) downto 0 );
|
||||
subtype unsigneds is unsigned (( width * 2 ) downto 0 );
|
||||
type stage_array is array ( width downto 0 ) of vectors;
|
||||
type adder_array is array ( width downto 0 ) of unsigneds;
|
||||
signal stage1, stage2 : stage_array;
|
||||
signal adder_stage : adder_array;
|
||||
signal reg_stage : adder_array;
|
||||
begin -- rtl
|
||||
|
||||
-- Fill the two arrays
|
||||
build_stage1 : process ( inp1 )
|
||||
begin
|
||||
stage_loop1 : for i in 0 to width loop
|
||||
stage1 ( i ) <= ( others => '0' );
|
||||
stage1 ( i ) ( width + i downto i ) <= inp1;
|
||||
end loop stage_loop1;
|
||||
end process build_stage1;
|
||||
|
||||
build_stage2 : process ( inp2 )
|
||||
begin
|
||||
stage_loop2 : for i in 0 to width loop
|
||||
stage2 ( i ) <= ( others => inp2 ( i ) );
|
||||
end loop stage_loop2;
|
||||
end process build_stage2;
|
||||
|
||||
-- and the two arrays together, now you have a matrix which
|
||||
-- you can add up.
|
||||
and_stages : process ( stage1, stage2 )
|
||||
begin
|
||||
and_loop : for i in 0 to width loop
|
||||
adder_stage ( i ) <= unsigned ( stage1 ( i ) and stage2 ( i ) );
|
||||
end loop and_loop;
|
||||
end process and_stages;
|
||||
|
||||
register_stages : process ( reset, clk )
|
||||
variable local_sum : unsigned ( sum'high downto 0 );
|
||||
begin
|
||||
if reset = '0' then
|
||||
reset_loop : for i in 0 to width loop
|
||||
reg_stage ( i ) <= ( others => '0' );
|
||||
end loop reset_loop;
|
||||
elsif rising_edge ( clk ) then
|
||||
if enable = '1' then
|
||||
adder_loop : for i in 0 to ( width + 1 ) / 2 loop
|
||||
reg_stage ( i ) <= adder_stage ( i ) + adder_stage ( width - i );
|
||||
end loop adder_loop;
|
||||
reg_stage ( 4 ) <= reg_stage ( 0 ) + reg_stage ( 3 );
|
||||
reg_stage ( 5 ) <= reg_stage ( 1 ) + reg_stage ( 2 );
|
||||
reg_stage ( 6 ) <= reg_stage ( 4 ) + reg_stage ( 5 );
|
||||
end if;
|
||||
end if;
|
||||
end process register_stages;
|
||||
|
||||
sum <= std_logic_vector (reg_stage ( 6 ));
|
||||
|
||||
end rtl;
|
||||
67
tests/vhdl/test_parity.vhdl
Normal file
67
tests/vhdl/test_parity.vhdl
Normal file
@@ -0,0 +1,67 @@
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
--* * * * * * * * * * * * * * * * VHDL Source Code * * * * * * * * * * * * * *
|
||||
--* * * Copyright (C) 1997 - Eastman Kodak Company - All Rights Reserved * * *
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
--* Title : TEST_PARITY
|
||||
--* Filename & Ext : test_parity.vhdl
|
||||
--* Author : David Bishop X-66788
|
||||
--* Created : 3/18/97
|
||||
--* Version : 1.2
|
||||
--* Revision Date : 97/04/15
|
||||
--* SCCSid : 1.2 04/15/97 test_parity.vhdl
|
||||
--* WORK Library : testchip
|
||||
--* Mod History :
|
||||
--* Description : This is a parity generator which is written recursively
|
||||
--* : It is designed to test the ability of Simulation and
|
||||
--* : Synthesis tools to check this capability.
|
||||
--* Known Bugs :
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
|
||||
-- Parity is done in a recursively called function.
|
||||
-- Package definition
|
||||
package Parity_Pack is
|
||||
function Recursive_Parity ( BUSX : std_logic_vector )
|
||||
return std_ulogic;
|
||||
end Parity_Pack;
|
||||
|
||||
-- Package body.
|
||||
package body Parity_Pack is
|
||||
function Recursive_Parity ( BUSX : std_logic_vector )
|
||||
return std_ulogic is
|
||||
variable Upper, Lower : std_ulogic;
|
||||
variable Half : integer;
|
||||
variable BUS_int : std_logic_vector ( BUSX'length - 1 downto 0 );
|
||||
variable Result : std_logic;
|
||||
begin
|
||||
BUS_int := BUSX;
|
||||
if ( BUS_int'length = 1 ) then
|
||||
Result := BUS_int ( BUS_int'left );
|
||||
elsif ( BUS_int'length = 2 ) then
|
||||
Result := BUS_int ( BUS_int'right ) xor BUS_int ( BUS_int'left );
|
||||
else
|
||||
Half := ( BUS_int'length + 1 ) / 2 + BUS_int'right;
|
||||
Upper := Recursive_Parity ( BUS_int ( BUS_int'left downto Half ));
|
||||
Lower := Recursive_Parity ( BUS_int ( Half - 1 downto BUS_int'right ));
|
||||
Result := Upper xor Lower;
|
||||
end if;
|
||||
return Result;
|
||||
end;
|
||||
end Parity_Pack;
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
use work.Parity_Pack.all;
|
||||
|
||||
entity Test_Parity is
|
||||
generic ( WIDTH : integer := 16);
|
||||
port ( BUSX : in std_logic_vector ( WIDTH downto 0 );
|
||||
Parity : out std_ulogic );
|
||||
end Test_Parity;
|
||||
|
||||
architecture RTL of Test_Parity is
|
||||
begin
|
||||
Parity <= Recursive_Parity ( BUSX );
|
||||
end RTL;
|
||||
219
tests/vhdl/testchip_core.vhdl
Normal file
219
tests/vhdl/testchip_core.vhdl
Normal file
@@ -0,0 +1,219 @@
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
--* * * * * * * * * * * * * * * * VHDL Source Code * * * * * * * * * * * * * *
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
--* Title : TESTCHIP_CORE
|
||||
--* Filename & Ext : testchip_core.vhdl
|
||||
--* Author : David W. Bishop
|
||||
--* Created : 6/6/96
|
||||
--* Version : 1.1
|
||||
--* Revision Date : 97/12/03
|
||||
--* SCCSid : 1.1 12/03/97 testchip_core.vhdl
|
||||
--* WORK Library : chiptest
|
||||
--* Mod History :
|
||||
--* Description : This is a test chip core, designed to test several
|
||||
--* : functions in Synthesis and simulation
|
||||
--* Known Bugs :
|
||||
--* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
entity testchip_core is
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
dclk : in std_ulogic;
|
||||
dclk_i : out std_ulogic;
|
||||
slow_count : out std_logic_vector ( 4 downto 0 );
|
||||
enable : in std_ulogic;
|
||||
load : in std_ulogic;
|
||||
input_data : in std_logic_vector ( 7 downto 0 );
|
||||
shout : out std_ulogic;
|
||||
control : out std_logic_vector ( 1 downto 0 );
|
||||
count : out std_logic_vector ( 7 downto 0 );
|
||||
sum : out std_logic_vector ( 8 downto 0 );
|
||||
mulout : out std_logic_vector ( 14 downto 0 );
|
||||
parity : out std_ulogic );
|
||||
end testchip_core;
|
||||
|
||||
architecture rtl of testchip_core is
|
||||
|
||||
--------------------------------------------------------------------------------- Start with the declarations for the sub-blocks
|
||||
-------------------------------------------------------------------------------
|
||||
component Test_ClkGen
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
dclk : out std_ulogic );
|
||||
end component;
|
||||
|
||||
component test_counter
|
||||
generic ( width : integer := 17 );
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
enable : in std_ulogic;
|
||||
count : out std_logic_vector ( width - 1 downto 0) );
|
||||
end component;
|
||||
|
||||
component test_add
|
||||
generic ( width : integer := 17 );
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
enable : in std_ulogic;
|
||||
inp1 : in std_logic_vector ( width downto 0);
|
||||
inp2 : in std_logic_vector ( width downto 0);
|
||||
sum : out std_logic_vector ( (width + 1) downto 0) );
|
||||
end component;
|
||||
|
||||
component test_reg
|
||||
generic ( width : integer := 17 );
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
enable : in std_ulogic;
|
||||
sel : in std_ulogic;
|
||||
inp1 : in std_logic_vector ( width downto 0);
|
||||
inp2 : in std_logic_vector ( width downto 0);
|
||||
outpt : out std_logic_vector ( width downto 0) );
|
||||
end component;
|
||||
|
||||
component test_shift
|
||||
generic ( width : integer := 17 );
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
load : in std_ulogic;
|
||||
en : in std_ulogic;
|
||||
inp : in std_logic_vector ( width downto 0 );
|
||||
outp : out std_ulogic );
|
||||
end component;
|
||||
|
||||
component test_state
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
con1, con2, con3 : in std_ulogic;
|
||||
out1, out2 : out std_ulogic );
|
||||
end component;
|
||||
|
||||
component test_multpipe
|
||||
generic ( width : integer := 7 );
|
||||
port ( clk : in std_ulogic;
|
||||
reset : in std_ulogic;
|
||||
enable : in std_ulogic;
|
||||
inp1, inp2 : in std_logic_vector ( width downto 0);
|
||||
sum : out std_logic_vector ( (width * 2 ) downto 0) );
|
||||
end component;
|
||||
|
||||
component test_parity
|
||||
generic ( WIDTH : integer := 16);
|
||||
port ( BUSX : in std_logic_vector ( WIDTH downto 0 );
|
||||
Parity : out std_ulogic );
|
||||
end component;
|
||||
|
||||
-- Signal declarations
|
||||
signal internal_data : std_logic_vector ( input_data'high downto 0 );
|
||||
signal local_count : std_logic_vector ( input_data'high downto 0 );
|
||||
signal local_mulout : std_logic_vector ( mulout'high downto 0 );
|
||||
signal VCC, GND : std_ulogic;
|
||||
|
||||
begin -- rtl
|
||||
|
||||
VCC <= '1';
|
||||
GND <= '0';
|
||||
mulout <= local_mulout;
|
||||
|
||||
U1 : test_clkgen
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
dclk => dclk_i );
|
||||
|
||||
U2 : test_counter
|
||||
generic map ( width => 5 )
|
||||
port map (
|
||||
clk => dclk,
|
||||
reset => reset,
|
||||
enable => VCC,
|
||||
count => slow_count
|
||||
);
|
||||
|
||||
U3 : test_reg
|
||||
generic map ( width => internal_data'high )
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
enable => VCC,
|
||||
sel => VCC,
|
||||
inp1 => input_data,
|
||||
inp2 => local_count,
|
||||
outpt => internal_data
|
||||
);
|
||||
|
||||
U4 : test_counter
|
||||
generic map ( width => internal_data'high + 1 )
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
enable => enable,
|
||||
count => local_count
|
||||
);
|
||||
|
||||
U7 : test_add
|
||||
generic map ( width => internal_data'high )
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
enable => enable,
|
||||
inp1 => local_count,
|
||||
inp2 => internal_data,
|
||||
sum => sum
|
||||
);
|
||||
|
||||
U5 : test_shift
|
||||
generic map ( width => internal_data'high )
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
en => enable,
|
||||
load => load,
|
||||
inp => internal_data,
|
||||
outp => shout
|
||||
);
|
||||
|
||||
U9 : test_state
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
con1 => local_count ( 0 ),
|
||||
con2 => local_count ( 1 ),
|
||||
con3 => local_count ( 2 ),
|
||||
out1 => control ( 0 ),
|
||||
out2 => control ( 1 )
|
||||
);
|
||||
|
||||
U8 : test_multpipe
|
||||
generic map ( width => internal_data'high )
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
enable => enable,
|
||||
inp1 => local_count,
|
||||
inp2 => internal_data,
|
||||
sum => local_mulout );
|
||||
|
||||
U6 : Test_Parity
|
||||
generic map ( Width => internal_data'high )
|
||||
port map (
|
||||
BUSX => internal_data,
|
||||
Parity => parity );
|
||||
|
||||
U10 : test_reg
|
||||
generic map ( width => count'high )
|
||||
port map (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
enable => VCC,
|
||||
sel => GND,
|
||||
inp1 => input_data,
|
||||
inp2 => local_count,
|
||||
outpt => count
|
||||
);
|
||||
|
||||
|
||||
end rtl;
|
||||
Reference in New Issue
Block a user