content
stringlengths
1
1.04M
library ieee; use ieee.std_logic_1164.all; entity issue is port (i_foo : in std_logic; o_foo : out std_logic); end entity issue; architecture beh of issue is signal k_foo : std_logic := i_foo; begin o_foo <= k_foo xor '0'; end architecture;
-------------------------------------------------------------------------------- -- -- FIFO Generator Core Demo Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: cmdfifo_tb.vhd -- -- Description: -- This is the demo testbench top file for fifo_generator core. -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY ieee; LIBRARY std; USE ieee.std_logic_1164.ALL; USE ieee.std_logic_unsigned.ALL; USE IEEE.std_logic_arith.ALL; USE IEEE.std_logic_misc.ALL; USE ieee.numeric_std.ALL; USE ieee.std_logic_textio.ALL; USE std.textio.ALL; LIBRARY work; USE work.cmdfifo_pkg.ALL; ENTITY cmdfifo_tb IS END ENTITY; ARCHITECTURE cmdfifo_arch OF cmdfifo_tb IS SIGNAL status : STD_LOGIC_VECTOR(7 DOWNTO 0) := "00000000"; SIGNAL wr_clk : STD_LOGIC; SIGNAL rd_clk : STD_LOGIC; SIGNAL reset : STD_LOGIC; SIGNAL sim_done : STD_LOGIC := '0'; SIGNAL end_of_sim : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '0'); -- Write and Read clock periods CONSTANT wr_clk_period_by_2 : TIME := 200 ns; CONSTANT rd_clk_period_by_2 : TIME := 100 ns; -- Procedures to display strings PROCEDURE disp_str(CONSTANT str:IN STRING) IS variable dp_l : line := null; BEGIN write(dp_l,str); writeline(output,dp_l); END PROCEDURE; PROCEDURE disp_hex(signal hex:IN STD_LOGIC_VECTOR(7 DOWNTO 0)) IS variable dp_lx : line := null; BEGIN hwrite(dp_lx,hex); writeline(output,dp_lx); END PROCEDURE; BEGIN -- Generation of clock PROCESS BEGIN WAIT FOR 400 ns; -- Wait for global reset WHILE 1 = 1 LOOP wr_clk <= '0'; WAIT FOR wr_clk_period_by_2; wr_clk <= '1'; WAIT FOR wr_clk_period_by_2; END LOOP; END PROCESS; PROCESS BEGIN WAIT FOR 200 ns;-- Wait for global reset WHILE 1 = 1 LOOP rd_clk <= '0'; WAIT FOR rd_clk_period_by_2; rd_clk <= '1'; WAIT FOR rd_clk_period_by_2; END LOOP; END PROCESS; -- Generation of Reset PROCESS BEGIN reset <= '1'; WAIT FOR 4200 ns; reset <= '0'; WAIT; END PROCESS; -- Error message printing based on STATUS signal from cmdfifo_synth PROCESS(status) BEGIN IF(status /= "0" AND status /= "1") THEN disp_str("STATUS:"); disp_hex(status); END IF; IF(status(7) = '1') THEN assert false report "Data mismatch found" severity error; END IF; IF(status(1) = '1') THEN END IF; IF(status(3) = '1') THEN assert false report "Almost Empty flag Mismatch/timeout" severity error; END IF; IF(status(4) = '1') THEN assert false report "Almost Full flag Mismatch/timeout" severity error; END IF; IF(status(5) = '1') THEN assert false report "Empty flag Mismatch/timeout" severity error; END IF; IF(status(6) = '1') THEN assert false report "Full Flag Mismatch/timeout" severity error; END IF; END PROCESS; PROCESS BEGIN wait until sim_done = '1'; IF(status /= "0" AND status /= "1") THEN assert false report "Simulation failed" severity failure; ELSE assert false report "Test Completed Successfully" severity failure; END IF; END PROCESS; PROCESS BEGIN wait for 400 ms; assert false report "Test bench timed out" severity failure; END PROCESS; -- Instance of cmdfifo_synth cmdfifo_synth_inst:cmdfifo_synth GENERIC MAP( FREEZEON_ERROR => 0, TB_STOP_CNT => 2, TB_SEED => 20 ) PORT MAP( WR_CLK => wr_clk, RD_CLK => rd_clk, RESET => reset, SIM_DONE => sim_done, STATUS => status ); END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- FIFO Generator Core Demo Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: cmdfifo_tb.vhd -- -- Description: -- This is the demo testbench top file for fifo_generator core. -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY ieee; LIBRARY std; USE ieee.std_logic_1164.ALL; USE ieee.std_logic_unsigned.ALL; USE IEEE.std_logic_arith.ALL; USE IEEE.std_logic_misc.ALL; USE ieee.numeric_std.ALL; USE ieee.std_logic_textio.ALL; USE std.textio.ALL; LIBRARY work; USE work.cmdfifo_pkg.ALL; ENTITY cmdfifo_tb IS END ENTITY; ARCHITECTURE cmdfifo_arch OF cmdfifo_tb IS SIGNAL status : STD_LOGIC_VECTOR(7 DOWNTO 0) := "00000000"; SIGNAL wr_clk : STD_LOGIC; SIGNAL rd_clk : STD_LOGIC; SIGNAL reset : STD_LOGIC; SIGNAL sim_done : STD_LOGIC := '0'; SIGNAL end_of_sim : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '0'); -- Write and Read clock periods CONSTANT wr_clk_period_by_2 : TIME := 200 ns; CONSTANT rd_clk_period_by_2 : TIME := 100 ns; -- Procedures to display strings PROCEDURE disp_str(CONSTANT str:IN STRING) IS variable dp_l : line := null; BEGIN write(dp_l,str); writeline(output,dp_l); END PROCEDURE; PROCEDURE disp_hex(signal hex:IN STD_LOGIC_VECTOR(7 DOWNTO 0)) IS variable dp_lx : line := null; BEGIN hwrite(dp_lx,hex); writeline(output,dp_lx); END PROCEDURE; BEGIN -- Generation of clock PROCESS BEGIN WAIT FOR 400 ns; -- Wait for global reset WHILE 1 = 1 LOOP wr_clk <= '0'; WAIT FOR wr_clk_period_by_2; wr_clk <= '1'; WAIT FOR wr_clk_period_by_2; END LOOP; END PROCESS; PROCESS BEGIN WAIT FOR 200 ns;-- Wait for global reset WHILE 1 = 1 LOOP rd_clk <= '0'; WAIT FOR rd_clk_period_by_2; rd_clk <= '1'; WAIT FOR rd_clk_period_by_2; END LOOP; END PROCESS; -- Generation of Reset PROCESS BEGIN reset <= '1'; WAIT FOR 4200 ns; reset <= '0'; WAIT; END PROCESS; -- Error message printing based on STATUS signal from cmdfifo_synth PROCESS(status) BEGIN IF(status /= "0" AND status /= "1") THEN disp_str("STATUS:"); disp_hex(status); END IF; IF(status(7) = '1') THEN assert false report "Data mismatch found" severity error; END IF; IF(status(1) = '1') THEN END IF; IF(status(3) = '1') THEN assert false report "Almost Empty flag Mismatch/timeout" severity error; END IF; IF(status(4) = '1') THEN assert false report "Almost Full flag Mismatch/timeout" severity error; END IF; IF(status(5) = '1') THEN assert false report "Empty flag Mismatch/timeout" severity error; END IF; IF(status(6) = '1') THEN assert false report "Full Flag Mismatch/timeout" severity error; END IF; END PROCESS; PROCESS BEGIN wait until sim_done = '1'; IF(status /= "0" AND status /= "1") THEN assert false report "Simulation failed" severity failure; ELSE assert false report "Test Completed Successfully" severity failure; END IF; END PROCESS; PROCESS BEGIN wait for 400 ms; assert false report "Test bench timed out" severity failure; END PROCESS; -- Instance of cmdfifo_synth cmdfifo_synth_inst:cmdfifo_synth GENERIC MAP( FREEZEON_ERROR => 0, TB_STOP_CNT => 2, TB_SEED => 20 ) PORT MAP( WR_CLK => wr_clk, RD_CLK => rd_clk, RESET => reset, SIM_DONE => sim_done, STATUS => status ); END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- FIFO Generator Core Demo Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: cmdfifo_tb.vhd -- -- Description: -- This is the demo testbench top file for fifo_generator core. -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY ieee; LIBRARY std; USE ieee.std_logic_1164.ALL; USE ieee.std_logic_unsigned.ALL; USE IEEE.std_logic_arith.ALL; USE IEEE.std_logic_misc.ALL; USE ieee.numeric_std.ALL; USE ieee.std_logic_textio.ALL; USE std.textio.ALL; LIBRARY work; USE work.cmdfifo_pkg.ALL; ENTITY cmdfifo_tb IS END ENTITY; ARCHITECTURE cmdfifo_arch OF cmdfifo_tb IS SIGNAL status : STD_LOGIC_VECTOR(7 DOWNTO 0) := "00000000"; SIGNAL wr_clk : STD_LOGIC; SIGNAL rd_clk : STD_LOGIC; SIGNAL reset : STD_LOGIC; SIGNAL sim_done : STD_LOGIC := '0'; SIGNAL end_of_sim : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '0'); -- Write and Read clock periods CONSTANT wr_clk_period_by_2 : TIME := 200 ns; CONSTANT rd_clk_period_by_2 : TIME := 100 ns; -- Procedures to display strings PROCEDURE disp_str(CONSTANT str:IN STRING) IS variable dp_l : line := null; BEGIN write(dp_l,str); writeline(output,dp_l); END PROCEDURE; PROCEDURE disp_hex(signal hex:IN STD_LOGIC_VECTOR(7 DOWNTO 0)) IS variable dp_lx : line := null; BEGIN hwrite(dp_lx,hex); writeline(output,dp_lx); END PROCEDURE; BEGIN -- Generation of clock PROCESS BEGIN WAIT FOR 400 ns; -- Wait for global reset WHILE 1 = 1 LOOP wr_clk <= '0'; WAIT FOR wr_clk_period_by_2; wr_clk <= '1'; WAIT FOR wr_clk_period_by_2; END LOOP; END PROCESS; PROCESS BEGIN WAIT FOR 200 ns;-- Wait for global reset WHILE 1 = 1 LOOP rd_clk <= '0'; WAIT FOR rd_clk_period_by_2; rd_clk <= '1'; WAIT FOR rd_clk_period_by_2; END LOOP; END PROCESS; -- Generation of Reset PROCESS BEGIN reset <= '1'; WAIT FOR 4200 ns; reset <= '0'; WAIT; END PROCESS; -- Error message printing based on STATUS signal from cmdfifo_synth PROCESS(status) BEGIN IF(status /= "0" AND status /= "1") THEN disp_str("STATUS:"); disp_hex(status); END IF; IF(status(7) = '1') THEN assert false report "Data mismatch found" severity error; END IF; IF(status(1) = '1') THEN END IF; IF(status(3) = '1') THEN assert false report "Almost Empty flag Mismatch/timeout" severity error; END IF; IF(status(4) = '1') THEN assert false report "Almost Full flag Mismatch/timeout" severity error; END IF; IF(status(5) = '1') THEN assert false report "Empty flag Mismatch/timeout" severity error; END IF; IF(status(6) = '1') THEN assert false report "Full Flag Mismatch/timeout" severity error; END IF; END PROCESS; PROCESS BEGIN wait until sim_done = '1'; IF(status /= "0" AND status /= "1") THEN assert false report "Simulation failed" severity failure; ELSE assert false report "Test Completed Successfully" severity failure; END IF; END PROCESS; PROCESS BEGIN wait for 400 ms; assert false report "Test bench timed out" severity failure; END PROCESS; -- Instance of cmdfifo_synth cmdfifo_synth_inst:cmdfifo_synth GENERIC MAP( FREEZEON_ERROR => 0, TB_STOP_CNT => 2, TB_SEED => 20 ) PORT MAP( WR_CLK => wr_clk, RD_CLK => rd_clk, RESET => reset, SIM_DONE => sim_done, STATUS => status ); END ARCHITECTURE;
Library ieee; Use ieee.std_logic_1164.all; use ieee.std_logic_signed.all; ENTITY AddSubIncDec IS port( R1,R2: in std_logic_vector(15 downto 0); OutPut : out std_logic_vector(15 downto 0); OpCode :in std_logic_vector(4 downto 0); --Z: out std_logic; --V: out std_logic; C: out std_logic --N: out std_logic ); END AddSubIncDec; Architecture archi of AddSubIncDec is Component my_nadder is PORT (a, b : in std_logic_vector(15 downto 0) ; s : out std_logic_vector(15 downto 0); cout : out std_logic); end component; signal tmpR1 : std_logic_vector(15 downto 0); signal tmpR2 : std_logic_vector(15 downto 0); signal TempOut : std_logic_vector(15 downto 0); begin tmpR1 <= R1 ; tmpR2 <= R2 when OpCode = "00010" else -R2 when OpCode = "00011" else "0000000000000001" when OpCode = "10010" else (others => '1') when OpCode = "10011"; F : my_nadder port map(tmpR1,tmpR2,TempOut,C); OutPut <= TempOut; end archi;
-------------------------------------------------------------------------------- -- Title : CDC Sync Block -- Project : Tri-Mode Ethernet MAC -------------------------------------------------------------------------------- -- File : tri_mode_ethernet_mac_0_sync_block.vhd -- Author : Xilinx Inc. -------------------------------------------------------------------------------- -- Description: Used on signals crossing from one clock domain to another, this -- is a multiple flip-flop pipeline, with all flops placed together -- into the same slice. Thus the routing delay between the two is -- minimum to safe-guard against metastability issues. -- ----------------------------------------------------------------------------- -- (c) Copyright 2004-2013 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library unisim; use unisim.vcomponents.all; entity tri_mode_ethernet_mac_0_sync_block is generic ( INITIALISE : bit := '0'; DEPTH : integer := 5 ); port ( clk : in std_logic; -- clock to be sync'ed to data_in : in std_logic; -- Data to be 'synced' data_out : out std_logic -- synced data ); attribute dont_touch : string; attribute dont_touch of tri_mode_ethernet_mac_0_sync_block : entity is "yes"; end tri_mode_ethernet_mac_0_sync_block; architecture structural of tri_mode_ethernet_mac_0_sync_block is -- Internal Signals signal data_sync0 : std_logic; signal data_sync1 : std_logic; signal data_sync2 : std_logic; signal data_sync3 : std_logic; signal data_sync4 : std_logic; -- These attributes will stop timing errors being reported in back annotated -- SDF simulation. attribute async_reg : string; attribute async_reg of data_sync_reg0 : label is "true"; attribute async_reg of data_sync_reg1 : label is "true"; attribute async_reg of data_sync_reg2 : label is "true"; attribute async_reg of data_sync_reg3 : label is "true"; attribute async_reg of data_sync_reg4 : label is "true"; attribute shreg_extract : string; attribute shreg_extract of data_sync_reg0 : label is "no"; attribute shreg_extract of data_sync_reg1 : label is "no"; attribute shreg_extract of data_sync_reg2 : label is "no"; attribute shreg_extract of data_sync_reg3 : label is "no"; attribute shreg_extract of data_sync_reg4 : label is "no"; begin data_sync_reg0 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_in, Q => data_sync0, CE => '1', R => '0' ); data_sync_reg1 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync0, Q => data_sync1, CE => '1', R => '0' ); data_sync_reg2 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync1, Q => data_sync2, CE => '1', R => '0' ); data_sync_reg3 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync2, Q => data_sync3, CE => '1', R => '0' ); data_sync_reg4 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync3, Q => data_sync4, CE => '1', R => '0' ); data_out <= data_sync4; end structural;
-------------------------------------------------------------------------------- -- Title : CDC Sync Block -- Project : Tri-Mode Ethernet MAC -------------------------------------------------------------------------------- -- File : tri_mode_ethernet_mac_0_sync_block.vhd -- Author : Xilinx Inc. -------------------------------------------------------------------------------- -- Description: Used on signals crossing from one clock domain to another, this -- is a multiple flip-flop pipeline, with all flops placed together -- into the same slice. Thus the routing delay between the two is -- minimum to safe-guard against metastability issues. -- ----------------------------------------------------------------------------- -- (c) Copyright 2004-2013 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library unisim; use unisim.vcomponents.all; entity tri_mode_ethernet_mac_0_sync_block is generic ( INITIALISE : bit := '0'; DEPTH : integer := 5 ); port ( clk : in std_logic; -- clock to be sync'ed to data_in : in std_logic; -- Data to be 'synced' data_out : out std_logic -- synced data ); attribute dont_touch : string; attribute dont_touch of tri_mode_ethernet_mac_0_sync_block : entity is "yes"; end tri_mode_ethernet_mac_0_sync_block; architecture structural of tri_mode_ethernet_mac_0_sync_block is -- Internal Signals signal data_sync0 : std_logic; signal data_sync1 : std_logic; signal data_sync2 : std_logic; signal data_sync3 : std_logic; signal data_sync4 : std_logic; -- These attributes will stop timing errors being reported in back annotated -- SDF simulation. attribute async_reg : string; attribute async_reg of data_sync_reg0 : label is "true"; attribute async_reg of data_sync_reg1 : label is "true"; attribute async_reg of data_sync_reg2 : label is "true"; attribute async_reg of data_sync_reg3 : label is "true"; attribute async_reg of data_sync_reg4 : label is "true"; attribute shreg_extract : string; attribute shreg_extract of data_sync_reg0 : label is "no"; attribute shreg_extract of data_sync_reg1 : label is "no"; attribute shreg_extract of data_sync_reg2 : label is "no"; attribute shreg_extract of data_sync_reg3 : label is "no"; attribute shreg_extract of data_sync_reg4 : label is "no"; begin data_sync_reg0 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_in, Q => data_sync0, CE => '1', R => '0' ); data_sync_reg1 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync0, Q => data_sync1, CE => '1', R => '0' ); data_sync_reg2 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync1, Q => data_sync2, CE => '1', R => '0' ); data_sync_reg3 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync2, Q => data_sync3, CE => '1', R => '0' ); data_sync_reg4 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync3, Q => data_sync4, CE => '1', R => '0' ); data_out <= data_sync4; end structural;
-------------------------------------------------------------------------------- -- Title : CDC Sync Block -- Project : Tri-Mode Ethernet MAC -------------------------------------------------------------------------------- -- File : tri_mode_ethernet_mac_0_sync_block.vhd -- Author : Xilinx Inc. -------------------------------------------------------------------------------- -- Description: Used on signals crossing from one clock domain to another, this -- is a multiple flip-flop pipeline, with all flops placed together -- into the same slice. Thus the routing delay between the two is -- minimum to safe-guard against metastability issues. -- ----------------------------------------------------------------------------- -- (c) Copyright 2004-2013 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library unisim; use unisim.vcomponents.all; entity tri_mode_ethernet_mac_0_sync_block is generic ( INITIALISE : bit := '0'; DEPTH : integer := 5 ); port ( clk : in std_logic; -- clock to be sync'ed to data_in : in std_logic; -- Data to be 'synced' data_out : out std_logic -- synced data ); attribute dont_touch : string; attribute dont_touch of tri_mode_ethernet_mac_0_sync_block : entity is "yes"; end tri_mode_ethernet_mac_0_sync_block; architecture structural of tri_mode_ethernet_mac_0_sync_block is -- Internal Signals signal data_sync0 : std_logic; signal data_sync1 : std_logic; signal data_sync2 : std_logic; signal data_sync3 : std_logic; signal data_sync4 : std_logic; -- These attributes will stop timing errors being reported in back annotated -- SDF simulation. attribute async_reg : string; attribute async_reg of data_sync_reg0 : label is "true"; attribute async_reg of data_sync_reg1 : label is "true"; attribute async_reg of data_sync_reg2 : label is "true"; attribute async_reg of data_sync_reg3 : label is "true"; attribute async_reg of data_sync_reg4 : label is "true"; attribute shreg_extract : string; attribute shreg_extract of data_sync_reg0 : label is "no"; attribute shreg_extract of data_sync_reg1 : label is "no"; attribute shreg_extract of data_sync_reg2 : label is "no"; attribute shreg_extract of data_sync_reg3 : label is "no"; attribute shreg_extract of data_sync_reg4 : label is "no"; begin data_sync_reg0 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_in, Q => data_sync0, CE => '1', R => '0' ); data_sync_reg1 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync0, Q => data_sync1, CE => '1', R => '0' ); data_sync_reg2 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync1, Q => data_sync2, CE => '1', R => '0' ); data_sync_reg3 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync2, Q => data_sync3, CE => '1', R => '0' ); data_sync_reg4 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync3, Q => data_sync4, CE => '1', R => '0' ); data_out <= data_sync4; end structural;
-------------------------------------------------------------------------------- -- Title : CDC Sync Block -- Project : Tri-Mode Ethernet MAC -------------------------------------------------------------------------------- -- File : tri_mode_ethernet_mac_0_sync_block.vhd -- Author : Xilinx Inc. -------------------------------------------------------------------------------- -- Description: Used on signals crossing from one clock domain to another, this -- is a multiple flip-flop pipeline, with all flops placed together -- into the same slice. Thus the routing delay between the two is -- minimum to safe-guard against metastability issues. -- ----------------------------------------------------------------------------- -- (c) Copyright 2004-2013 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -- ----------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library unisim; use unisim.vcomponents.all; entity tri_mode_ethernet_mac_0_sync_block is generic ( INITIALISE : bit := '0'; DEPTH : integer := 5 ); port ( clk : in std_logic; -- clock to be sync'ed to data_in : in std_logic; -- Data to be 'synced' data_out : out std_logic -- synced data ); attribute dont_touch : string; attribute dont_touch of tri_mode_ethernet_mac_0_sync_block : entity is "yes"; end tri_mode_ethernet_mac_0_sync_block; architecture structural of tri_mode_ethernet_mac_0_sync_block is -- Internal Signals signal data_sync0 : std_logic; signal data_sync1 : std_logic; signal data_sync2 : std_logic; signal data_sync3 : std_logic; signal data_sync4 : std_logic; -- These attributes will stop timing errors being reported in back annotated -- SDF simulation. attribute async_reg : string; attribute async_reg of data_sync_reg0 : label is "true"; attribute async_reg of data_sync_reg1 : label is "true"; attribute async_reg of data_sync_reg2 : label is "true"; attribute async_reg of data_sync_reg3 : label is "true"; attribute async_reg of data_sync_reg4 : label is "true"; attribute shreg_extract : string; attribute shreg_extract of data_sync_reg0 : label is "no"; attribute shreg_extract of data_sync_reg1 : label is "no"; attribute shreg_extract of data_sync_reg2 : label is "no"; attribute shreg_extract of data_sync_reg3 : label is "no"; attribute shreg_extract of data_sync_reg4 : label is "no"; begin data_sync_reg0 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_in, Q => data_sync0, CE => '1', R => '0' ); data_sync_reg1 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync0, Q => data_sync1, CE => '1', R => '0' ); data_sync_reg2 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync1, Q => data_sync2, CE => '1', R => '0' ); data_sync_reg3 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync2, Q => data_sync3, CE => '1', R => '0' ); data_sync_reg4 : FDRE generic map ( INIT => INITIALISE ) port map ( C => clk, D => data_sync3, Q => data_sync4, CE => '1', R => '0' ); data_out <= data_sync4; end structural;
-- ------------------------------------------------------------- -- -- Entity Declaration for inst_ok_3_e -- -- Generated -- by: wig -- on: Fri Jul 15 13:54:30 2005 -- cmd: h:/work/eclipse/mix/mix_0.pl -nodelta ../macro.xls -- -- !!! Do not edit this file! Autogenerated by MIX !!! -- $Author: wig $ -- $Id: inst_ok_3_e-e.vhd,v 1.2 2005/07/15 16:20:01 wig Exp $ -- $Date: 2005/07/15 16:20:01 $ -- $Log: inst_ok_3_e-e.vhd,v $ -- Revision 1.2 2005/07/15 16:20:01 wig -- Update all testcases; still problems though -- -- -- Based on Mix Entity Template built into RCSfile: MixWriter.pm,v -- Id: MixWriter.pm,v 1.55 2005/07/13 15:38:34 wig Exp -- -- Generator: mix_0.pl Version: Revision: 1.36 , wilfried.gaensheimer@micronas.com -- (C) 2003 Micronas GmbH -- -- -------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; -- No project specific VHDL libraries/enty -- -- -- Start of Generated Entity inst_ok_3_e -- entity inst_ok_3_e is -- Generics: -- No Generated Generics for Entity inst_ok_3_e -- Generated Port Declaration: -- No Generated Port for Entity inst_ok_3_e end inst_ok_3_e; -- -- End of Generated Entity inst_ok_3_e -- -- --!End of Entity/ies -- --------------------------------------------------------------
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: bscanregsbd -- File: bscanregsbd.vhd -- Author: Magnus Hjorth - Aeroflex Gaisler -- Description: JTAG boundary scan registers, bi-directional IO ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; entity bscanregsbd is generic ( tech: integer:= 0; nsigs: integer := 8; enable: integer range 0 to 1 := 1; hzsup: integer range 0 to 1 := 1 ); port ( pado : out std_logic_vector(nsigs-1 downto 0); padoen : out std_logic_vector(nsigs-1 downto 0); padi : in std_logic_vector(nsigs-1 downto 0); coreo : in std_logic_vector(nsigs-1 downto 0); coreoen : in std_logic_vector(nsigs-1 downto 0); corei : out std_logic_vector(nsigs-1 downto 0); tck : in std_ulogic; tckn : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; bsshft : in std_ulogic; bscapt : in std_ulogic; -- capture signals to scan regs on next tck edge bsupdi : in std_ulogic; -- update indata reg from scan reg on next tck edge bsupdo : in std_ulogic; -- update outdata reg from scan reg on next tck edge bsdrive : in std_ulogic; -- drive outdata regs to pad, -- drive datareg(coreoen=0) or coreo(coreoen=1) to corei bshighz : in std_ulogic -- tri-state output ); end; architecture rtl of bscanregsbd is signal ltdi: std_logic_vector(nsigs downto 0); begin disgen: if enable = 0 generate pado <= coreo; padoen <= coreoen; corei <= padi; tdo <= '0'; ltdi <= (others => '0'); end generate; engen: if enable /= 0 generate g: for x in 0 to nsigs-1 generate r: scanregio generic map (tech,hzsup) port map (pado(x),padoen(x),padi(x),coreo(x),coreoen(x),corei(x), tck,tckn,ltdi(x),ltdi(x+1),bsshft,bscapt,bsupdi,bsupdo,bsdrive,bshighz); end generate; ltdi(0) <= tdi; tdo <= ltdi(nsigs); end generate; end;
-- ------------------------------------------------------------- -- -- File Name: hdl_prj/hdlsrc/OFDM_transmitter/TWDLROM_3_7.vhd -- Created: 2017-03-27 15:50:06 -- -- Generated by MATLAB 9.1 and HDL Coder 3.9 -- -- ------------------------------------------------------------- -- ------------------------------------------------------------- -- -- Module: TWDLROM_3_7 -- Source Path: OFDM_transmitter/IFFT HDL Optimized/TWDLROM_3_7 -- Hierarchy Level: 2 -- -- ------------------------------------------------------------- LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; USE IEEE.numeric_std.ALL; USE work.OFDM_transmitter_pkg.ALL; ENTITY TWDLROM_3_7 IS PORT( clk : IN std_logic; reset : IN std_logic; enb_1_16_0 : IN std_logic; dout_2_vld : IN std_logic; softReset : IN std_logic; twdl_3_7_re : OUT std_logic_vector(15 DOWNTO 0); -- sfix16_En14 twdl_3_7_im : OUT std_logic_vector(15 DOWNTO 0); -- sfix16_En14 twdl_3_7_vld : OUT std_logic ); END TWDLROM_3_7; ARCHITECTURE rtl OF TWDLROM_3_7 IS -- Constants CONSTANT Twiddle_re_table_data : vector_of_signed16(0 TO 1) := (to_signed(16#4000#, 16), to_signed(16#3B21#, 16)); -- sfix16 [2] CONSTANT Twiddle_im_table_data : vector_of_signed16(0 TO 1) := (to_signed(16#0000#, 16), to_signed(-16#187E#, 16)); -- sfix16 [2] -- Signals SIGNAL Radix22TwdlMapping_cnt : unsigned(1 DOWNTO 0); -- ufix2 SIGNAL Radix22TwdlMapping_phase : unsigned(1 DOWNTO 0); -- ufix2 SIGNAL Radix22TwdlMapping_octantReg1 : unsigned(2 DOWNTO 0); -- ufix3 SIGNAL Radix22TwdlMapping_twdlAddr_raw : unsigned(3 DOWNTO 0); -- ufix4 SIGNAL Radix22TwdlMapping_twdlAddrMap : std_logic; -- ufix1 SIGNAL Radix22TwdlMapping_twdl45Reg : std_logic; SIGNAL Radix22TwdlMapping_dvldReg1 : std_logic; SIGNAL Radix22TwdlMapping_dvldReg2 : std_logic; SIGNAL Radix22TwdlMapping_cnt_next : unsigned(1 DOWNTO 0); -- ufix2 SIGNAL Radix22TwdlMapping_phase_next : unsigned(1 DOWNTO 0); -- ufix2 SIGNAL Radix22TwdlMapping_octantReg1_next : unsigned(2 DOWNTO 0); -- ufix3 SIGNAL Radix22TwdlMapping_twdlAddr_raw_next : unsigned(3 DOWNTO 0); -- ufix4 SIGNAL Radix22TwdlMapping_twdlAddrMap_next : std_logic; -- ufix1 SIGNAL Radix22TwdlMapping_twdl45Reg_next : std_logic; SIGNAL Radix22TwdlMapping_dvldReg1_next : std_logic; SIGNAL Radix22TwdlMapping_dvldReg2_next : std_logic; SIGNAL twdlAddr : std_logic; -- ufix1 SIGNAL twdlAddrVld : std_logic; SIGNAL twdlOctant : unsigned(2 DOWNTO 0); -- ufix3 SIGNAL twdl45 : std_logic; SIGNAL Twiddle_re_cast : signed(31 DOWNTO 0); -- int32 SIGNAL twiddleS_re : signed(15 DOWNTO 0); -- sfix16_En14 SIGNAL twiddleReg_re : signed(15 DOWNTO 0); -- sfix16_En14 SIGNAL Twiddle_im_cast : signed(31 DOWNTO 0); -- int32 SIGNAL twiddleS_im : signed(15 DOWNTO 0); -- sfix16_En14 SIGNAL twiddleReg_im : signed(15 DOWNTO 0); -- sfix16_En14 SIGNAL twdlOctantReg : unsigned(2 DOWNTO 0); -- ufix3 SIGNAL twdl45Reg : std_logic; SIGNAL twdl_3_7_re_tmp : signed(15 DOWNTO 0); -- sfix16_En14 SIGNAL twdl_3_7_im_tmp : signed(15 DOWNTO 0); -- sfix16_En14 BEGIN -- Radix22TwdlMapping Radix22TwdlMapping_process : PROCESS (clk, reset) BEGIN IF reset = '1' THEN Radix22TwdlMapping_octantReg1 <= to_unsigned(16#0#, 3); Radix22TwdlMapping_twdlAddr_raw <= to_unsigned(16#0#, 4); Radix22TwdlMapping_twdlAddrMap <= '0'; Radix22TwdlMapping_twdl45Reg <= '0'; Radix22TwdlMapping_dvldReg1 <= '0'; Radix22TwdlMapping_dvldReg2 <= '0'; Radix22TwdlMapping_cnt <= to_unsigned(16#2#, 2); Radix22TwdlMapping_phase <= to_unsigned(16#1#, 2); ELSIF clk'EVENT AND clk = '1' THEN IF enb_1_16_0 = '1' THEN Radix22TwdlMapping_cnt <= Radix22TwdlMapping_cnt_next; Radix22TwdlMapping_phase <= Radix22TwdlMapping_phase_next; Radix22TwdlMapping_octantReg1 <= Radix22TwdlMapping_octantReg1_next; Radix22TwdlMapping_twdlAddr_raw <= Radix22TwdlMapping_twdlAddr_raw_next; Radix22TwdlMapping_twdlAddrMap <= Radix22TwdlMapping_twdlAddrMap_next; Radix22TwdlMapping_twdl45Reg <= Radix22TwdlMapping_twdl45Reg_next; Radix22TwdlMapping_dvldReg1 <= Radix22TwdlMapping_dvldReg1_next; Radix22TwdlMapping_dvldReg2 <= Radix22TwdlMapping_dvldReg2_next; END IF; END IF; END PROCESS Radix22TwdlMapping_process; Radix22TwdlMapping_output : PROCESS (Radix22TwdlMapping_cnt, Radix22TwdlMapping_phase, Radix22TwdlMapping_octantReg1, Radix22TwdlMapping_twdlAddr_raw, Radix22TwdlMapping_twdlAddrMap, Radix22TwdlMapping_twdl45Reg, Radix22TwdlMapping_dvldReg1, Radix22TwdlMapping_dvldReg2, dout_2_vld) VARIABLE octant : unsigned(2 DOWNTO 0); VARIABLE cnt_cast : unsigned(3 DOWNTO 0); VARIABLE sub_cast : signed(9 DOWNTO 0); VARIABLE sub_temp : signed(9 DOWNTO 0); VARIABLE sub_cast_0 : signed(5 DOWNTO 0); VARIABLE sub_temp_0 : signed(5 DOWNTO 0); VARIABLE sub_cast_1 : signed(5 DOWNTO 0); VARIABLE sub_temp_1 : signed(5 DOWNTO 0); VARIABLE sub_cast_2 : signed(9 DOWNTO 0); VARIABLE sub_temp_2 : signed(9 DOWNTO 0); VARIABLE sub_cast_3 : signed(9 DOWNTO 0); VARIABLE sub_temp_3 : signed(9 DOWNTO 0); BEGIN Radix22TwdlMapping_twdlAddr_raw_next <= Radix22TwdlMapping_twdlAddr_raw; Radix22TwdlMapping_twdlAddrMap_next <= Radix22TwdlMapping_twdlAddrMap; Radix22TwdlMapping_twdl45Reg_next <= Radix22TwdlMapping_twdl45Reg; Radix22TwdlMapping_dvldReg2_next <= Radix22TwdlMapping_dvldReg1; Radix22TwdlMapping_dvldReg1_next <= dout_2_vld; CASE Radix22TwdlMapping_twdlAddr_raw IS WHEN "0010" => octant := to_unsigned(16#0#, 3); Radix22TwdlMapping_twdl45Reg_next <= '1'; WHEN "0100" => octant := to_unsigned(16#1#, 3); Radix22TwdlMapping_twdl45Reg_next <= '0'; WHEN "0110" => octant := to_unsigned(16#2#, 3); Radix22TwdlMapping_twdl45Reg_next <= '1'; WHEN "1000" => octant := to_unsigned(16#3#, 3); Radix22TwdlMapping_twdl45Reg_next <= '0'; WHEN "1010" => octant := to_unsigned(16#4#, 3); Radix22TwdlMapping_twdl45Reg_next <= '1'; WHEN OTHERS => octant := Radix22TwdlMapping_twdlAddr_raw(3 DOWNTO 1); Radix22TwdlMapping_twdl45Reg_next <= '0'; END CASE; Radix22TwdlMapping_octantReg1_next <= octant; CASE octant IS WHEN "000" => Radix22TwdlMapping_twdlAddrMap_next <= Radix22TwdlMapping_twdlAddr_raw(0); WHEN "001" => sub_cast_0 := signed(resize(Radix22TwdlMapping_twdlAddr_raw, 6)); sub_temp_0 := to_signed(16#04#, 6) - sub_cast_0; Radix22TwdlMapping_twdlAddrMap_next <= sub_temp_0(0); WHEN "010" => sub_cast_1 := signed(resize(Radix22TwdlMapping_twdlAddr_raw, 6)); sub_temp_1 := sub_cast_1 - to_signed(16#04#, 6); Radix22TwdlMapping_twdlAddrMap_next <= sub_temp_1(0); WHEN "011" => sub_cast_2 := signed(resize(Radix22TwdlMapping_twdlAddr_raw & '0', 10)); sub_temp_2 := to_signed(16#010#, 10) - sub_cast_2; Radix22TwdlMapping_twdlAddrMap_next <= sub_temp_2(1); WHEN "100" => sub_cast_3 := signed(resize(Radix22TwdlMapping_twdlAddr_raw & '0', 10)); sub_temp_3 := sub_cast_3 - to_signed(16#010#, 10); Radix22TwdlMapping_twdlAddrMap_next <= sub_temp_3(1); WHEN OTHERS => sub_cast := signed(resize(Radix22TwdlMapping_twdlAddr_raw & '0', 10)); sub_temp := to_signed(16#018#, 10) - sub_cast; Radix22TwdlMapping_twdlAddrMap_next <= sub_temp(1); END CASE; IF Radix22TwdlMapping_phase = to_unsigned(16#0#, 2) THEN Radix22TwdlMapping_twdlAddr_raw_next <= to_unsigned(16#0#, 4); ELSIF Radix22TwdlMapping_phase = to_unsigned(16#1#, 2) THEN Radix22TwdlMapping_twdlAddr_raw_next <= resize(Radix22TwdlMapping_cnt, 4) sll 1; ELSIF Radix22TwdlMapping_phase = to_unsigned(16#2#, 2) THEN Radix22TwdlMapping_twdlAddr_raw_next <= resize(Radix22TwdlMapping_cnt, 4); ELSE cnt_cast := resize(Radix22TwdlMapping_cnt, 4); Radix22TwdlMapping_twdlAddr_raw_next <= (cnt_cast sll 1) + cnt_cast; END IF; Radix22TwdlMapping_phase_next <= to_unsigned(16#1#, 2); Radix22TwdlMapping_cnt_next <= Radix22TwdlMapping_cnt + to_unsigned(16#000000010#, 2); twdlAddr <= Radix22TwdlMapping_twdlAddrMap; twdlAddrVld <= Radix22TwdlMapping_dvldReg2; twdlOctant <= Radix22TwdlMapping_octantReg1; twdl45 <= Radix22TwdlMapping_twdl45Reg; END PROCESS Radix22TwdlMapping_output; -- Twiddle ROM1 Twiddle_re_cast <= '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & twdlAddr; twiddleS_re <= Twiddle_re_table_data(to_integer(Twiddle_re_cast)); TWIDDLEROM_RE_process : PROCESS (clk, reset) BEGIN IF reset = '1' THEN twiddleReg_re <= to_signed(16#0000#, 16); ELSIF clk'EVENT AND clk = '1' THEN IF enb_1_16_0 = '1' THEN twiddleReg_re <= twiddleS_re; END IF; END IF; END PROCESS TWIDDLEROM_RE_process; -- Twiddle ROM2 Twiddle_im_cast <= '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & '0' & twdlAddr; twiddleS_im <= Twiddle_im_table_data(to_integer(Twiddle_im_cast)); TWIDDLEROM_IM_process : PROCESS (clk, reset) BEGIN IF reset = '1' THEN twiddleReg_im <= to_signed(16#0000#, 16); ELSIF clk'EVENT AND clk = '1' THEN IF enb_1_16_0 = '1' THEN twiddleReg_im <= twiddleS_im; END IF; END IF; END PROCESS TWIDDLEROM_IM_process; intdelay_process : PROCESS (clk, reset) BEGIN IF reset = '1' THEN twdlOctantReg <= to_unsigned(16#0#, 3); ELSIF clk'EVENT AND clk = '1' THEN IF enb_1_16_0 = '1' THEN twdlOctantReg <= twdlOctant; END IF; END IF; END PROCESS intdelay_process; intdelay_1_process : PROCESS (clk, reset) BEGIN IF reset = '1' THEN twdl45Reg <= '0'; ELSIF clk'EVENT AND clk = '1' THEN IF enb_1_16_0 = '1' THEN twdl45Reg <= twdl45; END IF; END IF; END PROCESS intdelay_1_process; -- Radix22TwdlOctCorr Radix22TwdlOctCorr_output : PROCESS (twiddleReg_re, twiddleReg_im, twdlOctantReg, twdl45Reg) VARIABLE twdlIn_re : signed(15 DOWNTO 0); VARIABLE twdlIn_im : signed(15 DOWNTO 0); VARIABLE cast : signed(16 DOWNTO 0); VARIABLE cast_0 : signed(16 DOWNTO 0); VARIABLE cast_1 : signed(16 DOWNTO 0); VARIABLE cast_2 : signed(16 DOWNTO 0); VARIABLE cast_3 : signed(16 DOWNTO 0); VARIABLE cast_4 : signed(16 DOWNTO 0); VARIABLE cast_5 : signed(16 DOWNTO 0); VARIABLE cast_6 : signed(16 DOWNTO 0); VARIABLE cast_7 : signed(16 DOWNTO 0); VARIABLE cast_8 : signed(16 DOWNTO 0); VARIABLE cast_9 : signed(16 DOWNTO 0); VARIABLE cast_10 : signed(16 DOWNTO 0); BEGIN twdlIn_re := twiddleReg_re; twdlIn_im := twiddleReg_im; IF twdl45Reg = '1' THEN CASE twdlOctantReg IS WHEN "000" => twdlIn_re := to_signed(16#2D41#, 16); twdlIn_im := to_signed(-16#2D41#, 16); WHEN "010" => twdlIn_re := to_signed(-16#2D41#, 16); twdlIn_im := to_signed(-16#2D41#, 16); WHEN "100" => twdlIn_re := to_signed(-16#2D41#, 16); twdlIn_im := to_signed(16#2D41#, 16); WHEN OTHERS => twdlIn_re := to_signed(16#2D41#, 16); twdlIn_im := to_signed(-16#2D41#, 16); END CASE; ELSE CASE twdlOctantReg IS WHEN "000" => NULL; WHEN "001" => cast := resize(twiddleReg_im, 17); cast_0 := - (cast); twdlIn_re := cast_0(15 DOWNTO 0); cast_5 := resize(twiddleReg_re, 17); cast_6 := - (cast_5); twdlIn_im := cast_6(15 DOWNTO 0); WHEN "010" => twdlIn_re := twiddleReg_im; cast_7 := resize(twiddleReg_re, 17); cast_8 := - (cast_7); twdlIn_im := cast_8(15 DOWNTO 0); WHEN "011" => cast_1 := resize(twiddleReg_re, 17); cast_2 := - (cast_1); twdlIn_re := cast_2(15 DOWNTO 0); twdlIn_im := twiddleReg_im; WHEN "100" => cast_3 := resize(twiddleReg_re, 17); cast_4 := - (cast_3); twdlIn_re := cast_4(15 DOWNTO 0); cast_9 := resize(twiddleReg_im, 17); cast_10 := - (cast_9); twdlIn_im := cast_10(15 DOWNTO 0); WHEN OTHERS => twdlIn_re := twiddleReg_im; twdlIn_im := twiddleReg_re; END CASE; END IF; twdl_3_7_re_tmp <= twdlIn_re; twdl_3_7_im_tmp <= twdlIn_im; END PROCESS Radix22TwdlOctCorr_output; twdl_3_7_re <= std_logic_vector(twdl_3_7_re_tmp); twdl_3_7_im <= std_logic_vector(twdl_3_7_im_tmp); intdelay_2_process : PROCESS (clk, reset) BEGIN IF reset = '1' THEN twdl_3_7_vld <= '0'; ELSIF clk'EVENT AND clk = '1' THEN IF enb_1_16_0 = '1' THEN twdl_3_7_vld <= twdlAddrVld; END IF; END IF; END PROCESS intdelay_2_process; END rtl;
------------------------------------------------------------------ -- VHDL PRELUDE -------------------------------------------------- -- combinational module ------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; entity mod_user_And41 IS port (A : in std_logic; B : in std_logic; C : in std_logic; D : in std_logic; vout : out std_logic); end mod_user_And41; architecture struct of mod_user_And41 is -- node declarations signal w1, wire_x0620 : std_logic; begin -- each submodule is wired up here. mod_user_AND2_nagPx : entity work.mod_user_AND2 port map (in1 => A, in2 => B, out1 => w1); mod_user_AND2_LxVDj : entity work.mod_user_AND2 port map (in1 => C, in2 => D, out1 => wire_x0620); mod_user_AND2_7KpMR : entity work.mod_user_AND2 port map (in1 => w1, in2 => wire_x0620, out1 => vout); end struct; -- Combinational testbench. --------------------------------------- library STD; use STD.textio.all; -- basic I/O use STD.env.all; library IEEE; use IEEE.std_logic_1164.all; -- basic logic types use IEEE.std_logic_textio.all; -- I/O for logic types use ieee.numeric_std.all; entity /user/And41 is end entity /user/And41; architecture behaviour of /user/And41 is A, B, C, D, vout: std_logic; begin dut : entity work.mod_user_And41 port map (A => A, B => B, C => C, D => D, vout => vout); process begin ------------------------------------------------------- A <= '1'; B <= '1'; C <= '1'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 1"; report "expecting: vout = '1'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 1: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '1'; C <= '1'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 2"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 2: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '1'; C <= '0'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 3"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 3: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '1'; C <= '0'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 4"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 4: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '0'; C <= '1'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 5"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 5: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '0'; C <= '1'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 6"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 6: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '0'; C <= '0'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 7"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 7: PASSED" & LF); end if; wait for 1.0 ns; A <= '1'; B <= '0'; C <= '0'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 8"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 8: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '1'; C <= '1'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 9"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 9: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '1'; C <= '1'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 10"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 10: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '1'; C <= '0'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 11"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 11: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '1'; C <= '0'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 12"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 12: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '0'; C <= '1'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 13"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 13: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '0'; C <= '1'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 14"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 14: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '0'; C <= '0'; D <= '1'; wait for 99.0 ns; if vout /= '0' then report "" report "TestNum 15"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 15: PASSED" & LF); end if; wait for 1.0 ns; A <= '0'; B <= '0'; C <= '0'; D <= '0'; wait for 99.0 ns; if vout /= '0' then report "// This comment is included in vhdl test cases." report "TestNum 16"; report "expecting: vout = '0'"; report "got : vout = " & to_string(vout); stop(-1); else write(OUTPUT, "TEST 16: PASSED" & LF); end if; wait for 1.0 ns; finish(0); end process; end behavior;
-- Copyright (C) 1991-2011 Altera Corporation -- Your use of Altera Corporation's design tools, logic functions -- and other software and tools, and its AMPP partner logic -- functions, and any output files from any of the foregoing -- (including device programming or simulation files), and any -- associated documentation or information are expressly subject -- to the terms and conditions of the Altera Program License -- Subscription Agreement, Altera MegaCore Function License -- Agreement, or other applicable license agreement, including, -- without limitation, that your use is for the sole purpose of -- programming logic devices manufactured by Altera and sold by -- Altera or its authorized distributors. Please refer to the -- applicable agreement for further details. -- Quartus II 11.0 Build 157 04/27/2011 ---------------------------------------------------------------------------- -- ALtera Primitives Component Declaration File ---------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.VITAL_Timing.all; use IEEE.VITAL_Primitives.all; package dffeas_pack is -- default generic values CONSTANT DefWireDelay : VitalDelayType01 := (0 ns, 0 ns); CONSTANT DefPropDelay01 : VitalDelayType01 := (0 ns, 0 ns); CONSTANT DefPropDelay01Z : VitalDelayType01Z := (OTHERS => 0 ns); CONSTANT DefSetupHoldCnst : TIME := 0 ns; CONSTANT DefPulseWdthCnst : TIME := 0 ns; CONSTANT DefGlitchMode : VitalGlitchKindType := VitalTransport; CONSTANT DefGlitchMsgOn : BOOLEAN := FALSE; CONSTANT DefGlitchXOn : BOOLEAN := FALSE; CONSTANT DefMsgOnChecks : BOOLEAN := TRUE; CONSTANT DefXOnChecks : BOOLEAN := TRUE; end dffeas_pack; library ieee; use ieee.std_logic_1164.all; use IEEE.VITAL_Timing.all; use work.dffeas_pack.all; package altera_primitives_components is component carry port ( a_in : in std_logic; a_out : out std_logic ); end component; component cascade port ( a_in : in std_logic; a_out : out std_logic ); end component; component global port ( a_in : in std_logic; a_out : out std_logic); end component; component tri port( a_in : in std_logic; oe : in std_logic; a_out : out std_logic); end component; component carry_sum port ( sin : in std_logic; cin : in std_logic; sout : out std_logic; cout : out std_logic ); end component; component exp port ( a_in : in std_logic; a_out : out std_logic); end component; component soft port ( a_in : in std_logic; a_out : out std_logic ); end component; component opndrn port ( a_in : in std_logic; a_out : out std_logic ); end component; component row_global port ( a_in : in std_logic; a_out : out std_logic ); end component; component lut_input port( a_in : in std_logic; a_out : out std_logic); end component; component lut_output port( a_in : in std_logic; a_out : out std_logic); end component; component dlatch port( d : in std_logic; ena : in std_logic; clrn : in std_logic; prn : in std_logic; q : out std_logic); end component; component latch port( d : in std_logic; ena : in std_logic; q : out std_logic); end component; component dff port( d, clk, clrn, prn : in std_logic; q : out std_logic); end component; component dffe port( d, clk, ena, clrn, prn : in std_logic; q : out std_logic); end component; component dffea port( d, clk, ena, clrn, prn, aload, adata : in std_logic; q : out std_logic); end component; component dffeas generic ( power_up : string := "DONT_CARE"; is_wysiwyg : string := "false"; x_on_violation : string := "on"; lpm_type : string := "DFFEAS"; tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst; tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01; tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01; tpd_asdata_q: VitalDelayType01 := DefPropDelay01; tipd_clk : VitalDelayType01 := DefPropDelay01; tipd_d : VitalDelayType01 := DefPropDelay01; tipd_asdata : VitalDelayType01 := DefPropDelay01; tipd_sclr : VitalDelayType01 := DefPropDelay01; tipd_sload : VitalDelayType01 := DefPropDelay01; tipd_clrn : VitalDelayType01 := DefPropDelay01; tipd_prn : VitalDelayType01 := DefPropDelay01; tipd_aload : VitalDelayType01 := DefPropDelay01; tipd_ena : VitalDelayType01 := DefPropDelay01; TimingChecksOn: Boolean := True; MsgOn: Boolean := DefGlitchMsgOn; XOn: Boolean := DefGlitchXOn; MsgOnChecks: Boolean := DefMsgOnChecks; XOnChecks: Boolean := DefXOnChecks; InstancePath: STRING := "*" ); port ( d : in std_logic := '0'; clk : in std_logic := '0'; ena : in std_logic := '1'; clrn : in std_logic := '1'; prn : in std_logic := '1'; aload : in std_logic := '0'; asdata : in std_logic := '1'; sclr : in std_logic := '0'; sload : in std_logic := '0'; devclrn : in std_logic := '1'; devpor : in std_logic := '1'; q : out std_logic ); end component; component tff port( t, clk, clrn, prn : in std_logic; q : out std_logic); end component; component tffe port( t, clk, ena, clrn, prn : in std_logic; q : out std_logic); end component; component jkff port( j, k, clk, clrn, prn : in std_logic; q : out std_logic); end component; component jkffe port( j, k, clk, ena, clrn, prn : in std_logic; q : out std_logic); end component; component srff port( s, r, clk, clrn, prn : in std_logic; q : out std_logic); end component; component srffe port( s, r, clk, ena, clrn, prn : in std_logic; q : out std_logic); end component; component clklock generic( input_frequency : natural := 10000; clockboost : natural := 1); port( inclk : in std_logic; outclk : out std_logic); end component; component alt_inbuf generic( io_standard : string := "NONE"; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; lpm_type : string := "alt_inbuf" ); port( i : in std_logic; o : out std_logic); end component; component alt_outbuf generic( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; slow_slew_rate : string := "NONE"; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; lpm_type : string := "alt_outbuf" ); port( i : in std_logic; o : out std_logic); end component; component alt_outbuf_tri generic( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; slow_slew_rate : string := "NONE"; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; lpm_type : string := "alt_outbuf_tri" ); port( i : in std_logic; oe : in std_logic; o : out std_logic); end component; component alt_iobuf generic( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; slow_slew_rate : string := "NONE"; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; input_termination : string := "NONE"; output_termination : string := "NONE"; lpm_type : string := "alt_iobuf" ); port( i : in std_logic; oe : in std_logic; io : inout std_logic; o : out std_logic); end component; component alt_inbuf_diff generic( io_standard : string := "NONE"; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; lpm_type : string := "alt_inbuf_diff" ); port( i : in std_logic; ibar : in std_logic; o : out std_logic); end component; component alt_outbuf_diff generic ( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; lpm_type : string := "alt_outbuf_diff" ); port( i : in std_logic; o : out std_logic; obar : out std_logic ); end component; component alt_outbuf_tri_diff generic ( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; lpm_type : string := "alt_outbuf_tri_diff" ); port( i : in std_logic; oe : in std_logic; o : out std_logic; obar : out std_logic ); end component; component alt_iobuf_diff generic ( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; input_termination : string := "NONE"; output_termination : string := "NONE"; lpm_type : string := "alt_iobuf_diff" ); port( i : in std_logic; oe : in std_logic; io : inout std_logic; iobar : inout std_logic; o : out std_logic ); end component; component alt_bidir_diff generic ( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; input_termination : string := "NONE"; output_termination : string := "NONE"; lpm_type : string := "alt_bidir_diff" ); port( oe : in std_logic; bidirin : inout std_logic; io : inout std_logic; iobar : inout std_logic ); end component; component alt_bidir_buf generic ( io_standard : string := "NONE"; current_strength : string := "NONE"; current_strength_new : string := "NONE"; slew_rate : integer := -1; location : string := "NONE"; enable_bus_hold : string := "NONE"; weak_pull_up_resistor : string := "NONE"; termination : string := "NONE"; input_termination : string := "NONE"; output_termination : string := "NONE"; lpm_type : string := "alt_bidir_buf" ); port( oe : in std_logic; bidirin : inout std_logic; io : inout std_logic ); end component; end altera_primitives_components;
-------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 12:47:05 06/16/2015 -- Design Name: -- Module Name: C:/project10/CU_tb.vhd -- Project Name: project10 -- Target Device: -- Tool versions: -- Description: -- -- VHDL Test Bench Created by ISE for module: CU -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- -- Notes: -- This testbench has been automatically generated using types std_logic and -- std_logic_vector for the ports of the unit under test. Xilinx recommends -- that these types always be used for the top-level I/O of a design in order -- to guarantee that the testbench will bind correctly to the post-implementation -- simulation model. -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL; ENTITY CU_tb IS END CU_tb; ARCHITECTURE behavior OF CU_tb IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT CU PORT( clk : IN std_logic; op_code : IN std_logic_vector(4 downto 0); ctrl_signal : OUT std_logic_vector(17 downto 0) ); END COMPONENT; --Inputs signal clk : std_logic := '0'; signal op_code : std_logic_vector(4 downto 0) := (others => '0'); --Outputs signal ctrl_signal : std_logic_vector(17 downto 0); -- Clock period definitions constant clk_period : time := 10 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: CU PORT MAP ( clk => clk, op_code => op_code, ctrl_signal => ctrl_signal ); -- Clock process definitions clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process begin op_code<="00000"; wait for 40 ns; op_code<="00010"; wait for 40 ns; op_code<="00011"; wait for 40 ns; op_code<="00100"; wait for 40 ns; op_code<="00101"; wait for 40 ns; op_code<="00110"; wait for 40 ns; op_code<="00111"; wait for 60 ns; op_code<="01001"; wait for 60 ns; op_code<="01011"; wait for 60 ns; op_code<="01101"; wait for 40 ns; op_code<="01111"; wait for 40 ns; op_code<="00000"; -- insert stimulus here wait; end process; END;
-- Copyright (C) 2002 Morgan Kaufmann Publishers, Inc -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- not in book library ieee; use ieee.std_logic_1164.all; entity control_section is end entity control_section; -- end not in book architecture structural of control_section is component reg is generic ( width : positive ); port ( clk : in std_logic; d : in std_logic_vector(0 to width - 1); q : out std_logic_vector(0 to width - 1) ); end component reg; for flag_reg : reg use entity work.reg(gate_level) port map ( clock => clk, data_in => d, data_out => q ); -- . . . -- not in book signal clock_phase1, zero_result, neg_result, overflow_result, zero_flag, neg_flag, overflow_flag : std_logic; -- end not in book begin flag_reg : component reg generic map ( width => 3 ) port map ( clk => clock_phase1, d(0) => zero_result, d(1) => neg_result, d(2) => overflow_result, q(0) => zero_flag, q(1) => neg_flag, q(2) => overflow_flag ); -- . . . -- not in book stimulus : process is begin clock_phase1 <= '0'; zero_result <= '0'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; wait; end process stimulus; -- end not in book end architecture structural;
-- Copyright (C) 2002 Morgan Kaufmann Publishers, Inc -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- not in book library ieee; use ieee.std_logic_1164.all; entity control_section is end entity control_section; -- end not in book architecture structural of control_section is component reg is generic ( width : positive ); port ( clk : in std_logic; d : in std_logic_vector(0 to width - 1); q : out std_logic_vector(0 to width - 1) ); end component reg; for flag_reg : reg use entity work.reg(gate_level) port map ( clock => clk, data_in => d, data_out => q ); -- . . . -- not in book signal clock_phase1, zero_result, neg_result, overflow_result, zero_flag, neg_flag, overflow_flag : std_logic; -- end not in book begin flag_reg : component reg generic map ( width => 3 ) port map ( clk => clock_phase1, d(0) => zero_result, d(1) => neg_result, d(2) => overflow_result, q(0) => zero_flag, q(1) => neg_flag, q(2) => overflow_flag ); -- . . . -- not in book stimulus : process is begin clock_phase1 <= '0'; zero_result <= '0'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; wait; end process stimulus; -- end not in book end architecture structural;
-- Copyright (C) 2002 Morgan Kaufmann Publishers, Inc -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- not in book library ieee; use ieee.std_logic_1164.all; entity control_section is end entity control_section; -- end not in book architecture structural of control_section is component reg is generic ( width : positive ); port ( clk : in std_logic; d : in std_logic_vector(0 to width - 1); q : out std_logic_vector(0 to width - 1) ); end component reg; for flag_reg : reg use entity work.reg(gate_level) port map ( clock => clk, data_in => d, data_out => q ); -- . . . -- not in book signal clock_phase1, zero_result, neg_result, overflow_result, zero_flag, neg_flag, overflow_flag : std_logic; -- end not in book begin flag_reg : component reg generic map ( width => 3 ) port map ( clk => clock_phase1, d(0) => zero_result, d(1) => neg_result, d(2) => overflow_result, q(0) => zero_flag, q(1) => neg_flag, q(2) => overflow_flag ); -- . . . -- not in book stimulus : process is begin clock_phase1 <= '0'; zero_result <= '0'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '0'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; zero_result <= '1'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns; clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns; wait; end process stimulus; -- end not in book end architecture structural;
package body gen2 is use pkg.all; function get2 return natural is begin return get; end get2; end gen2;
package body gen2 is use pkg.all; function get2 return natural is begin return get; end get2; end gen2;
------------------------------------------------------------------------------ ---- ---- ---- ZPU Medium ---- ---- ---- ---- http://www.opencores.org/ ---- ---- ---- ---- Description: ---- ---- ZPU is a 32 bits small stack cpu. This is the medium size version. ---- ---- Supports external memories. ---- ---- Modified to support the interrupt line. ---- ---- ---- ---- To Do: ---- ---- - ---- ---- ---- ---- Author: ---- ---- - Øyvind Harboe, oyvind.harboe zylin.com ---- ---- - Salvador E. Tropea, salvador inti.gob.ar ---- ---- - Koen Martens, gmc sonologic.nl ---- ---- ---- ------------------------------------------------------------------------------ ---- ---- ---- Copyright (c) 2008 Øyvind Harboe <oyvind.harboe zylin.com> ---- ---- Copyright (c) 2008 Salvador E. Tropea <salvador inti.gob.ar> ---- ---- Copyright (c) 2008 Instituto Nacional de Tecnología Industrial ---- ---- ---- ---- Distributed under the BSD license ---- ---- ---- ------------------------------------------------------------------------------ ---- ---- ---- Design unit: ZPUMediumCore(Behave) (Entity and architecture) ---- ---- File name: zpu_medium.vhdl ---- ---- Note: None ---- ---- Limitations: None known ---- ---- Errors: None known ---- ---- Library: zpu ---- ---- Dependencies: IEEE.std_logic_1164 ---- ---- IEEE.numeric_std ---- ---- zpu.zpupkg ---- ---- Target FPGA: Spartan 3 (XC3S400-4-FT256) ---- ---- Language: VHDL ---- ---- Wishbone: No ---- ---- Synthesis tools: Xilinx Release 9.2.03i - xst J.39 ---- ---- Simulation tools: GHDL [Sokcho edition] (0.2x) ---- ---- Text editor: SETEdit 0.5.x ---- ---- ---- ------------------------------------------------------------------------------ -- -- write_en_o - set to '1' for a single cycle to send off a write request. -- data_o is valid only while write_en_o='1'. -- read_en_o - set to '1' for a single cycle to send off a read request. -- mem_busy_i - It is illegal to send off a read/write request when -- mem_busy_i='1'. -- Set to '0' when data_i is valid after a read request. -- If it goes to '1'(busy), it is on the cycle after read/ -- write_en_o is '1'. -- addr_o - address for read/write request -- data_i - read data. Valid only on the cycle after mem_busy_i='0' -- after read_en_o='1' for a single cycle. -- data_o - data to write -- break_o - set to '1' when CPU hits break instruction library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library zpu; use zpu.zpupkg.all; entity ZPUMediumCore is generic( WORD_SIZE : integer:=32; -- 16/32 (2**wordPower) ADDR_W : integer:=16; -- Total address space width (incl. I/O) MEM_W : integer:=15; -- Memory (prog+data+stack) width D_CARE_VAL : std_logic:='X'; -- Value used to fill the unsused bits MULT_PIPE : boolean:=false; -- Pipeline multiplication BINOP_PIPE : integer range 0 to 2:=0; -- Pipeline binary operations (-, =, < and <=) ENA_LEVEL0 : boolean:=true; -- eq, loadb, neqbranch and pushspadd ENA_LEVEL1 : boolean:=true; -- lessthan, ulessthan, mult, storeb, callpcrel and sub ENA_LEVEL2 : boolean:=false; -- lessthanorequal, ulessthanorequal, call and poppcrel ENA_LSHR : boolean:=true; -- lshiftright ENA_IDLE : boolean:=false; -- Enable the enable_i input FAST_FETCH : boolean:=true); -- Merge the st_fetch with the st_execute states port( clk_i : in std_logic; -- CPU Clock reset_i : in std_logic; -- Sync Reset interrupt_i : in std_logic; -- Interrupt enable_i : in std_logic; -- Hold the CPU (after reset) break_o : out std_logic; -- Break instruction executed dbg_o : out zpu_dbgo_t; -- Debug outputs (i.e. trace log) -- Memory interface mem_busy_i : in std_logic; -- Memory is busy data_i : in unsigned(WORD_SIZE-1 downto 0); -- Data from mem data_o : out unsigned(WORD_SIZE-1 downto 0); -- Data to mem addr_o : out unsigned(ADDR_W-1 downto 0); -- Memory address write_en_o : out std_logic; -- Memory write enable read_en_o : out std_logic); -- Memory read enable end entity ZPUMediumCore; architecture Behave of ZPUMediumCore is constant BYTE_BITS : integer:=WORD_SIZE/16; -- # of bits in a word that addresses bytes constant WORD_BYTES : integer:=WORD_SIZE/OPCODE_W; constant MAX_ADDR_BIT : integer:=ADDR_W-2; -- Stack Pointer initial value: BRAM size-8 constant SP_START_1 : unsigned(ADDR_W-1 downto 0):=to_unsigned((2**MEM_W)-8,ADDR_W); constant SP_START : unsigned(ADDR_W-1 downto BYTE_BITS):= SP_START_1(ADDR_W-1 downto BYTE_BITS); -- Update [SP+1]. We hold it in b_r, this writes the value to memory. procedure FlushB(signal we : out std_logic; signal addr : out unsigned(ADDR_W-1 downto BYTE_BITS); signal inc_sp : in unsigned(ADDR_W-1 downto BYTE_BITS); signal data : out unsigned(WORD_SIZE-1 downto 0); signal b : in unsigned(WORD_SIZE-1 downto 0)) is begin we <= '1'; addr <= inc_sp; data <= b; end procedure FlushB; -- Do a simple stack push, it is performed in the internal cache registers, -- not in the real memory. procedure Push(signal sp : inout unsigned(ADDR_W-1 downto BYTE_BITS); signal a : in unsigned(WORD_SIZE-1 downto 0); signal b : out unsigned(WORD_SIZE-1 downto 0)) is begin b <= a; -- Update cache [SP+1]=[SP] sp <= sp-1; end procedure Push; -- Do a simple stack pop, it is performed in the internal cache registers, -- not in the real memory. procedure Pop(signal sp : inout unsigned(ADDR_W-1 downto BYTE_BITS); signal a : out unsigned(WORD_SIZE-1 downto 0); signal b : in unsigned(WORD_SIZE-1 downto 0)) is begin a <= b; -- Update cache [SP]=[SP+1] sp <= sp+1; end procedure Pop; -- Expand a PC value to WORD_SIZE function ExpandPC(v : unsigned(ADDR_W-1 downto 0)) return unsigned is variable nv : unsigned(WORD_SIZE-1 downto 0); begin nv:=(others => '0'); nv(ADDR_W-1 downto 0):=v; return nv; end function ExpandPC; -- Program counter signal pc_r : unsigned(ADDR_W-1 downto 0):=(others => '0'); -- Stack pointer signal sp_r : unsigned(ADDR_W-1 downto BYTE_BITS):=SP_START; -- SP+1, SP+2 and SP-1 are very used, these are shortcuts signal inc_sp : unsigned(ADDR_W-1 downto BYTE_BITS); signal inc_inc_sp : unsigned(ADDR_W-1 downto BYTE_BITS); -- a_r is a cache for the top of the stack [SP] -- Note: as this is a stack CPU this is a very important register. signal a_r : unsigned(WORD_SIZE-1 downto 0); -- b_r is a cache for the next value in the stack [SP+1] signal b_r : unsigned(WORD_SIZE-1 downto 0); signal bin_op_res1_r : unsigned(WORD_SIZE-1 downto 0):=(others => '0'); signal bin_op_res2_r : unsigned(WORD_SIZE-1 downto 0):=(others => '0'); signal mult_res1_r : unsigned(WORD_SIZE-1 downto 0); signal mult_res2_r : unsigned(WORD_SIZE-1 downto 0); signal mult_res3_r : unsigned(WORD_SIZE-1 downto 0); signal mult_a_r : unsigned(WORD_SIZE-1 downto 0):=(others => '0'); signal mult_b_r : unsigned(WORD_SIZE-1 downto 0):=(others => '0'); signal idim_r : std_logic; signal write_en_r : std_logic; signal read_en_r : std_logic; signal addr_r : unsigned(ADDR_W-1 downto BYTE_BITS):=(others => '0'); signal fetched_w_r : unsigned(WORD_SIZE-1 downto 0); -- IRQ flag signal in_irq_r : std_logic:='0'; type state_t is(st_load2, st_popped, st_load_sp2, st_load_sp3, st_add_sp2, st_fetch, st_execute, st_decode, st_decode2, st_resync, st_store_sp2, st_resync2, st_resync3, st_loadb2, st_storeb2, st_mult2, st_mult3, st_mult5, st_mult4, st_binary_op_res2, st_binary_op_res, st_idle); signal state : state_t:=st_resync; -- Go to st_fetch state or just do its work procedure DoFetch(constant FAST : boolean; signal state : out state_t; signal addr : out unsigned(ADDR_W-1 downto BYTE_BITS); signal pc : in unsigned(ADDR_W-1 downto 0); signal re : out std_logic; signal busy : in std_logic) is begin if FAST then -- Equivalent to st_fetch if busy='0' then addr <= pc(ADDR_W-1 downto BYTE_BITS); re <= '1'; state <= st_decode; end if; else state <= st_fetch; end if; end procedure DoFetch; -- Perform a "binary operation" (2 operands) procedure DoBinOp(result : in unsigned(WORD_SIZE-1 downto 0); signal state : out state_t; signal sp : inout unsigned(ADDR_W-1 downto BYTE_BITS); signal addr : out unsigned(ADDR_W-1 downto BYTE_BITS); signal re : out std_logic; signal dest : out unsigned(WORD_SIZE-1 downto 0); signal dest_p : out unsigned(WORD_SIZE-1 downto 0); constant DEPTH : natural) is begin if DEPTH=2 then -- 2 clocks: st_binary_op_res+st_binary_op_res2 state <= st_binary_op_res; dest_p <= result; elsif DEPTH=1 then -- 1 clock: st_binary_op_res2 state <= st_binary_op_res2; dest_p <= result; else -- 0 clocks re <= '1'; addr <= sp+2; sp <= sp+1; dest <= result; state <= st_popped; end if; end procedure DoBinOp; -- Perform a boolean "binary operation" (2 operands) procedure DoBinOpBool(result : in boolean; signal state : out state_t; signal sp : inout unsigned(ADDR_W-1 downto BYTE_BITS); signal addr : out unsigned(ADDR_W-1 downto BYTE_BITS); signal re : out std_logic; signal dest : out unsigned(WORD_SIZE-1 downto 0); signal dest_p : out unsigned(WORD_SIZE-1 downto 0); constant DEPTH : natural) is variable res : unsigned(WORD_SIZE-1 downto 0):=(others => '0'); begin if result then res(0):='1'; end if; DoBinOp(res,state,sp,addr,re,dest,dest_p,DEPTH); end procedure DoBinOpBool; type insn_t is (dec_add_top, dec_dup, dec_dup_stk_b, dec_pop, dec_add, dec_or, dec_and, dec_store, dec_add_sp, dec_shift, dec_nop, dec_im, dec_load_sp, dec_store_sp, dec_emulate, dec_load, dec_push_sp, dec_pop_pc, dec_pop_pc_rel, dec_not, dec_flip, dec_pop_sp, dec_neq_branch, dec_eq, dec_loadb, dec_mult, dec_less_than, dec_less_than_or_equal, dec_lshr, dec_u_less_than_or_equal, dec_u_less_than, dec_push_sp_add, dec_call, dec_call_pc_rel, dec_sub, dec_break, dec_storeb, dec_insn_fetch, dec_pop_down, dec_interrupt); signal insn : insn_t; type insn_array_t is array(0 to WORD_BYTES-1) of insn_t; signal insns : insn_array_t; type opcode_array_t is array(0 to WORD_BYTES-1) of unsigned(OPCODE_W-1 downto 0); signal opcode_r : opcode_array_t; begin -- the memory subsystem will tell us one cycle later whether or -- not it is busy write_en_o <= write_en_r; read_en_o <= read_en_r; addr_o(ADDR_W-1 downto BYTE_BITS) <= addr_r; addr_o(BYTE_BITS-1 downto 0) <= (others => '0'); -- SP+1 and +2 inc_sp <= sp_r+1; inc_inc_sp <= sp_r+2; opcode_control: process (clk_i) variable topcode : unsigned(OPCODE_W-1 downto 0); variable ex_opcode : unsigned(OPCODE_W-1 downto 0); variable sp_offset : unsigned(4 downto 0); variable tsp_offset : unsigned(4 downto 0); variable next_pc : unsigned(ADDR_W-1 downto 0); variable tdecoded : insn_t; variable tinsns : insn_array_t; variable mult_res : unsigned(WORD_SIZE*2-1 downto 0); variable ipc_low : integer range 0 to 3; -- Address inside a word (pc_r) variable inpc_low : integer range 0 to 3; -- Address inside a word (next_pc) variable h_bit : integer; variable l_bit : integer; variable not_lshr : std_logic:='1'; begin if rising_edge(clk_i) then break_o <= '0'; if reset_i='1' then if ENA_IDLE then state <= st_idle; else state <= st_resync; end if; sp_r <= SP_START; pc_r <= (others => '0'); idim_r <= '0'; in_irq_r <= '0'; write_en_r <= '0'; read_en_r <= '0'; mult_a_r <= (others => '0'); mult_b_r <= (others => '0'); dbg_o.b_inst <= '0'; -- Reseting add_r here makes XST fail to use BRAMs ?! else -- reset_i='1' if MULT_PIPE then -- We must multiply unconditionally to get pipelined multiplication mult_res:=mult_a_r*mult_b_r; mult_res1_r <= mult_res(WORD_SIZE-1 downto 0); mult_res2_r <= mult_res1_r; mult_res3_r <= mult_res2_r; mult_a_r <= (others => D_CARE_VAL); mult_b_r <= (others => D_CARE_VAL); end if; if BINOP_PIPE=2 then bin_op_res2_r <= bin_op_res1_r; -- pipeline a bit. end if; read_en_r <='0'; write_en_r <='0'; -- Allow synthesis tools to load bogus values when we don't -- care about the address and output data. addr_r <= (others => D_CARE_VAL); data_o <= (others => D_CARE_VAL); if (write_en_r='1') and (read_en_r='1') then report "read/write collision" severity failure; end if; ipc_low:=to_integer(pc_r(BYTE_BITS-1 downto 0)); sp_offset(4):=not opcode_r(ipc_low)(4); sp_offset(3 downto 0):=opcode_r(ipc_low)(3 downto 0); next_pc:=pc_r+1; if interrupt_i='0' then in_irq_r <= '0'; -- nolonger in an interrupt end if; -- Prepare trace snapshot dbg_o.opcode <= opcode_r(ipc_low); dbg_o.pc <= resize(pc_r,32); dbg_o.stk_a <= resize(a_r,32); dbg_o.stk_b <= resize(b_r,32); dbg_o.b_inst <= '0'; dbg_o.sp <= (others => '0'); dbg_o.sp(ADDR_W-1 downto BYTE_BITS) <= sp_r; case state is when st_idle => if enable_i='1' then state <= st_resync; end if; -- Initial state of ZPU, fetch top of stack (A/B) + first instruction when st_resync => if mem_busy_i='0' then addr_r <= sp_r; read_en_r <= '1'; state <= st_resync2; end if; when st_resync2 => if mem_busy_i='0' then a_r <= data_i; addr_r <= inc_sp; read_en_r <= '1'; state <= st_resync3; end if; when st_resync3 => if mem_busy_i='0' then b_r <= data_i; addr_r <= pc_r(ADDR_W-1 downto BYTE_BITS); read_en_r <= '1'; state <= st_decode; end if; when st_decode => if mem_busy_i='0' then -- Here we latch the fetched word to give one full clock -- cycle to the instruction decoder. This could be removed -- if using BRAMs and the decoder delay isn't important. fetched_w_r <= data_i; state <= st_decode2; end if; when st_decode2 => if interrupt_i='1' and in_irq_r='0' then -- if interrupt asserted, execute interrupt tinsns(0):=dec_interrupt; tinsns(1):=dec_interrupt; tinsns(2):=dec_interrupt; tinsns(3):=dec_interrupt; insn <= tinsns(ipc_low); -- once we wrap, we need to fetch -- tinsns(0):=dec_insn_fetch; insns <= tinsns; state <= st_execute; in_irq_r <= '1'; else -- decode 4 instructions in parallel for i in 0 to WORD_BYTES-1 loop topcode:=fetched_w_r((WORD_BYTES-1-i+1)*8-1 downto (WORD_BYTES-1-i)*8); tsp_offset(4):=not topcode(4); tsp_offset(3 downto 0):=topcode(3 downto 0); opcode_r(i) <= topcode; if topcode(7 downto 7)=OPCODE_IM then tdecoded:=dec_im; elsif topcode(7 downto 5)=OPCODE_STORESP then if tsp_offset=0 then -- Special case, we can avoid a write tdecoded:=dec_pop; elsif tsp_offset=1 then -- Special case, collision tdecoded:=dec_pop_down; else tdecoded:=dec_store_sp; end if; elsif topcode(7 downto 5)=OPCODE_LOADSP then if tsp_offset=0 then tdecoded:=dec_dup; elsif tsp_offset=1 then tdecoded:=dec_dup_stk_b; else tdecoded:=dec_load_sp; end if; elsif topcode(7 downto 5)=OPCODE_EMULATE then tdecoded:=dec_emulate; if ENA_LEVEL0 and topcode(5 downto 0)=OPCODE_NEQBRANCH then tdecoded:=dec_neq_branch; elsif ENA_LEVEL0 and topcode(5 downto 0)=OPCODE_EQ then tdecoded:=dec_eq; elsif ENA_LEVEL0 and topcode(5 downto 0)=OPCODE_LOADB then tdecoded:=dec_loadb; elsif ENA_LEVEL0 and topcode(5 downto 0)=OPCODE_PUSHSPADD then tdecoded:=dec_push_sp_add; elsif ENA_LEVEL1 and topcode(5 downto 0)=OPCODE_LESSTHAN then tdecoded:=dec_less_than; elsif ENA_LEVEL1 and topcode(5 downto 0)=OPCODE_ULESSTHAN then tdecoded:=dec_u_less_than; elsif ENA_LEVEL1 and topcode(5 downto 0)=OPCODE_MULT then tdecoded:=dec_mult; elsif ENA_LEVEL1 and topcode(5 downto 0)=OPCODE_STOREB then tdecoded:=dec_storeb; elsif ENA_LEVEL1 and topcode(5 downto 0)=OPCODE_CALLPCREL then tdecoded:=dec_call_pc_rel; elsif ENA_LEVEL1 and topcode(5 downto 0)=OPCODE_SUB then tdecoded:=dec_sub; elsif ENA_LEVEL2 and topcode(5 downto 0)=OPCODE_LESSTHANOREQUAL then tdecoded:=dec_less_than_or_equal; elsif ENA_LEVEL2 and topcode(5 downto 0)=OPCODE_ULESSTHANOREQUAL then tdecoded:=dec_u_less_than_or_equal; elsif ENA_LEVEL2 and topcode(5 downto 0)=OPCODE_CALL then tdecoded:=dec_call; elsif ENA_LEVEL2 and topcode(5 downto 0)=OPCODE_POPPCREL then tdecoded:=dec_pop_pc_rel; elsif ENA_LSHR and topcode(5 downto 0)=OPCODE_LSHIFTRIGHT then tdecoded:=dec_lshr; end if; elsif topcode(7 downto 4)=OPCODE_ADDSP then if tsp_offset=0 then tdecoded:=dec_shift; elsif tsp_offset=1 then tdecoded:=dec_add_top; else tdecoded:=dec_add_sp; end if; else -- OPCODE_SHORT case topcode(3 downto 0) is when OPCODE_BREAK => tdecoded:=dec_break; when OPCODE_PUSHSP => tdecoded:=dec_push_sp; when OPCODE_POPPC => tdecoded:=dec_pop_pc; when OPCODE_ADD => tdecoded:=dec_add; when OPCODE_OR => tdecoded:=dec_or; when OPCODE_AND => tdecoded:=dec_and; when OPCODE_LOAD => tdecoded:=dec_load; when OPCODE_NOT => tdecoded:=dec_not; when OPCODE_FLIP => tdecoded:=dec_flip; when OPCODE_STORE => tdecoded:=dec_store; when OPCODE_POPSP => tdecoded:=dec_pop_sp; when others => -- OPCODE_NOP and others tdecoded:=dec_nop; end case; end if; tinsns(i):=tdecoded; end loop; insn <= tinsns(ipc_low); -- once we wrap, we need to fetch tinsns(0):=dec_insn_fetch; insns <= tinsns; state <= st_execute; end if; -- Each instruction must: -- -- 1. increase pc_r if applicable -- 2. set next state if applicable -- 3. do it's operation when st_execute => -- Some shortcut to make the code readable: inpc_low:=to_integer(next_pc(BYTE_BITS-1 downto 0)); ex_opcode:=opcode_r(ipc_low); insn <= insns(inpc_low); -- Defaults used by most instructions if insn/=dec_insn_fetch and insn/=dec_im then dbg_o.b_inst <= '1'; idim_r <= '0'; end if; case insn is when dec_interrupt => -- Not a real instruction, interrupt -- Push(PC); PC=32 -- sp_r <= sp_r-1; -- a_addr_r <= sp_r-1; -- a_we_r <= '1'; FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); a_r <= (others => D_CARE_VAL); a_r(ADDR_W-1 downto 0) <= pc_r; Push(sp_r,a_r,b_r); pc_r <= to_unsigned(32,ADDR_W); -- interrupt address report "ZPU jumped to interrupt!" severity note; -- TODO: force fetch insn <= dec_insn_fetch; when dec_insn_fetch => -- Not a real instruction, fetch new instructions DoFetch(FAST_FETCH,state,addr_r,pc_r,read_en_r,mem_busy_i); when dec_im => -- Push(immediate value), IDIM=1 -- if IDIM=0 Push(signed(opcode & 0x7F)) else -- Push((Pop()<<7)|(opcode&0x7F)) if mem_busy_i='0' then dbg_o.b_inst <= '1'; idim_r <= '1'; pc_r <= pc_r+1; if idim_r='1' then -- We already started an IM sequence -- Shift left 7 bits a_r(WORD_SIZE-1 downto 7) <= a_r(WORD_SIZE-8 downto 0); -- Put the new value a_r(6 downto 0) <= ex_opcode(6 downto 0); else -- First IM, push the value sign extended FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); a_r <= unsigned(resize(signed(ex_opcode(6 downto 0)),WORD_SIZE)); Push(sp_r,a_r,b_r); end if; end if; when dec_store_sp => -- [SP+Offset]=Pop() if mem_busy_i='0' then write_en_r <= '1'; addr_r <= sp_r+sp_offset; data_o <= a_r; Pop(sp_r,a_r,b_r); -- We need to fetch B state <= st_store_sp2; end if; when dec_load_sp => -- Push([SP+Offset]) if mem_busy_i='0' then FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); Push(sp_r,a_r,b_r); -- We are flushing B cache, so we need more time to -- read the value. state <= st_load_sp2; end if; when dec_emulate => -- Push(PC+1), PC=Opcode[4:0]*32 if mem_busy_i='0' then FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); state <= st_fetch; a_r <= ExpandPC(pc_r+1); Push(sp_r,a_r,b_r); -- The emulate address is: -- 98 7654 3210 -- 0000 00aa aaa0 0000 pc_r <= (others => '0'); pc_r(9 downto 5) <= ex_opcode(4 downto 0); end if; when dec_call_pc_rel => -- t=Pop(), Push(PC+1), PC=PC+t if mem_busy_i='0' and ENA_LEVEL1 then state <= st_fetch; a_r <= ExpandPC(pc_r+1); pc_r <= pc_r+a_r(ADDR_W-1 downto 0); end if; when dec_call => -- t=Pop(), Push(PC+1), PC=t if mem_busy_i='0' and ENA_LEVEL2 then state <= st_fetch; a_r <= ExpandPC(pc_r+1); pc_r <= a_r(ADDR_W-1 downto 0); end if; when dec_add_sp => -- Push(Pop()+[SP+Offset]) if mem_busy_i='0' then -- Read SP+Offset state <= st_add_sp2; read_en_r <= '1'; addr_r <= sp_r+sp_offset; pc_r <= pc_r+1; end if; when dec_push_sp => -- Push(SP) if mem_busy_i='0' then FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); pc_r <= pc_r+1; a_r <= (others => '0'); a_r(ADDR_W-1 downto BYTE_BITS) <= sp_r; Push(sp_r,a_r,b_r); end if; when dec_pop_pc => -- PC=Pop() (return) if mem_busy_i='0' then FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); state <= st_resync; pc_r <= a_r(ADDR_W-1 downto 0); sp_r <= inc_sp; end if; when dec_pop_pc_rel => -- PC=PC+Pop() if mem_busy_i='0' and ENA_LEVEL2 then FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); state <= st_resync; pc_r <= a_r(ADDR_W-1 downto 0)+pc_r; sp_r <= inc_sp; end if; when dec_add => -- Push(Pop()+Pop()) [A=A+B, SP++, update B] if mem_busy_i='0' then state <= st_popped; a_r <= a_r+b_r; read_en_r <= '1'; addr_r <= inc_inc_sp; sp_r <= inc_sp; end if; when dec_sub => -- a=Pop(), b=Pop(), Push(b-a) if mem_busy_i='0' and ENA_LEVEL1 then DoBinOp(b_r-a_r,state,sp_r,addr_r,read_en_r, a_r,bin_op_res1_r,BINOP_PIPE); end if; when dec_pop => -- Pop() if mem_busy_i='0' then state <= st_popped; addr_r <= inc_inc_sp; read_en_r <= '1'; Pop(sp_r,a_r,b_r); end if; when dec_pop_down => -- t=Pop(), Pop(), Push(t) if mem_busy_i='0' then -- PopDown leaves top of stack unchanged state <= st_popped; addr_r <= inc_inc_sp; read_en_r <= '1'; sp_r <= inc_sp; end if; when dec_or => -- Push(Pop() or Pop()) if mem_busy_i='0' then state <= st_popped; a_r <= a_r or b_r; read_en_r <= '1'; addr_r <= inc_inc_sp; sp_r <= inc_sp; end if; when dec_and => -- Push(Pop() and Pop()) if mem_busy_i='0' then state <= st_popped; a_r <= a_r and b_r; read_en_r <= '1'; addr_r <= inc_inc_sp; sp_r <= inc_sp; end if; when dec_eq => -- a=Pop(), b=Pop(), Push(a=b ? 1 : 0) if mem_busy_i='0' and ENA_LEVEL0 then DoBinOpBool(a_r=b_r,state,sp_r,addr_r,read_en_r, a_r,bin_op_res1_r,BINOP_PIPE); end if; when dec_u_less_than => -- a=Pop(), b=Pop(), Push(a<b ? 1 : 0) if mem_busy_i='0' and ENA_LEVEL1 then DoBinOpBool(a_r<b_r,state,sp_r,addr_r,read_en_r, a_r,bin_op_res1_r,BINOP_PIPE); end if; when dec_u_less_than_or_equal => -- a=Pop(), b=Pop(), Push(a<=b ? 1 : 0) if mem_busy_i='0' and ENA_LEVEL2 then DoBinOpBool(a_r<=b_r,state,sp_r,addr_r,read_en_r, a_r,bin_op_res1_r,BINOP_PIPE); end if; when dec_less_than => -- a=signed(Pop()), b=signed(Pop()), Push(a<b ? 1 : 0) if mem_busy_i='0' and ENA_LEVEL1 then DoBinOpBool(signed(a_r)<signed(b_r),state,sp_r, addr_r,read_en_r,a_r,bin_op_res1_r, BINOP_PIPE); end if; when dec_less_than_or_equal => -- a=signed(Pop()), b=signed(Pop()), Push(a<=b ? 1 : 0) if mem_busy_i='0' and ENA_LEVEL2 then DoBinOpBool(signed(a_r)<=signed(b_r),state,sp_r, addr_r,read_en_r,a_r,bin_op_res1_r, BINOP_PIPE); end if; when dec_load => -- Push([Pop()]) if mem_busy_i='0' then state <= st_load2; addr_r <= a_r(ADDR_W-1 downto BYTE_BITS); read_en_r <= '1'; pc_r <= pc_r+1; end if; when dec_dup => -- t=Pop(), Push(t), Push(t) if mem_busy_i='0' then pc_r <= pc_r+1; -- A is dupped, no change Push(sp_r,a_r,b_r); FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); end if; when dec_dup_stk_b => -- Pop(), t=Pop(), Push(t), Push(t), Push(t) if mem_busy_i='0' then pc_r <= pc_r+1; a_r <= b_r; -- B goes to A Push(sp_r,a_r,b_r); FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); end if; when dec_store => -- a=Pop(), b=Pop(), [a]=b if mem_busy_i='0' then state <= st_resync; pc_r <= pc_r+1; addr_r <= a_r(ADDR_W-1 downto BYTE_BITS); data_o <= b_r; write_en_r <= '1'; sp_r <= inc_inc_sp; end if; when dec_pop_sp => -- SP=Pop() if mem_busy_i='0' then FlushB(write_en_r,addr_r,inc_sp,data_o,b_r); state <= st_resync; pc_r <= pc_r+1; sp_r <= a_r(ADDR_W-1 downto BYTE_BITS); end if; when dec_nop => pc_r <= pc_r+1; when dec_not => -- Push(not(Pop())) pc_r <= pc_r+1; a_r <= not a_r; when dec_flip => -- Push(flip(Pop())) pc_r <= pc_r+1; for i in 0 to WORD_SIZE-1 loop a_r(i) <= a_r(WORD_SIZE-1-i); end loop; when dec_add_top => -- a=Pop(), b=Pop(), Push(b), Push(a+b) pc_r <= pc_r+1; a_r <= a_r+b_r; when dec_shift => -- Push(Pop()<<1) [equivalent to a=Pop(), Push(a+a)] pc_r <= pc_r+1; a_r(WORD_SIZE-1 downto 1) <= a_r(WORD_SIZE-2 downto 0); a_r(0) <= '0'; when dec_push_sp_add => -- Push(Pop()+SP) if ENA_LEVEL0 then pc_r <= pc_r+1; a_r <= (others => '0'); a_r(ADDR_W-1 downto BYTE_BITS) <= a_r(ADDR_W-1-BYTE_BITS downto 0)+sp_r; end if; when dec_neq_branch => -- a=Pop(), b=Pop(), PC+=b==0 ? 1 : a -- Branches are almost always taken as they form loops if ENA_LEVEL0 then sp_r <= inc_inc_sp; -- Need to fetch stack again. state <= st_resync; if b_r/=0 then pc_r <= a_r(ADDR_W-1 downto 0)+pc_r; else pc_r <= pc_r+1; end if; end if; when dec_mult => -- Push(Pop()*Pop()) if ENA_LEVEL1 then if MULT_PIPE then mult_a_r <= a_r; mult_b_r <= b_r; state <= st_mult2; else mult_res:=a_r*b_r; mult_res1_r <= mult_res(WORD_SIZE-1 downto 0); state <= st_mult5; end if; end if; when dec_break => -- Assert the break_o signal --report "Break instruction encountered" severity failure; break_o <= '1'; pc_r <= pc_r+1; when dec_loadb => -- Push([Pop()] & 0xFF) (byte address) if mem_busy_i='0' and ENA_LEVEL0 then state <= st_loadb2; addr_r <= a_r(ADDR_W-1 downto BYTE_BITS); read_en_r <= '1'; pc_r <= pc_r+1; end if; when dec_storeb => -- [Pop()]=Pop() & 0xFF (byte address) if mem_busy_i='0' and ENA_LEVEL1 then state <= st_storeb2; addr_r <= a_r(ADDR_W-1 downto BYTE_BITS); read_en_r <= '1'; pc_r <= pc_r+1; end if; when dec_lshr => -- a=Pop(), b=Pop(), Push(b>>(a&0x3F)) if ENA_LSHR then -- This instruction takes more than one cycle. -- We must avoid duplications in the trace log. dbg_o.b_inst <= not_lshr; not_lshr:='0'; if a_r(5 downto 0)=0 then -- Only 6 bits used -- No more shifts if mem_busy_i='0' then state <= st_popped; a_r <= b_r; read_en_r <= '1'; addr_r <= inc_inc_sp; sp_r <= inc_sp; not_lshr:='1'; end if; else -- More shifts needed b_r <= "0"&b_r(WORD_SIZE-1 downto 1); a_r(5 downto 0) <= a_r(5 downto 0)-1; insn <= insn; end if; end if; when others => -- Undefined behavior, we shouldn't get here. -- It only helps synthesis tools. sp_r <= (others => D_CARE_VAL); report "Illegal decode instruction?!" severity failure; --break_o <= '1'; end case; -- The followup of operations that takes more than one execution clock when st_store_sp2 => if mem_busy_i='0' then addr_r <= inc_sp; read_en_r <= '1'; state <= st_popped; end if; when st_load_sp2 => if mem_busy_i='0' then state <= st_load_sp3; -- Now we can read SP+Offset (SP already decremented) read_en_r <= '1'; addr_r <= sp_r+sp_offset+1; end if; when st_load_sp3 => if mem_busy_i='0' then -- Note: We can't increment PC in the decode stage -- because it will modify sp_offset. pc_r <= pc_r+1; -- Finally we have the result in A state <= st_execute; a_r <= data_i; end if; when st_add_sp2 => if mem_busy_i='0' then state <= st_execute; a_r <= a_r+data_i; end if; when st_load2 => if mem_busy_i='0' then a_r <= data_i; state <= st_execute; end if; when st_loadb2 => if mem_busy_i='0' then a_r <= (others => '0'); -- Select the source bits using the less significant bits (byte address) h_bit:=(WORD_BYTES-to_integer(a_r(BYTE_BITS-1 downto 0)))*8-1; l_bit:=h_bit-7; a_r(7 downto 0) <= data_i(h_bit downto l_bit); state <= st_execute; end if; when st_storeb2 => if mem_busy_i='0' then addr_r <= a_r(ADDR_W-1 downto BYTE_BITS); data_o <= data_i; -- Select the source bits using the less significant bits (byte address) h_bit:=(WORD_BYTES-to_integer(a_r(BYTE_BITS-1 downto 0)))*8-1; l_bit:=h_bit-7; data_o(h_bit downto l_bit) <= b_r(7 downto 0); write_en_r <= '1'; sp_r <= inc_inc_sp; state <= st_resync; end if; when st_fetch => if mem_busy_i='0' then addr_r <= pc_r(ADDR_W-1 downto BYTE_BITS); read_en_r <= '1'; state <= st_decode; end if; -- The following states can be used to leave cycles free for -- tools that can automagically decompose the multiplication -- in various stages. Xilinx tools can do it to increase the -- multipliers performance. when st_mult2 => state <= st_mult3; when st_mult3 => state <= st_mult4; when st_mult4 => state <= st_mult5; when st_mult5 => if mem_busy_i='0' then if MULT_PIPE then a_r <= mult_res3_r; else a_r <= mult_res1_r; end if; read_en_r <= '1'; addr_r <= inc_inc_sp; sp_r <= inc_sp; state <= st_popped; end if; when st_binary_op_res => -- BINOP_PIPE=2 state <= st_binary_op_res2; when st_binary_op_res2 => -- BINOP_PIPE>=1 read_en_r <= '1'; addr_r <= inc_inc_sp; sp_r <= inc_sp; state <= st_popped; if BINOP_PIPE=2 then a_r <= bin_op_res2_r; else -- 1 a_r <= bin_op_res1_r; end if; when st_popped => if mem_busy_i='0' then -- Note: Moving this PC++ to the decoder seems to -- consume more LUTs. pc_r <= pc_r+1; b_r <= data_i; state <= st_execute; end if; when others => -- Undefined behavior, we shouldn't get here. -- It only helps synthesis tools. sp_r <= (others => D_CARE_VAL); report "Illegal state?!" severity failure; --break_o <= '1'; end case; -- state end if; -- else reset_i='1' end if; -- rising_edge(clk_i) end process opcode_control; end architecture Behave; -- Entity: ZPUMediumCore
---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 16:22:23 01/22/2014 -- Design Name: -- Module Name: Multiply16Booth4 - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Multiply16Booth4 is PORT ( a: IN STD_LOGIC_VECTOR(15 downto 0); b: IN STD_LOGIC_VECTOR(15 downto 0); o: OUT STD_LOGIC_VECTOR(15 downto 0)); end Multiply16Booth4; architecture Behavioral of Multiply16Booth4 is COMPONENT BoothPartProdGen is PORT ( bin3: in STD_LOGIC_VECTOR(2 downto 0); a: in STD_LOGIC_VECTOR(15 downto 0); product: out STD_LOGIC_VECTOR(16 downto 0) ); end COMPONENT; COMPONENT BoothPartProdRed is PORT( prod0: in STD_LOGIC_VECTOR(19 downto 0); prod1: in STD_LOGIC_VECTOR(20 downto 2); prod2: in STD_LOGIC_VECTOR(22 downto 4); prod3: in STD_LOGIC_VECTOR(24 downto 6); prod4: in STD_LOGIC_VECTOR(26 downto 8); prod5: in STD_LOGIC_VECTOR(28 downto 10); prod6: in STD_LOGIC_VECTOR(30 downto 12); prod7: in STD_LOGIC_VECTOR(31 downto 14); result: out STD_LOGIC_VECTOR(31 downto 0)); end COMPONENT; SIGNAL aTmp: STD_LOGIC_VECTOR(16 downto 0); SIGNAL oTmp: STD_LOGIC_VECTOR(31 downto 0); SIGNAL prod0: STD_LOGIC_VECTOR(19 downto 0); SIGNAL prod1: STD_LOGIC_VECTOR(18 downto 0); SIGNAL prod2: STD_LOGIC_VECTOR(18 downto 0); SIGNAL prod3: STD_LOGIC_VECTOR(18 downto 0); SIGNAL prod4: STD_LOGIC_VECTOR(18 downto 0); SIGNAL prod5: STD_LOGIC_VECTOR(18 downto 0); SIGNAL prod6: STD_LOGIC_VECTOR(18 downto 0); SIGNAL prod7: STD_LOGIC_VECTOR(17 downto 0); begin aTmp <= a & '0'; prod0(19 downto 17) <= (not prod0(16)) & prod0(16) & prod0(16); prod1(18 downto 17) <= '1' & (not prod1(16)); prod2(18 downto 17) <= '1' & (not prod2(16)); prod3(18 downto 17) <= '1' & (not prod3(16)); prod4(18 downto 17) <= '1' & (not prod4(16)); prod5(18 downto 17) <= '1' & (not prod5(16)); prod6(18 downto 17) <= '1' & (not prod6(16)); prod7(17) <= not prod7(16); prodgen0: BoothPartProdGen PORT MAP ( bin3 => aTmp(2 downto 0), a => b, product => prod0(16 downto 0) ); prodgen1: BoothPartProdGen PORT MAP ( bin3 => aTmp(4 downto 2), a => b, product => prod1(16 downto 0) ); prodgen2: BoothPartProdGen PORT MAP ( bin3 => aTmp(6 downto 4), a => b, product => prod2(16 downto 0) ); prodgen3: BoothPartProdGen PORT MAP ( bin3 => aTmp(8 downto 6), a => b, product => prod3(16 downto 0) ); prodgen4: BoothPartProdGen PORT MAP ( bin3 => aTmp(10 downto 8), a => b, product => prod4(16 downto 0) ); prodgen5: BoothPartProdGen PORT MAP ( bin3 => aTmp(12 downto 10), a => b, product => prod5(16 downto 0) ); prodgen6: BoothPartProdGen PORT MAP ( bin3 => aTmp(14 downto 12), a => b, product => prod6(16 downto 0) ); prodgen7: BoothPartProdGen PORT MAP ( bin3 => aTmp(16 downto 14), a => b, product => prod7(16 downto 0) ); output: BoothPartProdRed PORT MAP ( prod0 => prod0, prod1 => prod1, prod2 => prod2, prod3 => prod3, prod4 => prod4, prod5 => prod5, prod6 => prod6, prod7 => prod7, result => oTmp ); o <= oTmp(23 downto 8); end Behavioral;
library ieee; use ieee.NUMERIC_STD.all; use ieee.STD_LOGIC_UNSIGNED.all; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; entity microprocessor_tb is end microprocessor_tb; architecture TB_ARCHITECTURE of microprocessor_tb is component MicroProcessor port( clk : in STD_LOGIC; rst : in STD_LOGIC; start : in STD_LOGIC; stop : out STD_LOGIC); end component; signal clk : STD_LOGIC := '0'; signal rst : STD_LOGIC := '0'; signal start : STD_LOGIC := '0'; signal stop : STD_LOGIC := '0'; constant CLK_PERIOD : time := 10 ns; begin UUT : microprocessor port map( clk => clk, rst => rst, start => start, stop => stop ); CLK_P : process begin clk <= '0'; wait for CLK_PERIOD / 2; clk <= '1'; wait for CLK_PERIOD / 2; end process; MAIN_P : process begin rst <= '1'; wait for CLK_PERIOD; rst <= '0'; start <= '1'; wait for 100 * CLK_PERIOD; wait; end process; end TB_ARCHITECTURE;
entity test is end test; architecture only of test is begin -- only only: process variable string_variable : string(1 to 5) := "Hello"; alias string_alias : string(1 to 5) is string_variable; begin -- process assert string_alias = "Hello" report "TEST FAILED" severity FAILURE; report "TEST PASSED"; wait; end process; end only;
entity test is end test; architecture only of test is begin -- only only: process variable string_variable : string(1 to 5) := "Hello"; alias string_alias : string(1 to 5) is string_variable; begin -- process assert string_alias = "Hello" report "TEST FAILED" severity FAILURE; report "TEST PASSED"; wait; end process; end only;
entity test is end test; architecture only of test is begin -- only only: process variable string_variable : string(1 to 5) := "Hello"; alias string_alias : string(1 to 5) is string_variable; begin -- process assert string_alias = "Hello" report "TEST FAILED" severity FAILURE; report "TEST PASSED"; wait; end process; end only;
entity rec is end; architecture behav of rec is type rec_type is record a, b : natural; end record; constant r1 : rec_type := (a | b => 2); constant b : boolean := r1.a = r1.b; begin process variable a : integer := 5; begin case a = 5 is when b => null; when false => null; end case; wait; end process; end behav;
entity rec is end; architecture behav of rec is type rec_type is record a, b : natural; end record; constant r1 : rec_type := (a | b => 2); constant b : boolean := r1.a = r1.b; begin process variable a : integer := 5; begin case a = 5 is when b => null; when false => null; end case; wait; end process; end behav;
library ieee; use ieee.std_logic_1164.all; entity cmp_216 is port ( eq : out std_logic; in0 : in std_logic_vector(2 downto 0); in1 : in std_logic_vector(2 downto 0) ); end cmp_216; architecture augh of cmp_216 is signal tmp : std_logic; begin -- Compute the result tmp <= '0' when in0 /= in1 else '1'; -- Set the outputs eq <= tmp; end architecture;
library ieee; use ieee.std_logic_1164.all; entity cmp_216 is port ( eq : out std_logic; in0 : in std_logic_vector(2 downto 0); in1 : in std_logic_vector(2 downto 0) ); end cmp_216; architecture augh of cmp_216 is signal tmp : std_logic; begin -- Compute the result tmp <= '0' when in0 /= in1 else '1'; -- Set the outputs eq <= tmp; end architecture;
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_2 Core - Data Generator -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: data_gen.vhd -- -- Description: -- Data Generator -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.BMG_TB_PKG.ALL; ENTITY DATA_GEN IS GENERIC ( DATA_GEN_WIDTH : INTEGER := 32; DOUT_WIDTH : INTEGER := 32; DATA_PART_CNT : INTEGER := 1; SEED : INTEGER := 2 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; EN : IN STD_LOGIC; DATA_OUT : OUT STD_LOGIC_VECTOR (DOUT_WIDTH-1 DOWNTO 0) --OUTPUT VECTOR ); END DATA_GEN; ARCHITECTURE DATA_GEN_ARCH OF DATA_GEN IS CONSTANT LOOP_COUNT : INTEGER := DIVROUNDUP(DATA_GEN_WIDTH,8); SIGNAL RAND_DATA : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0); SIGNAL LOCAL_DATA_OUT : STD_LOGIC_VECTOR(DATA_GEN_WIDTH-1 DOWNTO 0); SIGNAL LOCAL_CNT : INTEGER :=1; SIGNAL DATA_GEN_I : STD_LOGIC :='0'; BEGIN LOCAL_DATA_OUT <= RAND_DATA(DATA_GEN_WIDTH-1 DOWNTO 0); DATA_OUT <= LOCAL_DATA_OUT(((DOUT_WIDTH*LOCAL_CNT)-1) DOWNTO ((DOUT_WIDTH*LOCAL_CNT)-DOUT_WIDTH)); DATA_GEN_I <= '0' WHEN (LOCAL_CNT < DATA_PART_CNT) ELSE EN; PROCESS(CLK) BEGIN IF(RISING_EDGE (CLK)) THEN IF(EN ='1' AND (DATA_PART_CNT =1)) THEN LOCAL_CNT <=1; ELSIF(EN='1' AND (DATA_PART_CNT>1)) THEN IF(LOCAL_CNT = 1) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSIF(LOCAL_CNT < DATA_PART_CNT) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSE LOCAL_CNT <= 1; END IF; ELSE LOCAL_CNT <= 1; END IF; END IF; END PROCESS; RAND_GEN:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE RAND_GEN_INST:ENTITY work.RANDOM GENERIC MAP( WIDTH => 8, SEED => (SEED+N) ) PORT MAP( CLK => CLK, RST => RST, EN => DATA_GEN_I, RANDOM_NUM => RAND_DATA(8*(N+1)-1 DOWNTO 8*N) ); END GENERATE RAND_GEN; END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_2 Core - Data Generator -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: data_gen.vhd -- -- Description: -- Data Generator -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.BMG_TB_PKG.ALL; ENTITY DATA_GEN IS GENERIC ( DATA_GEN_WIDTH : INTEGER := 32; DOUT_WIDTH : INTEGER := 32; DATA_PART_CNT : INTEGER := 1; SEED : INTEGER := 2 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; EN : IN STD_LOGIC; DATA_OUT : OUT STD_LOGIC_VECTOR (DOUT_WIDTH-1 DOWNTO 0) --OUTPUT VECTOR ); END DATA_GEN; ARCHITECTURE DATA_GEN_ARCH OF DATA_GEN IS CONSTANT LOOP_COUNT : INTEGER := DIVROUNDUP(DATA_GEN_WIDTH,8); SIGNAL RAND_DATA : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0); SIGNAL LOCAL_DATA_OUT : STD_LOGIC_VECTOR(DATA_GEN_WIDTH-1 DOWNTO 0); SIGNAL LOCAL_CNT : INTEGER :=1; SIGNAL DATA_GEN_I : STD_LOGIC :='0'; BEGIN LOCAL_DATA_OUT <= RAND_DATA(DATA_GEN_WIDTH-1 DOWNTO 0); DATA_OUT <= LOCAL_DATA_OUT(((DOUT_WIDTH*LOCAL_CNT)-1) DOWNTO ((DOUT_WIDTH*LOCAL_CNT)-DOUT_WIDTH)); DATA_GEN_I <= '0' WHEN (LOCAL_CNT < DATA_PART_CNT) ELSE EN; PROCESS(CLK) BEGIN IF(RISING_EDGE (CLK)) THEN IF(EN ='1' AND (DATA_PART_CNT =1)) THEN LOCAL_CNT <=1; ELSIF(EN='1' AND (DATA_PART_CNT>1)) THEN IF(LOCAL_CNT = 1) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSIF(LOCAL_CNT < DATA_PART_CNT) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSE LOCAL_CNT <= 1; END IF; ELSE LOCAL_CNT <= 1; END IF; END IF; END PROCESS; RAND_GEN:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE RAND_GEN_INST:ENTITY work.RANDOM GENERIC MAP( WIDTH => 8, SEED => (SEED+N) ) PORT MAP( CLK => CLK, RST => RST, EN => DATA_GEN_I, RANDOM_NUM => RAND_DATA(8*(N+1)-1 DOWNTO 8*N) ); END GENERATE RAND_GEN; END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_2 Core - Data Generator -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: data_gen.vhd -- -- Description: -- Data Generator -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.BMG_TB_PKG.ALL; ENTITY DATA_GEN IS GENERIC ( DATA_GEN_WIDTH : INTEGER := 32; DOUT_WIDTH : INTEGER := 32; DATA_PART_CNT : INTEGER := 1; SEED : INTEGER := 2 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; EN : IN STD_LOGIC; DATA_OUT : OUT STD_LOGIC_VECTOR (DOUT_WIDTH-1 DOWNTO 0) --OUTPUT VECTOR ); END DATA_GEN; ARCHITECTURE DATA_GEN_ARCH OF DATA_GEN IS CONSTANT LOOP_COUNT : INTEGER := DIVROUNDUP(DATA_GEN_WIDTH,8); SIGNAL RAND_DATA : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0); SIGNAL LOCAL_DATA_OUT : STD_LOGIC_VECTOR(DATA_GEN_WIDTH-1 DOWNTO 0); SIGNAL LOCAL_CNT : INTEGER :=1; SIGNAL DATA_GEN_I : STD_LOGIC :='0'; BEGIN LOCAL_DATA_OUT <= RAND_DATA(DATA_GEN_WIDTH-1 DOWNTO 0); DATA_OUT <= LOCAL_DATA_OUT(((DOUT_WIDTH*LOCAL_CNT)-1) DOWNTO ((DOUT_WIDTH*LOCAL_CNT)-DOUT_WIDTH)); DATA_GEN_I <= '0' WHEN (LOCAL_CNT < DATA_PART_CNT) ELSE EN; PROCESS(CLK) BEGIN IF(RISING_EDGE (CLK)) THEN IF(EN ='1' AND (DATA_PART_CNT =1)) THEN LOCAL_CNT <=1; ELSIF(EN='1' AND (DATA_PART_CNT>1)) THEN IF(LOCAL_CNT = 1) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSIF(LOCAL_CNT < DATA_PART_CNT) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSE LOCAL_CNT <= 1; END IF; ELSE LOCAL_CNT <= 1; END IF; END IF; END PROCESS; RAND_GEN:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE RAND_GEN_INST:ENTITY work.RANDOM GENERIC MAP( WIDTH => 8, SEED => (SEED+N) ) PORT MAP( CLK => CLK, RST => RST, EN => DATA_GEN_I, RANDOM_NUM => RAND_DATA(8*(N+1)-1 DOWNTO 8*N) ); END GENERATE RAND_GEN; END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_2 Core - Data Generator -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: data_gen.vhd -- -- Description: -- Data Generator -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.BMG_TB_PKG.ALL; ENTITY DATA_GEN IS GENERIC ( DATA_GEN_WIDTH : INTEGER := 32; DOUT_WIDTH : INTEGER := 32; DATA_PART_CNT : INTEGER := 1; SEED : INTEGER := 2 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; EN : IN STD_LOGIC; DATA_OUT : OUT STD_LOGIC_VECTOR (DOUT_WIDTH-1 DOWNTO 0) --OUTPUT VECTOR ); END DATA_GEN; ARCHITECTURE DATA_GEN_ARCH OF DATA_GEN IS CONSTANT LOOP_COUNT : INTEGER := DIVROUNDUP(DATA_GEN_WIDTH,8); SIGNAL RAND_DATA : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0); SIGNAL LOCAL_DATA_OUT : STD_LOGIC_VECTOR(DATA_GEN_WIDTH-1 DOWNTO 0); SIGNAL LOCAL_CNT : INTEGER :=1; SIGNAL DATA_GEN_I : STD_LOGIC :='0'; BEGIN LOCAL_DATA_OUT <= RAND_DATA(DATA_GEN_WIDTH-1 DOWNTO 0); DATA_OUT <= LOCAL_DATA_OUT(((DOUT_WIDTH*LOCAL_CNT)-1) DOWNTO ((DOUT_WIDTH*LOCAL_CNT)-DOUT_WIDTH)); DATA_GEN_I <= '0' WHEN (LOCAL_CNT < DATA_PART_CNT) ELSE EN; PROCESS(CLK) BEGIN IF(RISING_EDGE (CLK)) THEN IF(EN ='1' AND (DATA_PART_CNT =1)) THEN LOCAL_CNT <=1; ELSIF(EN='1' AND (DATA_PART_CNT>1)) THEN IF(LOCAL_CNT = 1) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSIF(LOCAL_CNT < DATA_PART_CNT) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSE LOCAL_CNT <= 1; END IF; ELSE LOCAL_CNT <= 1; END IF; END IF; END PROCESS; RAND_GEN:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE RAND_GEN_INST:ENTITY work.RANDOM GENERIC MAP( WIDTH => 8, SEED => (SEED+N) ) PORT MAP( CLK => CLK, RST => RST, EN => DATA_GEN_I, RANDOM_NUM => RAND_DATA(8*(N+1)-1 DOWNTO 8*N) ); END GENERATE RAND_GEN; END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_2 Core - Data Generator -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: data_gen.vhd -- -- Description: -- Data Generator -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.BMG_TB_PKG.ALL; ENTITY DATA_GEN IS GENERIC ( DATA_GEN_WIDTH : INTEGER := 32; DOUT_WIDTH : INTEGER := 32; DATA_PART_CNT : INTEGER := 1; SEED : INTEGER := 2 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; EN : IN STD_LOGIC; DATA_OUT : OUT STD_LOGIC_VECTOR (DOUT_WIDTH-1 DOWNTO 0) --OUTPUT VECTOR ); END DATA_GEN; ARCHITECTURE DATA_GEN_ARCH OF DATA_GEN IS CONSTANT LOOP_COUNT : INTEGER := DIVROUNDUP(DATA_GEN_WIDTH,8); SIGNAL RAND_DATA : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0); SIGNAL LOCAL_DATA_OUT : STD_LOGIC_VECTOR(DATA_GEN_WIDTH-1 DOWNTO 0); SIGNAL LOCAL_CNT : INTEGER :=1; SIGNAL DATA_GEN_I : STD_LOGIC :='0'; BEGIN LOCAL_DATA_OUT <= RAND_DATA(DATA_GEN_WIDTH-1 DOWNTO 0); DATA_OUT <= LOCAL_DATA_OUT(((DOUT_WIDTH*LOCAL_CNT)-1) DOWNTO ((DOUT_WIDTH*LOCAL_CNT)-DOUT_WIDTH)); DATA_GEN_I <= '0' WHEN (LOCAL_CNT < DATA_PART_CNT) ELSE EN; PROCESS(CLK) BEGIN IF(RISING_EDGE (CLK)) THEN IF(EN ='1' AND (DATA_PART_CNT =1)) THEN LOCAL_CNT <=1; ELSIF(EN='1' AND (DATA_PART_CNT>1)) THEN IF(LOCAL_CNT = 1) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSIF(LOCAL_CNT < DATA_PART_CNT) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSE LOCAL_CNT <= 1; END IF; ELSE LOCAL_CNT <= 1; END IF; END IF; END PROCESS; RAND_GEN:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE RAND_GEN_INST:ENTITY work.RANDOM GENERIC MAP( WIDTH => 8, SEED => (SEED+N) ) PORT MAP( CLK => CLK, RST => RST, EN => DATA_GEN_I, RANDOM_NUM => RAND_DATA(8*(N+1)-1 DOWNTO 8*N) ); END GENERATE RAND_GEN; END ARCHITECTURE;
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_2 Core - Data Generator -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: data_gen.vhd -- -- Description: -- Data Generator -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY work; USE work.BMG_TB_PKG.ALL; ENTITY DATA_GEN IS GENERIC ( DATA_GEN_WIDTH : INTEGER := 32; DOUT_WIDTH : INTEGER := 32; DATA_PART_CNT : INTEGER := 1; SEED : INTEGER := 2 ); PORT ( CLK : IN STD_LOGIC; RST : IN STD_LOGIC; EN : IN STD_LOGIC; DATA_OUT : OUT STD_LOGIC_VECTOR (DOUT_WIDTH-1 DOWNTO 0) --OUTPUT VECTOR ); END DATA_GEN; ARCHITECTURE DATA_GEN_ARCH OF DATA_GEN IS CONSTANT LOOP_COUNT : INTEGER := DIVROUNDUP(DATA_GEN_WIDTH,8); SIGNAL RAND_DATA : STD_LOGIC_VECTOR(8*LOOP_COUNT-1 DOWNTO 0); SIGNAL LOCAL_DATA_OUT : STD_LOGIC_VECTOR(DATA_GEN_WIDTH-1 DOWNTO 0); SIGNAL LOCAL_CNT : INTEGER :=1; SIGNAL DATA_GEN_I : STD_LOGIC :='0'; BEGIN LOCAL_DATA_OUT <= RAND_DATA(DATA_GEN_WIDTH-1 DOWNTO 0); DATA_OUT <= LOCAL_DATA_OUT(((DOUT_WIDTH*LOCAL_CNT)-1) DOWNTO ((DOUT_WIDTH*LOCAL_CNT)-DOUT_WIDTH)); DATA_GEN_I <= '0' WHEN (LOCAL_CNT < DATA_PART_CNT) ELSE EN; PROCESS(CLK) BEGIN IF(RISING_EDGE (CLK)) THEN IF(EN ='1' AND (DATA_PART_CNT =1)) THEN LOCAL_CNT <=1; ELSIF(EN='1' AND (DATA_PART_CNT>1)) THEN IF(LOCAL_CNT = 1) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSIF(LOCAL_CNT < DATA_PART_CNT) THEN LOCAL_CNT <= LOCAL_CNT+1; ELSE LOCAL_CNT <= 1; END IF; ELSE LOCAL_CNT <= 1; END IF; END IF; END PROCESS; RAND_GEN:FOR N IN LOOP_COUNT-1 DOWNTO 0 GENERATE RAND_GEN_INST:ENTITY work.RANDOM GENERIC MAP( WIDTH => 8, SEED => (SEED+N) ) PORT MAP( CLK => CLK, RST => RST, EN => DATA_GEN_I, RANDOM_NUM => RAND_DATA(8*(N+1)-1 DOWNTO 8*N) ); END GENERATE RAND_GEN; END ARCHITECTURE;
library verilog; use verilog.vl_types.all; entity andGate is port( busAND : out vl_logic_vector(31 downto 0); busA : in vl_logic_vector(31 downto 0); busB : in vl_logic_vector(31 downto 0); zAND : out vl_logic; oAND : out vl_logic; cAND : out vl_logic; \nAND\ : out vl_logic ); end andGate;
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2014, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; use work.debug.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 10; -- system clock period romwidth : integer := 32; -- rom data width (8/32) romdepth : integer := 16; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 18; -- ram address depth srambanks : integer := 2 -- number of ram banks ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal sys_clk : std_logic := '0'; signal sysace_clk : std_logic := '0'; signal sys_rst_in : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal errorn : std_logic; signal address : std_logic_vector(27 downto 0); signal data : std_logic_vector(15 downto 0); signal xdata : std_logic_vector(31 downto 0); signal romsn : std_logic; signal iosn : std_ulogic; signal writen, read : std_ulogic; signal oen : std_ulogic; signal flash_rstn : std_logic; signal ddr_clk : std_logic_vector(2 downto 0); signal ddr_clkb : std_logic_vector(2 downto 0); signal ddr_clk_fb : std_logic; signal ddr_clk_fb_out : std_logic; signal ddr_cke : std_logic_vector(1 downto 0); signal ddr_csb : std_logic_vector(1 downto 0); signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (7 downto 0); -- ddr dm signal ddr_dqs : std_logic_vector (7 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (13 downto 0); -- ddr address signal ddr_ba : std_logic_vector (1 downto 0); -- ddr bank address signal ddr_dq : std_logic_vector (63 downto 0); -- ddr data signal txd1 : std_logic; -- UART1 tx data signal rxd1 : std_logic; -- UART1 rx data signal gpio : std_logic_vector(31 downto 0); -- I/O port signal flash_cex : std_logic; signal etx_clk, erx_clk, erx_dv, erx_er, erx_col, erx_crs, etx_en, etx_er : std_logic:='0'; signal erxd, etxd: std_logic_vector(3 downto 0):=(others=>'0'); signal emdc, emdio, eresetn : std_logic; signal etx_slew : std_logic_vector(1 downto 0); signal leds : std_logic_vector(1 downto 0); signal vid_clock : std_ulogic; signal vid_blankn : std_ulogic; signal vid_syncn : std_ulogic; signal vid_hsync : std_ulogic; signal vid_vsync : std_ulogic; signal vid_r : std_logic_vector(7 downto 0); signal vid_g : std_logic_vector(7 downto 0); signal vid_b : std_logic_vector(7 downto 0); signal ps2clk : std_logic_vector(1 downto 0); signal ps2data : std_logic_vector(1 downto 0); signal cf_mpa : std_logic_vector(6 downto 0); signal cf_mpd : std_logic_vector(15 downto 0); signal cf_mp_ce_z : std_ulogic; signal cf_mp_oe_z : std_ulogic; signal cf_mp_we_z : std_ulogic; signal cf_mpirq : std_ulogic; signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; constant lresp : boolean := false; signal dsuen : std_ulogic; signal dsubre : std_ulogic; signal dsuact : std_ulogic; begin -- clock and reset sys_clk <= not sys_clk after ct * 1 ns; sysace_clk <= not sysace_clk after 15 ns; sys_rst_in <= '0', '1' after 200 ns; rxd1 <= 'H'; errorn <= 'H'; dsuen <= '0'; dsubre <= 'H'; ddr_clk_fb <= ddr_clk_fb_out; rxd1 <= txd1; cf_mpd <= (others => 'H'); cf_mpirq <= 'L'; cpu : entity work.leon3mp generic map ( fabtech, memtech, padtech, ncpu, disas, dbguart, pclow ) port map ( sys_rst_in, sys_clk, sysace_clk, errorn, dsuen, dsubre, dsuact, ddr_clk, ddr_clkb, ddr_clk_fb, ddr_clk_fb_out, ddr_cke, ddr_csb, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_ad, ddr_ba, ddr_dq, rxd1, txd1, leds(0), leds(1), -- gpio, emdio, etx_clk, erx_clk, erxd, erx_dv, erx_er, erx_col, erx_crs, etxd, etx_en, etx_er, emdc, eresetn, etx_slew, ps2clk, ps2data, vid_clock, vid_blankn, vid_syncn, vid_hsync, vid_vsync, vid_r, vid_g, vid_b, cf_mpa, cf_mpd, cf_mp_ce_z, cf_mp_oe_z, cf_mp_we_z, cf_mpirq ); ddrmem : for i in 0 to 1 generate -- u3 : mt46v16m16 -- generic map (index => 3, fname => sdramfile, bbits => 64) -- PORT MAP( -- Dq => ddr_dq(15 downto 0), Dqs => ddr_dqs(1 downto 0), Addr => ddr_ad(12 downto 0), -- Ba => ddr_ba, Clk => ddr_clk(i), Clk_n => ddr_clkb(i), Cke => ddr_cke(i), -- Cs_n => ddr_csb(i), Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, -- Dm => ddr_dm(1 downto 0)); -- u2 : mt46v16m16 -- generic map (index => 2, fname => sdramfile, bbits => 64) -- PORT MAP( -- Dq => ddr_dq(31 downto 16), Dqs => ddr_dqs(3 downto 2), Addr => ddr_ad(12 downto 0), -- Ba => ddr_ba, Clk => ddr_clk(i), Clk_n => ddr_clkb(i), Cke => ddr_cke(i), -- Cs_n => ddr_csb(i), Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, -- Dm => ddr_dm(3 downto 2)); -- u1 : mt46v16m16 -- generic map (index => 1, fname => sdramfile, bbits => 64) -- PORT MAP( -- Dq => ddr_dq(47 downto 32), Dqs => ddr_dqs(5 downto 4), Addr => ddr_ad(12 downto 0), -- Ba => ddr_ba, Clk => ddr_clk(i), Clk_n => ddr_clkb(i), Cke => ddr_cke(i), -- Cs_n => ddr_csb(i), Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, -- Dm => ddr_dm(5 downto 4)); -- u0 : mt46v16m16 -- generic map (index => 0, fname => sdramfile, bbits => 64) -- PORT MAP( -- Dq => ddr_dq(63 downto 48), Dqs => ddr_dqs(7 downto 6), Addr => ddr_ad(12 downto 0), -- Ba => ddr_ba, Clk => ddr_clk(i), Clk_n => ddr_clkb(i), Cke => ddr_cke(i), -- Cs_n => ddr_csb(i), Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, -- Dm => ddr_dm(7 downto 6)); ddr0 : ddrram generic map(width => 64, abits => 14, colbits => 9, rowbits => 14, implbanks => 1, fname => sdramfile, speedbin => 1, density => 1) port map (ck => ddr_clk(i), cke => ddr_cke(i), csn => ddr_csb(i), rasn => ddr_rasb, casn => ddr_casb, wen => ddr_web, dm => ddr_dm, ba => ddr_ba, a => ddr_ad, dq => ddr_dq, dqs => ddr_dqs); end generate; prom0 : sram16 generic map (index => 4, abits => romdepth, fname => promfile) port map (address(romdepth-1 downto 0), data, gnd, gnd, romsn, writen, oen); iuerr : process begin wait for 5000 ns; if to_x01(errorn) = '1' then wait on errorn; end if; assert (to_x01(errorn) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; end process; xdata <= "0000000000000000" & data; test0 : grtestmod port map ( sys_rst_in, sys_clk, errorn, address(20 downto 1), xdata, iosn, oen, writen, open); data <= buskeep(data), (others => 'H') after 250 ns; ddr_dq <= buskeep(ddr_dq), (others => 'H') after 250 ns; end ;
--------------------------------------------------------------------------- -- Company : ARMades Systems -- Author(s) : Fabien Marteau <fabien.marteau@armadeus.com> -- -- Creation Date : 03/09/2008 -- File : simplegpio.vhd -- -- Abstract : -- --------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.numeric_std.all; --------------------------------------------------------------------------- Entity simplegpio is --------------------------------------------------------------------------- generic( id : natural := 3; -- identify id size : natural := 16 -- wishbone data size 8,16 or 32 ); port ( -- clock and reset clk_i : in std_logic ; -- master clock input rst_i : in std_logic ; -- asynchronous reset -- wishbone adr_i : in std_logic_vector( 1 downto 0); dat_i : in std_logic_vector( size-1 downto 0); dat_o : out std_logic_vector( size-1 downto 0); we_i : in std_logic ; stb_i : in std_logic ; ack_o : out std_logic ; cyc_i : in std_logic; -- gpio gpio : inout std_logic_vector( size-1 downto 0) ); end entity; --------------------------------------------------------------------------- Architecture simplegpio_1 of simplegpio is --------------------------------------------------------------------------- signal write_register : std_logic_vector( size-1 downto 0); signal ctrl_register : std_logic_vector( size-1 downto 0); signal rd_ack : std_logic ; signal wr_ack : std_logic ; begin -- register reading process process(clk_i, rst_i) begin if(rst_i = '1') then dat_o <= (others => '0'); rd_ack <= '0'; elsif(rising_edge(clk_i)) then rd_ack <= '0'; if(stb_i = '1' and we_i = '0' and cyc_i = '1') then rd_ack <= '1'; if(adr_i = "00") then dat_o <= gpio; elsif(adr_i = "01") then dat_o <= ctrl_register; elsif(adr_i = "10") then dat_o <= std_logic_vector(to_unsigned(id,size)); else dat_o <= (others => '0'); end if; end if; end if; end process; -- register write process process(clk_i,rst_i) begin if(rst_i = '1') then ctrl_register <= (others => '0'); write_register <= (others => '0'); wr_ack <= '0'; elsif(rising_edge(clk_i)) then wr_ack <= '0'; if(stb_i = '1' and we_i = '1' and cyc_i = '1') then wr_ack <= '1'; if(adr_i = "00") then write_register <= dat_i; elsif(adr_i = "01") then ctrl_register <= dat_i; end if; end if; end if; end process; -- acknowledge ack_o <= rd_ack or wr_ack; -- gpio write gpiogen : for i in 0 to (size-1) generate gpio(i) <= write_register(i) when ctrl_register(i) = '1' else 'Z'; end generate; end architecture simplegpio_1;
---------------------------------------------------------------------------------- -- Company: FIT CTU -- Engineer: Elena Filipenkova -- -- Create Date: 01:28:25 03/22/2015 -- Design Name: FPGA deska rizena procesorem -- Module Name: reg_file_controller - Behavioral -- Target Devices: Spartan-3E Starter Kit -- Revision 0.01 - File Created ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; use IEEE.MATH_REAL.ALL; entity reg_file_controller is generic( reg_num : integer := 32; reg_width : integer := 32; rf_addr_w : integer := 5; data_bits : integer := 8 ); port( clk : in std_logic; reset : in std_logic; rx_din : in std_logic_vector(data_bits - 1 downto 0); renew : in std_logic; --led : out std_logic_vector(7 downto 0); rx_req : out std_logic; tx_req : out std_logic; rf_req : out std_logic; tx_dout : out std_logic_vector(data_bits - 1 downto 0); rf_dout : out std_logic_vector(reg_width - 1 downto 0); rf_addr : out std_logic_vector(rf_addr_w - 1 downto 0) ); end reg_file_controller; architecture Behavioral of reg_file_controller is constant iter : integer := integer(round(real(reg_width/4))) + 1; type t_state is (idle, idle2, send_req, last, last2, parse, ignore); signal state, state_next : t_state; signal req_cnt, req_cnt_next : integer range 0 to 4; signal reg_cnt, reg_cnt_next : integer range 0 to 31; signal parse_mode, parse_mode_next : integer range 0 to 8; --iter; signal tx_data, tx_data_next : std_logic_vector(data_bits - 1 downto 0); signal tx_en, tx_en_next : std_logic; signal rx_en, rx_en_next : std_logic; signal reg_data, reg_data_next : std_logic_vector(15 downto 0); signal din: std_logic_vector(7 downto 0); signal rf_en, rf_en_next : std_logic; signal addr, addr_next : std_logic_vector(rf_addr_w - 1 downto 0); signal ren_sig : std_logic; signal q0, q1, q2 : std_logic; signal delay, delay_next : integer; signal ig_first, ig_first_next : std_logic; begin registers : process (clk) begin if clk = '1' and clk'event then if reset = '1' then state <= idle; req_cnt <= 0; reg_cnt <= 0; parse_mode <= 0; tx_data <=(others => '0'); tx_en <= '0'; rx_en <= '0'; reg_data <=(others => '0'); delay <= 0; rf_en <= '0'; addr <=(others => '0'); ig_first <= '0'; else state <= state_next; req_cnt <= req_cnt_next; reg_cnt <= reg_cnt_next; parse_mode <= parse_mode_next; tx_data <= tx_data_next; tx_en <= tx_en_next; rx_en <= rx_en_next; reg_data <= reg_data_next; delay <= delay_next; rf_en <= rf_en_next; addr <= addr_next; ig_first <= ig_first_next; end if; end if; end process; routing : process (state, req_cnt, tx_data, tx_en, delay, reg_cnt, parse_mode, rx_en, reg_data, din, rf_en, addr, ig_first, ren_sig) begin state_next <= state; req_cnt_next <= req_cnt; reg_cnt_next <= reg_cnt; parse_mode_next <= parse_mode; tx_data_next <= tx_data; tx_en_next <= tx_en; rx_en_next <= rx_en; reg_data_next <= reg_data; delay_next <= delay; rf_en_next <= rf_en; addr_next <= addr; ig_first_next <= ig_first; case state is when idle => if delay = 100000 then state_next <= send_req; delay_next <= 0; tx_en_next <= '0'; else delay_next <= delay + 1; tx_en_next <= '0'; end if; when send_req => case req_cnt is when 0 => tx_data_next <= "01000000"; -- 40 = @ req_cnt_next <= 1; tx_en_next <= '1'; when 1 => tx_data_next <= "01010010"; -- 52 = R req_cnt_next <= 2; tx_en_next <= '1'; when 2 => case reg_cnt is when 0 => tx_data_next <= "00110000"; req_cnt_next <= 4; tx_en_next <= '1'; when 1 => tx_data_next <= "00110001"; req_cnt_next <= 4; tx_en_next <= '1'; when 2 => tx_data_next <= "00110010"; req_cnt_next <= 4; tx_en_next <= '1'; when 3 => tx_data_next <= "00110011"; req_cnt_next <= 4; tx_en_next <= '1'; when 4 => tx_data_next <= "00110100"; req_cnt_next <= 4; tx_en_next <= '1'; when 5 => tx_data_next <= "00110101"; req_cnt_next <= 4; tx_en_next <= '1'; when 6 => tx_data_next <= "00110110"; req_cnt_next <= 4; tx_en_next <= '1'; when 7 => tx_data_next <= "00110111"; req_cnt_next <= 4; tx_en_next <= '1'; when 8 => tx_data_next <= "00111000"; req_cnt_next <= 4; tx_en_next <= '1'; when 9 => tx_data_next <= "00111001"; req_cnt_next <= 4; tx_en_next <= '1'; when 10 => tx_data_next <= "01000001"; -- A req_cnt_next <= 4; tx_en_next <= '1'; when 11 => tx_data_next <= "01000010"; -- B req_cnt_next <= 4; tx_en_next <= '1'; when 12 => tx_data_next <= "01000011"; -- C req_cnt_next <= 4; tx_en_next <= '1'; when 13 => tx_data_next <= "01000100"; -- D req_cnt_next <= 4; tx_en_next <= '1'; when 14 => tx_data_next <= "01000101"; -- E req_cnt_next <= 4; tx_en_next <= '1'; when 15 => tx_data_next <= "01000110"; -- F req_cnt_next <= 4; tx_en_next <= '1'; when 16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31 => tx_data_next <= "00110001"; req_cnt_next <= 3; tx_en_next <= '1'; end case; when 3 => case reg_cnt is when 16 => tx_data_next <= "00110000"; req_cnt_next <= 4; tx_en_next <= '1'; when 17 => tx_data_next <= "00110001"; req_cnt_next <= 4; tx_en_next <= '1'; when 18 => tx_data_next <= "00110010"; req_cnt_next <= 4; tx_en_next <= '1'; when 19 => tx_data_next <= "00110011"; req_cnt_next <= 4; tx_en_next <= '1'; when 20 => tx_data_next <= "00110100"; req_cnt_next <= 4; tx_en_next <= '1'; when 21 => tx_data_next <= "00110101"; req_cnt_next <= 4; tx_en_next <= '1'; when 22 => tx_data_next <= "00110110"; req_cnt_next <= 4; tx_en_next <= '1'; when 23 => tx_data_next <= "00110111"; req_cnt_next <= 4; tx_en_next <= '1'; when 24 => tx_data_next <= "00111000"; req_cnt_next <= 4; tx_en_next <= '1'; when 25 => tx_data_next <= "00111001"; req_cnt_next <= 4; tx_en_next <= '1'; when 26 => tx_data_next <= "01000001"; -- A req_cnt_next <= 4; tx_en_next <= '1'; when 27 => tx_data_next <= "01000010"; -- B req_cnt_next <= 4; tx_en_next <= '1'; when 28 => tx_data_next <= "01000011"; -- C req_cnt_next <= 4; tx_en_next <= '1'; when 29 => tx_data_next <= "01000100"; -- D req_cnt_next <= 4; tx_en_next <= '1'; when 30 => tx_data_next <= "01000101"; -- E req_cnt_next <= 4; tx_en_next <= '1'; when 31 => tx_data_next <= "01000110"; -- F req_cnt_next <= 4; tx_en_next <= '1'; when others => NULL; end case; when 4 => tx_data_next <= "00001010"; -- 10 = LF (\n) req_cnt_next <= 0; tx_en_next <= '1'; if reg_cnt = 31 then state_next <= last; reg_cnt_next <= 0; else state_next <= send_req; reg_cnt_next <= reg_cnt + 1; end if; end case; when last => state_next <= last2; tx_data_next <= "00000000"; tx_en_next <= '1'; when last2 => if delay = 150000000 then if ig_first = '1' then state_next <= ignore; else state_next <= parse; end if; reg_cnt_next <= 0; tx_en_next <= '0'; delay_next <= 0; else delay_next <= delay + 1; end if; when ignore => if delay = 4 then delay_next <= 0; rx_en_next <= '0'; state_next <= parse; else delay_next <= delay + 1; rx_en_next <= '1'; end if; when parse => case parse_mode is when 0 => if delay = 1 then delay_next <= 0; rx_en_next <= '0'; parse_mode_next <= 1; addr_next <= std_logic_vector(to_unsigned(reg_cnt, rf_addr_w)); else rx_en_next <= '1'; delay_next <= delay + 1; end if; when 1 => case din is when "00110000"|"00110001"|"00110010"|"00110011"|"00110100"|"00110101"|"00110110"|"00110111"|"00111000"|"00111001" => reg_data_next(15 downto 12) <= din(3 downto 0); parse_mode_next <= 2; when "01000001"|"01000010"|"01000011"|"01000100"|"01000101"|"01000110" => reg_data_next(15 downto 12) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 2; when "01100001"|"01100010"|"01100011"|"01100100"|"01100101"|"01100110" => reg_data_next(15 downto 12) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 2; when others => parse_mode_next <= 0; end case; when 2 => if delay = 1 then delay_next <= 0; rx_en_next <= '0'; parse_mode_next <= 3; else rx_en_next <= '1'; delay_next <= delay + 1; end if; when 3 => case din is when "00110000"|"00110001"|"00110010"|"00110011"|"00110100"|"00110101"|"00110110"|"00110111"|"00111000"|"00111001" => reg_data_next(11 downto 8) <= din(3 downto 0); parse_mode_next <= 4; when "01000001"|"01000010"|"01000011"|"01000100"|"01000101"|"01000110" => reg_data_next(11 downto 8) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 4; when "01100001"|"01100010"|"01100011"|"01100100"|"01100101"|"01100110" => reg_data_next(11 downto 8) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 4; when others => parse_mode_next <= 2; end case; when 4 => if delay = 1 then delay_next <= 0; rx_en_next <= '0'; parse_mode_next <= 5; else rx_en_next <= '1'; delay_next <= delay + 1; end if; when 5 => case din is when "00110000"|"00110001"|"00110010"|"00110011"|"00110100"|"00110101"|"00110110"|"00110111"|"00111000"|"00111001" => reg_data_next(7 downto 4) <= din(3 downto 0); parse_mode_next <= 6; when "01000001"|"01000010"|"01000011"|"01000100"|"01000101"|"01000110" => reg_data_next(7 downto 4) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 6; when "01100001"|"01100010"|"01100011"|"01100100"|"01100101"|"01100110" => reg_data_next(7 downto 4) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 6; when others => parse_mode_next <= 4; end case; when 6 => if delay = 1 then delay_next <= 0; rx_en_next <= '0'; parse_mode_next <= 7; else rx_en_next <= '1'; delay_next <= delay + 1; end if; when 7 => case din is when "00110000"|"00110001"|"00110010"|"00110011"|"00110100"|"00110101"|"00110110"|"00110111"|"00111000"|"00111001" => reg_data_next(3 downto 0) <= din(3 downto 0); parse_mode_next <= 8; when "01000001"|"01000010"|"01000011"|"01000100"|"01000101"|"01000110" => reg_data_next(3 downto 0) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 8; when "01100001"|"01100010"|"01100011"|"01100100"|"01100101"|"01100110" => reg_data_next(3 downto 0) <= std_logic_vector(unsigned(din(3 downto 0)) + 9); parse_mode_next <= 8; when others => parse_mode_next <= 6; end case; when 8 => if delay = 2 then rx_en_next <= '0'; parse_mode_next <= 0; if reg_cnt = 31 then state_next <= idle2; delay_next <= integer'low; reg_cnt_next <= 0; else state_next <= parse; delay_next <= 0; reg_cnt_next <= reg_cnt + 1; end if; else rx_en_next <= '1'; delay_next <= delay + 1; end if; end case; when idle2 => if delay = integer'high then state_next <= idle; delay_next <= 0; else if ren_sig = '1' then state_next <= idle; delay_next <= 0; else delay_next <= delay + 1; end if; end if; tx_en_next <= '0'; rf_en_next <= '0'; ig_first_next <= '1'; end case; end process; renew_deb: process(clk) begin if clk'event and clk='1' then if reset = '1' then q0 <= '0'; q1 <= '0'; q2 <= '0'; else q0 <= renew; q1 <= q0; q2 <= q1; end if; end if; end process; ren_sig <= q0 and q1 and (not q2); tx_dout <= tx_data; tx_req <= tx_en; rx_req <= rx_en; rf_req <= rf_en; rf_addr <= addr; rf_dout <= reg_data; din <= rx_din; end Behavioral;
architecture RTL of FIFO is procedure proc1 is begin end procedure proc1; PROCEDURE PROC1 IS BEGIN END procedure PROC1; begin end architecture RTL;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------- -- (c) Copyright 1984 - 2012 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. ------------------------------------------------------------------- -- ************************************************************************ -- ------------------------------------------------------------------------------- -- Filename: axi_lite_ipif.vhd -- Version: v2.0 -- Description: This is the top level design file for the axi_lite_ipif -- function. It provides a standardized slave interface -- between the IP and the AXI. This version supports -- single read/write transfers only. It does not provide -- address pipelining or simultaneous read and write -- operations. ------------------------------------------------------------------------------- -- Structure: This section shows the hierarchical structure of axi_lite_ipif. -- -- --axi_lite_ipif.vhd -- --slave_attachment.vhd -- --address_decoder.vhd ------------------------------------------------------------------------------- -- Author: BSB -- -- History: -- -- BSB 05/20/10 -- First version -- ~~~~~~ -- - Created the first version v1.00.a -- ^^^^^^ -- ~~~~~~ -- SK 06/09/10 -- v1.01.a -- 1. updated to reduce the utilization -- Closed CR #574507 -- 2. Optimized the state machine code -- 3. Optimized the address decoder logic to generate the CE's with common logic -- 4. Address GAP decoding logic is removed and timeout counter is made active -- for all transactions. -- ^^^^^^ -- ~~~~~~ -- SK 12/16/12 -- v2.0 -- 1. up reved to major version for 2013.1 Vivado release. No logic updates. -- 2. Updated the version of AXI LITE IPIF to v2.0 in X.Y format -- 3. updated the proc common version to proc_common_base_v5_0 -- 4. No Logic Updates -- ^^^^^^ ------------------------------------------------------------------------------- -- Naming Conventions: -- active low signals: "*_n" -- clock signals: "clk", "clk_div#", "clk_#x" -- reset signals: "rst", "rst_n" -- generics: "C_*" -- user defined types: "*_TYPE" -- state machine next state: "*_ns" -- state machine current state: "*_cs" -- combinatorial signals: "*_cmb" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port "*_i" -- device pins: "*_pin" -- ports: - Names begin with Uppercase -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC> ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0; use axi_lite_ipif_v3_0.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_S_AXI_DATA_WIDTH -- AXI data bus width -- C_S_AXI_ADDR_WIDTH -- AXI address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- C_USE_WSTRB -- Use write strobs or not -- C_DPHASE_TIMEOUT -- Data phase time out counter -- C_ARD_ADDR_RANGE_ARRAY-- Base /High Address Pair for each Address Range -- C_ARD_NUM_CE_ARRAY -- Desired number of chip enables for an address range -- C_FAMILY -- Target FPGA family ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- S_AXI_ACLK -- AXI Clock -- S_AXI_ARESETN -- AXI Reset -- S_AXI_AWADDR -- AXI Write address -- S_AXI_AWVALID -- Write address valid -- S_AXI_AWREADY -- Write address ready -- S_AXI_WDATA -- Write data -- S_AXI_WSTRB -- Write strobes -- S_AXI_WVALID -- Write valid -- S_AXI_WREADY -- Write ready -- S_AXI_BRESP -- Write response -- S_AXI_BVALID -- Write response valid -- S_AXI_BREADY -- Response ready -- S_AXI_ARADDR -- Read address -- S_AXI_ARVALID -- Read address valid -- S_AXI_ARREADY -- Read address ready -- S_AXI_RDATA -- Read data -- S_AXI_RRESP -- Read response -- S_AXI_RVALID -- Read valid -- S_AXI_RREADY -- Read ready -- Bus2IP_Clk -- Synchronization clock provided to User IP -- Bus2IP_Reset -- Active high reset for use by the User IP -- Bus2IP_Addr -- Desired address of read or write operation -- Bus2IP_RNW -- Read or write indicator for the transaction -- Bus2IP_BE -- Byte enables for the data bus -- Bus2IP_CS -- Chip select for the transcations -- Bus2IP_RdCE -- Chip enables for the read -- Bus2IP_WrCE -- Chip enables for the write -- Bus2IP_Data -- Write data bus to the User IP -- IP2Bus_Data -- Input Read Data bus from the User IP -- IP2Bus_WrAck -- Active high Write Data qualifier from the IP -- IP2Bus_RdAck -- Active high Read Data qualifier from the IP -- IP2Bus_Error -- Error signal from the IP ------------------------------------------------------------------------------- entity axi_lite_ipif is generic ( C_S_AXI_DATA_WIDTH : integer range 32 to 32 := 32; C_S_AXI_ADDR_WIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(31 downto 0):= X"000001FF"; C_USE_WSTRB : integer := 0; C_DPHASE_TIMEOUT : integer range 0 to 512 := 8; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := -- not used ( X"0000_0000_7000_0000", -- IP user0 base address X"0000_0000_7000_00FF", -- IP user0 high address X"0000_0000_7000_0100", -- IP user1 base address X"0000_0000_7000_01FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := -- not used ( 4, -- User0 CE Number 12 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( --System signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_S_AXI_DATA_WIDTH/8)-1 downto 0); S_AXI_WVALID : in std_logic; S_AXI_WREADY : out std_logic; S_AXI_BRESP : out std_logic_vector(1 downto 0); S_AXI_BVALID : out std_logic; S_AXI_BREADY : in std_logic; S_AXI_ARADDR : in std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_S_AXI_DATA_WIDTH-1 downto 0); S_AXI_RRESP : out std_logic_vector(1 downto 0); S_AXI_RVALID : out std_logic; S_AXI_RREADY : in std_logic; -- Controls to the IP/IPIF modules Bus2IP_Clk : out std_logic; Bus2IP_Resetn : out std_logic; Bus2IP_Addr : out std_logic_vector ((C_S_AXI_ADDR_WIDTH-1) downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_S_AXI_DATA_WIDTH/8)-1) downto 0); Bus2IP_CS : out std_logic_vector (((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2-1) downto 0); Bus2IP_RdCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_WrCE : out std_logic_vector ((calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) downto 0); Bus2IP_Data : out std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_S_AXI_DATA_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end axi_lite_ipif; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture imp of axi_lite_ipif is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Slave Attachment ------------------------------------------------------------------------------- I_SLAVE_ATTACHMENT: entity axi_lite_ipif_v3_0.slave_attachment generic map( C_ARD_ADDR_RANGE_ARRAY => C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_IPIF_ABUS_WIDTH => C_S_AXI_ADDR_WIDTH, C_IPIF_DBUS_WIDTH => C_S_AXI_DATA_WIDTH, C_USE_WSTRB => C_USE_WSTRB, C_DPHASE_TIMEOUT => C_DPHASE_TIMEOUT, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_FAMILY => C_FAMILY ) port map( -- AXI signals S_AXI_ACLK => S_AXI_ACLK, S_AXI_ARESETN => S_AXI_ARESETN, S_AXI_AWADDR => S_AXI_AWADDR, S_AXI_AWVALID => S_AXI_AWVALID, S_AXI_AWREADY => S_AXI_AWREADY, S_AXI_WDATA => S_AXI_WDATA, S_AXI_WSTRB => S_AXI_WSTRB, S_AXI_WVALID => S_AXI_WVALID, S_AXI_WREADY => S_AXI_WREADY, S_AXI_BRESP => S_AXI_BRESP, S_AXI_BVALID => S_AXI_BVALID, S_AXI_BREADY => S_AXI_BREADY, S_AXI_ARADDR => S_AXI_ARADDR, S_AXI_ARVALID => S_AXI_ARVALID, S_AXI_ARREADY => S_AXI_ARREADY, S_AXI_RDATA => S_AXI_RDATA, S_AXI_RRESP => S_AXI_RRESP, S_AXI_RVALID => S_AXI_RVALID, S_AXI_RREADY => S_AXI_RREADY, -- IPIC signals Bus2IP_Clk => Bus2IP_Clk, Bus2IP_Resetn => Bus2IP_Resetn, Bus2IP_Addr => Bus2IP_Addr, Bus2IP_RNW => Bus2IP_RNW, Bus2IP_BE => Bus2IP_BE, Bus2IP_CS => Bus2IP_CS, Bus2IP_RdCE => Bus2IP_RdCE, Bus2IP_WrCE => Bus2IP_WrCE, Bus2IP_Data => Bus2IP_Data, IP2Bus_Data => IP2Bus_Data, IP2Bus_WrAck => IP2Bus_WrAck, IP2Bus_RdAck => IP2Bus_RdAck, IP2Bus_Error => IP2Bus_Error ); end imp;
------------------------------------------------------------------------- ---- ---- ---- Company : ELB-Elektroniklaboratorien Bonn UG ---- ---- (haftungsbeschränkt) ---- ---- ---- ------------------------------------------------------------------------- ---- ---- ---- Copyright (C) 2015 ELB ---- ---- ---- ---- This program is free software; you can redistribute it and/or ---- ---- modify it under the terms of the GNU General Public License as ---- ---- published by the Free Software Foundation; either version 3 of ---- ---- the License, or (at your option) any later version. ---- ---- ---- ---- This program is distributed in the hope that it will be useful, ---- ---- but WITHOUT ANY WARRANTY; without even the implied warranty of ---- ---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ---- ---- GNU General Public License for more details. ---- ---- ---- ---- You should have received a copy of the GNU General Public ---- ---- License along with this program; if not, see ---- ---- <http://www.gnu.org/licenses>. ---- ---- ---- ------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Controller_25AA02E48 is Port ( CLK : in STD_LOGIC; CLKDivH,CLKDivL : in std_logic_vector(3 downto 0); ReadID : in STD_LOGIC; ID : out STD_LOGIC_VECTOR (47 downto 0); SCLK, CS, MOSI : out STD_LOGIC; MISO : in STD_LOGIC); end Controller_25AA02E48; architecture Behavioral of Controller_25AA02E48 is --Signal BusyRegister : STD_LOGIC :='0'; --Signal DataRegister : STD_LOGIC_VECTOR (11 downto 0) :=(others=>'0'); --signal AddressRegister : STD_LOGIC_VECTOR (4 downto 0) :=(others=>'0'); Signal TransferRegister : STD_LOGIC_VECTOR (6 downto 0) :=(others=>'0'); -- Data and Address to be transfered. Only 15 bit because MSB is applied immidately at WE='1' Signal ReadRegister : STD_LOGIC_VECTOR(7 downto 0):=X"EE"; Signal SCLKRegister, MOSIRegister : STD_LOGIC :='0'; -- DAC draws less current if pins are low -> when idle pull low. Signal CSRegister : STD_LOGIC :='0'; -- Chip select high when idle, low for initial read cycle Signal ClockDivCounter,Final_counter : unsigned (3 downto 0):=to_unsigned(0,4);-- How many CLK-Cycles has already been waited (update SCLK, when counter reached value set in interface), second: counter to release CS Signal BitCounter : unsigned (4 downto 0):=to_unsigned(0,5); -- How many bits have been transfered? Signal NCRESCLK : STD_LOGIC; -- Next Clockcycle has Rising Edge on SCLK Signal NCFESCLK : STD_LOGIC; -- Next Clockcycle has Falling Edge on SCLK type controller_states is (waiting, -- idle state, accept command write_instruction_byte, -- write command to chip write_address, -- write read address read1, -- read three bytes read2, read3, read4, read5, read6, final_wait_to_CS ); signal cont_state : controller_states := write_instruction_byte; Signal ByteToSend : STD_LOGIC_VECTOR (7 downto 0) :=X"03"; Signal ReceivedID : STD_LOGIC_VECTOR (47 downto 0):=X"DEADDEADBEEF"; Signal WE: STD_LOGIC:='1'; Signal BusyRegister : STD_LOGIC:='0'; begin SCLK<=SCLKRegister; MOSI<=MOSIRegister; CS<=CSRegister; --Busy<=BusyRegister; ID<=ReceivedID; GenerateSCLK : Process (CLK) is begin if rising_edge(CLK) then if BusyRegister='0' then -- reset case ClockDivCounter<=to_unsigned(0,4); SCLKRegister<='0'; else ClockDivCounter<=ClockDivCounter+1; if SCLKRegister='1' then if CLKDivH = STD_LOGIC_VECTOR (ClockDivCounter) then SCLKRegister<='0'; ClockDivCounter<=to_unsigned(0,4); end if; else if CLKDivL = STD_LOGIC_VECTOR (ClockDivCounter) then SCLKRegister<='1'; ClockDivCounter<=to_unsigned(0,4); end if; end if; end if; end if; end process; Process (CLKDivL, ClockDivCounter, SCLKRegister) is begin if CLKDivL = STD_LOGIC_VECTOR (ClockDivCounter) AND SCLKRegister ='0' then NCRESCLK<='1'; else NCRESCLK<='0'; end if; end Process; Process (CLKDivH, ClockDivCounter, SCLKRegister) is begin if CLKDivH = STD_LOGIC_VECTOR (ClockDivCounter) AND SCLKRegister ='1' then NCFESCLK<='1'; else NCFESCLK<='0'; end if; end Process; Process (CLK) is begin if rising_edge(CLK) then if BusyRegister='0' then if WE='1' then TransferRegister <= ByteToSend(6 downto 0); BusyRegister<='1'; --CSRegister<='0'; MOSIRegister <=ByteToSend(7); end if; else if NCFESCLK ='1' then -- on falling edge, bits are transfered-> increase number of transferred bits BitCounter<=BitCounter+1; TransferRegister (6 downto 1) <=TransferRegister (5 downto 0); MOSIRegister <=TransferRegister(6); ReadRegister(7 downto 1) <=ReadRegister(6 downto 0); ReadRegister(0)<=MISO; end if; if NCRESCLK ='1' then -- on rising edge, change data (should work best because t_setup = t_hold = 2,5 ns) end if; if BitCounter = to_unsigned(7,5) AND NCFESCLK ='1' then -- when 16 bits have been transfered, wait until clock to cipselect time is fullfilled (min 10 ns, --CSRegister<='1'; BusyRegister<='0'; BitCounter <=to_unsigned(0,5); end if; end if; end if; end process; Process (CLK) is begin if rising_Edge(CLK) then case cont_state is when waiting => WE<='0'; CSRegister<='1'; if ReadID='1' then CSRegister<='0'; cont_state <= write_instruction_byte; ByteToSend <= X"03"; WE<='1'; end if; when write_instruction_byte => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= write_address; ByteToSend <= X"FA"; WE<='1'; end if; when write_address => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= read1; ByteToSend <= X"00"; WE<='1'; end if; when read1 => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= read2; ByteToSend <= X"00"; WE<='1'; ReceivedID(47 downto 40)<=ReadRegister; end if; when read2 => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= read3; --ByteToSend <= X"00"; ReceivedID(39 downto 32)<=ReadRegister; WE<='1'; end if; when read3 => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= read4; --ByteToSend <= X"00"; ReceivedID(31 downto 24)<=ReadRegister; WE<='1'; end if; when read4 => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= read5; --ByteToSend <= X"00"; ReceivedID(23 downto 16)<=ReadRegister; WE<='1'; end if; when read5 => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= read6; --ByteToSend <= X"00"; ReceivedID(15 downto 8)<=ReadRegister; WE<='1'; end if; when read6 => WE<='0'; if BusyRegister='0' and WE='0' then cont_state <= final_wait_to_CS; --ByteToSend <= X"00"; ReceivedID(7 downto 0)<=ReadRegister; Final_counter<=to_unsigned(0,4); end if; when final_wait_to_CS=> Final_counter<=Final_counter+1; if CLKDivL = STD_LOGIC_VECTOR(Final_counter) then cont_state <= waiting; end if; when others=> null; end case; end if; end process; end Behavioral;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc854.vhd,v 1.2 2001-10-26 16:30:00 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c01s03b01x00p12n01i00854pkg_b is constant zero : integer ; constant one : integer ; constant two : integer ; constant three: integer ; constant four : integer ; constant five : integer ; constant six : integer ; constant seven: integer ; constant eight: integer ; constant nine : integer ; constant fifteen: integer; end c01s03b01x00p12n01i00854pkg_b; package body c01s03b01x00p12n01i00854pkg_b is constant zero : integer := 0; constant one : integer := 1; constant two : integer := 2; constant three: integer := 3; constant four : integer := 4; constant five : integer := 5; constant six : integer := 6; constant seven: integer := 7; constant eight: integer := 8; constant nine : integer := 9; constant fifteen:integer:= 15; end c01s03b01x00p12n01i00854pkg_b; use work.c01s03b01x00p12n01i00854pkg_b.all; package c01s03b01x00p12n01i00854pkg_a is constant low_number : integer := 0; constant hi_number : integer := 3; subtype hi_to_low_range is integer range low_number to hi_number; type boolean_vector is array (natural range <>) of boolean; type severity_level_vector is array (natural range <>) of severity_level; type integer_vector is array (natural range <>) of integer; type real_vector is array (natural range <>) of real; type time_vector is array (natural range <>) of time; type natural_vector is array (natural range <>) of natural; type positive_vector is array (natural range <>) of positive; type record_std_package is record a: boolean; b: bit; c:character; d:severity_level; e:integer; f:real; g:time; h:natural; i:positive; end record; type array_rec_std is array (natural range <>) of record_std_package; type four_value is ('Z','0','1','X'); --enumerated type constant C1 : boolean := true; constant C2 : bit := '1'; constant C3 : character := 's'; constant C4 : severity_level := note; constant C5 : integer := 3; constant C6 : real := 3.0; constant C7 : time := 3 ns; constant C8 : natural := 1; constant C9 : positive := 1; constant dumy : bit_vector(zero to three) := "1010"; signal Sin1 : bit_vector(zero to five) ; signal Sin2 : boolean_vector(zero to five) ; signal Sin4 : severity_level_vector(zero to five) ; signal Sin5 : integer_vector(zero to five) ; signal Sin6 : real_vector(zero to five) ; signal Sin7 : time_vector(zero to five) ; signal Sin8 : natural_vector(zero to five) ; signal Sin9 : positive_vector(zero to five) ; signal Sin10: array_rec_std(zero to five) ; end c01s03b01x00p12n01i00854pkg_a; use work.c01s03b01x00p12n01i00854pkg_a.all; use work.c01s03b01x00p12n01i00854pkg_b.all; entity test is port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end; architecture test of test is begin sigout1 <= sigin1; sigout2 <= sigin2; sigout4 <= sigin4; sigout5 <= sigin5; sigout6 <= sigin6; sigout7 <= sigin7; sigout8 <= sigin8; sigout9 <= sigin9; sigout10 <= sigin10; end; configuration testbench of test is for test end for; end; use work.c01s03b01x00p12n01i00854pkg_a.all; use work.c01s03b01x00p12n01i00854pkg_b.all; ENTITY c01s03b01x00p12n01i00854ent IS END c01s03b01x00p12n01i00854ent; ARCHITECTURE c01s03b01x00p12n01i00854arch OF c01s03b01x00p12n01i00854ent IS component test port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end component; begin Sin1(zero) <='1'; Sin2(zero) <= true; Sin4(zero) <= note; Sin5(zero) <= 3; Sin6(zero) <= 3.0; Sin7(zero) <= 3 ns; Sin8(zero) <= 1; Sin9(zero) <= 1; Sin10(zero) <= (C1,C2,C3,C4,C5,C6,C7,C8,C9); K:block component test port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end component; BEGIN T5 : test port map ( Sin2(4),Sin2(5), Sin1(4),Sin1(5), Sin4(4),Sin4(5), Sin5(4),Sin5(5), Sin6(4),Sin6(5), Sin7(4),Sin7(5), Sin8(4),Sin8(5), Sin9(4),Sin9(5), Sin10(4),Sin10(5) ); G: for i in zero to three generate T1:test port map ( Sin2(i),Sin2(i+1), Sin1(i),Sin1(i+1), Sin4(i),Sin4(i+1), Sin5(i),Sin5(i+1), Sin6(i),Sin6(i+1), Sin7(i),Sin7(i+1), Sin8(i),Sin8(i+1), Sin9(i),Sin9(i+1), Sin10(i),Sin10(i+1) ); end generate; end block; TESTING: PROCESS BEGIN wait for 1 ns; assert Sin1(0) = Sin1(5) report "assignment of Sin1(0) to Sin1(4) is invalid through entity port" severity failure; assert Sin2(0) = Sin2(5) report "assignment of Sin2(0) to Sin2(4) is invalid through entity port" severity failure; assert Sin4(0) = Sin4(5) report "assignment of Sin4(0) to Sin4(4) is invalid through entity port" severity failure; assert Sin5(0) = Sin5(5) report "assignment of Sin5(0) to Sin5(4) is invalid through entity port" severity failure; assert Sin6(0) = Sin6(5) report "assignment of Sin6(0) to Sin6(4) is invalid through entity port" severity failure; assert Sin7(0) = Sin7(5) report "assignment of Sin7(0) to Sin7(4) is invalid through entity port" severity failure; assert Sin8(0) = Sin8(5) report "assignment of Sin8(0) to Sin8(4) is invalid through entity port" severity failure; assert Sin9(0) = Sin9(5) report "assignment of Sin9(0) to Sin9(4) is invalid through entity port" severity failure; assert Sin10(0) = Sin10(5) report "assignment of Sin10(0) to Sin10(4) is invalid through entity port" severity failure; assert NOT( Sin1(0) = sin1(5) and Sin2(0) = Sin2(5) and Sin4(0) = Sin4(5) and Sin5(0) = Sin5(5) and Sin6(0) = Sin6(5) and Sin7(0) = Sin7(5) and Sin8(0) = Sin8(5) and Sin9(0) = Sin9(5) and Sin10(0)= Sin10(0) ) report "***PASSED TEST: c01s03b01x00p12n01i00854" severity NOTE; assert ( Sin1(0) = sin1(5) and Sin2(0) = Sin2(5) and Sin4(0) = Sin4(5) and Sin5(0) = Sin5(5) and Sin6(0) = Sin6(5) and Sin7(0) = Sin7(5) and Sin8(0) = Sin8(5) and Sin9(0) = Sin9(5) and Sin10(0)= Sin10(0) ) report "***FAILED TEST: c01s03b01x00p12n01i00854 - If such a block configuration contains an index specification that is a discrete range, then the block configuration applies to those implicit block statements that are generated for the specified range of values of the corresponding generate index." severity ERROR; wait; END PROCESS TESTING; END c01s03b01x00p12n01i00854arch; configuration c01s03b01x00p12n01i00854cfg of c01s03b01x00p12n01i00854ent is for c01s03b01x00p12n01i00854arch for K for T5:test use configuration work.testbench; end for; for G(dumy'reverse_range(1)) for T1:test use configuration work.testbench; end for; end for; end for; end for; end;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc854.vhd,v 1.2 2001-10-26 16:30:00 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c01s03b01x00p12n01i00854pkg_b is constant zero : integer ; constant one : integer ; constant two : integer ; constant three: integer ; constant four : integer ; constant five : integer ; constant six : integer ; constant seven: integer ; constant eight: integer ; constant nine : integer ; constant fifteen: integer; end c01s03b01x00p12n01i00854pkg_b; package body c01s03b01x00p12n01i00854pkg_b is constant zero : integer := 0; constant one : integer := 1; constant two : integer := 2; constant three: integer := 3; constant four : integer := 4; constant five : integer := 5; constant six : integer := 6; constant seven: integer := 7; constant eight: integer := 8; constant nine : integer := 9; constant fifteen:integer:= 15; end c01s03b01x00p12n01i00854pkg_b; use work.c01s03b01x00p12n01i00854pkg_b.all; package c01s03b01x00p12n01i00854pkg_a is constant low_number : integer := 0; constant hi_number : integer := 3; subtype hi_to_low_range is integer range low_number to hi_number; type boolean_vector is array (natural range <>) of boolean; type severity_level_vector is array (natural range <>) of severity_level; type integer_vector is array (natural range <>) of integer; type real_vector is array (natural range <>) of real; type time_vector is array (natural range <>) of time; type natural_vector is array (natural range <>) of natural; type positive_vector is array (natural range <>) of positive; type record_std_package is record a: boolean; b: bit; c:character; d:severity_level; e:integer; f:real; g:time; h:natural; i:positive; end record; type array_rec_std is array (natural range <>) of record_std_package; type four_value is ('Z','0','1','X'); --enumerated type constant C1 : boolean := true; constant C2 : bit := '1'; constant C3 : character := 's'; constant C4 : severity_level := note; constant C5 : integer := 3; constant C6 : real := 3.0; constant C7 : time := 3 ns; constant C8 : natural := 1; constant C9 : positive := 1; constant dumy : bit_vector(zero to three) := "1010"; signal Sin1 : bit_vector(zero to five) ; signal Sin2 : boolean_vector(zero to five) ; signal Sin4 : severity_level_vector(zero to five) ; signal Sin5 : integer_vector(zero to five) ; signal Sin6 : real_vector(zero to five) ; signal Sin7 : time_vector(zero to five) ; signal Sin8 : natural_vector(zero to five) ; signal Sin9 : positive_vector(zero to five) ; signal Sin10: array_rec_std(zero to five) ; end c01s03b01x00p12n01i00854pkg_a; use work.c01s03b01x00p12n01i00854pkg_a.all; use work.c01s03b01x00p12n01i00854pkg_b.all; entity test is port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end; architecture test of test is begin sigout1 <= sigin1; sigout2 <= sigin2; sigout4 <= sigin4; sigout5 <= sigin5; sigout6 <= sigin6; sigout7 <= sigin7; sigout8 <= sigin8; sigout9 <= sigin9; sigout10 <= sigin10; end; configuration testbench of test is for test end for; end; use work.c01s03b01x00p12n01i00854pkg_a.all; use work.c01s03b01x00p12n01i00854pkg_b.all; ENTITY c01s03b01x00p12n01i00854ent IS END c01s03b01x00p12n01i00854ent; ARCHITECTURE c01s03b01x00p12n01i00854arch OF c01s03b01x00p12n01i00854ent IS component test port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end component; begin Sin1(zero) <='1'; Sin2(zero) <= true; Sin4(zero) <= note; Sin5(zero) <= 3; Sin6(zero) <= 3.0; Sin7(zero) <= 3 ns; Sin8(zero) <= 1; Sin9(zero) <= 1; Sin10(zero) <= (C1,C2,C3,C4,C5,C6,C7,C8,C9); K:block component test port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end component; BEGIN T5 : test port map ( Sin2(4),Sin2(5), Sin1(4),Sin1(5), Sin4(4),Sin4(5), Sin5(4),Sin5(5), Sin6(4),Sin6(5), Sin7(4),Sin7(5), Sin8(4),Sin8(5), Sin9(4),Sin9(5), Sin10(4),Sin10(5) ); G: for i in zero to three generate T1:test port map ( Sin2(i),Sin2(i+1), Sin1(i),Sin1(i+1), Sin4(i),Sin4(i+1), Sin5(i),Sin5(i+1), Sin6(i),Sin6(i+1), Sin7(i),Sin7(i+1), Sin8(i),Sin8(i+1), Sin9(i),Sin9(i+1), Sin10(i),Sin10(i+1) ); end generate; end block; TESTING: PROCESS BEGIN wait for 1 ns; assert Sin1(0) = Sin1(5) report "assignment of Sin1(0) to Sin1(4) is invalid through entity port" severity failure; assert Sin2(0) = Sin2(5) report "assignment of Sin2(0) to Sin2(4) is invalid through entity port" severity failure; assert Sin4(0) = Sin4(5) report "assignment of Sin4(0) to Sin4(4) is invalid through entity port" severity failure; assert Sin5(0) = Sin5(5) report "assignment of Sin5(0) to Sin5(4) is invalid through entity port" severity failure; assert Sin6(0) = Sin6(5) report "assignment of Sin6(0) to Sin6(4) is invalid through entity port" severity failure; assert Sin7(0) = Sin7(5) report "assignment of Sin7(0) to Sin7(4) is invalid through entity port" severity failure; assert Sin8(0) = Sin8(5) report "assignment of Sin8(0) to Sin8(4) is invalid through entity port" severity failure; assert Sin9(0) = Sin9(5) report "assignment of Sin9(0) to Sin9(4) is invalid through entity port" severity failure; assert Sin10(0) = Sin10(5) report "assignment of Sin10(0) to Sin10(4) is invalid through entity port" severity failure; assert NOT( Sin1(0) = sin1(5) and Sin2(0) = Sin2(5) and Sin4(0) = Sin4(5) and Sin5(0) = Sin5(5) and Sin6(0) = Sin6(5) and Sin7(0) = Sin7(5) and Sin8(0) = Sin8(5) and Sin9(0) = Sin9(5) and Sin10(0)= Sin10(0) ) report "***PASSED TEST: c01s03b01x00p12n01i00854" severity NOTE; assert ( Sin1(0) = sin1(5) and Sin2(0) = Sin2(5) and Sin4(0) = Sin4(5) and Sin5(0) = Sin5(5) and Sin6(0) = Sin6(5) and Sin7(0) = Sin7(5) and Sin8(0) = Sin8(5) and Sin9(0) = Sin9(5) and Sin10(0)= Sin10(0) ) report "***FAILED TEST: c01s03b01x00p12n01i00854 - If such a block configuration contains an index specification that is a discrete range, then the block configuration applies to those implicit block statements that are generated for the specified range of values of the corresponding generate index." severity ERROR; wait; END PROCESS TESTING; END c01s03b01x00p12n01i00854arch; configuration c01s03b01x00p12n01i00854cfg of c01s03b01x00p12n01i00854ent is for c01s03b01x00p12n01i00854arch for K for T5:test use configuration work.testbench; end for; for G(dumy'reverse_range(1)) for T1:test use configuration work.testbench; end for; end for; end for; end for; end;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc854.vhd,v 1.2 2001-10-26 16:30:00 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c01s03b01x00p12n01i00854pkg_b is constant zero : integer ; constant one : integer ; constant two : integer ; constant three: integer ; constant four : integer ; constant five : integer ; constant six : integer ; constant seven: integer ; constant eight: integer ; constant nine : integer ; constant fifteen: integer; end c01s03b01x00p12n01i00854pkg_b; package body c01s03b01x00p12n01i00854pkg_b is constant zero : integer := 0; constant one : integer := 1; constant two : integer := 2; constant three: integer := 3; constant four : integer := 4; constant five : integer := 5; constant six : integer := 6; constant seven: integer := 7; constant eight: integer := 8; constant nine : integer := 9; constant fifteen:integer:= 15; end c01s03b01x00p12n01i00854pkg_b; use work.c01s03b01x00p12n01i00854pkg_b.all; package c01s03b01x00p12n01i00854pkg_a is constant low_number : integer := 0; constant hi_number : integer := 3; subtype hi_to_low_range is integer range low_number to hi_number; type boolean_vector is array (natural range <>) of boolean; type severity_level_vector is array (natural range <>) of severity_level; type integer_vector is array (natural range <>) of integer; type real_vector is array (natural range <>) of real; type time_vector is array (natural range <>) of time; type natural_vector is array (natural range <>) of natural; type positive_vector is array (natural range <>) of positive; type record_std_package is record a: boolean; b: bit; c:character; d:severity_level; e:integer; f:real; g:time; h:natural; i:positive; end record; type array_rec_std is array (natural range <>) of record_std_package; type four_value is ('Z','0','1','X'); --enumerated type constant C1 : boolean := true; constant C2 : bit := '1'; constant C3 : character := 's'; constant C4 : severity_level := note; constant C5 : integer := 3; constant C6 : real := 3.0; constant C7 : time := 3 ns; constant C8 : natural := 1; constant C9 : positive := 1; constant dumy : bit_vector(zero to three) := "1010"; signal Sin1 : bit_vector(zero to five) ; signal Sin2 : boolean_vector(zero to five) ; signal Sin4 : severity_level_vector(zero to five) ; signal Sin5 : integer_vector(zero to five) ; signal Sin6 : real_vector(zero to five) ; signal Sin7 : time_vector(zero to five) ; signal Sin8 : natural_vector(zero to five) ; signal Sin9 : positive_vector(zero to five) ; signal Sin10: array_rec_std(zero to five) ; end c01s03b01x00p12n01i00854pkg_a; use work.c01s03b01x00p12n01i00854pkg_a.all; use work.c01s03b01x00p12n01i00854pkg_b.all; entity test is port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end; architecture test of test is begin sigout1 <= sigin1; sigout2 <= sigin2; sigout4 <= sigin4; sigout5 <= sigin5; sigout6 <= sigin6; sigout7 <= sigin7; sigout8 <= sigin8; sigout9 <= sigin9; sigout10 <= sigin10; end; configuration testbench of test is for test end for; end; use work.c01s03b01x00p12n01i00854pkg_a.all; use work.c01s03b01x00p12n01i00854pkg_b.all; ENTITY c01s03b01x00p12n01i00854ent IS END c01s03b01x00p12n01i00854ent; ARCHITECTURE c01s03b01x00p12n01i00854arch OF c01s03b01x00p12n01i00854ent IS component test port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end component; begin Sin1(zero) <='1'; Sin2(zero) <= true; Sin4(zero) <= note; Sin5(zero) <= 3; Sin6(zero) <= 3.0; Sin7(zero) <= 3 ns; Sin8(zero) <= 1; Sin9(zero) <= 1; Sin10(zero) <= (C1,C2,C3,C4,C5,C6,C7,C8,C9); K:block component test port( sigin1 : in boolean ; sigout1 : out boolean ; sigin2 : in bit ; sigout2 : out bit ; sigin4 : in severity_level ; sigout4 : out severity_level ; sigin5 : in integer ; sigout5 : out integer ; sigin6 : in real ; sigout6 : out real ; sigin7 : in time ; sigout7 : out time ; sigin8 : in natural ; sigout8 : out natural ; sigin9 : in positive ; sigout9 : out positive ; sigin10 : in record_std_package ; sigout10 : out record_std_package ); end component; BEGIN T5 : test port map ( Sin2(4),Sin2(5), Sin1(4),Sin1(5), Sin4(4),Sin4(5), Sin5(4),Sin5(5), Sin6(4),Sin6(5), Sin7(4),Sin7(5), Sin8(4),Sin8(5), Sin9(4),Sin9(5), Sin10(4),Sin10(5) ); G: for i in zero to three generate T1:test port map ( Sin2(i),Sin2(i+1), Sin1(i),Sin1(i+1), Sin4(i),Sin4(i+1), Sin5(i),Sin5(i+1), Sin6(i),Sin6(i+1), Sin7(i),Sin7(i+1), Sin8(i),Sin8(i+1), Sin9(i),Sin9(i+1), Sin10(i),Sin10(i+1) ); end generate; end block; TESTING: PROCESS BEGIN wait for 1 ns; assert Sin1(0) = Sin1(5) report "assignment of Sin1(0) to Sin1(4) is invalid through entity port" severity failure; assert Sin2(0) = Sin2(5) report "assignment of Sin2(0) to Sin2(4) is invalid through entity port" severity failure; assert Sin4(0) = Sin4(5) report "assignment of Sin4(0) to Sin4(4) is invalid through entity port" severity failure; assert Sin5(0) = Sin5(5) report "assignment of Sin5(0) to Sin5(4) is invalid through entity port" severity failure; assert Sin6(0) = Sin6(5) report "assignment of Sin6(0) to Sin6(4) is invalid through entity port" severity failure; assert Sin7(0) = Sin7(5) report "assignment of Sin7(0) to Sin7(4) is invalid through entity port" severity failure; assert Sin8(0) = Sin8(5) report "assignment of Sin8(0) to Sin8(4) is invalid through entity port" severity failure; assert Sin9(0) = Sin9(5) report "assignment of Sin9(0) to Sin9(4) is invalid through entity port" severity failure; assert Sin10(0) = Sin10(5) report "assignment of Sin10(0) to Sin10(4) is invalid through entity port" severity failure; assert NOT( Sin1(0) = sin1(5) and Sin2(0) = Sin2(5) and Sin4(0) = Sin4(5) and Sin5(0) = Sin5(5) and Sin6(0) = Sin6(5) and Sin7(0) = Sin7(5) and Sin8(0) = Sin8(5) and Sin9(0) = Sin9(5) and Sin10(0)= Sin10(0) ) report "***PASSED TEST: c01s03b01x00p12n01i00854" severity NOTE; assert ( Sin1(0) = sin1(5) and Sin2(0) = Sin2(5) and Sin4(0) = Sin4(5) and Sin5(0) = Sin5(5) and Sin6(0) = Sin6(5) and Sin7(0) = Sin7(5) and Sin8(0) = Sin8(5) and Sin9(0) = Sin9(5) and Sin10(0)= Sin10(0) ) report "***FAILED TEST: c01s03b01x00p12n01i00854 - If such a block configuration contains an index specification that is a discrete range, then the block configuration applies to those implicit block statements that are generated for the specified range of values of the corresponding generate index." severity ERROR; wait; END PROCESS TESTING; END c01s03b01x00p12n01i00854arch; configuration c01s03b01x00p12n01i00854cfg of c01s03b01x00p12n01i00854ent is for c01s03b01x00p12n01i00854arch for K for T5:test use configuration work.testbench; end for; for G(dumy'reverse_range(1)) for T1:test use configuration work.testbench; end for; end for; end for; end for; end;
-- Gaisler Ethernet core constant CFG_GRETH : integer := CONFIG_GRETH_ENABLE; constant CFG_GRETH1G : integer := CONFIG_GRETH_GIGA; constant CFG_ETH_FIFO : integer := CFG_GRETH_FIFO;
-- Gaisler Ethernet core constant CFG_GRETH : integer := CONFIG_GRETH_ENABLE; constant CFG_GRETH1G : integer := CONFIG_GRETH_GIGA; constant CFG_ETH_FIFO : integer := CFG_GRETH_FIFO;
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; library std; use std.textio.all; library work; use work.all; use work.procedures.all; entity tb_mp_writeback is end tb_mp_writeback; architecture behav of tb_mp_writeback is signal rst : std_logic := '1'; signal clk : std_logic := '0'; signal cmd_in : t_vliw := empty_vliw; signal arg_in : t_data_array(4 downto 0) := (others => (others => '0')); signal val_in : t_data_array(4 downto 0) := (others => (others => '0')); signal mem_wr : std_logic := '0'; signal mem_data : t_data := (others => '0'); signal mem_addr : std_logic_vector(9 downto 0) := (others => '0'); signal busy : std_logic := '0'; begin clock: process begin clk <= '0', '1' after 10 ns; wait for 20 ns; end process clock; process variable l : line; begin wait for 10 ns; wait for 40 ns; rst <= '0'; wait for 80 ns; cmd_in.wb <= (0 => '1', others => '0'); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); cmd_in.wb_memchunk <= (others => "00"); arg_in <= (0=> X"01", 1=> X"02",2 => X"03", 3 => X"04", 4 => X"05"); val_in <= (0=> X"11", 1=> X"12",2 => X"13", 3 => X"14", 4 => X"15"); wait for 20 ns; cmd_in.wb_assign <= (0 => "001", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb_assign <= (0 => "010", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb_assign <= (0 => "011", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb_assign <= (0 => "100", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 40 ns; cmd_in.wb <= (0 => '1', 1 => '1', others => '0'); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 20 ns; cmd_in.wb <= (0 => '1', 1 => '1', others => '0'); cmd_in.wb_assign <= (0 => "001", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 20 ns; cmd_in.wb <= (0 => '1', 1 => '1', others => '0'); cmd_in.wb_assign <= (0 => "010", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 20 ns; cmd_in.wb <= (0 => '1', 1 => '1', others => '0'); cmd_in.wb_assign <= (0 => "011", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 20 ns; cmd_in.wb <= (0 => '1', 1 => '1', others => '0'); cmd_in.wb_assign <= (0 => "100", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 40 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 120 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "001", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 120 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "010", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 120 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "011", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 120 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "100", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 80 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "001", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 80 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "010", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 80 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "011", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 80 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_assign <= (0 => "100", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "001"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "010"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "011"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "100"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "101"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "110"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; cmd_in.wb <= (others => '1'); cmd_in.wb_bitrev <= (others => "111"); cmd_in.wb_assign <= (0 => "000", 1 => "001", 2 => "010", 3 => "011", 4 => "100"); wait for 20 ns; cmd_in.wb <= (others => '0'); wait for 140 ns; wait for 160 ns; assert false report "stop" severity failure; end process; mp_writeback_i: entity work.mp_writeback port map( rst => rst, clk => clk, cmd_in => cmd_in, arg_in => arg_in, val_in => val_in, mem_wr => mem_wr, mem_data => mem_data, mem_addr => mem_addr, busy => busy ); end behav;
LIBRARY ieee; USE ieee.std_logic_1164.all; LIBRARY work; ENTITY bramki IS PORT( B : IN STD_LOGIC; A : IN STD_LOGIC; Y : OUT STD_LOGIC; Y1 : OUT STD_LOGIC); END bramki; ARCHITECTURE logic OF bramki IS BEGIN Y <= A AND B; Y1 <= A OR B; END logic;
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity reg_file is generic( constant width : natural := 32; constant depth : natural := 32 ); port( clk : in std_logic; wr_en : in std_logic; -- input rd_reg_num1 : in std_logic_vector( 4 downto 0); rd_reg_num2 : in std_logic_vector( 4 downto 0); wr_reg_num : in std_logic_vector( 4 downto 0); wr_data : in std_logic_vector( width - 1 downto 0); -- output rd_data1 : out std_logic_vector( width - 1 downto 0); rd_data2 : out std_logic_vector( width - 1 downto 0) ); end reg_file; architecture behavioral of reg_file is -- an array of size 32, width 32 type reg_array is array( 0 to 31 ) of std_logic_vector ( 31 downto 0 ); signal reg_file : reg_array := (others =>(others => '0')); begin write1 : process(clk) begin if rising_edge(clk) then if wr_en = '1' then if to_integer(unsigned(wr_reg_num)) /= 0 then reg_file(to_integer(unsigned(wr_reg_num))) <= wr_data; end if; end if; end if; end process; rd_data1 <= reg_file(to_integer(unsigned(rd_reg_num1))); rd_data2 <= reg_file(to_integer(unsigned(rd_reg_num2))); end behavioral;
library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.numeric_std.all; entity mul_328 is port ( result : out std_logic_vector(31 downto 0); in_a : in std_logic_vector(31 downto 0); in_b : in std_logic_vector(14 downto 0) ); end mul_328; architecture augh of mul_328 is signal tmp_res : signed(46 downto 0); begin -- The actual multiplication tmp_res <= signed(in_a) * signed(in_b); -- Set the output result <= std_logic_vector(tmp_res(31 downto 0)); end architecture;
library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.numeric_std.all; entity mul_328 is port ( result : out std_logic_vector(31 downto 0); in_a : in std_logic_vector(31 downto 0); in_b : in std_logic_vector(14 downto 0) ); end mul_328; architecture augh of mul_328 is signal tmp_res : signed(46 downto 0); begin -- The actual multiplication tmp_res <= signed(in_a) * signed(in_b); -- Set the output result <= std_logic_vector(tmp_res(31 downto 0)); end architecture;
entity And2 is port (x, y: in BIT; z: out BIT); end entity And2; architecture arch3 of And2 is signal xy: BIT_VECTOR (0 to 1); begin xy <= x & y; -- to attach y to x, or "concatenation" with xy select z <= '1' when "11", '0' when others; end architecture arch3; -- When entity has only one architecture, architecture name -- can be omitted
-------------------------------------------------------------------------------- -- -- FIFO Generator Core Demo Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: fg_tb_pkg.vhd -- -- Description: -- This is the demo testbench package file for fifo_generator_v8.4 core. -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE ieee.std_logic_arith.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; PACKAGE fg_tb_pkg IS FUNCTION divroundup ( data_value : INTEGER; divisor : INTEGER) RETURN INTEGER; ------------------------ FUNCTION if_then_else ( condition : BOOLEAN; true_case : INTEGER; false_case : INTEGER) RETURN INTEGER; ------------------------ FUNCTION if_then_else ( condition : BOOLEAN; true_case : STD_LOGIC; false_case : STD_LOGIC) RETURN STD_LOGIC; ------------------------ FUNCTION if_then_else ( condition : BOOLEAN; true_case : TIME; false_case : TIME) RETURN TIME; ------------------------ FUNCTION log2roundup ( data_value : INTEGER) RETURN INTEGER; ------------------------ FUNCTION hexstr_to_std_logic_vec( arg1 : string; size : integer ) RETURN std_logic_vector; ------------------------ COMPONENT fg_tb_rng IS GENERIC (WIDTH : integer := 8; SEED : integer := 3); PORT ( CLK : IN STD_LOGIC; RESET : IN STD_LOGIC; ENABLE : IN STD_LOGIC; RANDOM_NUM : OUT STD_LOGIC_VECTOR (WIDTH-1 DOWNTO 0) ); END COMPONENT; ------------------------ COMPONENT fg_tb_dgen IS GENERIC ( C_DIN_WIDTH : INTEGER := 32; C_DOUT_WIDTH : INTEGER := 32; C_CH_TYPE : INTEGER := 0; TB_SEED : INTEGER := 2 ); PORT ( RESET : IN STD_LOGIC; WR_CLK : IN STD_LOGIC; PRC_WR_EN : IN STD_LOGIC; FULL : IN STD_LOGIC; WR_EN : OUT STD_LOGIC; WR_DATA : OUT STD_LOGIC_VECTOR(C_DIN_WIDTH-1 DOWNTO 0) ); END COMPONENT; ------------------------ COMPONENT fg_tb_dverif IS GENERIC( C_DIN_WIDTH : INTEGER := 0; C_DOUT_WIDTH : INTEGER := 0; C_USE_EMBEDDED_REG : INTEGER := 0; C_CH_TYPE : INTEGER := 0; TB_SEED : INTEGER := 2 ); PORT( RESET : IN STD_LOGIC; RD_CLK : IN STD_LOGIC; PRC_RD_EN : IN STD_LOGIC; EMPTY : IN STD_LOGIC; DATA_OUT : IN STD_LOGIC_VECTOR(C_DOUT_WIDTH-1 DOWNTO 0); RD_EN : OUT STD_LOGIC; DOUT_CHK : OUT STD_LOGIC ); END COMPONENT; ------------------------ COMPONENT fg_tb_pctrl IS GENERIC( AXI_CHANNEL : STRING := "NONE"; C_APPLICATION_TYPE : INTEGER := 0; C_DIN_WIDTH : INTEGER := 0; C_DOUT_WIDTH : INTEGER := 0; C_WR_PNTR_WIDTH : INTEGER := 0; C_RD_PNTR_WIDTH : INTEGER := 0; C_CH_TYPE : INTEGER := 0; FREEZEON_ERROR : INTEGER := 0; TB_STOP_CNT : INTEGER := 2; TB_SEED : INTEGER := 2 ); PORT( RESET_WR : IN STD_LOGIC; RESET_RD : IN STD_LOGIC; WR_CLK : IN STD_LOGIC; RD_CLK : IN STD_LOGIC; FULL : IN STD_LOGIC; EMPTY : IN STD_LOGIC; ALMOST_FULL : IN STD_LOGIC; ALMOST_EMPTY : IN STD_LOGIC; DATA_IN : IN STD_LOGIC_VECTOR(C_DIN_WIDTH-1 DOWNTO 0); DATA_OUT : IN STD_LOGIC_VECTOR(C_DOUT_WIDTH-1 DOWNTO 0); DOUT_CHK : IN STD_LOGIC; PRC_WR_EN : OUT STD_LOGIC; PRC_RD_EN : OUT STD_LOGIC; RESET_EN : OUT STD_LOGIC; SIM_DONE : OUT STD_LOGIC; STATUS : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END COMPONENT; ------------------------ COMPONENT fg_tb_synth IS GENERIC( FREEZEON_ERROR : INTEGER := 0; TB_STOP_CNT : INTEGER := 0; TB_SEED : INTEGER := 1 ); PORT( WR_CLK : IN STD_LOGIC; RD_CLK : IN STD_LOGIC; RESET : IN STD_LOGIC; SIM_DONE : OUT STD_LOGIC; STATUS : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END COMPONENT; ------------------------ COMPONENT FIFO_DDR_DATA_IN_top IS PORT ( WR_CLK : IN std_logic; RD_CLK : IN std_logic; RST : IN std_logic; WR_EN : IN std_logic; RD_EN : IN std_logic; DIN : IN std_logic_vector(16-1 DOWNTO 0); DOUT : OUT std_logic_vector(16-1 DOWNTO 0); FULL : OUT std_logic; EMPTY : OUT std_logic); END COMPONENT; ------------------------ END fg_tb_pkg; PACKAGE BODY fg_tb_pkg IS FUNCTION divroundup ( data_value : INTEGER; divisor : INTEGER) RETURN INTEGER IS VARIABLE div : INTEGER; BEGIN div := data_value/divisor; IF ( (data_value MOD divisor) /= 0) THEN div := div+1; END IF; RETURN div; END divroundup; --------------------------------- FUNCTION if_then_else ( condition : BOOLEAN; true_case : INTEGER; false_case : INTEGER) RETURN INTEGER IS VARIABLE retval : INTEGER := 0; BEGIN IF condition=false THEN retval:=false_case; ELSE retval:=true_case; END IF; RETURN retval; END if_then_else; --------------------------------- FUNCTION if_then_else ( condition : BOOLEAN; true_case : STD_LOGIC; false_case : STD_LOGIC) RETURN STD_LOGIC IS VARIABLE retval : STD_LOGIC := '0'; BEGIN IF condition=false THEN retval:=false_case; ELSE retval:=true_case; END IF; RETURN retval; END if_then_else; --------------------------------- FUNCTION if_then_else ( condition : BOOLEAN; true_case : TIME; false_case : TIME) RETURN TIME IS VARIABLE retval : TIME := 0 ps; BEGIN IF condition=false THEN retval:=false_case; ELSE retval:=true_case; END IF; RETURN retval; END if_then_else; ------------------------------- FUNCTION log2roundup ( data_value : INTEGER) RETURN INTEGER IS VARIABLE width : INTEGER := 0; VARIABLE cnt : INTEGER := 1; BEGIN IF (data_value <= 1) THEN width := 1; ELSE WHILE (cnt < data_value) LOOP width := width + 1; cnt := cnt *2; END LOOP; END IF; RETURN width; END log2roundup; ------------------------------------------------------------------------------ -- hexstr_to_std_logic_vec -- This function converts a hex string to a std_logic_vector ------------------------------------------------------------------------------ FUNCTION hexstr_to_std_logic_vec( arg1 : string; size : integer ) RETURN std_logic_vector IS VARIABLE result : std_logic_vector(size-1 DOWNTO 0) := (OTHERS => '0'); VARIABLE bin : std_logic_vector(3 DOWNTO 0); VARIABLE index : integer := 0; BEGIN FOR i IN arg1'reverse_range LOOP CASE arg1(i) IS WHEN '0' => bin := (OTHERS => '0'); WHEN '1' => bin := (0 => '1', OTHERS => '0'); WHEN '2' => bin := (1 => '1', OTHERS => '0'); WHEN '3' => bin := (0 => '1', 1 => '1', OTHERS => '0'); WHEN '4' => bin := (2 => '1', OTHERS => '0'); WHEN '5' => bin := (0 => '1', 2 => '1', OTHERS => '0'); WHEN '6' => bin := (1 => '1', 2 => '1', OTHERS => '0'); WHEN '7' => bin := (3 => '0', OTHERS => '1'); WHEN '8' => bin := (3 => '1', OTHERS => '0'); WHEN '9' => bin := (0 => '1', 3 => '1', OTHERS => '0'); WHEN 'A' => bin := (0 => '0', 2 => '0', OTHERS => '1'); WHEN 'a' => bin := (0 => '0', 2 => '0', OTHERS => '1'); WHEN 'B' => bin := (2 => '0', OTHERS => '1'); WHEN 'b' => bin := (2 => '0', OTHERS => '1'); WHEN 'C' => bin := (0 => '0', 1 => '0', OTHERS => '1'); WHEN 'c' => bin := (0 => '0', 1 => '0', OTHERS => '1'); WHEN 'D' => bin := (1 => '0', OTHERS => '1'); WHEN 'd' => bin := (1 => '0', OTHERS => '1'); WHEN 'E' => bin := (0 => '0', OTHERS => '1'); WHEN 'e' => bin := (0 => '0', OTHERS => '1'); WHEN 'F' => bin := (OTHERS => '1'); WHEN 'f' => bin := (OTHERS => '1'); WHEN OTHERS => FOR j IN 0 TO 3 LOOP bin(j) := 'X'; END LOOP; END CASE; FOR j IN 0 TO 3 LOOP IF (index*4)+j < size THEN result((index*4)+j) := bin(j); END IF; END LOOP; index := index + 1; END LOOP; RETURN result; END hexstr_to_std_logic_vec; END fg_tb_pkg;
---------------------------------------------------------------------------------- -- Engineer: Noxet -- -- Module Name: md5_mux - Behavioral -- Description: -- A mux to select which hash to compare ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; -- include the hash_array type -- use work.hash_array_pkg.all; entity md5_mux is generic ( N : integer ); port ( i_hash : in hash_array(N-1 downto 0); i_select : in std_logic_vector(N-1 downto 0); -- should be ceil(log2(N-1)) o_hash : out std_logic_vector(127 downto 0) ); end md5_mux; architecture Behavioral of md5_mux is begin o_hash <= i_hash(to_integer(unsigned(i_select))); end Behavioral;
------------------------------------------------------------------------------- -- -- Title : sync -- Design : plk_mn -- ------------------------------------------------------------------------------- -- -- File : edgedet.vhd -- Generated : Wed Jul 27 09:33:40 2011 -- From : interface description file -- By : Itf2Vhdl ver. 1.22 -- ------------------------------------------------------------------------------- -- -- (c) B&R, 2011 -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- 3. Neither the name of B&R nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without prior written permission. For written -- permission, please contact office@br-automation.com -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. -- ------------------------------------------------------------------------------- -- -- 2011-07-26 V0.01 zelenkaj First version -- 2011-11-29 V0.02 zelenkaj omitted out reset -- 2011-12-12 V0.03 zelenkaj reduced to one FF -- 2012-07-30 V0.04 zelenkaj reverted to two FFs to reduce glitch -- ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; ENTITY edgeDet IS PORT ( din : IN STD_LOGIC; rising : OUT STD_LOGIC; falling : OUT STD_LOGIC; any : OUT STD_LOGIC; clk : IN STD_LOGIC; rst : IN STD_LOGIC ); END ENTITY edgeDet; ARCHITECTURE rtl OF edgeDet IS signal RegDin, RegDinL : std_logic; BEGIN any <= RegDinL xor RegDin; falling <= RegDinL and not RegDin; rising <= not RegDinL and RegDin; process(clk) begin if rising_edge(clk) then RegDin <= din; RegDinL <= RegDin; end if; end process; END ARCHITECTURE rtl;
------------------------------------------------------------------------------- -- -- Title : sync -- Design : plk_mn -- ------------------------------------------------------------------------------- -- -- File : edgedet.vhd -- Generated : Wed Jul 27 09:33:40 2011 -- From : interface description file -- By : Itf2Vhdl ver. 1.22 -- ------------------------------------------------------------------------------- -- -- (c) B&R, 2011 -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- 3. Neither the name of B&R nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without prior written permission. For written -- permission, please contact office@br-automation.com -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. -- ------------------------------------------------------------------------------- -- -- 2011-07-26 V0.01 zelenkaj First version -- 2011-11-29 V0.02 zelenkaj omitted out reset -- 2011-12-12 V0.03 zelenkaj reduced to one FF -- 2012-07-30 V0.04 zelenkaj reverted to two FFs to reduce glitch -- ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; ENTITY edgeDet IS PORT ( din : IN STD_LOGIC; rising : OUT STD_LOGIC; falling : OUT STD_LOGIC; any : OUT STD_LOGIC; clk : IN STD_LOGIC; rst : IN STD_LOGIC ); END ENTITY edgeDet; ARCHITECTURE rtl OF edgeDet IS signal RegDin, RegDinL : std_logic; BEGIN any <= RegDinL xor RegDin; falling <= RegDinL and not RegDin; rising <= not RegDinL and RegDin; process(clk) begin if rising_edge(clk) then RegDin <= din; RegDinL <= RegDin; end if; end process; END ARCHITECTURE rtl;
------------------------------------------------------------------------------- -- -- Title : sync -- Design : plk_mn -- ------------------------------------------------------------------------------- -- -- File : edgedet.vhd -- Generated : Wed Jul 27 09:33:40 2011 -- From : interface description file -- By : Itf2Vhdl ver. 1.22 -- ------------------------------------------------------------------------------- -- -- (c) B&R, 2011 -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- 3. Neither the name of B&R nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without prior written permission. For written -- permission, please contact office@br-automation.com -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. -- ------------------------------------------------------------------------------- -- -- 2011-07-26 V0.01 zelenkaj First version -- 2011-11-29 V0.02 zelenkaj omitted out reset -- 2011-12-12 V0.03 zelenkaj reduced to one FF -- 2012-07-30 V0.04 zelenkaj reverted to two FFs to reduce glitch -- ------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; ENTITY edgeDet IS PORT ( din : IN STD_LOGIC; rising : OUT STD_LOGIC; falling : OUT STD_LOGIC; any : OUT STD_LOGIC; clk : IN STD_LOGIC; rst : IN STD_LOGIC ); END ENTITY edgeDet; ARCHITECTURE rtl OF edgeDet IS signal RegDin, RegDinL : std_logic; BEGIN any <= RegDinL xor RegDin; falling <= RegDinL and not RegDin; rising <= not RegDinL and RegDin; process(clk) begin if rising_edge(clk) then RegDin <= din; RegDinL <= RegDin; end if; end process; END ARCHITECTURE rtl;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc619.vhd,v 1.3 2001-10-29 02:12:45 paw Exp $ -- $Revision: 1.3 $ -- -- --------------------------------------------------------------------- -- **************************** -- -- Ported to VHDL 93 by port93.pl - Tue Nov 5 16:37:44 1996 -- -- **************************** -- ENTITY c03s04b01x00p01n01i00619ent IS END c03s04b01x00p01n01i00619ent; ARCHITECTURE c03s04b01x00p01n01i00619arch OF c03s04b01x00p01n01i00619ent IS constant C4 : natural := 3 ; type natural_vector is array (natural range <>) of natural; subtype natural_vector_st is natural_vector(0 to 15); type natural_vector_st_file is file of natural_vector_st; constant C27 : natural_vector_st := (others => C4); BEGIN TESTING: PROCESS file filein : natural_vector_st_file open write_mode is "iofile.30"; BEGIN for i in 1 to 100 loop write(filein, C27); end loop; assert FALSE report "***PASSED TEST: c03s04b01x00p01n01i00619 - The output file will be verified by test s010266.vhd." severity NOTE; wait; END PROCESS TESTING; END c03s04b01x00p01n01i00619arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc619.vhd,v 1.3 2001-10-29 02:12:45 paw Exp $ -- $Revision: 1.3 $ -- -- --------------------------------------------------------------------- -- **************************** -- -- Ported to VHDL 93 by port93.pl - Tue Nov 5 16:37:44 1996 -- -- **************************** -- ENTITY c03s04b01x00p01n01i00619ent IS END c03s04b01x00p01n01i00619ent; ARCHITECTURE c03s04b01x00p01n01i00619arch OF c03s04b01x00p01n01i00619ent IS constant C4 : natural := 3 ; type natural_vector is array (natural range <>) of natural; subtype natural_vector_st is natural_vector(0 to 15); type natural_vector_st_file is file of natural_vector_st; constant C27 : natural_vector_st := (others => C4); BEGIN TESTING: PROCESS file filein : natural_vector_st_file open write_mode is "iofile.30"; BEGIN for i in 1 to 100 loop write(filein, C27); end loop; assert FALSE report "***PASSED TEST: c03s04b01x00p01n01i00619 - The output file will be verified by test s010266.vhd." severity NOTE; wait; END PROCESS TESTING; END c03s04b01x00p01n01i00619arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc619.vhd,v 1.3 2001-10-29 02:12:45 paw Exp $ -- $Revision: 1.3 $ -- -- --------------------------------------------------------------------- -- **************************** -- -- Ported to VHDL 93 by port93.pl - Tue Nov 5 16:37:44 1996 -- -- **************************** -- ENTITY c03s04b01x00p01n01i00619ent IS END c03s04b01x00p01n01i00619ent; ARCHITECTURE c03s04b01x00p01n01i00619arch OF c03s04b01x00p01n01i00619ent IS constant C4 : natural := 3 ; type natural_vector is array (natural range <>) of natural; subtype natural_vector_st is natural_vector(0 to 15); type natural_vector_st_file is file of natural_vector_st; constant C27 : natural_vector_st := (others => C4); BEGIN TESTING: PROCESS file filein : natural_vector_st_file open write_mode is "iofile.30"; BEGIN for i in 1 to 100 loop write(filein, C27); end loop; assert FALSE report "***PASSED TEST: c03s04b01x00p01n01i00619 - The output file will be verified by test s010266.vhd." severity NOTE; wait; END PROCESS TESTING; END c03s04b01x00p01n01i00619arch;
-------------------------------------------------------------------------------- -- Author: Parham Alvani (parham.alvani@gmail.com) -- -- Create Date: 25-04-2016 -- Module Name: p6-3.vhd -------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; entity seq_detector_3 is port (reset, clk, w : in std_logic z : out std_logic); end entity; architecture rtl of seq_detector_3 is type state is (rst, s_1, s_10, s_11, s_100, s_111) signal current_state, next_state : state; begin process (clk) begin if reset = '1' then current_state <= rst; elsif clk'event and clk = '1' then currnet_state <= next_state; end if; end process; process (current_state, w) begin if current_state = rst then if w = '1' then z <= '0'; next_state <= s_1; else z <= '0'; next_state <= rst; end if; elsif currnet_state = s_1 then if w = '1' then z <= '0'; next_state <= s_11; else z <= '0'; next_state <= s_10; end if; elsif current_state = s_11 then if w = '1' then z <= '0'; next_state <= s_111; else z <= '0'; next_state <= s_10; end if; elsif current_state = s_10 then if w = '1' then z <= '0'; next_state <= s_1; else z <= '0'; next_state <= s_100; end if; elsif current_state = s_100 then if w = '1' then z <= '1'; next_state <= s_1; else z <= '0'; next_state <= rst; end if; elsif current_state = s_111 then if w = '1' then z <= '1'; next_state <= s_1; else z <= '0'; next_state <= S_10; end if; end if; end process; end architecture;
------------------------------------------------------------------------------- -- Title : Double Buffering Control ------------------------------------------------------------------------------- -- Author : strongly-typed -- Standard : VHDL'87 ------------------------------------------------------------------------------- -- Description: ------------------------------------------------------------------------------- -- Copyright (c) 2012 strongly-typed ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.reg_file_pkg.all; use work.utils_pkg.all; entity double_buffering is port ( ready_p : in std_logic; enable_p : out std_logic; irq_p : out std_logic; ack_p : in std_logic; bank_p : out std_logic; clk : in std_logic); end double_buffering; architecture behavourial of double_buffering is signal enable_s : std_logic := '0'; signal irq_s : std_logic := '0'; signal bank_s : std_logic := '0'; signal ack_rise_s : std_logic := '0'; begin -- behavourial -- does synchronisation, can be connected directly to port pin. edge_detect_1 : entity work.edge_detect port map ( async_sig => ack_p, clk => clk, rise => ack_rise_s, fall => open); enable_p <= enable_s; irq_p <= irq_s; bank_p <= bank_s; irq_proc : process (clk) is begin -- process if rising_edge(clk) then -- rising clock edge if (ready_p = '1') then irq_s <= '1'; elsif (ack_rise_s = '1') then irq_s <= '0'; else -- keep irq_s <= irq_s; end if; end if; end process irq_proc; -- bank_proc : process (clk) is begin -- process bank_proc if rising_edge(clk) then -- rising clock edge if (ready_p = '1') and (irq_s = '0') then -- the other bank was read and is empty now (= irq_s low) bank_s <= not bank_s; end if; end if; end process bank_proc; -- types -- signals end behavourial;
------------------------------------------------------------------------------- -- Title : Double Buffering Control ------------------------------------------------------------------------------- -- Author : strongly-typed -- Standard : VHDL'87 ------------------------------------------------------------------------------- -- Description: ------------------------------------------------------------------------------- -- Copyright (c) 2012 strongly-typed ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; use work.reg_file_pkg.all; use work.utils_pkg.all; entity double_buffering is port ( ready_p : in std_logic; enable_p : out std_logic; irq_p : out std_logic; ack_p : in std_logic; bank_p : out std_logic; clk : in std_logic); end double_buffering; architecture behavourial of double_buffering is signal enable_s : std_logic := '0'; signal irq_s : std_logic := '0'; signal bank_s : std_logic := '0'; signal ack_rise_s : std_logic := '0'; begin -- behavourial -- does synchronisation, can be connected directly to port pin. edge_detect_1 : entity work.edge_detect port map ( async_sig => ack_p, clk => clk, rise => ack_rise_s, fall => open); enable_p <= enable_s; irq_p <= irq_s; bank_p <= bank_s; irq_proc : process (clk) is begin -- process if rising_edge(clk) then -- rising clock edge if (ready_p = '1') then irq_s <= '1'; elsif (ack_rise_s = '1') then irq_s <= '0'; else -- keep irq_s <= irq_s; end if; end if; end process irq_proc; -- bank_proc : process (clk) is begin -- process bank_proc if rising_edge(clk) then -- rising clock edge if (ready_p = '1') and (irq_s = '0') then -- the other bank was read and is empty now (= irq_s low) bank_s <= not bank_s; end if; end if; end process bank_proc; -- types -- signals end behavourial;
------------------------------------------------------------------------------------ -- -- -- Copyright (c) 2004, Hangouet Samuel -- -- , Jan Sebastien -- -- , Mouton Louis-Marie -- -- , Schneider Olivier all rights reserved -- -- -- -- This file is part of miniMIPS. -- -- -- -- miniMIPS is free software; you can redistribute it and/or modify -- -- it under the terms of the GNU Lesser General Public License as published by -- -- the Free Software Foundation; either version 2.1 of the License, or -- -- (at your option) any later version. -- -- -- -- miniMIPS is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- -- GNU Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser General Public License -- -- along with miniMIPS; if not, write to the Free Software -- -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- ------------------------------------------------------------------------------------ -- If you encountered any problem, please contact : -- -- lmouton@enserg.fr -- oschneid@enserg.fr -- shangoue@enserg.fr -- -------------------------------------------------------------------------- -- -- -- -- -- miniMIPS Processor : Arithmetical and logical unit -- -- -- -- -- -- -- -- Authors : Hangouet Samuel -- -- Jan Sébastien -- -- Mouton Louis-Marie -- -- Schneider Olivier -- -- -- -- june 2003 -- -------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library work; use work.pack_mips.all; entity alu is port ( clock : in bus1; reset : in bus1; op1 : in bus32; -- Operand 1 op2 : in bus32; -- Operand 2 ctrl : in alu_ctrl_type; -- Opearator control res : out bus32; -- The result is 32 bit long overflow : out bus1 -- Overflow of the result ); end alu; architecture rtl of alu is -- Signals to pre-process the operands signal efct_op1, efct_op2 : bus33; -- Effective operands of the adder (33 bits) signal comp_op2 : bus1; -- Select the opposite of operand 2 signal igno_op2 : bus1; -- Ignore op 2 (put zeros) signal sign_op1 : bus1; -- High bit of op 1 signal sign_op2 : bus1; -- High bit of op 2 signal signe : bus1; -- Signed operation (bit sign extension) signal shift_val : natural range 0 to 31; -- Value of the shift -- Signals for internal results signal res_shl, res_shr : bus32; -- Results of left and right shifter signal res_lui : bus32; -- Result of Load Upper Immediate signal res_add : bus33; -- Result of the adder signal carry : bus33; -- Carry for the adder signal nul : bus1; -- Check if the adder result is zero signal hilo : bus64; -- Internal registers to store the multiplication operation signal tmp_hilo : bus64; -- Internal registers to store the multiplication operation (synchronised) begin -- Process if the operation is signed compliant signe <= '1' when (ctrl=OP_ADD or ctrl=OP_SUB or ctrl=OP_SLT or ctrl=OP_SNEG or ctrl=OP_SPOS or ctrl=OP_LNEG or ctrl=OP_LPOS) else '0'; sign_op1 <= signe and op1(31); sign_op2 <= signe and op2(31); -- Selection of the value of the second operand : op2 or -op2 (ie not op2 + 1) comp_op2 <= '1' when -- The opposite of op2 is used (ctrl=OP_SUB or ctrl=OP_SUBU) -- Opposite of the operand 2 to obtain a substraction or (ctrl=OP_SLT or ctrl=OP_SLTU) -- Process the difference to check the lesser than operation for the operands or (ctrl=OP_EQU or ctrl=OP_NEQU) -- Process the difference to check the equality of the operands else '0'; -- by default, op2 is used igno_op2 <= '1' when -- Op 2 will be zero (when comp_op2='0') (ctrl=OP_SPOS or ctrl=OP_LNEG) -- Process if the op1 is nul with op1+0 else '0'; -- Effective signals for the adder efct_op2 <= not (sign_op2 & op2) when (comp_op2='1') else -- We take the opposite of op2 to get -op2 (we will add 1 with the carry) (others => '0') when (igno_op2='1') else -- Op2 is zero (sign_op2 & op2); -- by default we use op2 (33 bits long) efct_op1 <= sign_op1 & op1; -- Execution of the addition carry <= X"00000000" & comp_op2; -- Carry to one when -op2 is needed res_add <= std_logic_vector(unsigned(efct_op1) + unsigned(efct_op2) + unsigned(carry)); nul <= '1' when (res_add(31 downto 0)=X"00000000") else '0'; -- Check the nullity of the result -- Value of the shift for the programmable shifter shift_val <= to_integer(unsigned(op1(4 downto 0))); res_shl <= bus32(shift_left(unsigned(op2), shift_val)); res_shr <= not bus32(shift_right(unsigned(not op2) , shift_val)) when (ctrl=OP_SRA and op2(31)='1') else bus32(shift_right(unsigned(op2), shift_val)); res_lui <= op2(15 downto 0) & X"0000"; -- Affectation of the hilo register if necessary tmp_hilo <= std_logic_vector(signed(op1)*signed(op2)) when (ctrl=OP_MULT) else std_logic_vector(unsigned(op1)*unsigned(op2)) when (ctrl=OP_MULTU) else op1 & hilo(31 downto 0) when (ctrl=OP_MTHI) else hilo(63 downto 32) & op1 when (ctrl=OP_MTLO) else (others => '0'); -- Check the overflows overflow <= '1' when ((ctrl=OP_ADD and op1(31)=efct_op2(31) and op1(31)/=res_add(31)) or (ctrl=OP_SUB and op1(31)/=op2(31) and op1(31)/=res_add(31))) else '0'; -- Only ADD and SUB can overflow -- Result affectation res <= -- Arithmetical operations res_add(31 downto 0) when (ctrl=OP_ADD or ctrl=OP_ADDU or ctrl=OP_SUB or ctrl=OP_SUBU) else -- Logical operations op1 and op2 when (ctrl=OP_AND) else op1 or op2 when (ctrl=OP_OR) else op1 nor op2 when (ctrl=OP_NOR) else op1 xor op2 when (ctrl=OP_XOR) else -- Different tests : the result is one when the test is succesful (0 => res_add(32), others=>'0') when (ctrl=OP_SLTU or ctrl=OP_SLT) else (0 => nul, others=>'0') when (ctrl=OP_EQU) else (0 => not nul, others=>'0') when (ctrl=OP_NEQU) else (0 => op1(31), others=>'0') when (ctrl=OP_SNEG) else (0 => not (op1(31) or nul), others=>'0') when (ctrl=OP_SPOS) else (0 => (op1(31) or nul), others=>'0') when (ctrl=OP_LNEG) else (0 => not op1(31), others=>'0') when (ctrl=OP_LPOS) else -- Shifts res_shl when (ctrl=OP_SLL) else res_shr when (ctrl=OP_SRL or ctrl=OP_SRA) else res_lui when (ctrl=OP_LUI) else -- Internal registers hilo(63 downto 32) when (ctrl=OP_MFHI) else hilo(31 downto 0) when (ctrl=OP_MFLO or ctrl=OP_MULT or ctrl=OP_MULTU) else op1 when (ctrl=OP_MTHI or ctrl=OP_MTLO) else op2 when (ctrl=OP_OP2) else -- Always true X"00000001" when (ctrl=OP_OUI) else -- Unknown operation or nul result desired (others => '0'); -- Save the hilo register process (clock) begin if clock = '1' and clock'event then if reset = '1' then hilo <= (others => '0'); elsif (ctrl = OP_MULT) or (ctrl = OP_MULTU) or (ctrl = OP_MTLO) or (ctrl = OP_MTHI) then hilo <= tmp_hilo; end if; end if; end process; end rtl;
-------------------------------------------------------------------------------- -- -- FIFO Generator Core Demo Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: fg_tb_synth.vhd -- -- Description: -- This is the demo testbench for fifo_generator core. -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.STD_LOGIC_1164.ALL; USE ieee.STD_LOGIC_unsigned.ALL; USE IEEE.STD_LOGIC_arith.ALL; USE ieee.numeric_std.ALL; USE ieee.STD_LOGIC_misc.ALL; LIBRARY std; USE std.textio.ALL; LIBRARY unisim; USE unisim.vcomponents.ALL; LIBRARY work; USE work.fg_tb_pkg.ALL; -------------------------------------------------------------------------------- -- Entity Declaration -------------------------------------------------------------------------------- ENTITY fg_tb_synth IS GENERIC( FREEZEON_ERROR : INTEGER := 0; TB_STOP_CNT : INTEGER := 0; TB_SEED : INTEGER := 1 ); PORT( WR_CLK : IN STD_LOGIC; RD_CLK : IN STD_LOGIC; RESET : IN STD_LOGIC; SIM_DONE : OUT STD_LOGIC; STATUS : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) ); END ENTITY; ARCHITECTURE simulation_arch OF fg_tb_synth IS -- FIFO interface signal declarations SIGNAL wr_clk_i : STD_LOGIC; SIGNAL rd_clk_i : STD_LOGIC; SIGNAL valid : STD_LOGIC; SIGNAL rst : STD_LOGIC; SIGNAL wr_en : STD_LOGIC; SIGNAL rd_en : STD_LOGIC; SIGNAL din : STD_LOGIC_VECTOR(1-1 DOWNTO 0); SIGNAL dout : STD_LOGIC_VECTOR(1-1 DOWNTO 0); SIGNAL full : STD_LOGIC; SIGNAL empty : STD_LOGIC; -- TB Signals SIGNAL wr_data : STD_LOGIC_VECTOR(1-1 DOWNTO 0); SIGNAL dout_i : STD_LOGIC_VECTOR(1-1 DOWNTO 0); SIGNAL wr_en_i : STD_LOGIC := '0'; SIGNAL rd_en_i : STD_LOGIC := '0'; SIGNAL full_i : STD_LOGIC := '0'; SIGNAL empty_i : STD_LOGIC := '0'; SIGNAL almost_full_i : STD_LOGIC := '0'; SIGNAL almost_empty_i : STD_LOGIC := '0'; SIGNAL prc_we_i : STD_LOGIC := '0'; SIGNAL prc_re_i : STD_LOGIC := '0'; SIGNAL dout_chk_i : STD_LOGIC := '0'; SIGNAL rst_int_rd : STD_LOGIC := '0'; SIGNAL rst_int_wr : STD_LOGIC := '0'; SIGNAL rst_s_wr1 : STD_LOGIC := '0'; SIGNAL rst_s_wr2 : STD_LOGIC := '0'; SIGNAL rst_gen_rd : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); SIGNAL rst_s_wr3 : STD_LOGIC := '0'; SIGNAL rst_s_rd : STD_LOGIC := '0'; SIGNAL reset_en : STD_LOGIC := '0'; SIGNAL rst_async_wr1 : STD_LOGIC := '0'; SIGNAL rst_async_wr2 : STD_LOGIC := '0'; SIGNAL rst_async_wr3 : STD_LOGIC := '0'; SIGNAL rst_async_rd1 : STD_LOGIC := '0'; SIGNAL rst_async_rd2 : STD_LOGIC := '0'; SIGNAL rst_async_rd3 : STD_LOGIC := '0'; BEGIN ---- Reset generation logic ----- rst_int_wr <= rst_async_wr3 OR rst_s_wr3; rst_int_rd <= rst_async_rd3 OR rst_s_rd; --Testbench reset synchronization PROCESS(rd_clk_i,RESET) BEGIN IF(RESET = '1') THEN rst_async_rd1 <= '1'; rst_async_rd2 <= '1'; rst_async_rd3 <= '1'; ELSIF(rd_clk_i'event AND rd_clk_i='1') THEN rst_async_rd1 <= RESET; rst_async_rd2 <= rst_async_rd1; rst_async_rd3 <= rst_async_rd2; END IF; END PROCESS; PROCESS(wr_clk_i,RESET) BEGIN IF(RESET = '1') THEN rst_async_wr1 <= '1'; rst_async_wr2 <= '1'; rst_async_wr3 <= '1'; ELSIF(wr_clk_i'event AND wr_clk_i='1') THEN rst_async_wr1 <= RESET; rst_async_wr2 <= rst_async_wr1; rst_async_wr3 <= rst_async_wr2; END IF; END PROCESS; --Soft reset for core and testbench PROCESS(rd_clk_i) BEGIN IF(rd_clk_i'event AND rd_clk_i='1') THEN rst_gen_rd <= rst_gen_rd + "1"; IF(reset_en = '1' AND AND_REDUCE(rst_gen_rd) = '1') THEN rst_s_rd <= '1'; assert false report "Reset applied..Memory Collision checks are not valid" severity note; ELSE IF(AND_REDUCE(rst_gen_rd) = '1' AND rst_s_rd = '1') THEN rst_s_rd <= '0'; END IF; END IF; END IF; END PROCESS; PROCESS(wr_clk_i) BEGIN IF(wr_clk_i'event AND wr_clk_i='1') THEN rst_s_wr1 <= rst_s_rd; rst_s_wr2 <= rst_s_wr1; rst_s_wr3 <= rst_s_wr2; IF(rst_s_wr3 = '1' AND rst_s_wr2 = '0') THEN assert false report "Reset removed..Memory Collision checks are valid" severity note; END IF; END IF; END PROCESS; ------------------ ---- Clock buffers for testbench ---- wr_clk_buf: bufg PORT map( i => WR_CLK, o => wr_clk_i ); rdclk_buf: bufg PORT map( i => RD_CLK, o => rd_clk_i ); ------------------ rst <= RESET OR rst_s_rd AFTER 12 ns; din <= wr_data; dout_i <= dout; wr_en <= wr_en_i; rd_en <= rd_en_i; full_i <= full; empty_i <= empty; fg_dg_nv: fg_tb_dgen GENERIC MAP ( C_DIN_WIDTH => 1, C_DOUT_WIDTH => 1, TB_SEED => TB_SEED, C_CH_TYPE => 0 ) PORT MAP ( -- Write Port RESET => rst_int_wr, WR_CLK => wr_clk_i, PRC_WR_EN => prc_we_i, FULL => full_i, WR_EN => wr_en_i, WR_DATA => wr_data ); fg_dv_nv: fg_tb_dverif GENERIC MAP ( C_DOUT_WIDTH => 1, C_DIN_WIDTH => 1, C_USE_EMBEDDED_REG => 0, TB_SEED => TB_SEED, C_CH_TYPE => 0 ) PORT MAP( RESET => rst_int_rd, RD_CLK => rd_clk_i, PRC_RD_EN => prc_re_i, RD_EN => rd_en_i, EMPTY => empty_i, DATA_OUT => dout_i, DOUT_CHK => dout_chk_i ); fg_pc_nv: fg_tb_pctrl GENERIC MAP ( AXI_CHANNEL => "Native", C_APPLICATION_TYPE => 0, C_DOUT_WIDTH => 1, C_DIN_WIDTH => 1, C_WR_PNTR_WIDTH => 4, C_RD_PNTR_WIDTH => 4, C_CH_TYPE => 0, FREEZEON_ERROR => FREEZEON_ERROR, TB_SEED => TB_SEED, TB_STOP_CNT => TB_STOP_CNT ) PORT MAP( RESET_WR => rst_int_wr, RESET_RD => rst_int_rd, RESET_EN => reset_en, WR_CLK => wr_clk_i, RD_CLK => rd_clk_i, PRC_WR_EN => prc_we_i, PRC_RD_EN => prc_re_i, FULL => full_i, ALMOST_FULL => almost_full_i, ALMOST_EMPTY => almost_empty_i, DOUT_CHK => dout_chk_i, EMPTY => empty_i, DATA_IN => wr_data, DATA_OUT => dout, SIM_DONE => SIM_DONE, STATUS => STATUS ); fg_inst : pulse_regen_k7_top PORT MAP ( WR_CLK => wr_clk_i, RD_CLK => rd_clk_i, VALID => valid, RST => rst, WR_EN => wr_en, RD_EN => rd_en, DIN => din, DOUT => dout, FULL => full, EMPTY => empty); END ARCHITECTURE;
architecture rtl of fifo is type t_record is record a : std_logic; b : std_logic; end record t_record; type t_record is record a : std_logic; b : std_logic; end record t_record; type t_record is record a : std_logic; b : std_logic; end record; begin end architecture rtl;
-- Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. -- -------------------------------------------------------------------------------- -- Tool Version: Vivado v.2017.2 (win64) Build 1909853 Thu Jun 15 18:39:09 MDT 2017 -- Date : Wed Sep 20 21:07:52 2017 -- Host : EffulgentTome running 64-bit major release (build 9200) -- Command : write_vhdl -force -mode funcsim -- c:/Users/markb/Source/Repos/FPGA_Sandbox/RecComp/Lab1/my_lab_1/my_lab_1.srcs/sources_1/bd/zqynq_lab_1_design/ip/zqynq_lab_1_design_axi_gpio_0_0/zqynq_lab_1_design_axi_gpio_0_0_sim_netlist.vhdl -- Design : zqynq_lab_1_design_axi_gpio_0_0 -- Purpose : This VHDL netlist is a functional simulation representation of the design and should not be modified or -- synthesized. This netlist cannot be used for SDF annotated simulation. -- Device : xc7z020clg484-1 -- -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity zqynq_lab_1_design_axi_gpio_0_0_GPIO_Core is port ( D : out STD_LOGIC_VECTOR ( 7 downto 0 ); gpio_io_o : out STD_LOGIC_VECTOR ( 7 downto 0 ); GPIO_xferAck_i : out STD_LOGIC; gpio_xferAck_Reg : out STD_LOGIC; ip2bus_rdack_i : out STD_LOGIC; ip2bus_wrack_i_D1_reg : out STD_LOGIC; gpio_io_t : out STD_LOGIC_VECTOR ( 7 downto 0 ); bus2ip_rnw_i_reg : in STD_LOGIC; s_axi_aclk : in STD_LOGIC; SS : in STD_LOGIC_VECTOR ( 0 to 0 ); bus2ip_rnw : in STD_LOGIC; bus2ip_cs : in STD_LOGIC; E : in STD_LOGIC_VECTOR ( 0 to 0 ); \MEM_DECODE_GEN[0].cs_out_i_reg[0]\ : in STD_LOGIC_VECTOR ( 7 downto 0 ); rst_reg : in STD_LOGIC_VECTOR ( 0 to 0 ) ); attribute ORIG_REF_NAME : string; attribute ORIG_REF_NAME of zqynq_lab_1_design_axi_gpio_0_0_GPIO_Core : entity is "GPIO_Core"; end zqynq_lab_1_design_axi_gpio_0_0_GPIO_Core; architecture STRUCTURE of zqynq_lab_1_design_axi_gpio_0_0_GPIO_Core is signal \^gpio_xferack_i\ : STD_LOGIC; signal \^gpio_io_o\ : STD_LOGIC_VECTOR ( 7 downto 0 ); signal \^gpio_xferack_reg\ : STD_LOGIC; signal iGPIO_xferAck : STD_LOGIC; attribute SOFT_HLUTNM : string; attribute SOFT_HLUTNM of iGPIO_xferAck_i_1 : label is "soft_lutpair4"; attribute SOFT_HLUTNM of ip2bus_rdack_i_D1_i_1 : label is "soft_lutpair4"; begin GPIO_xferAck_i <= \^gpio_xferack_i\; gpio_io_o(7 downto 0) <= \^gpio_io_o\(7 downto 0); gpio_xferAck_Reg <= \^gpio_xferack_reg\; \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(7), Q => D(7), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[1].GPIO_DBus_i_reg[25]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(6), Q => D(6), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[2].GPIO_DBus_i_reg[26]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(5), Q => D(5), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[3].GPIO_DBus_i_reg[27]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(4), Q => D(4), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[4].GPIO_DBus_i_reg[28]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(3), Q => D(3), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[5].GPIO_DBus_i_reg[29]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(2), Q => D(2), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[6].GPIO_DBus_i_reg[30]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(1), Q => D(1), R => bus2ip_rnw_i_reg ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[7].GPIO_DBus_i_reg[31]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_io_o\(0), Q => D(0), R => bus2ip_rnw_i_reg ); \Not_Dual.gpio_Data_Out_reg[0]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(7), Q => \^gpio_io_o\(7), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[1]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(6), Q => \^gpio_io_o\(6), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[2]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(5), Q => \^gpio_io_o\(5), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[3]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(4), Q => \^gpio_io_o\(4), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[4]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(3), Q => \^gpio_io_o\(3), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[5]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(2), Q => \^gpio_io_o\(2), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[6]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(1), Q => \^gpio_io_o\(1), R => SS(0) ); \Not_Dual.gpio_Data_Out_reg[7]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => E(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(0), Q => \^gpio_io_o\(0), R => SS(0) ); \Not_Dual.gpio_OE_reg[0]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(7), Q => gpio_io_t(7), S => SS(0) ); \Not_Dual.gpio_OE_reg[1]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(6), Q => gpio_io_t(6), S => SS(0) ); \Not_Dual.gpio_OE_reg[2]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(5), Q => gpio_io_t(5), S => SS(0) ); \Not_Dual.gpio_OE_reg[3]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(4), Q => gpio_io_t(4), S => SS(0) ); \Not_Dual.gpio_OE_reg[4]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(3), Q => gpio_io_t(3), S => SS(0) ); \Not_Dual.gpio_OE_reg[5]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(2), Q => gpio_io_t(2), S => SS(0) ); \Not_Dual.gpio_OE_reg[6]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(1), Q => gpio_io_t(1), S => SS(0) ); \Not_Dual.gpio_OE_reg[7]\: unisim.vcomponents.FDSE generic map( INIT => '1' ) port map ( C => s_axi_aclk, CE => rst_reg(0), D => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(0), Q => gpio_io_t(0), S => SS(0) ); gpio_xferAck_Reg_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \^gpio_xferack_i\, Q => \^gpio_xferack_reg\, R => SS(0) ); iGPIO_xferAck_i_1: unisim.vcomponents.LUT3 generic map( INIT => X"02" ) port map ( I0 => bus2ip_cs, I1 => \^gpio_xferack_reg\, I2 => \^gpio_xferack_i\, O => iGPIO_xferAck ); iGPIO_xferAck_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => iGPIO_xferAck, Q => \^gpio_xferack_i\, R => SS(0) ); ip2bus_rdack_i_D1_i_1: unisim.vcomponents.LUT2 generic map( INIT => X"8" ) port map ( I0 => \^gpio_xferack_i\, I1 => bus2ip_rnw, O => ip2bus_rdack_i ); ip2bus_wrack_i_D1_i_1: unisim.vcomponents.LUT2 generic map( INIT => X"2" ) port map ( I0 => \^gpio_xferack_i\, I1 => bus2ip_rnw, O => ip2bus_wrack_i_D1_reg ); end STRUCTURE; library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity zqynq_lab_1_design_axi_gpio_0_0_address_decoder is port ( \MEM_DECODE_GEN[0].cs_out_i_reg[0]_0\ : out STD_LOGIC; E : out STD_LOGIC_VECTOR ( 0 to 0 ); \Not_Dual.gpio_OE_reg[0]\ : out STD_LOGIC_VECTOR ( 0 to 0 ); s_axi_arready : out STD_LOGIC; s_axi_wready : out STD_LOGIC; D : out STD_LOGIC_VECTOR ( 7 downto 0 ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ : out STD_LOGIC; s_axi_aclk : in STD_LOGIC; rst_reg : in STD_LOGIC; Q : in STD_LOGIC_VECTOR ( 2 downto 0 ); bus2ip_rnw_i_reg : in STD_LOGIC; ip2bus_rdack_i_D1 : in STD_LOGIC; is_read : in STD_LOGIC; \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\ : in STD_LOGIC_VECTOR ( 3 downto 0 ); ip2bus_wrack_i_D1 : in STD_LOGIC; is_write_reg : in STD_LOGIC; s_axi_wdata : in STD_LOGIC_VECTOR ( 15 downto 0 ); start2_reg : in STD_LOGIC; s_axi_aresetn : in STD_LOGIC; gpio_xferAck_Reg : in STD_LOGIC; GPIO_xferAck_i : in STD_LOGIC ); attribute ORIG_REF_NAME : string; attribute ORIG_REF_NAME of zqynq_lab_1_design_axi_gpio_0_0_address_decoder : entity is "address_decoder"; end zqynq_lab_1_design_axi_gpio_0_0_address_decoder; architecture STRUCTURE of zqynq_lab_1_design_axi_gpio_0_0_address_decoder is signal \MEM_DECODE_GEN[0].cs_out_i[0]_i_1_n_0\ : STD_LOGIC; signal \^mem_decode_gen[0].cs_out_i_reg[0]_0\ : STD_LOGIC; signal \^s_axi_arready\ : STD_LOGIC; signal \^s_axi_wready\ : STD_LOGIC; begin \MEM_DECODE_GEN[0].cs_out_i_reg[0]_0\ <= \^mem_decode_gen[0].cs_out_i_reg[0]_0\; s_axi_arready <= \^s_axi_arready\; s_axi_wready <= \^s_axi_wready\; \MEM_DECODE_GEN[0].cs_out_i[0]_i_1\: unisim.vcomponents.LUT5 generic map( INIT => X"000000E0" ) port map ( I0 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I1 => start2_reg, I2 => s_axi_aresetn, I3 => \^s_axi_arready\, I4 => \^s_axi_wready\, O => \MEM_DECODE_GEN[0].cs_out_i[0]_i_1_n_0\ ); \MEM_DECODE_GEN[0].cs_out_i_reg[0]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => \MEM_DECODE_GEN[0].cs_out_i[0]_i_1_n_0\, Q => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, R => '0' ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[7].GPIO_DBus_i[31]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FFF7" ) port map ( I0 => bus2ip_rnw_i_reg, I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => gpio_xferAck_Reg, I3 => GPIO_xferAck_i, O => \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ ); \Not_Dual.gpio_Data_Out[0]_i_1\: unisim.vcomponents.LUT6 generic map( INIT => X"AAAAAAAAAAABAAAA" ) port map ( I0 => rst_reg, I1 => Q(1), I2 => bus2ip_rnw_i_reg, I3 => Q(0), I4 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I5 => Q(2), O => E(0) ); \Not_Dual.gpio_Data_Out[0]_i_2\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(7), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(15), O => D(7) ); \Not_Dual.gpio_Data_Out[1]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(6), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(14), O => D(6) ); \Not_Dual.gpio_Data_Out[2]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(5), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(13), O => D(5) ); \Not_Dual.gpio_Data_Out[3]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(4), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(12), O => D(4) ); \Not_Dual.gpio_Data_Out[4]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(3), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(11), O => D(3) ); \Not_Dual.gpio_Data_Out[5]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(2), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(10), O => D(2) ); \Not_Dual.gpio_Data_Out[6]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(1), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(9), O => D(1) ); \Not_Dual.gpio_Data_Out[7]_i_1\: unisim.vcomponents.LUT4 generic map( INIT => X"FB08" ) port map ( I0 => s_axi_wdata(0), I1 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I2 => Q(1), I3 => s_axi_wdata(8), O => D(0) ); \Not_Dual.gpio_OE[0]_i_1\: unisim.vcomponents.LUT6 generic map( INIT => X"AAAAAAAAAAAEAAAA" ) port map ( I0 => rst_reg, I1 => Q(0), I2 => Q(1), I3 => bus2ip_rnw_i_reg, I4 => \^mem_decode_gen[0].cs_out_i_reg[0]_0\, I5 => Q(2), O => \Not_Dual.gpio_OE_reg[0]\(0) ); s_axi_arready_INST_0: unisim.vcomponents.LUT6 generic map( INIT => X"AAAAAAAAAAAEAAAA" ) port map ( I0 => ip2bus_rdack_i_D1, I1 => is_read, I2 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(2), I3 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(1), I4 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(3), I5 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(0), O => \^s_axi_arready\ ); s_axi_wready_INST_0: unisim.vcomponents.LUT6 generic map( INIT => X"AAAAAAAAAAAEAAAA" ) port map ( I0 => ip2bus_wrack_i_D1, I1 => is_write_reg, I2 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(2), I3 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(1), I4 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(3), I5 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(0), O => \^s_axi_wready\ ); end STRUCTURE; library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity zqynq_lab_1_design_axi_gpio_0_0_slave_attachment is port ( SR : out STD_LOGIC; \Not_Dual.gpio_Data_Out_reg[0]\ : out STD_LOGIC; \MEM_DECODE_GEN[0].cs_out_i_reg[0]\ : out STD_LOGIC; s_axi_rvalid : out STD_LOGIC; s_axi_bvalid : out STD_LOGIC; s_axi_arready : out STD_LOGIC; E : out STD_LOGIC_VECTOR ( 0 to 0 ); \Not_Dual.gpio_OE_reg[0]\ : out STD_LOGIC_VECTOR ( 0 to 0 ); s_axi_wready : out STD_LOGIC; D : out STD_LOGIC_VECTOR ( 7 downto 0 ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ : out STD_LOGIC; s_axi_rdata : out STD_LOGIC_VECTOR ( 7 downto 0 ); s_axi_aclk : in STD_LOGIC; s_axi_arvalid : in STD_LOGIC; s_axi_awvalid : in STD_LOGIC; s_axi_wvalid : in STD_LOGIC; s_axi_araddr : in STD_LOGIC_VECTOR ( 2 downto 0 ); s_axi_awaddr : in STD_LOGIC_VECTOR ( 2 downto 0 ); s_axi_aresetn : in STD_LOGIC; s_axi_rready : in STD_LOGIC; s_axi_bready : in STD_LOGIC; ip2bus_rdack_i_D1 : in STD_LOGIC; ip2bus_wrack_i_D1 : in STD_LOGIC; s_axi_wdata : in STD_LOGIC_VECTOR ( 15 downto 0 ); gpio_xferAck_Reg : in STD_LOGIC; GPIO_xferAck_i : in STD_LOGIC; Q : in STD_LOGIC_VECTOR ( 7 downto 0 ) ); attribute ORIG_REF_NAME : string; attribute ORIG_REF_NAME of zqynq_lab_1_design_axi_gpio_0_0_slave_attachment : entity is "slave_attachment"; end zqynq_lab_1_design_axi_gpio_0_0_slave_attachment; architecture STRUCTURE of zqynq_lab_1_design_axi_gpio_0_0_slave_attachment is signal \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\ : STD_LOGIC_VECTOR ( 3 downto 0 ); signal \^not_dual.gpio_data_out_reg[0]\ : STD_LOGIC; signal \^sr\ : STD_LOGIC; signal bus2ip_addr : STD_LOGIC_VECTOR ( 0 to 6 ); signal \bus2ip_addr_i[2]_i_1_n_0\ : STD_LOGIC; signal \bus2ip_addr_i[3]_i_1_n_0\ : STD_LOGIC; signal \bus2ip_addr_i[8]_i_1_n_0\ : STD_LOGIC; signal \bus2ip_addr_i[8]_i_2_n_0\ : STD_LOGIC; signal bus2ip_rnw_i06_out : STD_LOGIC; signal clear : STD_LOGIC; signal is_read : STD_LOGIC; signal is_read_i_1_n_0 : STD_LOGIC; signal is_write : STD_LOGIC; signal is_write_i_1_n_0 : STD_LOGIC; signal is_write_reg_n_0 : STD_LOGIC; signal p_0_out : STD_LOGIC_VECTOR ( 1 downto 0 ); signal p_1_in : STD_LOGIC; signal plusOp : STD_LOGIC_VECTOR ( 3 downto 0 ); signal \^s_axi_arready\ : STD_LOGIC; signal \^s_axi_bvalid\ : STD_LOGIC; signal s_axi_bvalid_i_i_1_n_0 : STD_LOGIC; signal \s_axi_rdata_i[7]_i_1_n_0\ : STD_LOGIC; signal \^s_axi_rvalid\ : STD_LOGIC; signal s_axi_rvalid_i_i_1_n_0 : STD_LOGIC; signal \^s_axi_wready\ : STD_LOGIC; signal start2 : STD_LOGIC; signal start2_i_1_n_0 : STD_LOGIC; signal state : STD_LOGIC_VECTOR ( 1 downto 0 ); signal \state1__2\ : STD_LOGIC; signal \state[1]_i_3_n_0\ : STD_LOGIC; attribute SOFT_HLUTNM : string; attribute SOFT_HLUTNM of \INCLUDE_DPHASE_TIMER.dpto_cnt[0]_i_1\ : label is "soft_lutpair3"; attribute SOFT_HLUTNM of \INCLUDE_DPHASE_TIMER.dpto_cnt[1]_i_1\ : label is "soft_lutpair3"; attribute SOFT_HLUTNM of \INCLUDE_DPHASE_TIMER.dpto_cnt[2]_i_1\ : label is "soft_lutpair2"; attribute SOFT_HLUTNM of \INCLUDE_DPHASE_TIMER.dpto_cnt[3]_i_2\ : label is "soft_lutpair2"; attribute SOFT_HLUTNM of \bus2ip_addr_i[3]_i_1\ : label is "soft_lutpair0"; attribute SOFT_HLUTNM of bus2ip_rnw_i_i_1 : label is "soft_lutpair0"; attribute SOFT_HLUTNM of start2_i_1 : label is "soft_lutpair1"; attribute SOFT_HLUTNM of \state[1]_i_3\ : label is "soft_lutpair1"; begin \Not_Dual.gpio_Data_Out_reg[0]\ <= \^not_dual.gpio_data_out_reg[0]\; SR <= \^sr\; s_axi_arready <= \^s_axi_arready\; s_axi_bvalid <= \^s_axi_bvalid\; s_axi_rvalid <= \^s_axi_rvalid\; s_axi_wready <= \^s_axi_wready\; \INCLUDE_DPHASE_TIMER.dpto_cnt[0]_i_1\: unisim.vcomponents.LUT1 generic map( INIT => X"1" ) port map ( I0 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(0), O => plusOp(0) ); \INCLUDE_DPHASE_TIMER.dpto_cnt[1]_i_1\: unisim.vcomponents.LUT2 generic map( INIT => X"6" ) port map ( I0 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(0), I1 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(1), O => plusOp(1) ); \INCLUDE_DPHASE_TIMER.dpto_cnt[2]_i_1\: unisim.vcomponents.LUT3 generic map( INIT => X"78" ) port map ( I0 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(0), I1 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(1), I2 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(2), O => plusOp(2) ); \INCLUDE_DPHASE_TIMER.dpto_cnt[3]_i_1\: unisim.vcomponents.LUT2 generic map( INIT => X"9" ) port map ( I0 => state(0), I1 => state(1), O => clear ); \INCLUDE_DPHASE_TIMER.dpto_cnt[3]_i_2\: unisim.vcomponents.LUT4 generic map( INIT => X"7F80" ) port map ( I0 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(1), I1 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(0), I2 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(2), I3 => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(3), O => plusOp(3) ); \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[0]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => plusOp(0), Q => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(0), R => clear ); \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[1]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => plusOp(1), Q => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(1), R => clear ); \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[2]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => plusOp(2), Q => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(2), R => clear ); \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => plusOp(3), Q => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(3), R => clear ); I_DECODER: entity work.zqynq_lab_1_design_axi_gpio_0_0_address_decoder port map ( D(7 downto 0) => D(7 downto 0), E(0) => E(0), GPIO_xferAck_i => GPIO_xferAck_i, \INCLUDE_DPHASE_TIMER.dpto_cnt_reg[3]\(3 downto 0) => \INCLUDE_DPHASE_TIMER.dpto_cnt_reg__0\(3 downto 0), \MEM_DECODE_GEN[0].cs_out_i_reg[0]_0\ => \MEM_DECODE_GEN[0].cs_out_i_reg[0]\, \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ => \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\, \Not_Dual.gpio_OE_reg[0]\(0) => \Not_Dual.gpio_OE_reg[0]\(0), Q(2) => bus2ip_addr(0), Q(1) => bus2ip_addr(5), Q(0) => bus2ip_addr(6), bus2ip_rnw_i_reg => \^not_dual.gpio_data_out_reg[0]\, gpio_xferAck_Reg => gpio_xferAck_Reg, ip2bus_rdack_i_D1 => ip2bus_rdack_i_D1, ip2bus_wrack_i_D1 => ip2bus_wrack_i_D1, is_read => is_read, is_write_reg => is_write_reg_n_0, rst_reg => \^sr\, s_axi_aclk => s_axi_aclk, s_axi_aresetn => s_axi_aresetn, s_axi_arready => \^s_axi_arready\, s_axi_wdata(15 downto 0) => s_axi_wdata(15 downto 0), s_axi_wready => \^s_axi_wready\, start2_reg => start2 ); \bus2ip_addr_i[2]_i_1\: unisim.vcomponents.LUT5 generic map( INIT => X"CCCACCCC" ) port map ( I0 => s_axi_araddr(0), I1 => s_axi_awaddr(0), I2 => state(0), I3 => state(1), I4 => s_axi_arvalid, O => \bus2ip_addr_i[2]_i_1_n_0\ ); \bus2ip_addr_i[3]_i_1\: unisim.vcomponents.LUT5 generic map( INIT => X"CCCACCCC" ) port map ( I0 => s_axi_araddr(1), I1 => s_axi_awaddr(1), I2 => state(0), I3 => state(1), I4 => s_axi_arvalid, O => \bus2ip_addr_i[3]_i_1_n_0\ ); \bus2ip_addr_i[8]_i_1\: unisim.vcomponents.LUT5 generic map( INIT => X"000000EA" ) port map ( I0 => s_axi_arvalid, I1 => s_axi_awvalid, I2 => s_axi_wvalid, I3 => state(1), I4 => state(0), O => \bus2ip_addr_i[8]_i_1_n_0\ ); \bus2ip_addr_i[8]_i_2\: unisim.vcomponents.LUT5 generic map( INIT => X"CCCACCCC" ) port map ( I0 => s_axi_araddr(2), I1 => s_axi_awaddr(2), I2 => state(0), I3 => state(1), I4 => s_axi_arvalid, O => \bus2ip_addr_i[8]_i_2_n_0\ ); \bus2ip_addr_i_reg[2]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => \bus2ip_addr_i[8]_i_1_n_0\, D => \bus2ip_addr_i[2]_i_1_n_0\, Q => bus2ip_addr(6), R => \^sr\ ); \bus2ip_addr_i_reg[3]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => \bus2ip_addr_i[8]_i_1_n_0\, D => \bus2ip_addr_i[3]_i_1_n_0\, Q => bus2ip_addr(5), R => \^sr\ ); \bus2ip_addr_i_reg[8]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => \bus2ip_addr_i[8]_i_1_n_0\, D => \bus2ip_addr_i[8]_i_2_n_0\, Q => bus2ip_addr(0), R => \^sr\ ); bus2ip_rnw_i_i_1: unisim.vcomponents.LUT3 generic map( INIT => X"10" ) port map ( I0 => state(0), I1 => state(1), I2 => s_axi_arvalid, O => bus2ip_rnw_i06_out ); bus2ip_rnw_i_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => \bus2ip_addr_i[8]_i_1_n_0\, D => bus2ip_rnw_i06_out, Q => \^not_dual.gpio_data_out_reg[0]\, R => \^sr\ ); is_read_i_1: unisim.vcomponents.LUT5 generic map( INIT => X"3FFA000A" ) port map ( I0 => s_axi_arvalid, I1 => \state1__2\, I2 => state(0), I3 => state(1), I4 => is_read, O => is_read_i_1_n_0 ); is_read_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => is_read_i_1_n_0, Q => is_read, R => \^sr\ ); is_write_i_1: unisim.vcomponents.LUT6 generic map( INIT => X"0040FFFF00400000" ) port map ( I0 => s_axi_arvalid, I1 => s_axi_awvalid, I2 => s_axi_wvalid, I3 => state(1), I4 => is_write, I5 => is_write_reg_n_0, O => is_write_i_1_n_0 ); is_write_i_2: unisim.vcomponents.LUT6 generic map( INIT => X"F88800000000FFFF" ) port map ( I0 => \^s_axi_rvalid\, I1 => s_axi_rready, I2 => \^s_axi_bvalid\, I3 => s_axi_bready, I4 => state(0), I5 => state(1), O => is_write ); is_write_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => is_write_i_1_n_0, Q => is_write_reg_n_0, R => \^sr\ ); rst_i_1: unisim.vcomponents.LUT1 generic map( INIT => X"1" ) port map ( I0 => s_axi_aresetn, O => p_1_in ); rst_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => p_1_in, Q => \^sr\, R => '0' ); s_axi_bvalid_i_i_1: unisim.vcomponents.LUT5 generic map( INIT => X"08FF0808" ) port map ( I0 => \^s_axi_wready\, I1 => state(1), I2 => state(0), I3 => s_axi_bready, I4 => \^s_axi_bvalid\, O => s_axi_bvalid_i_i_1_n_0 ); s_axi_bvalid_i_reg: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => '1', D => s_axi_bvalid_i_i_1_n_0, Q => \^s_axi_bvalid\, R => \^sr\ ); \s_axi_rdata_i[7]_i_1\: unisim.vcomponents.LUT2 generic map( INIT => X"2" ) port map ( I0 => state(0), I1 => state(1), O => \s_axi_rdata_i[7]_i_1_n_0\ ); \s_axi_rdata_i_reg[0]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(0), Q => s_axi_rdata(0), R => \^sr\ ); \s_axi_rdata_i_reg[1]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(1), Q => s_axi_rdata(1), R => \^sr\ ); \s_axi_rdata_i_reg[2]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(2), Q => s_axi_rdata(2), R => \^sr\ ); \s_axi_rdata_i_reg[3]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(3), Q => s_axi_rdata(3), R => \^sr\ ); \s_axi_rdata_i_reg[4]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(4), Q => s_axi_rdata(4), R => \^sr\ ); \s_axi_rdata_i_reg[5]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(5), Q => s_axi_rdata(5), R => \^sr\ ); \s_axi_rdata_i_reg[6]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(6), Q => s_axi_rdata(6), R => \^sr\ ); \s_axi_rdata_i_reg[7]\: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => \s_axi_rdata_i[7]_i_1_n_0\, D => Q(7), Q => s_axi_rdata(7), R => \^sr\ ); s_axi_rvalid_i_i_1: unisim.vcomponents.LUT5 generic map( INIT => X"08FF0808" ) port map ( I0 => \^s_axi_arready\, I1 => state(0), I2 => state(1), I3 => s_axi_rready, I4 => \^s_axi_rvalid\, O => s_axi_rvalid_i_i_1_n_0 ); s_axi_rvalid_i_reg: unisim.vcomponents.FDRE generic map( INIT => '0' ) port map ( C => s_axi_aclk, CE => '1', D => s_axi_rvalid_i_i_1_n_0, Q => \^s_axi_rvalid\, R => \^sr\ ); start2_i_1: unisim.vcomponents.LUT5 generic map( INIT => X"000000F8" ) port map ( I0 => s_axi_awvalid, I1 => s_axi_wvalid, I2 => s_axi_arvalid, I3 => state(1), I4 => state(0), O => start2_i_1_n_0 ); start2_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => start2_i_1_n_0, Q => start2, R => \^sr\ ); \state[0]_i_1\: unisim.vcomponents.LUT5 generic map( INIT => X"77FC44FC" ) port map ( I0 => \state1__2\, I1 => state(0), I2 => s_axi_arvalid, I3 => state(1), I4 => \^s_axi_wready\, O => p_0_out(0) ); \state[1]_i_1\: unisim.vcomponents.LUT5 generic map( INIT => X"5FFC50FC" ) port map ( I0 => \state1__2\, I1 => \state[1]_i_3_n_0\, I2 => state(1), I3 => state(0), I4 => \^s_axi_arready\, O => p_0_out(1) ); \state[1]_i_2\: unisim.vcomponents.LUT4 generic map( INIT => X"F888" ) port map ( I0 => s_axi_bready, I1 => \^s_axi_bvalid\, I2 => s_axi_rready, I3 => \^s_axi_rvalid\, O => \state1__2\ ); \state[1]_i_3\: unisim.vcomponents.LUT3 generic map( INIT => X"08" ) port map ( I0 => s_axi_wvalid, I1 => s_axi_awvalid, I2 => s_axi_arvalid, O => \state[1]_i_3_n_0\ ); \state_reg[0]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => p_0_out(0), Q => state(0), R => \^sr\ ); \state_reg[1]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => p_0_out(1), Q => state(1), R => \^sr\ ); end STRUCTURE; library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity zqynq_lab_1_design_axi_gpio_0_0_axi_lite_ipif is port ( bus2ip_reset : out STD_LOGIC; bus2ip_rnw : out STD_LOGIC; bus2ip_cs : out STD_LOGIC; s_axi_rvalid : out STD_LOGIC; s_axi_bvalid : out STD_LOGIC; s_axi_arready : out STD_LOGIC; E : out STD_LOGIC_VECTOR ( 0 to 0 ); \Not_Dual.gpio_OE_reg[0]\ : out STD_LOGIC_VECTOR ( 0 to 0 ); s_axi_wready : out STD_LOGIC; D : out STD_LOGIC_VECTOR ( 7 downto 0 ); \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ : out STD_LOGIC; s_axi_rdata : out STD_LOGIC_VECTOR ( 7 downto 0 ); s_axi_aclk : in STD_LOGIC; s_axi_arvalid : in STD_LOGIC; s_axi_awvalid : in STD_LOGIC; s_axi_wvalid : in STD_LOGIC; s_axi_araddr : in STD_LOGIC_VECTOR ( 2 downto 0 ); s_axi_awaddr : in STD_LOGIC_VECTOR ( 2 downto 0 ); s_axi_aresetn : in STD_LOGIC; s_axi_rready : in STD_LOGIC; s_axi_bready : in STD_LOGIC; ip2bus_rdack_i_D1 : in STD_LOGIC; ip2bus_wrack_i_D1 : in STD_LOGIC; s_axi_wdata : in STD_LOGIC_VECTOR ( 15 downto 0 ); gpio_xferAck_Reg : in STD_LOGIC; GPIO_xferAck_i : in STD_LOGIC; Q : in STD_LOGIC_VECTOR ( 7 downto 0 ) ); attribute ORIG_REF_NAME : string; attribute ORIG_REF_NAME of zqynq_lab_1_design_axi_gpio_0_0_axi_lite_ipif : entity is "axi_lite_ipif"; end zqynq_lab_1_design_axi_gpio_0_0_axi_lite_ipif; architecture STRUCTURE of zqynq_lab_1_design_axi_gpio_0_0_axi_lite_ipif is begin I_SLAVE_ATTACHMENT: entity work.zqynq_lab_1_design_axi_gpio_0_0_slave_attachment port map ( D(7 downto 0) => D(7 downto 0), E(0) => E(0), GPIO_xferAck_i => GPIO_xferAck_i, \MEM_DECODE_GEN[0].cs_out_i_reg[0]\ => bus2ip_cs, \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ => \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\, \Not_Dual.gpio_Data_Out_reg[0]\ => bus2ip_rnw, \Not_Dual.gpio_OE_reg[0]\(0) => \Not_Dual.gpio_OE_reg[0]\(0), Q(7 downto 0) => Q(7 downto 0), SR => bus2ip_reset, gpio_xferAck_Reg => gpio_xferAck_Reg, ip2bus_rdack_i_D1 => ip2bus_rdack_i_D1, ip2bus_wrack_i_D1 => ip2bus_wrack_i_D1, s_axi_aclk => s_axi_aclk, s_axi_araddr(2 downto 0) => s_axi_araddr(2 downto 0), s_axi_aresetn => s_axi_aresetn, s_axi_arready => s_axi_arready, s_axi_arvalid => s_axi_arvalid, s_axi_awaddr(2 downto 0) => s_axi_awaddr(2 downto 0), s_axi_awvalid => s_axi_awvalid, s_axi_bready => s_axi_bready, s_axi_bvalid => s_axi_bvalid, s_axi_rdata(7 downto 0) => s_axi_rdata(7 downto 0), s_axi_rready => s_axi_rready, s_axi_rvalid => s_axi_rvalid, s_axi_wdata(15 downto 0) => s_axi_wdata(15 downto 0), s_axi_wready => s_axi_wready, s_axi_wvalid => s_axi_wvalid ); end STRUCTURE; library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity zqynq_lab_1_design_axi_gpio_0_0_axi_gpio is port ( s_axi_aclk : in STD_LOGIC; s_axi_aresetn : in STD_LOGIC; s_axi_awaddr : in STD_LOGIC_VECTOR ( 8 downto 0 ); s_axi_awvalid : in STD_LOGIC; s_axi_awready : out STD_LOGIC; s_axi_wdata : in STD_LOGIC_VECTOR ( 31 downto 0 ); s_axi_wstrb : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_wvalid : in STD_LOGIC; s_axi_wready : out STD_LOGIC; s_axi_bresp : out STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_bvalid : out STD_LOGIC; s_axi_bready : in STD_LOGIC; s_axi_araddr : in STD_LOGIC_VECTOR ( 8 downto 0 ); s_axi_arvalid : in STD_LOGIC; s_axi_arready : out STD_LOGIC; s_axi_rdata : out STD_LOGIC_VECTOR ( 31 downto 0 ); s_axi_rresp : out STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_rvalid : out STD_LOGIC; s_axi_rready : in STD_LOGIC; ip2intc_irpt : out STD_LOGIC; gpio_io_i : in STD_LOGIC_VECTOR ( 7 downto 0 ); gpio_io_o : out STD_LOGIC_VECTOR ( 7 downto 0 ); gpio_io_t : out STD_LOGIC_VECTOR ( 7 downto 0 ); gpio2_io_i : in STD_LOGIC_VECTOR ( 31 downto 0 ); gpio2_io_o : out STD_LOGIC_VECTOR ( 31 downto 0 ); gpio2_io_t : out STD_LOGIC_VECTOR ( 31 downto 0 ) ); attribute C_ALL_INPUTS : integer; attribute C_ALL_INPUTS of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_ALL_INPUTS_2 : integer; attribute C_ALL_INPUTS_2 of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_ALL_OUTPUTS : integer; attribute C_ALL_OUTPUTS of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 1; attribute C_ALL_OUTPUTS_2 : integer; attribute C_ALL_OUTPUTS_2 of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_DOUT_DEFAULT : integer; attribute C_DOUT_DEFAULT of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_DOUT_DEFAULT_2 : integer; attribute C_DOUT_DEFAULT_2 of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_FAMILY : string; attribute C_FAMILY of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is "zynq"; attribute C_GPIO2_WIDTH : integer; attribute C_GPIO2_WIDTH of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 32; attribute C_GPIO_WIDTH : integer; attribute C_GPIO_WIDTH of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 8; attribute C_INTERRUPT_PRESENT : integer; attribute C_INTERRUPT_PRESENT of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_IS_DUAL : integer; attribute C_IS_DUAL of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 0; attribute C_S_AXI_ADDR_WIDTH : integer; attribute C_S_AXI_ADDR_WIDTH of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 9; attribute C_S_AXI_DATA_WIDTH : integer; attribute C_S_AXI_DATA_WIDTH of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is 32; attribute C_TRI_DEFAULT : integer; attribute C_TRI_DEFAULT of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is -1; attribute C_TRI_DEFAULT_2 : integer; attribute C_TRI_DEFAULT_2 of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is -1; attribute ORIG_REF_NAME : string; attribute ORIG_REF_NAME of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is "axi_gpio"; attribute downgradeipidentifiedwarnings : string; attribute downgradeipidentifiedwarnings of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is "yes"; attribute ip_group : string; attribute ip_group of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio : entity is "LOGICORE"; end zqynq_lab_1_design_axi_gpio_0_0_axi_gpio; architecture STRUCTURE of zqynq_lab_1_design_axi_gpio_0_0_axi_gpio is signal \<const0>\ : STD_LOGIC; signal \<const1>\ : STD_LOGIC; signal AXI_LITE_IPIF_I_n_17 : STD_LOGIC; signal AXI_LITE_IPIF_I_n_6 : STD_LOGIC; signal AXI_LITE_IPIF_I_n_7 : STD_LOGIC; signal DBus_Reg : STD_LOGIC_VECTOR ( 0 to 7 ); signal GPIO_xferAck_i : STD_LOGIC; signal bus2ip_cs : STD_LOGIC; signal bus2ip_reset : STD_LOGIC; signal bus2ip_rnw : STD_LOGIC; signal gpio_core_1_n_19 : STD_LOGIC; signal gpio_xferAck_Reg : STD_LOGIC; signal ip2bus_data : STD_LOGIC_VECTOR ( 24 to 31 ); signal ip2bus_data_i_D1 : STD_LOGIC_VECTOR ( 24 to 31 ); signal ip2bus_rdack_i : STD_LOGIC; signal ip2bus_rdack_i_D1 : STD_LOGIC; signal ip2bus_wrack_i_D1 : STD_LOGIC; signal \^s_axi_rdata\ : STD_LOGIC_VECTOR ( 7 downto 0 ); signal \^s_axi_wready\ : STD_LOGIC; begin gpio2_io_o(31) <= \<const0>\; gpio2_io_o(30) <= \<const0>\; gpio2_io_o(29) <= \<const0>\; gpio2_io_o(28) <= \<const0>\; gpio2_io_o(27) <= \<const0>\; gpio2_io_o(26) <= \<const0>\; gpio2_io_o(25) <= \<const0>\; gpio2_io_o(24) <= \<const0>\; gpio2_io_o(23) <= \<const0>\; gpio2_io_o(22) <= \<const0>\; gpio2_io_o(21) <= \<const0>\; gpio2_io_o(20) <= \<const0>\; gpio2_io_o(19) <= \<const0>\; gpio2_io_o(18) <= \<const0>\; gpio2_io_o(17) <= \<const0>\; gpio2_io_o(16) <= \<const0>\; gpio2_io_o(15) <= \<const0>\; gpio2_io_o(14) <= \<const0>\; gpio2_io_o(13) <= \<const0>\; gpio2_io_o(12) <= \<const0>\; gpio2_io_o(11) <= \<const0>\; gpio2_io_o(10) <= \<const0>\; gpio2_io_o(9) <= \<const0>\; gpio2_io_o(8) <= \<const0>\; gpio2_io_o(7) <= \<const0>\; gpio2_io_o(6) <= \<const0>\; gpio2_io_o(5) <= \<const0>\; gpio2_io_o(4) <= \<const0>\; gpio2_io_o(3) <= \<const0>\; gpio2_io_o(2) <= \<const0>\; gpio2_io_o(1) <= \<const0>\; gpio2_io_o(0) <= \<const0>\; gpio2_io_t(31) <= \<const1>\; gpio2_io_t(30) <= \<const1>\; gpio2_io_t(29) <= \<const1>\; gpio2_io_t(28) <= \<const1>\; gpio2_io_t(27) <= \<const1>\; gpio2_io_t(26) <= \<const1>\; gpio2_io_t(25) <= \<const1>\; gpio2_io_t(24) <= \<const1>\; gpio2_io_t(23) <= \<const1>\; gpio2_io_t(22) <= \<const1>\; gpio2_io_t(21) <= \<const1>\; gpio2_io_t(20) <= \<const1>\; gpio2_io_t(19) <= \<const1>\; gpio2_io_t(18) <= \<const1>\; gpio2_io_t(17) <= \<const1>\; gpio2_io_t(16) <= \<const1>\; gpio2_io_t(15) <= \<const1>\; gpio2_io_t(14) <= \<const1>\; gpio2_io_t(13) <= \<const1>\; gpio2_io_t(12) <= \<const1>\; gpio2_io_t(11) <= \<const1>\; gpio2_io_t(10) <= \<const1>\; gpio2_io_t(9) <= \<const1>\; gpio2_io_t(8) <= \<const1>\; gpio2_io_t(7) <= \<const1>\; gpio2_io_t(6) <= \<const1>\; gpio2_io_t(5) <= \<const1>\; gpio2_io_t(4) <= \<const1>\; gpio2_io_t(3) <= \<const1>\; gpio2_io_t(2) <= \<const1>\; gpio2_io_t(1) <= \<const1>\; gpio2_io_t(0) <= \<const1>\; ip2intc_irpt <= \<const0>\; s_axi_awready <= \^s_axi_wready\; s_axi_bresp(1) <= \<const0>\; s_axi_bresp(0) <= \<const0>\; s_axi_rdata(31) <= \<const0>\; s_axi_rdata(30) <= \<const0>\; s_axi_rdata(29) <= \<const0>\; s_axi_rdata(28) <= \<const0>\; s_axi_rdata(27) <= \<const0>\; s_axi_rdata(26) <= \<const0>\; s_axi_rdata(25) <= \<const0>\; s_axi_rdata(24) <= \<const0>\; s_axi_rdata(23) <= \<const0>\; s_axi_rdata(22) <= \<const0>\; s_axi_rdata(21) <= \<const0>\; s_axi_rdata(20) <= \<const0>\; s_axi_rdata(19) <= \<const0>\; s_axi_rdata(18) <= \<const0>\; s_axi_rdata(17) <= \<const0>\; s_axi_rdata(16) <= \<const0>\; s_axi_rdata(15) <= \<const0>\; s_axi_rdata(14) <= \<const0>\; s_axi_rdata(13) <= \<const0>\; s_axi_rdata(12) <= \<const0>\; s_axi_rdata(11) <= \<const0>\; s_axi_rdata(10) <= \<const0>\; s_axi_rdata(9) <= \<const0>\; s_axi_rdata(8) <= \<const0>\; s_axi_rdata(7 downto 0) <= \^s_axi_rdata\(7 downto 0); s_axi_rresp(1) <= \<const0>\; s_axi_rresp(0) <= \<const0>\; s_axi_wready <= \^s_axi_wready\; AXI_LITE_IPIF_I: entity work.zqynq_lab_1_design_axi_gpio_0_0_axi_lite_ipif port map ( D(7) => DBus_Reg(0), D(6) => DBus_Reg(1), D(5) => DBus_Reg(2), D(4) => DBus_Reg(3), D(3) => DBus_Reg(4), D(2) => DBus_Reg(5), D(1) => DBus_Reg(6), D(0) => DBus_Reg(7), E(0) => AXI_LITE_IPIF_I_n_6, GPIO_xferAck_i => GPIO_xferAck_i, \Not_Dual.ALLOUT_ND.READ_REG_GEN[0].GPIO_DBus_i_reg[24]\ => AXI_LITE_IPIF_I_n_17, \Not_Dual.gpio_OE_reg[0]\(0) => AXI_LITE_IPIF_I_n_7, Q(7) => ip2bus_data_i_D1(24), Q(6) => ip2bus_data_i_D1(25), Q(5) => ip2bus_data_i_D1(26), Q(4) => ip2bus_data_i_D1(27), Q(3) => ip2bus_data_i_D1(28), Q(2) => ip2bus_data_i_D1(29), Q(1) => ip2bus_data_i_D1(30), Q(0) => ip2bus_data_i_D1(31), bus2ip_cs => bus2ip_cs, bus2ip_reset => bus2ip_reset, bus2ip_rnw => bus2ip_rnw, gpio_xferAck_Reg => gpio_xferAck_Reg, ip2bus_rdack_i_D1 => ip2bus_rdack_i_D1, ip2bus_wrack_i_D1 => ip2bus_wrack_i_D1, s_axi_aclk => s_axi_aclk, s_axi_araddr(2) => s_axi_araddr(8), s_axi_araddr(1 downto 0) => s_axi_araddr(3 downto 2), s_axi_aresetn => s_axi_aresetn, s_axi_arready => s_axi_arready, s_axi_arvalid => s_axi_arvalid, s_axi_awaddr(2) => s_axi_awaddr(8), s_axi_awaddr(1 downto 0) => s_axi_awaddr(3 downto 2), s_axi_awvalid => s_axi_awvalid, s_axi_bready => s_axi_bready, s_axi_bvalid => s_axi_bvalid, s_axi_rdata(7 downto 0) => \^s_axi_rdata\(7 downto 0), s_axi_rready => s_axi_rready, s_axi_rvalid => s_axi_rvalid, s_axi_wdata(15 downto 8) => s_axi_wdata(31 downto 24), s_axi_wdata(7 downto 0) => s_axi_wdata(7 downto 0), s_axi_wready => \^s_axi_wready\, s_axi_wvalid => s_axi_wvalid ); GND: unisim.vcomponents.GND port map ( G => \<const0>\ ); VCC: unisim.vcomponents.VCC port map ( P => \<const1>\ ); gpio_core_1: entity work.zqynq_lab_1_design_axi_gpio_0_0_GPIO_Core port map ( D(7) => ip2bus_data(24), D(6) => ip2bus_data(25), D(5) => ip2bus_data(26), D(4) => ip2bus_data(27), D(3) => ip2bus_data(28), D(2) => ip2bus_data(29), D(1) => ip2bus_data(30), D(0) => ip2bus_data(31), E(0) => AXI_LITE_IPIF_I_n_6, GPIO_xferAck_i => GPIO_xferAck_i, \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(7) => DBus_Reg(0), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(6) => DBus_Reg(1), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(5) => DBus_Reg(2), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(4) => DBus_Reg(3), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(3) => DBus_Reg(4), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(2) => DBus_Reg(5), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(1) => DBus_Reg(6), \MEM_DECODE_GEN[0].cs_out_i_reg[0]\(0) => DBus_Reg(7), SS(0) => bus2ip_reset, bus2ip_cs => bus2ip_cs, bus2ip_rnw => bus2ip_rnw, bus2ip_rnw_i_reg => AXI_LITE_IPIF_I_n_17, gpio_io_o(7 downto 0) => gpio_io_o(7 downto 0), gpio_io_t(7 downto 0) => gpio_io_t(7 downto 0), gpio_xferAck_Reg => gpio_xferAck_Reg, ip2bus_rdack_i => ip2bus_rdack_i, ip2bus_wrack_i_D1_reg => gpio_core_1_n_19, rst_reg(0) => AXI_LITE_IPIF_I_n_7, s_axi_aclk => s_axi_aclk ); \ip2bus_data_i_D1_reg[24]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(24), Q => ip2bus_data_i_D1(24), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[25]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(25), Q => ip2bus_data_i_D1(25), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[26]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(26), Q => ip2bus_data_i_D1(26), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[27]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(27), Q => ip2bus_data_i_D1(27), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[28]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(28), Q => ip2bus_data_i_D1(28), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[29]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(29), Q => ip2bus_data_i_D1(29), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[30]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(30), Q => ip2bus_data_i_D1(30), R => bus2ip_reset ); \ip2bus_data_i_D1_reg[31]\: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_data(31), Q => ip2bus_data_i_D1(31), R => bus2ip_reset ); ip2bus_rdack_i_D1_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => ip2bus_rdack_i, Q => ip2bus_rdack_i_D1, R => bus2ip_reset ); ip2bus_wrack_i_D1_reg: unisim.vcomponents.FDRE port map ( C => s_axi_aclk, CE => '1', D => gpio_core_1_n_19, Q => ip2bus_wrack_i_D1, R => bus2ip_reset ); end STRUCTURE; library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity zqynq_lab_1_design_axi_gpio_0_0 is port ( s_axi_aclk : in STD_LOGIC; s_axi_aresetn : in STD_LOGIC; s_axi_awaddr : in STD_LOGIC_VECTOR ( 8 downto 0 ); s_axi_awvalid : in STD_LOGIC; s_axi_awready : out STD_LOGIC; s_axi_wdata : in STD_LOGIC_VECTOR ( 31 downto 0 ); s_axi_wstrb : in STD_LOGIC_VECTOR ( 3 downto 0 ); s_axi_wvalid : in STD_LOGIC; s_axi_wready : out STD_LOGIC; s_axi_bresp : out STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_bvalid : out STD_LOGIC; s_axi_bready : in STD_LOGIC; s_axi_araddr : in STD_LOGIC_VECTOR ( 8 downto 0 ); s_axi_arvalid : in STD_LOGIC; s_axi_arready : out STD_LOGIC; s_axi_rdata : out STD_LOGIC_VECTOR ( 31 downto 0 ); s_axi_rresp : out STD_LOGIC_VECTOR ( 1 downto 0 ); s_axi_rvalid : out STD_LOGIC; s_axi_rready : in STD_LOGIC; gpio_io_o : out STD_LOGIC_VECTOR ( 7 downto 0 ) ); attribute NotValidForBitStream : boolean; attribute NotValidForBitStream of zqynq_lab_1_design_axi_gpio_0_0 : entity is true; attribute CHECK_LICENSE_TYPE : string; attribute CHECK_LICENSE_TYPE of zqynq_lab_1_design_axi_gpio_0_0 : entity is "zqynq_lab_1_design_axi_gpio_0_0,axi_gpio,{}"; attribute downgradeipidentifiedwarnings : string; attribute downgradeipidentifiedwarnings of zqynq_lab_1_design_axi_gpio_0_0 : entity is "yes"; attribute x_core_info : string; attribute x_core_info of zqynq_lab_1_design_axi_gpio_0_0 : entity is "axi_gpio,Vivado 2017.2"; end zqynq_lab_1_design_axi_gpio_0_0; architecture STRUCTURE of zqynq_lab_1_design_axi_gpio_0_0 is signal NLW_U0_ip2intc_irpt_UNCONNECTED : STD_LOGIC; signal NLW_U0_gpio2_io_o_UNCONNECTED : STD_LOGIC_VECTOR ( 31 downto 0 ); signal NLW_U0_gpio2_io_t_UNCONNECTED : STD_LOGIC_VECTOR ( 31 downto 0 ); signal NLW_U0_gpio_io_t_UNCONNECTED : STD_LOGIC_VECTOR ( 7 downto 0 ); attribute C_ALL_INPUTS : integer; attribute C_ALL_INPUTS of U0 : label is 0; attribute C_ALL_INPUTS_2 : integer; attribute C_ALL_INPUTS_2 of U0 : label is 0; attribute C_ALL_OUTPUTS : integer; attribute C_ALL_OUTPUTS of U0 : label is 1; attribute C_ALL_OUTPUTS_2 : integer; attribute C_ALL_OUTPUTS_2 of U0 : label is 0; attribute C_DOUT_DEFAULT : integer; attribute C_DOUT_DEFAULT of U0 : label is 0; attribute C_DOUT_DEFAULT_2 : integer; attribute C_DOUT_DEFAULT_2 of U0 : label is 0; attribute C_FAMILY : string; attribute C_FAMILY of U0 : label is "zynq"; attribute C_GPIO2_WIDTH : integer; attribute C_GPIO2_WIDTH of U0 : label is 32; attribute C_GPIO_WIDTH : integer; attribute C_GPIO_WIDTH of U0 : label is 8; attribute C_INTERRUPT_PRESENT : integer; attribute C_INTERRUPT_PRESENT of U0 : label is 0; attribute C_IS_DUAL : integer; attribute C_IS_DUAL of U0 : label is 0; attribute C_S_AXI_ADDR_WIDTH : integer; attribute C_S_AXI_ADDR_WIDTH of U0 : label is 9; attribute C_S_AXI_DATA_WIDTH : integer; attribute C_S_AXI_DATA_WIDTH of U0 : label is 32; attribute C_TRI_DEFAULT : integer; attribute C_TRI_DEFAULT of U0 : label is -1; attribute C_TRI_DEFAULT_2 : integer; attribute C_TRI_DEFAULT_2 of U0 : label is -1; attribute downgradeipidentifiedwarnings of U0 : label is "yes"; attribute ip_group : string; attribute ip_group of U0 : label is "LOGICORE"; begin U0: entity work.zqynq_lab_1_design_axi_gpio_0_0_axi_gpio port map ( gpio2_io_i(31 downto 0) => B"00000000000000000000000000000000", gpio2_io_o(31 downto 0) => NLW_U0_gpio2_io_o_UNCONNECTED(31 downto 0), gpio2_io_t(31 downto 0) => NLW_U0_gpio2_io_t_UNCONNECTED(31 downto 0), gpio_io_i(7 downto 0) => B"00000000", gpio_io_o(7 downto 0) => gpio_io_o(7 downto 0), gpio_io_t(7 downto 0) => NLW_U0_gpio_io_t_UNCONNECTED(7 downto 0), ip2intc_irpt => NLW_U0_ip2intc_irpt_UNCONNECTED, s_axi_aclk => s_axi_aclk, s_axi_araddr(8 downto 0) => s_axi_araddr(8 downto 0), s_axi_aresetn => s_axi_aresetn, s_axi_arready => s_axi_arready, s_axi_arvalid => s_axi_arvalid, s_axi_awaddr(8 downto 0) => s_axi_awaddr(8 downto 0), s_axi_awready => s_axi_awready, s_axi_awvalid => s_axi_awvalid, s_axi_bready => s_axi_bready, s_axi_bresp(1 downto 0) => s_axi_bresp(1 downto 0), s_axi_bvalid => s_axi_bvalid, s_axi_rdata(31 downto 0) => s_axi_rdata(31 downto 0), s_axi_rready => s_axi_rready, s_axi_rresp(1 downto 0) => s_axi_rresp(1 downto 0), s_axi_rvalid => s_axi_rvalid, s_axi_wdata(31 downto 0) => s_axi_wdata(31 downto 0), s_axi_wready => s_axi_wready, s_axi_wstrb(3 downto 0) => s_axi_wstrb(3 downto 0), s_axi_wvalid => s_axi_wvalid ); end STRUCTURE;
-------------------------------------------------------------------------------- -- This file is owned and controlled by Xilinx and must be used solely -- -- for design, simulation, implementation and creation of design files -- -- limited to Xilinx devices or technologies. Use with non-Xilinx -- -- devices or technologies is expressly prohibited and immediately -- -- terminates your license. -- -- -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" SOLELY -- -- FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR XILINX DEVICES. BY -- -- PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -- -- IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX IS -- -- MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM ANY -- -- CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING ANY -- -- RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY -- -- DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE -- -- IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR -- -- REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF -- -- INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE. -- -- -- -- Xilinx products are not intended for use in life support appliances, -- -- devices, or systems. Use in such applications are expressly -- -- prohibited. -- -- -- -- (c) Copyright 1995-2013 Xilinx, Inc. -- -- All rights reserved. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- You must compile the wrapper file image_selector_fifo.vhd when simulating -- the core, image_selector_fifo. When compiling the wrapper file, be sure to -- reference the XilinxCoreLib VHDL simulation library. For detailed -- instructions, please refer to the "CORE Generator Help". -- The synthesis directives "translate_off/translate_on" specified -- below are supported by Xilinx, Mentor Graphics and Synplicity -- synthesis tools. Ensure they are correct for your synthesis tool(s). LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- synthesis translate_off LIBRARY XilinxCoreLib; -- synthesis translate_on ENTITY image_selector_fifo IS PORT ( rst : IN STD_LOGIC; wr_clk : IN STD_LOGIC; rd_clk : IN STD_LOGIC; din : IN STD_LOGIC_VECTOR(23 DOWNTO 0); wr_en : IN STD_LOGIC; rd_en : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(23 DOWNTO 0); full : OUT STD_LOGIC; almost_full : OUT STD_LOGIC; empty : OUT STD_LOGIC; almost_empty : OUT STD_LOGIC; valid : OUT STD_LOGIC ); END image_selector_fifo; ARCHITECTURE image_selector_fifo_a OF image_selector_fifo IS -- synthesis translate_off COMPONENT wrapped_image_selector_fifo PORT ( rst : IN STD_LOGIC; wr_clk : IN STD_LOGIC; rd_clk : IN STD_LOGIC; din : IN STD_LOGIC_VECTOR(23 DOWNTO 0); wr_en : IN STD_LOGIC; rd_en : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(23 DOWNTO 0); full : OUT STD_LOGIC; almost_full : OUT STD_LOGIC; empty : OUT STD_LOGIC; almost_empty : OUT STD_LOGIC; valid : OUT STD_LOGIC ); END COMPONENT; -- Configuration specification FOR ALL : wrapped_image_selector_fifo USE ENTITY XilinxCoreLib.fifo_generator_v9_2(behavioral) GENERIC MAP ( c_add_ngc_constraint => 0, c_application_type_axis => 0, c_application_type_rach => 0, c_application_type_rdch => 0, c_application_type_wach => 0, c_application_type_wdch => 0, c_application_type_wrch => 0, c_axi_addr_width => 32, c_axi_aruser_width => 1, c_axi_awuser_width => 1, c_axi_buser_width => 1, c_axi_data_width => 64, c_axi_id_width => 4, c_axi_ruser_width => 1, c_axi_type => 0, c_axi_wuser_width => 1, c_axis_tdata_width => 64, c_axis_tdest_width => 4, c_axis_tid_width => 8, c_axis_tkeep_width => 4, c_axis_tstrb_width => 4, c_axis_tuser_width => 4, c_axis_type => 0, c_common_clock => 0, c_count_type => 0, c_data_count_width => 8, c_default_value => "BlankString", c_din_width => 24, c_din_width_axis => 1, c_din_width_rach => 32, c_din_width_rdch => 64, c_din_width_wach => 32, c_din_width_wdch => 64, c_din_width_wrch => 2, c_dout_rst_val => "0", c_dout_width => 24, c_enable_rlocs => 0, c_enable_rst_sync => 1, c_error_injection_type => 0, c_error_injection_type_axis => 0, c_error_injection_type_rach => 0, c_error_injection_type_rdch => 0, c_error_injection_type_wach => 0, c_error_injection_type_wdch => 0, c_error_injection_type_wrch => 0, c_family => "spartan6", c_full_flags_rst_val => 0, c_has_almost_empty => 1, c_has_almost_full => 1, c_has_axi_aruser => 0, c_has_axi_awuser => 0, c_has_axi_buser => 0, c_has_axi_rd_channel => 0, c_has_axi_ruser => 0, c_has_axi_wr_channel => 0, c_has_axi_wuser => 0, c_has_axis_tdata => 0, c_has_axis_tdest => 0, c_has_axis_tid => 0, c_has_axis_tkeep => 0, c_has_axis_tlast => 0, c_has_axis_tready => 1, c_has_axis_tstrb => 0, c_has_axis_tuser => 0, c_has_backup => 0, c_has_data_count => 0, c_has_data_counts_axis => 0, c_has_data_counts_rach => 0, c_has_data_counts_rdch => 0, c_has_data_counts_wach => 0, c_has_data_counts_wdch => 0, c_has_data_counts_wrch => 0, c_has_int_clk => 0, c_has_master_ce => 0, c_has_meminit_file => 0, c_has_overflow => 0, c_has_prog_flags_axis => 0, c_has_prog_flags_rach => 0, c_has_prog_flags_rdch => 0, c_has_prog_flags_wach => 0, c_has_prog_flags_wdch => 0, c_has_prog_flags_wrch => 0, c_has_rd_data_count => 0, c_has_rd_rst => 0, c_has_rst => 1, c_has_slave_ce => 0, c_has_srst => 0, c_has_underflow => 0, c_has_valid => 1, c_has_wr_ack => 0, c_has_wr_data_count => 0, c_has_wr_rst => 0, c_implementation_type => 2, c_implementation_type_axis => 1, c_implementation_type_rach => 1, c_implementation_type_rdch => 1, c_implementation_type_wach => 1, c_implementation_type_wdch => 1, c_implementation_type_wrch => 1, c_init_wr_pntr_val => 0, c_interface_type => 0, c_memory_type => 1, c_mif_file_name => "BlankString", c_msgon_val => 1, c_optimization_mode => 0, c_overflow_low => 0, c_preload_latency => 0, c_preload_regs => 1, c_prim_fifo_type => "512x36", c_prog_empty_thresh_assert_val => 4, c_prog_empty_thresh_assert_val_axis => 1022, c_prog_empty_thresh_assert_val_rach => 1022, c_prog_empty_thresh_assert_val_rdch => 1022, c_prog_empty_thresh_assert_val_wach => 1022, c_prog_empty_thresh_assert_val_wdch => 1022, c_prog_empty_thresh_assert_val_wrch => 1022, c_prog_empty_thresh_negate_val => 5, c_prog_empty_type => 0, c_prog_empty_type_axis => 0, c_prog_empty_type_rach => 0, c_prog_empty_type_rdch => 0, c_prog_empty_type_wach => 0, c_prog_empty_type_wdch => 0, c_prog_empty_type_wrch => 0, c_prog_full_thresh_assert_val => 255, c_prog_full_thresh_assert_val_axis => 1023, c_prog_full_thresh_assert_val_rach => 1023, c_prog_full_thresh_assert_val_rdch => 1023, c_prog_full_thresh_assert_val_wach => 1023, c_prog_full_thresh_assert_val_wdch => 1023, c_prog_full_thresh_assert_val_wrch => 1023, c_prog_full_thresh_negate_val => 254, c_prog_full_type => 0, c_prog_full_type_axis => 0, c_prog_full_type_rach => 0, c_prog_full_type_rdch => 0, c_prog_full_type_wach => 0, c_prog_full_type_wdch => 0, c_prog_full_type_wrch => 0, c_rach_type => 0, c_rd_data_count_width => 8, c_rd_depth => 256, c_rd_freq => 1, c_rd_pntr_width => 8, c_rdch_type => 0, c_reg_slice_mode_axis => 0, c_reg_slice_mode_rach => 0, c_reg_slice_mode_rdch => 0, c_reg_slice_mode_wach => 0, c_reg_slice_mode_wdch => 0, c_reg_slice_mode_wrch => 0, c_synchronizer_stage => 2, c_underflow_low => 0, c_use_common_overflow => 0, c_use_common_underflow => 0, c_use_default_settings => 0, c_use_dout_rst => 1, c_use_ecc => 0, c_use_ecc_axis => 0, c_use_ecc_rach => 0, c_use_ecc_rdch => 0, c_use_ecc_wach => 0, c_use_ecc_wdch => 0, c_use_ecc_wrch => 0, c_use_embedded_reg => 0, c_use_fifo16_flags => 0, c_use_fwft_data_count => 0, c_valid_low => 0, c_wach_type => 0, c_wdch_type => 0, c_wr_ack_low => 0, c_wr_data_count_width => 8, c_wr_depth => 256, c_wr_depth_axis => 1024, c_wr_depth_rach => 16, c_wr_depth_rdch => 1024, c_wr_depth_wach => 16, c_wr_depth_wdch => 1024, c_wr_depth_wrch => 16, c_wr_freq => 1, c_wr_pntr_width => 8, c_wr_pntr_width_axis => 10, c_wr_pntr_width_rach => 4, c_wr_pntr_width_rdch => 10, c_wr_pntr_width_wach => 4, c_wr_pntr_width_wdch => 10, c_wr_pntr_width_wrch => 4, c_wr_response_latency => 1, c_wrch_type => 0 ); -- synthesis translate_on BEGIN -- synthesis translate_off U0 : wrapped_image_selector_fifo PORT MAP ( rst => rst, wr_clk => wr_clk, rd_clk => rd_clk, din => din, wr_en => wr_en, rd_en => rd_en, dout => dout, full => full, almost_full => almost_full, empty => empty, almost_empty => almost_empty, valid => valid ); -- synthesis translate_on END image_selector_fifo_a;
-------------------------------------------------------------------------------- -- This file is owned and controlled by Xilinx and must be used solely -- -- for design, simulation, implementation and creation of design files -- -- limited to Xilinx devices or technologies. Use with non-Xilinx -- -- devices or technologies is expressly prohibited and immediately -- -- terminates your license. -- -- -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" SOLELY -- -- FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR XILINX DEVICES. BY -- -- PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -- -- IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX IS -- -- MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM ANY -- -- CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING ANY -- -- RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY -- -- DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE -- -- IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR -- -- REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF -- -- INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE. -- -- -- -- Xilinx products are not intended for use in life support appliances, -- -- devices, or systems. Use in such applications are expressly -- -- prohibited. -- -- -- -- (c) Copyright 1995-2013 Xilinx, Inc. -- -- All rights reserved. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- You must compile the wrapper file image_selector_fifo.vhd when simulating -- the core, image_selector_fifo. When compiling the wrapper file, be sure to -- reference the XilinxCoreLib VHDL simulation library. For detailed -- instructions, please refer to the "CORE Generator Help". -- The synthesis directives "translate_off/translate_on" specified -- below are supported by Xilinx, Mentor Graphics and Synplicity -- synthesis tools. Ensure they are correct for your synthesis tool(s). LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- synthesis translate_off LIBRARY XilinxCoreLib; -- synthesis translate_on ENTITY image_selector_fifo IS PORT ( rst : IN STD_LOGIC; wr_clk : IN STD_LOGIC; rd_clk : IN STD_LOGIC; din : IN STD_LOGIC_VECTOR(23 DOWNTO 0); wr_en : IN STD_LOGIC; rd_en : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(23 DOWNTO 0); full : OUT STD_LOGIC; almost_full : OUT STD_LOGIC; empty : OUT STD_LOGIC; almost_empty : OUT STD_LOGIC; valid : OUT STD_LOGIC ); END image_selector_fifo; ARCHITECTURE image_selector_fifo_a OF image_selector_fifo IS -- synthesis translate_off COMPONENT wrapped_image_selector_fifo PORT ( rst : IN STD_LOGIC; wr_clk : IN STD_LOGIC; rd_clk : IN STD_LOGIC; din : IN STD_LOGIC_VECTOR(23 DOWNTO 0); wr_en : IN STD_LOGIC; rd_en : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(23 DOWNTO 0); full : OUT STD_LOGIC; almost_full : OUT STD_LOGIC; empty : OUT STD_LOGIC; almost_empty : OUT STD_LOGIC; valid : OUT STD_LOGIC ); END COMPONENT; -- Configuration specification FOR ALL : wrapped_image_selector_fifo USE ENTITY XilinxCoreLib.fifo_generator_v9_2(behavioral) GENERIC MAP ( c_add_ngc_constraint => 0, c_application_type_axis => 0, c_application_type_rach => 0, c_application_type_rdch => 0, c_application_type_wach => 0, c_application_type_wdch => 0, c_application_type_wrch => 0, c_axi_addr_width => 32, c_axi_aruser_width => 1, c_axi_awuser_width => 1, c_axi_buser_width => 1, c_axi_data_width => 64, c_axi_id_width => 4, c_axi_ruser_width => 1, c_axi_type => 0, c_axi_wuser_width => 1, c_axis_tdata_width => 64, c_axis_tdest_width => 4, c_axis_tid_width => 8, c_axis_tkeep_width => 4, c_axis_tstrb_width => 4, c_axis_tuser_width => 4, c_axis_type => 0, c_common_clock => 0, c_count_type => 0, c_data_count_width => 8, c_default_value => "BlankString", c_din_width => 24, c_din_width_axis => 1, c_din_width_rach => 32, c_din_width_rdch => 64, c_din_width_wach => 32, c_din_width_wdch => 64, c_din_width_wrch => 2, c_dout_rst_val => "0", c_dout_width => 24, c_enable_rlocs => 0, c_enable_rst_sync => 1, c_error_injection_type => 0, c_error_injection_type_axis => 0, c_error_injection_type_rach => 0, c_error_injection_type_rdch => 0, c_error_injection_type_wach => 0, c_error_injection_type_wdch => 0, c_error_injection_type_wrch => 0, c_family => "spartan6", c_full_flags_rst_val => 0, c_has_almost_empty => 1, c_has_almost_full => 1, c_has_axi_aruser => 0, c_has_axi_awuser => 0, c_has_axi_buser => 0, c_has_axi_rd_channel => 0, c_has_axi_ruser => 0, c_has_axi_wr_channel => 0, c_has_axi_wuser => 0, c_has_axis_tdata => 0, c_has_axis_tdest => 0, c_has_axis_tid => 0, c_has_axis_tkeep => 0, c_has_axis_tlast => 0, c_has_axis_tready => 1, c_has_axis_tstrb => 0, c_has_axis_tuser => 0, c_has_backup => 0, c_has_data_count => 0, c_has_data_counts_axis => 0, c_has_data_counts_rach => 0, c_has_data_counts_rdch => 0, c_has_data_counts_wach => 0, c_has_data_counts_wdch => 0, c_has_data_counts_wrch => 0, c_has_int_clk => 0, c_has_master_ce => 0, c_has_meminit_file => 0, c_has_overflow => 0, c_has_prog_flags_axis => 0, c_has_prog_flags_rach => 0, c_has_prog_flags_rdch => 0, c_has_prog_flags_wach => 0, c_has_prog_flags_wdch => 0, c_has_prog_flags_wrch => 0, c_has_rd_data_count => 0, c_has_rd_rst => 0, c_has_rst => 1, c_has_slave_ce => 0, c_has_srst => 0, c_has_underflow => 0, c_has_valid => 1, c_has_wr_ack => 0, c_has_wr_data_count => 0, c_has_wr_rst => 0, c_implementation_type => 2, c_implementation_type_axis => 1, c_implementation_type_rach => 1, c_implementation_type_rdch => 1, c_implementation_type_wach => 1, c_implementation_type_wdch => 1, c_implementation_type_wrch => 1, c_init_wr_pntr_val => 0, c_interface_type => 0, c_memory_type => 1, c_mif_file_name => "BlankString", c_msgon_val => 1, c_optimization_mode => 0, c_overflow_low => 0, c_preload_latency => 0, c_preload_regs => 1, c_prim_fifo_type => "512x36", c_prog_empty_thresh_assert_val => 4, c_prog_empty_thresh_assert_val_axis => 1022, c_prog_empty_thresh_assert_val_rach => 1022, c_prog_empty_thresh_assert_val_rdch => 1022, c_prog_empty_thresh_assert_val_wach => 1022, c_prog_empty_thresh_assert_val_wdch => 1022, c_prog_empty_thresh_assert_val_wrch => 1022, c_prog_empty_thresh_negate_val => 5, c_prog_empty_type => 0, c_prog_empty_type_axis => 0, c_prog_empty_type_rach => 0, c_prog_empty_type_rdch => 0, c_prog_empty_type_wach => 0, c_prog_empty_type_wdch => 0, c_prog_empty_type_wrch => 0, c_prog_full_thresh_assert_val => 255, c_prog_full_thresh_assert_val_axis => 1023, c_prog_full_thresh_assert_val_rach => 1023, c_prog_full_thresh_assert_val_rdch => 1023, c_prog_full_thresh_assert_val_wach => 1023, c_prog_full_thresh_assert_val_wdch => 1023, c_prog_full_thresh_assert_val_wrch => 1023, c_prog_full_thresh_negate_val => 254, c_prog_full_type => 0, c_prog_full_type_axis => 0, c_prog_full_type_rach => 0, c_prog_full_type_rdch => 0, c_prog_full_type_wach => 0, c_prog_full_type_wdch => 0, c_prog_full_type_wrch => 0, c_rach_type => 0, c_rd_data_count_width => 8, c_rd_depth => 256, c_rd_freq => 1, c_rd_pntr_width => 8, c_rdch_type => 0, c_reg_slice_mode_axis => 0, c_reg_slice_mode_rach => 0, c_reg_slice_mode_rdch => 0, c_reg_slice_mode_wach => 0, c_reg_slice_mode_wdch => 0, c_reg_slice_mode_wrch => 0, c_synchronizer_stage => 2, c_underflow_low => 0, c_use_common_overflow => 0, c_use_common_underflow => 0, c_use_default_settings => 0, c_use_dout_rst => 1, c_use_ecc => 0, c_use_ecc_axis => 0, c_use_ecc_rach => 0, c_use_ecc_rdch => 0, c_use_ecc_wach => 0, c_use_ecc_wdch => 0, c_use_ecc_wrch => 0, c_use_embedded_reg => 0, c_use_fifo16_flags => 0, c_use_fwft_data_count => 0, c_valid_low => 0, c_wach_type => 0, c_wdch_type => 0, c_wr_ack_low => 0, c_wr_data_count_width => 8, c_wr_depth => 256, c_wr_depth_axis => 1024, c_wr_depth_rach => 16, c_wr_depth_rdch => 1024, c_wr_depth_wach => 16, c_wr_depth_wdch => 1024, c_wr_depth_wrch => 16, c_wr_freq => 1, c_wr_pntr_width => 8, c_wr_pntr_width_axis => 10, c_wr_pntr_width_rach => 4, c_wr_pntr_width_rdch => 10, c_wr_pntr_width_wach => 4, c_wr_pntr_width_wdch => 10, c_wr_pntr_width_wrch => 4, c_wr_response_latency => 1, c_wrch_type => 0 ); -- synthesis translate_on BEGIN -- synthesis translate_off U0 : wrapped_image_selector_fifo PORT MAP ( rst => rst, wr_clk => wr_clk, rd_clk => rd_clk, din => din, wr_en => wr_en, rd_en => rd_en, dout => dout, full => full, almost_full => almost_full, empty => empty, almost_empty => almost_empty, valid => valid ); -- synthesis translate_on END image_selector_fifo_a;
-------------------------------------------------------------------------------- -- This file is owned and controlled by Xilinx and must be used solely -- -- for design, simulation, implementation and creation of design files -- -- limited to Xilinx devices or technologies. Use with non-Xilinx -- -- devices or technologies is expressly prohibited and immediately -- -- terminates your license. -- -- -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" SOLELY -- -- FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR XILINX DEVICES. BY -- -- PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -- -- IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX IS -- -- MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM ANY -- -- CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING ANY -- -- RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY -- -- DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE -- -- IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR -- -- REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF -- -- INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE. -- -- -- -- Xilinx products are not intended for use in life support appliances, -- -- devices, or systems. Use in such applications are expressly -- -- prohibited. -- -- -- -- (c) Copyright 1995-2013 Xilinx, Inc. -- -- All rights reserved. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- You must compile the wrapper file image_selector_fifo.vhd when simulating -- the core, image_selector_fifo. When compiling the wrapper file, be sure to -- reference the XilinxCoreLib VHDL simulation library. For detailed -- instructions, please refer to the "CORE Generator Help". -- The synthesis directives "translate_off/translate_on" specified -- below are supported by Xilinx, Mentor Graphics and Synplicity -- synthesis tools. Ensure they are correct for your synthesis tool(s). LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- synthesis translate_off LIBRARY XilinxCoreLib; -- synthesis translate_on ENTITY image_selector_fifo IS PORT ( rst : IN STD_LOGIC; wr_clk : IN STD_LOGIC; rd_clk : IN STD_LOGIC; din : IN STD_LOGIC_VECTOR(23 DOWNTO 0); wr_en : IN STD_LOGIC; rd_en : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(23 DOWNTO 0); full : OUT STD_LOGIC; almost_full : OUT STD_LOGIC; empty : OUT STD_LOGIC; almost_empty : OUT STD_LOGIC; valid : OUT STD_LOGIC ); END image_selector_fifo; ARCHITECTURE image_selector_fifo_a OF image_selector_fifo IS -- synthesis translate_off COMPONENT wrapped_image_selector_fifo PORT ( rst : IN STD_LOGIC; wr_clk : IN STD_LOGIC; rd_clk : IN STD_LOGIC; din : IN STD_LOGIC_VECTOR(23 DOWNTO 0); wr_en : IN STD_LOGIC; rd_en : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR(23 DOWNTO 0); full : OUT STD_LOGIC; almost_full : OUT STD_LOGIC; empty : OUT STD_LOGIC; almost_empty : OUT STD_LOGIC; valid : OUT STD_LOGIC ); END COMPONENT; -- Configuration specification FOR ALL : wrapped_image_selector_fifo USE ENTITY XilinxCoreLib.fifo_generator_v9_2(behavioral) GENERIC MAP ( c_add_ngc_constraint => 0, c_application_type_axis => 0, c_application_type_rach => 0, c_application_type_rdch => 0, c_application_type_wach => 0, c_application_type_wdch => 0, c_application_type_wrch => 0, c_axi_addr_width => 32, c_axi_aruser_width => 1, c_axi_awuser_width => 1, c_axi_buser_width => 1, c_axi_data_width => 64, c_axi_id_width => 4, c_axi_ruser_width => 1, c_axi_type => 0, c_axi_wuser_width => 1, c_axis_tdata_width => 64, c_axis_tdest_width => 4, c_axis_tid_width => 8, c_axis_tkeep_width => 4, c_axis_tstrb_width => 4, c_axis_tuser_width => 4, c_axis_type => 0, c_common_clock => 0, c_count_type => 0, c_data_count_width => 8, c_default_value => "BlankString", c_din_width => 24, c_din_width_axis => 1, c_din_width_rach => 32, c_din_width_rdch => 64, c_din_width_wach => 32, c_din_width_wdch => 64, c_din_width_wrch => 2, c_dout_rst_val => "0", c_dout_width => 24, c_enable_rlocs => 0, c_enable_rst_sync => 1, c_error_injection_type => 0, c_error_injection_type_axis => 0, c_error_injection_type_rach => 0, c_error_injection_type_rdch => 0, c_error_injection_type_wach => 0, c_error_injection_type_wdch => 0, c_error_injection_type_wrch => 0, c_family => "spartan6", c_full_flags_rst_val => 0, c_has_almost_empty => 1, c_has_almost_full => 1, c_has_axi_aruser => 0, c_has_axi_awuser => 0, c_has_axi_buser => 0, c_has_axi_rd_channel => 0, c_has_axi_ruser => 0, c_has_axi_wr_channel => 0, c_has_axi_wuser => 0, c_has_axis_tdata => 0, c_has_axis_tdest => 0, c_has_axis_tid => 0, c_has_axis_tkeep => 0, c_has_axis_tlast => 0, c_has_axis_tready => 1, c_has_axis_tstrb => 0, c_has_axis_tuser => 0, c_has_backup => 0, c_has_data_count => 0, c_has_data_counts_axis => 0, c_has_data_counts_rach => 0, c_has_data_counts_rdch => 0, c_has_data_counts_wach => 0, c_has_data_counts_wdch => 0, c_has_data_counts_wrch => 0, c_has_int_clk => 0, c_has_master_ce => 0, c_has_meminit_file => 0, c_has_overflow => 0, c_has_prog_flags_axis => 0, c_has_prog_flags_rach => 0, c_has_prog_flags_rdch => 0, c_has_prog_flags_wach => 0, c_has_prog_flags_wdch => 0, c_has_prog_flags_wrch => 0, c_has_rd_data_count => 0, c_has_rd_rst => 0, c_has_rst => 1, c_has_slave_ce => 0, c_has_srst => 0, c_has_underflow => 0, c_has_valid => 1, c_has_wr_ack => 0, c_has_wr_data_count => 0, c_has_wr_rst => 0, c_implementation_type => 2, c_implementation_type_axis => 1, c_implementation_type_rach => 1, c_implementation_type_rdch => 1, c_implementation_type_wach => 1, c_implementation_type_wdch => 1, c_implementation_type_wrch => 1, c_init_wr_pntr_val => 0, c_interface_type => 0, c_memory_type => 1, c_mif_file_name => "BlankString", c_msgon_val => 1, c_optimization_mode => 0, c_overflow_low => 0, c_preload_latency => 0, c_preload_regs => 1, c_prim_fifo_type => "512x36", c_prog_empty_thresh_assert_val => 4, c_prog_empty_thresh_assert_val_axis => 1022, c_prog_empty_thresh_assert_val_rach => 1022, c_prog_empty_thresh_assert_val_rdch => 1022, c_prog_empty_thresh_assert_val_wach => 1022, c_prog_empty_thresh_assert_val_wdch => 1022, c_prog_empty_thresh_assert_val_wrch => 1022, c_prog_empty_thresh_negate_val => 5, c_prog_empty_type => 0, c_prog_empty_type_axis => 0, c_prog_empty_type_rach => 0, c_prog_empty_type_rdch => 0, c_prog_empty_type_wach => 0, c_prog_empty_type_wdch => 0, c_prog_empty_type_wrch => 0, c_prog_full_thresh_assert_val => 255, c_prog_full_thresh_assert_val_axis => 1023, c_prog_full_thresh_assert_val_rach => 1023, c_prog_full_thresh_assert_val_rdch => 1023, c_prog_full_thresh_assert_val_wach => 1023, c_prog_full_thresh_assert_val_wdch => 1023, c_prog_full_thresh_assert_val_wrch => 1023, c_prog_full_thresh_negate_val => 254, c_prog_full_type => 0, c_prog_full_type_axis => 0, c_prog_full_type_rach => 0, c_prog_full_type_rdch => 0, c_prog_full_type_wach => 0, c_prog_full_type_wdch => 0, c_prog_full_type_wrch => 0, c_rach_type => 0, c_rd_data_count_width => 8, c_rd_depth => 256, c_rd_freq => 1, c_rd_pntr_width => 8, c_rdch_type => 0, c_reg_slice_mode_axis => 0, c_reg_slice_mode_rach => 0, c_reg_slice_mode_rdch => 0, c_reg_slice_mode_wach => 0, c_reg_slice_mode_wdch => 0, c_reg_slice_mode_wrch => 0, c_synchronizer_stage => 2, c_underflow_low => 0, c_use_common_overflow => 0, c_use_common_underflow => 0, c_use_default_settings => 0, c_use_dout_rst => 1, c_use_ecc => 0, c_use_ecc_axis => 0, c_use_ecc_rach => 0, c_use_ecc_rdch => 0, c_use_ecc_wach => 0, c_use_ecc_wdch => 0, c_use_ecc_wrch => 0, c_use_embedded_reg => 0, c_use_fifo16_flags => 0, c_use_fwft_data_count => 0, c_valid_low => 0, c_wach_type => 0, c_wdch_type => 0, c_wr_ack_low => 0, c_wr_data_count_width => 8, c_wr_depth => 256, c_wr_depth_axis => 1024, c_wr_depth_rach => 16, c_wr_depth_rdch => 1024, c_wr_depth_wach => 16, c_wr_depth_wdch => 1024, c_wr_depth_wrch => 16, c_wr_freq => 1, c_wr_pntr_width => 8, c_wr_pntr_width_axis => 10, c_wr_pntr_width_rach => 4, c_wr_pntr_width_rdch => 10, c_wr_pntr_width_wach => 4, c_wr_pntr_width_wdch => 10, c_wr_pntr_width_wrch => 4, c_wr_response_latency => 1, c_wrch_type => 0 ); -- synthesis translate_on BEGIN -- synthesis translate_off U0 : wrapped_image_selector_fifo PORT MAP ( rst => rst, wr_clk => wr_clk, rd_clk => rd_clk, din => din, wr_en => wr_en, rd_en => rd_en, dout => dout, full => full, almost_full => almost_full, empty => empty, almost_empty => almost_empty, valid => valid ); -- synthesis translate_on END image_selector_fifo_a;
-- ZPU -- -- Copyright 2004-2008 oharboe - Øyvind Harboe - oyvind.harboe@zylin.com -- -- The FreeBSD license -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above -- copyright notice, this list of conditions and the following -- disclaimer in the documentation and/or other materials -- provided with the distribution. -- -- THIS SOFTWARE IS PROVIDED BY THE ZPU PROJECT ``AS IS'' AND ANY -- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- ZPU PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- The views and conclusions contained in the software and documentation -- are those of the authors and should not be interpreted as representing -- official policies, either expressed or implied, of the ZPU Project. library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_UNSIGNED.ALL; package wishbone_pkg is type wishbone_bus_in is record adr : std_logic_vector(15 downto 0); sel : std_logic_vector(3 downto 0); we : std_logic; dat : std_logic_vector(31 downto 0); -- Note! Data written with 'we' cyc : std_logic; stb : std_logic; end record; type wishbone_bus_out is record dat : std_logic_vector(31 downto 0); ack : std_logic; end record; type wishbone_bus is record insig : wishbone_bus_in; outsig : wishbone_bus_out; end record; component atomic32_access is port ( cpu_clk : in std_logic; areset : in std_logic; -- Wishbone from CPU interface wb_16_i : in wishbone_bus_in; wb_16_o : out wishbone_bus_out; -- Wishbone to FPGA registers and ethernet core wb_32_i : in wishbone_bus_out; wb_32_o : out wishbone_bus_in); end component; component eth_access_corr is port ( cpu_clk : in std_logic; areset : in std_logic; -- Wishbone from Wishbone MUX eth_raw_o : out wishbone_bus_out; eth_raw_i : in wishbone_bus_in; -- Wishbone ethernet core eth_slave_i : in wishbone_bus_out; eth_slave_o : out wishbone_bus_in); end component; end wishbone_pkg;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2293.vhd,v 1.2 2001-10-26 16:29:47 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c07s02b06x00p32n01i02293ent IS END c07s02b06x00p32n01i02293ent; ARCHITECTURE c07s02b06x00p32n01i02293arch OF c07s02b06x00p32n01i02293ent IS BEGIN TESTING: PROCESS BEGIN -- Test the predefined type TIME in this respect. assert ((1 us * 1000.0) > 1 us) report "Assertion error.(31)"; assert ((1 ms * 1000.0) > 1 ms) report "Assertion error.(32)"; assert ((1 sec * 60.0) > 1 sec) report "Assertion error.(33)"; wait for 5 us; assert NOT( ((1 us * 1000.0) > 1 us) and ((1 ms * 1000.0) > 1 ms) and ((1 sec * 60.0) > 1 sec) and ((1000.0 * 1 us) > 1 us) and ((1000.0 * 1 ms) > 1 ms) and ((60.0 * 1 sec) > 1 sec) ) report "***PASSED TEST: c07s02b06x00p32n01i02293" severity NOTE; assert ( ((1 us * 1000.0) > 1 us) and ((1 ms * 1000.0) > 1 ms) and ((1 sec * 60.0) > 1 sec) and ((1000.0 * 1 us) > 1 us) and ((1000.0 * 1 ms) > 1 ms) and ((60.0 * 1 sec) > 1 sec) ) report "***FAILED TEST: c07s02b06x00p32n01i02293 - Multiplication of a predefined physical type by an floating point test failed." severity ERROR; wait; END PROCESS TESTING; END c07s02b06x00p32n01i02293arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2293.vhd,v 1.2 2001-10-26 16:29:47 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c07s02b06x00p32n01i02293ent IS END c07s02b06x00p32n01i02293ent; ARCHITECTURE c07s02b06x00p32n01i02293arch OF c07s02b06x00p32n01i02293ent IS BEGIN TESTING: PROCESS BEGIN -- Test the predefined type TIME in this respect. assert ((1 us * 1000.0) > 1 us) report "Assertion error.(31)"; assert ((1 ms * 1000.0) > 1 ms) report "Assertion error.(32)"; assert ((1 sec * 60.0) > 1 sec) report "Assertion error.(33)"; wait for 5 us; assert NOT( ((1 us * 1000.0) > 1 us) and ((1 ms * 1000.0) > 1 ms) and ((1 sec * 60.0) > 1 sec) and ((1000.0 * 1 us) > 1 us) and ((1000.0 * 1 ms) > 1 ms) and ((60.0 * 1 sec) > 1 sec) ) report "***PASSED TEST: c07s02b06x00p32n01i02293" severity NOTE; assert ( ((1 us * 1000.0) > 1 us) and ((1 ms * 1000.0) > 1 ms) and ((1 sec * 60.0) > 1 sec) and ((1000.0 * 1 us) > 1 us) and ((1000.0 * 1 ms) > 1 ms) and ((60.0 * 1 sec) > 1 sec) ) report "***FAILED TEST: c07s02b06x00p32n01i02293 - Multiplication of a predefined physical type by an floating point test failed." severity ERROR; wait; END PROCESS TESTING; END c07s02b06x00p32n01i02293arch;
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 2 of the License, or (at -- your option) any later version. -- VESTs is distributed in the hope that it will be useful, but WITHOUT -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- You should have received a copy of the GNU General Public License -- along with VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2293.vhd,v 1.2 2001-10-26 16:29:47 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c07s02b06x00p32n01i02293ent IS END c07s02b06x00p32n01i02293ent; ARCHITECTURE c07s02b06x00p32n01i02293arch OF c07s02b06x00p32n01i02293ent IS BEGIN TESTING: PROCESS BEGIN -- Test the predefined type TIME in this respect. assert ((1 us * 1000.0) > 1 us) report "Assertion error.(31)"; assert ((1 ms * 1000.0) > 1 ms) report "Assertion error.(32)"; assert ((1 sec * 60.0) > 1 sec) report "Assertion error.(33)"; wait for 5 us; assert NOT( ((1 us * 1000.0) > 1 us) and ((1 ms * 1000.0) > 1 ms) and ((1 sec * 60.0) > 1 sec) and ((1000.0 * 1 us) > 1 us) and ((1000.0 * 1 ms) > 1 ms) and ((60.0 * 1 sec) > 1 sec) ) report "***PASSED TEST: c07s02b06x00p32n01i02293" severity NOTE; assert ( ((1 us * 1000.0) > 1 us) and ((1 ms * 1000.0) > 1 ms) and ((1 sec * 60.0) > 1 sec) and ((1000.0 * 1 us) > 1 us) and ((1000.0 * 1 ms) > 1 ms) and ((60.0 * 1 sec) > 1 sec) ) report "***FAILED TEST: c07s02b06x00p32n01i02293 - Multiplication of a predefined physical type by an floating point test failed." severity ERROR; wait; END PROCESS TESTING; END c07s02b06x00p32n01i02293arch;
------------------------------------------------------------------------------- -- Bitmap VGA display with 640x480 pixel resolution ------------------------------------------------------------------------------- -- V 1.1.2 (2015/11/29) -- Bertrand Le Gal (bertrand.legal@enseirb-matmeca.fr) -- Some little modifications to support data reading -- from file for RAM initilization. -- -- V 1.1.1 (2015/07/28) -- Yannick Bornat (yannick.bornat@enseirb-matmeca.fr) -- -- For more information on this module, refer to module page : -- http://bornat.vvv.enseirb.fr/wiki/doku.php?id=en202:vga_bitmap -- -- V1.1.1 : -- - Comment additions -- - Code cleanup -- V1.1.0 : -- - added capacity above 3bpp -- - ability to display grayscale pictures -- - Module works @ 100MHz clock frequency -- V1.0.1 : -- - Fixed : image not centered on screen -- V1.0.0 : -- - Initial release -------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.numeric_std.ALL; use std.textio.ALL; entity VGA_bitmap_640x480 is port(clk : in std_logic; clk_vga : in std_logic; reset : in std_logic; VGA_hs : out std_logic; -- horisontal vga syncr. VGA_vs : out std_logic; -- vertical vga syncr. iter : out std_logic_vector(7 downto 0); -- iter output ADDR1 : in std_logic_vector(15 downto 0); data_in1 : in std_logic_vector(7 downto 0); data_write1 : in std_logic; ADDR2 : in std_logic_vector(15 downto 0); data_in2 : in std_logic_vector(7 downto 0); data_write2 : in std_logic; ADDR3 : in std_logic_vector(15 downto 0); data_in3 : in std_logic_vector(7 downto 0); data_write3 : in std_logic; ADDR4 : in std_logic_vector(15 downto 0); data_in4 : in std_logic_vector(7 downto 0); data_write4 : in std_logic; ADDR5 : in std_logic_vector(15 downto 0); data_in5 : in std_logic_vector(7 downto 0); data_write5 : in std_logic; ADDR6 : in std_logic_vector(15 downto 0); data_in6 : in std_logic_vector(7 downto 0); data_write6 : in std_logic; ADDR7 : in std_logic_vector(15 downto 0); data_in7 : in std_logic_vector(7 downto 0); data_write7 : in std_logic; ADDR8 : in std_logic_vector(15 downto 0); data_in8 : in std_logic_vector(7 downto 0); data_write8 : in std_logic); end VGA_bitmap_640x480; architecture Behavioral of VGA_bitmap_640x480 is component RAM_single_port Port ( clk : in STD_LOGIC; data_write : in STD_LOGIC; data_in : in STD_LOGIC_VECTOR(7 downto 0); ADDR : in STD_LOGIC_VECTOR (15 downto 0); data_out : out STD_LOGIC_VECTOR (7 downto 0)); end component; signal h_counter : integer range 0 to 3199:=0; -- counter for H sync. (size depends of frequ because of division) signal v_counter : integer range 0 to 520 :=0; -- counter for V sync. (base on v_counter, so no frequ issue) signal TOP_line : boolean := false; -- this signal is true when the current pixel column is visible on the screen signal TOP_display : boolean := false; -- this signal is true when the current pixel line is visible on the screen signal pix_read_addr : integer range 0 to 307199:=0; -- the address at which displayed data is read signal pix_read_addr1, pix_read1 : integer range 0 to 38399:=0; -- the address at which displayed data is read --signal next_pixel,next_pixel1,next_pixel2 : std_logic_vector(3 downto 0); -- the data coding the value of the pixel to be displayed signal pix_read_addrb : integer range 0 to 38399 := 0; -- the address at which displayed data is read signal next_pixel1, data_temp1, data_temp2 , data_outtemp1, data_outtemp2,data_temp3, data_temp4 , data_outtemp3, data_outtemp4, data_temp5, data_temp6 , data_outtemp5, data_outtemp6,data_temp7, data_temp8 , data_outtemp7, data_outtemp8 : std_logic_vector(7 downto 0); -- the data coding the value of the pixel to be displayed signal next_pixel2 : std_logic_vector(7 downto 0); -- the data coding the value of the pixel to be displayed signal next_pixel : std_logic_vector(7 downto 0); -- the data coding the value of the pixel to be displayed --signal data_writetemp1, data_writetemp2 : std_logic; signal ADDRtemp1, ADDRtemp2, ADDRtemp3, ADDRtemp4, ADDRtemp5, ADDRtemp6, ADDRtemp7, ADDRtemp8 : std_logic_vector(15 downto 0); -- the data coding the value of the pixel to be displayed begin -------------------------------------------------------------------------------- RAM1: RAM_single_port port map (clk, data_write1, data_in1, ADDRtemp1, data_outtemp1); RAM2: RAM_single_port port map (clk, data_write2, data_in2, ADDRtemp2, data_outtemp2); RAM3: RAM_single_port port map (clk, data_write3, data_in3, ADDRtemp3, data_outtemp3); RAM4: RAM_single_port port map (clk, data_write4, data_in4, ADDRtemp4, data_outtemp4); RAM5: RAM_single_port port map (clk, data_write5, data_in5, ADDRtemp5, data_outtemp5); RAM6: RAM_single_port port map (clk, data_write6, data_in6, ADDRtemp6, data_outtemp6); --RAM7: RAM_single_port --port map (clk, -- data_write7, -- data_in7, -- ADDRtemp7, -- data_outtemp7); -- --RAM8: RAM_single_port --port map (clk, -- data_write8, -- data_in8, -- ADDRtemp8, -- data_outtemp8); -- pix_read_addrb <= pix_read_addr when pix_read_addr < 153599 else pix_read_addr - 153599; ADDRtemp1<= ADDR1 when (data_write1 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp2<= ADDR2 when (data_write2 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp3<= ADDR3 when (data_write3 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp4<= ADDR4 when (data_write4 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp5<= ADDR5 when (data_write5 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp6<= ADDR6 when (data_write6 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp7<= ADDR7 when (data_write7 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; ADDRtemp8<= ADDR8 when (data_write8 = '1') else std_logic_vector(to_unsigned(pix_read1, 16)) ; --data_writetemp1 <= clk_VGA when (data_write1 = '0') else '1' ; --data_writetemp2 <= clk_VGA when (data_write2 = '0') else '1' ; -- process (clk) -- begin -- if (clk'event and clk = '1') then -- if (data_write1 = '1') then -- screen1(to_integer(unsigned(ADDR1))) <= data_in1 ; -- end if; -- end if; -- end process; -- -- process (clk_vga) -- begin -- if (clk_vga'event and clk_vga = '1') then -- next_pixel1 <= screen1(pix_read_addrb) ; -- end if; -- end process; -- -- process (clk) -- begin -- if (clk'event and clk = '1') then -- if (data_write2 = '1') then -- screen2(to_integer(unsigned(ADDR2))) <= data_in2 ; -- end if; -- end if; -- end process; -- -- process (clk_vga) -- begin -- if (clk_vga'event and clk_vga = '1') then -- next_pixel2 <= screen2(pix_read_addrb); -- end if; -- end process; process (clk_vga) begin if (clk_vga'event and clk_vga = '1') then IF pix_read_addr < 38399 THEN next_pixel <= data_outtemp1; ELSif pix_read_addr < 76799 THEN next_pixel <= data_outtemp2; ELSif pix_read_addr < 115199 THEN next_pixel <= data_outtemp3; ELSif pix_read_addr < 153599 THEN next_pixel <= data_outtemp4; ELSif pix_read_addr < 191999 THEN next_pixel <= data_outtemp5; ELSif pix_read_addr < 230399 THEN next_pixel <= data_outtemp6; -- ELSif pix_read_addr < 230399 THEN -- next_pixel <= data_outtemp7; else next_pixel <= (others=>'0'); END IF; end if; end process; --process (clk_vga) --begin -- if (clk_vga'event and clk_vga = '1') then -- if (data_write1 = '1') then -- screen1(to_integer(unsigned(ADDR1))) <= data_in1; -- next_pixel1 <= data_in1; -- else -- next_pixel1 <= screen1(to_integer(unsigned(ADDR1))); -- end if; -- end if; --end process; -- --process (clk_vga) --begin -- if (clk_vga'event and clk_vga = '1') then -- if (data_write2 = '1') then -- screen2(to_integer(unsigned(ADDR2))) <= data_in2; -- next_pixel2 <= data_in2; -- else -- next_pixel2 <= screen2(to_integer(unsigned(ADDR2)); -- end if; -- end if; --end process; --process (next_pixel) --begin -- if (clk_vga'event and clk_vga = '1') then -- next_pixel <= To_StdLogicVector( ram_out(pix_read_addr) ); -- end if; --end process; --ram_out <= screen1 when to_unsigned(pix_read_addr,16)(15) = '0' else screen2; -------------------------------------------------------------------------------- --proc<='0' when (pix_read_addr <153599) else '1'; pixel_read_addr : process(clk_vga, clk) begin if clk_vga'event and clk_vga='1' then if reset = '1' or (not TOP_display) then pix_read_addr <= 0; elsif TOP_line and (h_counter mod 4)=0 then pix_read_addr <= pix_read_addr + 1; elsif (pix_read_addr = 307199) then pix_read_addr <= 0; end if; end if; end process; pixel_read1 : process(clk_vga, clk) begin if clk_vga'event and clk_vga='1' then if reset = '1' or (not TOP_display) then pix_read1 <= 0; elsif TOP_line and (h_counter mod 4)=0 then pix_read1 <= pix_read1 + 1; elsif (pix_read1 = 38399) then pix_read1 <= 0; end if; end if; end process; --pixel_read_addrb : process(clk_vga, clk) --begin -- if clk_vga'event and clk_vga='1' then -- if reset = '1' or (not TOP_display) then -- pix_read_addrb <= 0; -- elsif TOP_line and (h_counter mod 4)=0 then -- pix_read_addrb <= pix_read_addrb + 1; -- elsif (pix_read_addrb = 153599) then -- pix_read_addrb <= 0; -- end if; -- end if; --end process; --process(pix_read_addr) --begin -- if pix_read_addr < 153599 then -- ram_number <= '0'; -- elsif pix_read_addr <307199 then -- ram_number <= '1'; -- else -- ram_number <= '0'; -- end if; --end process; -- this process manages the horizontal synchro using the counters process(clk_vga) begin if clk_vga'event and clk_vga='1' then if reset = '1' then VGA_vs <= '0'; TOP_display <= false; else case v_counter is when 0 => VGA_vs <= '0'; -- start of Tpw ( 0 -> 0 + 1) when 2 => VGA_vs <= '1'; -- start of Tbp ( 2 -> 2 + 28 = 30) when 31 => TOP_display <= true; -- start of Tdisp ( 31 -> 31 + 479 = 510) when 511 => TOP_display <= false; -- start of Tfp (511 -> 511 + 9 = 520) when others => null; end case; -- if v_counter = 0 then VGA_vs <= '0'; -- start of Tpw ( 0 -> 0 + 1) -- elsif v_counter = 2 then VGA_vs <= '1'; -- start of Tbp ( 2 -> 2 + 28 = 30) -- elsif v_counter = 75 then TOP_display <= true; -- start of Tdisp ( 31 -> 31 + 479 = 510) -- elsif v_counter = 475 then TOP_display <= false; -- start of Tfp (511 -> 511 + 9 = 520) -- end if; end if; end if; end process; process(clk_vga) begin if clk_vga'event and clk_vga='1' then if (not TOP_line) or (not TOP_display) then iter <= "00000000"; else iter<= next_pixel; end if; end if; end process; -- this process manages the horizontal synchro using the counters process(clk_vga) begin if clk_vga'event and clk_vga='1' then if reset = '1' then VGA_hs <= '0'; TOP_line <= false; else case h_counter is when 2 => VGA_hs <= '0'; -- start of Tpw ( 0 -> 0 + 95) -- +2 because of delay in RAM when 386 => VGA_hs <= '1'; -- start of Tbp ( 96 -> 96 + 47 = 143) -- 384=96*4 -- -- +2 because of delay in RAM when 576 => TOP_line <= true; -- start of Tdisp ( 144 -> 144 + 639 = 783) -- 576=144*4 when 3136 => TOP_line <= false; -- start of Tfp ( 784 -> 784 + 15 = 799) -- 3136 = 784*4 when others => null; end case; -- if h_counter=2 then VGA_hs <= '0'; -- start of Tpw ( 0 -> 0 + 95) -- +2 because of delay in RAM -- elsif h_counter=386 then VGA_hs <= '1'; -- start of Tbp ( 96 -> 96 + 47 = 143) -- 384=96*4 -- -- +2 because of delay in RAM -- elsif h_counter=576 then TOP_line <= true; -- start of Tdisp ( 144 -> 144 + 639 = 783) -- 576=144*4 -- elsif h_counter=3136 then TOP_line <= false; -- start of Tfp ( 784 -> 784 + 15 = 799) -- 3136 = 784*4 -- end if; end if; end if; end process; -- counter management for synchro process(clk_vga) begin if clk_vga'event and clk_vga='1' then if reset='1' then h_counter <= 0; v_counter <= 0; else if h_counter = 3199 then h_counter <= 0; if v_counter = 520 then v_counter <= 0; else v_counter <= v_counter + 1; end if; else h_counter <= h_counter +1; end if; end if; end if; end process; end Behavioral;
library ieee; use ieee.std_logic_1164.all; entity tb is end entity; architecture tb of tb is begin process constant a : std_logic_vector(3 downto 0) := x"A"; variable b : std_logic_vector(3 downto 0) := x"B"; begin report to_string(b); -- OK report to_string(a); -- fails assert to_string(a) = "1010"; assert to_string(b) = "1011"; wait; end process; end architecture;
------------------------------------------------------------------------------- -- -- File: tb_TestTop_AllZmods.vhd -- Author: Tudor Gherman, Robert Bocos -- Original Project: Zmod ADC 1410 Low Level Controller -- Date: 11 Dec. 2020 -- ------------------------------------------------------------------------------- -- (c) 2020 Copyright Digilent Incorporated -- All Rights Reserved -- -- This program is free software; distributed under the terms of BSD 3-clause -- license ("Revised BSD License", "New BSD License", or "Modified BSD License") -- -- Redistribution and use in source and binary forms, with or without modification, -- are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- 3. Neither the name(s) of the above-listed copyright holder(s) nor the names -- of its contributors may be used to endorse or promote products derived -- from this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- ------------------------------------------------------------------------------- -- -- This test bench is used to instantiate the tb_TestTop test bench for all -- supported ZmodADC variants. -- ------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use ieee.numeric_std.all; use work.PkgZmodDigitizer.all; entity tb_TestTop_AllZmods is end tb_TestTop_AllZmods; architecture Behavioral of tb_TestTop_AllZmods is constant kADC_SamplingClkPeriod_122_88 : time := 8.138ns; constant kADC_SamplingClkPeriod_50 : time := 20ns; constant kADC_SamplingClkPeriod_80 : time := 12.500ns; constant kADC_SamplingClkPeriod_100 : time := 10ns; constant kADC_SamplingClkPeriod_110 : time := 9.090ns; constant kADC_SamplingClkPeriod_120 : time := 8.333ns; constant kADC_SamplingClkPeriod_125 : time := 8ns; constant kExtCalibEn : boolean := true; constant kExtCmdInterfaceEn : boolean := true; constant kCDCE_SimulationConfig : boolean := true; constant kCDCE_SimulationCmdTotal : integer range 0 to kCDCE_RegNrZeroBased := 4; constant kCDCEFreqSel_122_88 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 0; constant kCDCEFreqSel_50 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 1; constant kCDCEFreqSel_80 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 2; constant kCDCEFreqSel_100 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 3; constant kCDCEFreqSel_110 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 4; constant kCDCEFreqSel_120 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 5; constant kCDCEFreqSel_125 : integer range 0 to (kCDCE_FreqCfgsNr - 1) := 6; constant kCDCEI2C_Addr : std_logic_vector(7 downto 0) := x"CE"; constant kCh1LgMultCoefStatic : std_logic_vector (17 downto 0) := "010001101010110010"; constant kCh1LgAddCoefStatic : std_logic_vector (17 downto 0) := "111111101111010101"; constant kCh1HgMultCoefStatic : std_logic_vector (17 downto 0) := "010001101010100010"; constant kCh1HgAddCoefStatic : std_logic_vector (17 downto 0) := "111111101111000101"; constant kCh2LgMultCoefStatic : std_logic_vector (17 downto 0) := "010001101010010010"; constant kCh2LgAddCoefStatic : std_logic_vector (17 downto 0) := "111111101101010101"; constant kCh2HgMultCoefStatic : std_logic_vector (17 downto 0) := "010001101000110010"; constant kCh2HgAddCoefStatic : std_logic_vector (17 downto 0) := "111111101111010001"; begin ------------------------------------------------------------------------------------------ -- Top level test bench instantiated for all supported Zmod ADC variants ------------------------------------------------------------------------------------------ InstTbTestTop_ZmodDigitizer_122_88: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_122_88, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_122_88 ); InstTbTestTop_ZmodDigitizer_50: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_50, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_50 ); InstTbTestTop_ZmodDigitizer_80: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_80, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_80 ); InstTbTestTop_ZmodDigitizer_100: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_100, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_100 ); InstTbTestTop_ZmodDigitizer_110: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_110, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_110 ); InstTbTestTop_ZmodDigitizer_120: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_120, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_120 ); InstTbTestTop_ZmodDigitizer_125: entity work.tb_TestTop Generic Map( kZmodID => kZmodDigitizer1430_125, kADC_SamplingClkPeriod => kADC_SamplingClkPeriod_125, kADC_ClkDiv => 1, kExtCalibEn => kExtCalibEn, kExtCmdInterfaceEn => kExtCmdInterfaceEn, kCh1HgMultCoefStatic => kCh1HgMultCoefStatic, kCh1HgAddCoefStatic => kCh1HgAddCoefStatic, kCh2HgMultCoefStatic => kCh2HgMultCoefStatic, kCh2HgAddCoefStatic => kCh2HgAddCoefStatic, kCDCEI2C_Addr => kCDCEI2C_Addr, kCDCE_SimulationConfig => kCDCE_SimulationConfig, kCDCE_SimulationCmdTotal => kCDCE_SimulationCmdTotal, kCDCEFreqSel => kCDCEFreqSel_125 ); end Behavioral;
------------------------------------------------------------------------------- -- Title : External Memory controller for SDRAM ------------------------------------------------------------------------------- -- Description: This module implements a simple, single burst memory controller. -- User interface is 16 bit (burst of 2), externally 4x 8 bit. ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library unisim; use unisim.vcomponents.all; library work; use work.mem_bus_pkg.all; entity ext_mem_ctrl_v6 is generic ( g_simulation : boolean := false; g_read_fifo : boolean := false; q_tcko_data : time := 100 ps; A_Width : integer := 13; SDRAM_WakeupTime : integer := 40; -- refresh periods SDRAM_Refr_period : integer := 375 ); port ( clock : in std_logic := '0'; clk_2x : in std_logic := '0'; reset : in std_logic := '0'; inhibit : in std_logic := '0'; is_idle : out std_logic; -- clk_4x : in std_logic := '0'; -- dummy : out std_logic; req : in t_mem_burst_16_req; resp : out t_mem_burst_16_resp; SDRAM_CLK : out std_logic; SDRAM_CKE : out std_logic := '0'; SDRAM_CSn : out std_logic := '1'; SDRAM_RASn : out std_logic := '1'; SDRAM_CASn : out std_logic := '1'; SDRAM_WEn : out std_logic := '1'; SDRAM_DQM : out std_logic := '0'; SDRAM_BA : out std_logic_vector(1 downto 0); SDRAM_A : out std_logic_vector(A_Width-1 downto 0); SDRAM_DQ : inout std_logic_vector(7 downto 0) := (others => 'Z')); end ext_mem_ctrl_v6; architecture Gideon of ext_mem_ctrl_v6 is type t_init is record addr : std_logic_vector(15 downto 0); cmd : std_logic_vector(2 downto 0); -- we-cas-ras end record; type t_init_array is array(natural range <>) of t_init; constant c_init_array : t_init_array(0 to 7) := ( ( X"0400", "010" ), -- auto precharge ( X"002B", "000" ), -- mode register, burstlen=8, writelen=8, CAS lat = 2, interleaved ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ) ); type t_ints is array(natural range <>) of integer; constant c_delays : t_ints(0 to 15) := ( 2, 4, 2, 3, -- R2R (other row&other bank, other row, other bank, same row+bank) 4, 5, 4, 5, -- R2W 2, 5, 2, 3, -- W2R 2, 4, 2, 3 );-- W2W type t_state is (boot, init, idle, sd_cas ); signal state : t_state; signal sdram_d_o : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal sdram_d_t : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal wdata_tri : std_logic_vector(8 downto 0) := (others => '1'); signal delay : integer range 0 to 15; signal inhibit_d : std_logic; signal mem_a_i : std_logic_vector(SDRAM_A'range) := (others => '0'); signal mem_ba_i : std_logic_vector(SDRAM_BA'range) := (others => '0'); signal cs_n_i : std_logic := '1'; signal col_addr : std_logic_vector(9 downto 0) := (others => '0'); signal refresh_cnt : integer range 0 to SDRAM_Refr_period-1; signal do_refresh : std_logic := '0'; signal do_refresh_d : std_logic := '0'; signal trigger_refresh : std_logic := '0'; signal not_clock : std_logic; signal not_clock_2x : std_logic; signal rdata_lo : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi_d : std_logic_vector(7 downto 0) := (others => '0'); signal wdata : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_i : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_av : std_logic; signal fifo_wdata_in : std_logic_vector(17 downto 0); signal wdqm : std_logic_vector(1 downto 0); signal dqm_override : std_logic := '1'; -- signal refr_delay : integer range 0 to 7; signal next_delay : integer range 0 to 7; signal boot_cnt : integer range 0 to SDRAM_WakeupTime-1 := SDRAM_WakeupTime-1; signal init_cnt : integer range 0 to c_init_array'high; signal enable_sdram : std_logic := '1'; signal req_i : std_logic; signal rack : std_logic; signal dack : std_logic_vector(5 downto 0) := "000000"; signal burst_start : std_logic_vector(5 downto 0) := "000000"; signal dnext : std_logic_vector(3 downto 0) := "0000"; signal last_bank : std_logic_vector(1 downto 0) := "10"; signal addr_bank : std_logic_vector(1 downto 0); signal same_bank : std_logic; signal last_row : std_logic_vector(12 downto 0) := "0101011010101"; signal addr_row : std_logic_vector(12 downto 0); signal same_row : std_logic; signal addr_column : std_logic_vector(9 downto 0); signal next_activate : std_logic; -- attribute fsm_encoding : string; -- attribute fsm_encoding of state : signal is "sequential"; -- attribute register_duplication : string; -- attribute register_duplication of mem_a_i : signal is "no"; attribute iob : string; attribute iob of SDRAM_CKE : signal is "false"; attribute iob of SDRAM_A : signal is "true"; attribute iob of SDRAM_BA : signal is "true"; attribute iob of SDRAM_RASn : signal is "true"; attribute iob of SDRAM_CASn : signal is "true"; attribute iob of SDRAM_WEn : signal is "true"; constant c_address_width : integer := req.address'length; constant c_data_width : integer := req.data'length; signal cmd_fifo_data_in : std_logic_vector(c_address_width downto 0); signal cmd_fifo_data_out : std_logic_vector(c_address_width downto 0); signal rwn_fifo : std_logic; signal rwn_i : std_logic := '1'; signal tag_fifo : std_logic_vector(7 downto 0); signal address_fifo : std_logic_vector(c_address_width-1 downto 0); signal cmd_af : std_logic; signal cmd_av : std_logic; signal rdata_af : std_logic := '0'; -- forced low for when there is no fifo signal push_cmd : std_logic; signal push_read_cmd : std_logic; signal crazy_index_slv : std_logic_vector(3 downto 0); signal crazy_index : integer range 0 to 15; signal sampled_dq : std_logic_vector(7 downto 0); begin is_idle <= '1' when state = idle else '0'; req_i <= cmd_av and not do_refresh_d; push_cmd <= req.request and not cmd_af; push_read_cmd <= push_cmd and req.read_writen; resp.ready <= not cmd_af; cmd_fifo_data_in <= req.read_writen & std_logic_vector(req.address); address_fifo <= cmd_fifo_data_out(address_fifo'range); rwn_fifo <= cmd_fifo_data_out(address_fifo'length); addr_bank <= address_fifo(14 downto 13); addr_row <= address_fifo(24 downto 15) & address_fifo(12 downto 10); addr_column <= address_fifo( 9 downto 0); i_command_fifo: entity work.srl_fifo generic map ( Width => c_address_width + 1, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => rack, PutElement => push_cmd, FlushFifo => '0', DataIn => cmd_fifo_data_in, DataOut => cmd_fifo_data_out, SpaceInFifo => open, AlmostFull => cmd_af, DataInFifo => cmd_av ); i_tag_fifo: entity work.srl_fifo generic map ( Width => 8, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => burst_start(1), PutElement => push_read_cmd, FlushFifo => '0', DataIn => req.request_tag, DataOut => tag_fifo, SpaceInFifo => open, AlmostFull => open, DataInFifo => open ); r_read_fifo: if g_read_fifo generate i_read_fifo: entity work.srl_fifo generic map ( Width => c_data_width, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => req.data_pop, PutElement => dack(0), FlushFifo => '0', DataIn(15 downto 8) => rdata_lo, DataIn(7 downto 0) => rdata_hi, DataOut => resp.data, SpaceInFifo => open, AlmostFull => rdata_af, DataInFifo => resp.rdata_av ); end generate; r_read_direct: if not g_read_fifo generate resp.data <= rdata_lo & rdata_hi; resp.rdata_av <= dack(0); end generate; fifo_wdata_in <= req.byte_en & req.data; wdqm <= (others => '1') when dqm_override='1' else (others => '0') when dnext(0)='0' else not wdata(17 downto 16); i_write_fifo: entity work.SRL_fifo generic map ( Width => (c_data_width*9)/8, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => dnext(0), PutElement => req.data_push, FlushFifo => '0', DataIn => fifo_wdata_in, DataOut => wdata_i, SpaceInFifo => open, AlmostFull => resp.wdata_full, DataInFifo => wdata_av ); wdata <= wdata_i after 1 ns; same_row <= '1' when addr_row = last_row else '0'; same_bank <= '1' when addr_bank = last_bank else '0'; crazy_index_slv <= not rwn_i & not rwn_fifo & same_row & same_bank; crazy_index <= to_integer(unsigned(crazy_index_slv)); trigger_refresh <= do_refresh_d and not (inhibit_d or inhibit); process(clock) procedure send_refresh_cmd is begin if next_delay = 0 then do_refresh <= '0'; do_refresh_d <= '0'; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; -- Auto Refresh next_delay <= 3; end if; end procedure; procedure accept_req is begin rwn_i <= rwn_fifo; col_addr <= addr_column; last_bank <= addr_bank; last_row <= addr_row; mem_a_i(addr_row'range) <= addr_row; mem_ba_i <= addr_bank; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; -- Command = ACTIVE delay <= 0; state <= sd_cas; end procedure; procedure issue_read_or_write is begin mem_a_i(9 downto 0) <= col_addr; do_refresh_d <= do_refresh; if req_i='0' or do_refresh='1' then if rwn_i='0' then next_delay <= 5; else next_delay <= 4; end if; mem_a_i(10) <= '1'; -- auto precharge next_activate <= '1'; else next_delay <= c_delays(crazy_index); mem_a_i(10) <= not (same_row and same_bank); -- do not AP when we'll continue in same row next_activate <= not (same_row and same_bank); -- only activate next time if we also AP. end if; if delay=0 then if rwn_i='0' then if wdata_av='1' then wdata_tri(7 downto 0) <= (others => '0') after 1 ns; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '0'; dnext <= "1111" after 1 ns; state <= idle; end if; else if rdata_af='0' then cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; dack(dack'high downto dack'high-3) <= (others => '1'); burst_start(2) <= '1'; state <= idle; end if; end if; end if; end procedure; begin if rising_edge(clock) then inhibit_d <= inhibit; rdata_hi_d <= rdata_hi; cs_n_i <= '1' after 1 ns; SDRAM_CKE <= enable_sdram; SDRAM_RASn <= '1'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; if burst_start(1)='1' then resp.data_tag <= tag_fifo; end if; if next_delay /= 0 then next_delay <= next_delay - 1; end if; if delay /= 0 then delay <= delay - 1; end if; wdata_tri <= "11" & wdata_tri(wdata_tri'high downto 2) after 1 ns; dack <= '0' & dack(dack'high downto 1); burst_start <= '0' & burst_start(burst_start'high downto 1); dnext <= '0' & dnext(dnext'high downto 1) after 1 ns; case state is when boot => enable_sdram <= '1'; if g_simulation then state <= init; elsif refresh_cnt = 0 then boot_cnt <= boot_cnt - 1; if boot_cnt = 1 then state <= init; end if; end if; when init => mem_a_i <= c_init_array(init_cnt).addr(mem_a_i'range); mem_ba_i <= (others => '0'); -- for DDR and such, maybe the upper 2/3 bits SDRAM_RASn <= c_init_array(init_cnt).cmd(0); SDRAM_CASn <= c_init_array(init_cnt).cmd(1); SDRAM_WEn <= c_init_array(init_cnt).cmd(2); if next_delay = 0 then next_delay <= 7; cs_n_i <= '0' after 1 ns; if init_cnt = c_init_array'high then state <= idle; dqm_override <= '0'; else init_cnt <= init_cnt + 1; end if; end if; when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then send_refresh_cmd; elsif inhibit='0' then if req_i='1' then if next_activate='1' and next_delay=0 then accept_req; elsif next_activate='0' and next_delay=1 then rwn_i <= rwn_fifo; col_addr <= addr_column; state <= sd_cas; end if; else do_refresh_d <= do_refresh; end if; end if; when sd_cas => issue_read_or_write; when others => null; end case; if refresh_cnt = SDRAM_Refr_period-1 then do_refresh <= '1'; refresh_cnt <= 0; else refresh_cnt <= refresh_cnt + 1; end if; if reset='1' then resp.data_tag <= (others => '0'); dqm_override <= '1'; state <= boot; wdata_tri <= (others => '0'); delay <= 0; next_delay <= 0; do_refresh <= '0'; do_refresh_d <= '0'; boot_cnt <= SDRAM_WakeupTime-1; init_cnt <= 0; enable_sdram <= '1'; next_activate <= '1'; rwn_i <= '1'; end if; end if; end process; -- Generate rack; the signal that indicates that a request is going to be issued -- and thus taken from the command fifo. process(state, trigger_refresh, inhibit, req_i, next_delay, next_activate) begin rack <= '0'; case state is when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then null; elsif inhibit='0' and req_i='1' then if next_activate='1' and next_delay = 0 then rack <= '1'; elsif next_activate='0' and next_delay = 1 then rack <= '1'; end if; end if; when others => null; end case; end process; SDRAM_A <= mem_a_i; SDRAM_BA <= mem_ba_i; not_clock_2x <= not clk_2x; not_clock <= not clock; clkout: FDDRRSE port map ( CE => '1', C0 => clk_2x, C1 => not_clock_2x, D0 => '0', D1 => enable_sdram, Q => SDRAM_CLK, R => '0', S => '0' ); r_data: for i in 0 to 7 generate i_dout: entity work.my_ioddr port map ( pin => SDRAM_DQ(i), clock => clock, D0 => wdata(8+i), D1 => wdata(i), T0 => wdata_tri(1), T1 => wdata_tri(0), Q0 => rdata_hi(i), Q1 => rdata_lo(i) ); end generate; select_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( CE => '1', C0 => clock, C1 => not_clock, D0 => '1', D1 => cs_n_i, Q => SDRAM_CSn, R => '0', S => '0' ); i_dqm_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( Q => SDRAM_DQM, C0 => clock, C1 => not_clock, CE => '1', D0 => wdqm(1), D1 => wdqm(0), R => '0', S => '0' ); end Gideon;
------------------------------------------------------------------------------- -- Title : External Memory controller for SDRAM ------------------------------------------------------------------------------- -- Description: This module implements a simple, single burst memory controller. -- User interface is 16 bit (burst of 2), externally 4x 8 bit. ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library unisim; use unisim.vcomponents.all; library work; use work.mem_bus_pkg.all; entity ext_mem_ctrl_v6 is generic ( g_simulation : boolean := false; g_read_fifo : boolean := false; q_tcko_data : time := 100 ps; A_Width : integer := 13; SDRAM_WakeupTime : integer := 40; -- refresh periods SDRAM_Refr_period : integer := 375 ); port ( clock : in std_logic := '0'; clk_2x : in std_logic := '0'; reset : in std_logic := '0'; inhibit : in std_logic := '0'; is_idle : out std_logic; -- clk_4x : in std_logic := '0'; -- dummy : out std_logic; req : in t_mem_burst_16_req; resp : out t_mem_burst_16_resp; SDRAM_CLK : out std_logic; SDRAM_CKE : out std_logic := '0'; SDRAM_CSn : out std_logic := '1'; SDRAM_RASn : out std_logic := '1'; SDRAM_CASn : out std_logic := '1'; SDRAM_WEn : out std_logic := '1'; SDRAM_DQM : out std_logic := '0'; SDRAM_BA : out std_logic_vector(1 downto 0); SDRAM_A : out std_logic_vector(A_Width-1 downto 0); SDRAM_DQ : inout std_logic_vector(7 downto 0) := (others => 'Z')); end ext_mem_ctrl_v6; architecture Gideon of ext_mem_ctrl_v6 is type t_init is record addr : std_logic_vector(15 downto 0); cmd : std_logic_vector(2 downto 0); -- we-cas-ras end record; type t_init_array is array(natural range <>) of t_init; constant c_init_array : t_init_array(0 to 7) := ( ( X"0400", "010" ), -- auto precharge ( X"002B", "000" ), -- mode register, burstlen=8, writelen=8, CAS lat = 2, interleaved ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ) ); type t_ints is array(natural range <>) of integer; constant c_delays : t_ints(0 to 15) := ( 2, 4, 2, 3, -- R2R (other row&other bank, other row, other bank, same row+bank) 4, 5, 4, 5, -- R2W 2, 5, 2, 3, -- W2R 2, 4, 2, 3 );-- W2W type t_state is (boot, init, idle, sd_cas ); signal state : t_state; signal sdram_d_o : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal sdram_d_t : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal wdata_tri : std_logic_vector(8 downto 0) := (others => '1'); signal delay : integer range 0 to 15; signal inhibit_d : std_logic; signal mem_a_i : std_logic_vector(SDRAM_A'range) := (others => '0'); signal mem_ba_i : std_logic_vector(SDRAM_BA'range) := (others => '0'); signal cs_n_i : std_logic := '1'; signal col_addr : std_logic_vector(9 downto 0) := (others => '0'); signal refresh_cnt : integer range 0 to SDRAM_Refr_period-1; signal do_refresh : std_logic := '0'; signal do_refresh_d : std_logic := '0'; signal trigger_refresh : std_logic := '0'; signal not_clock : std_logic; signal not_clock_2x : std_logic; signal rdata_lo : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi_d : std_logic_vector(7 downto 0) := (others => '0'); signal wdata : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_i : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_av : std_logic; signal fifo_wdata_in : std_logic_vector(17 downto 0); signal wdqm : std_logic_vector(1 downto 0); signal dqm_override : std_logic := '1'; -- signal refr_delay : integer range 0 to 7; signal next_delay : integer range 0 to 7; signal boot_cnt : integer range 0 to SDRAM_WakeupTime-1 := SDRAM_WakeupTime-1; signal init_cnt : integer range 0 to c_init_array'high; signal enable_sdram : std_logic := '1'; signal req_i : std_logic; signal rack : std_logic; signal dack : std_logic_vector(5 downto 0) := "000000"; signal burst_start : std_logic_vector(5 downto 0) := "000000"; signal dnext : std_logic_vector(3 downto 0) := "0000"; signal last_bank : std_logic_vector(1 downto 0) := "10"; signal addr_bank : std_logic_vector(1 downto 0); signal same_bank : std_logic; signal last_row : std_logic_vector(12 downto 0) := "0101011010101"; signal addr_row : std_logic_vector(12 downto 0); signal same_row : std_logic; signal addr_column : std_logic_vector(9 downto 0); signal next_activate : std_logic; -- attribute fsm_encoding : string; -- attribute fsm_encoding of state : signal is "sequential"; -- attribute register_duplication : string; -- attribute register_duplication of mem_a_i : signal is "no"; attribute iob : string; attribute iob of SDRAM_CKE : signal is "false"; attribute iob of SDRAM_A : signal is "true"; attribute iob of SDRAM_BA : signal is "true"; attribute iob of SDRAM_RASn : signal is "true"; attribute iob of SDRAM_CASn : signal is "true"; attribute iob of SDRAM_WEn : signal is "true"; constant c_address_width : integer := req.address'length; constant c_data_width : integer := req.data'length; signal cmd_fifo_data_in : std_logic_vector(c_address_width downto 0); signal cmd_fifo_data_out : std_logic_vector(c_address_width downto 0); signal rwn_fifo : std_logic; signal rwn_i : std_logic := '1'; signal tag_fifo : std_logic_vector(7 downto 0); signal address_fifo : std_logic_vector(c_address_width-1 downto 0); signal cmd_af : std_logic; signal cmd_av : std_logic; signal rdata_af : std_logic := '0'; -- forced low for when there is no fifo signal push_cmd : std_logic; signal push_read_cmd : std_logic; signal crazy_index_slv : std_logic_vector(3 downto 0); signal crazy_index : integer range 0 to 15; signal sampled_dq : std_logic_vector(7 downto 0); begin is_idle <= '1' when state = idle else '0'; req_i <= cmd_av and not do_refresh_d; push_cmd <= req.request and not cmd_af; push_read_cmd <= push_cmd and req.read_writen; resp.ready <= not cmd_af; cmd_fifo_data_in <= req.read_writen & std_logic_vector(req.address); address_fifo <= cmd_fifo_data_out(address_fifo'range); rwn_fifo <= cmd_fifo_data_out(address_fifo'length); addr_bank <= address_fifo(14 downto 13); addr_row <= address_fifo(24 downto 15) & address_fifo(12 downto 10); addr_column <= address_fifo( 9 downto 0); i_command_fifo: entity work.srl_fifo generic map ( Width => c_address_width + 1, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => rack, PutElement => push_cmd, FlushFifo => '0', DataIn => cmd_fifo_data_in, DataOut => cmd_fifo_data_out, SpaceInFifo => open, AlmostFull => cmd_af, DataInFifo => cmd_av ); i_tag_fifo: entity work.srl_fifo generic map ( Width => 8, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => burst_start(1), PutElement => push_read_cmd, FlushFifo => '0', DataIn => req.request_tag, DataOut => tag_fifo, SpaceInFifo => open, AlmostFull => open, DataInFifo => open ); r_read_fifo: if g_read_fifo generate i_read_fifo: entity work.srl_fifo generic map ( Width => c_data_width, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => req.data_pop, PutElement => dack(0), FlushFifo => '0', DataIn(15 downto 8) => rdata_lo, DataIn(7 downto 0) => rdata_hi, DataOut => resp.data, SpaceInFifo => open, AlmostFull => rdata_af, DataInFifo => resp.rdata_av ); end generate; r_read_direct: if not g_read_fifo generate resp.data <= rdata_lo & rdata_hi; resp.rdata_av <= dack(0); end generate; fifo_wdata_in <= req.byte_en & req.data; wdqm <= (others => '1') when dqm_override='1' else (others => '0') when dnext(0)='0' else not wdata(17 downto 16); i_write_fifo: entity work.SRL_fifo generic map ( Width => (c_data_width*9)/8, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => dnext(0), PutElement => req.data_push, FlushFifo => '0', DataIn => fifo_wdata_in, DataOut => wdata_i, SpaceInFifo => open, AlmostFull => resp.wdata_full, DataInFifo => wdata_av ); wdata <= wdata_i after 1 ns; same_row <= '1' when addr_row = last_row else '0'; same_bank <= '1' when addr_bank = last_bank else '0'; crazy_index_slv <= not rwn_i & not rwn_fifo & same_row & same_bank; crazy_index <= to_integer(unsigned(crazy_index_slv)); trigger_refresh <= do_refresh_d and not (inhibit_d or inhibit); process(clock) procedure send_refresh_cmd is begin if next_delay = 0 then do_refresh <= '0'; do_refresh_d <= '0'; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; -- Auto Refresh next_delay <= 3; end if; end procedure; procedure accept_req is begin rwn_i <= rwn_fifo; col_addr <= addr_column; last_bank <= addr_bank; last_row <= addr_row; mem_a_i(addr_row'range) <= addr_row; mem_ba_i <= addr_bank; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; -- Command = ACTIVE delay <= 0; state <= sd_cas; end procedure; procedure issue_read_or_write is begin mem_a_i(9 downto 0) <= col_addr; do_refresh_d <= do_refresh; if req_i='0' or do_refresh='1' then if rwn_i='0' then next_delay <= 5; else next_delay <= 4; end if; mem_a_i(10) <= '1'; -- auto precharge next_activate <= '1'; else next_delay <= c_delays(crazy_index); mem_a_i(10) <= not (same_row and same_bank); -- do not AP when we'll continue in same row next_activate <= not (same_row and same_bank); -- only activate next time if we also AP. end if; if delay=0 then if rwn_i='0' then if wdata_av='1' then wdata_tri(7 downto 0) <= (others => '0') after 1 ns; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '0'; dnext <= "1111" after 1 ns; state <= idle; end if; else if rdata_af='0' then cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; dack(dack'high downto dack'high-3) <= (others => '1'); burst_start(2) <= '1'; state <= idle; end if; end if; end if; end procedure; begin if rising_edge(clock) then inhibit_d <= inhibit; rdata_hi_d <= rdata_hi; cs_n_i <= '1' after 1 ns; SDRAM_CKE <= enable_sdram; SDRAM_RASn <= '1'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; if burst_start(1)='1' then resp.data_tag <= tag_fifo; end if; if next_delay /= 0 then next_delay <= next_delay - 1; end if; if delay /= 0 then delay <= delay - 1; end if; wdata_tri <= "11" & wdata_tri(wdata_tri'high downto 2) after 1 ns; dack <= '0' & dack(dack'high downto 1); burst_start <= '0' & burst_start(burst_start'high downto 1); dnext <= '0' & dnext(dnext'high downto 1) after 1 ns; case state is when boot => enable_sdram <= '1'; if g_simulation then state <= init; elsif refresh_cnt = 0 then boot_cnt <= boot_cnt - 1; if boot_cnt = 1 then state <= init; end if; end if; when init => mem_a_i <= c_init_array(init_cnt).addr(mem_a_i'range); mem_ba_i <= (others => '0'); -- for DDR and such, maybe the upper 2/3 bits SDRAM_RASn <= c_init_array(init_cnt).cmd(0); SDRAM_CASn <= c_init_array(init_cnt).cmd(1); SDRAM_WEn <= c_init_array(init_cnt).cmd(2); if next_delay = 0 then next_delay <= 7; cs_n_i <= '0' after 1 ns; if init_cnt = c_init_array'high then state <= idle; dqm_override <= '0'; else init_cnt <= init_cnt + 1; end if; end if; when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then send_refresh_cmd; elsif inhibit='0' then if req_i='1' then if next_activate='1' and next_delay=0 then accept_req; elsif next_activate='0' and next_delay=1 then rwn_i <= rwn_fifo; col_addr <= addr_column; state <= sd_cas; end if; else do_refresh_d <= do_refresh; end if; end if; when sd_cas => issue_read_or_write; when others => null; end case; if refresh_cnt = SDRAM_Refr_period-1 then do_refresh <= '1'; refresh_cnt <= 0; else refresh_cnt <= refresh_cnt + 1; end if; if reset='1' then resp.data_tag <= (others => '0'); dqm_override <= '1'; state <= boot; wdata_tri <= (others => '0'); delay <= 0; next_delay <= 0; do_refresh <= '0'; do_refresh_d <= '0'; boot_cnt <= SDRAM_WakeupTime-1; init_cnt <= 0; enable_sdram <= '1'; next_activate <= '1'; rwn_i <= '1'; end if; end if; end process; -- Generate rack; the signal that indicates that a request is going to be issued -- and thus taken from the command fifo. process(state, trigger_refresh, inhibit, req_i, next_delay, next_activate) begin rack <= '0'; case state is when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then null; elsif inhibit='0' and req_i='1' then if next_activate='1' and next_delay = 0 then rack <= '1'; elsif next_activate='0' and next_delay = 1 then rack <= '1'; end if; end if; when others => null; end case; end process; SDRAM_A <= mem_a_i; SDRAM_BA <= mem_ba_i; not_clock_2x <= not clk_2x; not_clock <= not clock; clkout: FDDRRSE port map ( CE => '1', C0 => clk_2x, C1 => not_clock_2x, D0 => '0', D1 => enable_sdram, Q => SDRAM_CLK, R => '0', S => '0' ); r_data: for i in 0 to 7 generate i_dout: entity work.my_ioddr port map ( pin => SDRAM_DQ(i), clock => clock, D0 => wdata(8+i), D1 => wdata(i), T0 => wdata_tri(1), T1 => wdata_tri(0), Q0 => rdata_hi(i), Q1 => rdata_lo(i) ); end generate; select_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( CE => '1', C0 => clock, C1 => not_clock, D0 => '1', D1 => cs_n_i, Q => SDRAM_CSn, R => '0', S => '0' ); i_dqm_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( Q => SDRAM_DQM, C0 => clock, C1 => not_clock, CE => '1', D0 => wdqm(1), D1 => wdqm(0), R => '0', S => '0' ); end Gideon;
------------------------------------------------------------------------------- -- Title : External Memory controller for SDRAM ------------------------------------------------------------------------------- -- Description: This module implements a simple, single burst memory controller. -- User interface is 16 bit (burst of 2), externally 4x 8 bit. ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library unisim; use unisim.vcomponents.all; library work; use work.mem_bus_pkg.all; entity ext_mem_ctrl_v6 is generic ( g_simulation : boolean := false; g_read_fifo : boolean := false; q_tcko_data : time := 100 ps; A_Width : integer := 13; SDRAM_WakeupTime : integer := 40; -- refresh periods SDRAM_Refr_period : integer := 375 ); port ( clock : in std_logic := '0'; clk_2x : in std_logic := '0'; reset : in std_logic := '0'; inhibit : in std_logic := '0'; is_idle : out std_logic; -- clk_4x : in std_logic := '0'; -- dummy : out std_logic; req : in t_mem_burst_16_req; resp : out t_mem_burst_16_resp; SDRAM_CLK : out std_logic; SDRAM_CKE : out std_logic := '0'; SDRAM_CSn : out std_logic := '1'; SDRAM_RASn : out std_logic := '1'; SDRAM_CASn : out std_logic := '1'; SDRAM_WEn : out std_logic := '1'; SDRAM_DQM : out std_logic := '0'; SDRAM_BA : out std_logic_vector(1 downto 0); SDRAM_A : out std_logic_vector(A_Width-1 downto 0); SDRAM_DQ : inout std_logic_vector(7 downto 0) := (others => 'Z')); end ext_mem_ctrl_v6; architecture Gideon of ext_mem_ctrl_v6 is type t_init is record addr : std_logic_vector(15 downto 0); cmd : std_logic_vector(2 downto 0); -- we-cas-ras end record; type t_init_array is array(natural range <>) of t_init; constant c_init_array : t_init_array(0 to 7) := ( ( X"0400", "010" ), -- auto precharge ( X"002B", "000" ), -- mode register, burstlen=8, writelen=8, CAS lat = 2, interleaved ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ) ); type t_ints is array(natural range <>) of integer; constant c_delays : t_ints(0 to 15) := ( 2, 4, 2, 3, -- R2R (other row&other bank, other row, other bank, same row+bank) 4, 5, 4, 5, -- R2W 2, 5, 2, 3, -- W2R 2, 4, 2, 3 );-- W2W type t_state is (boot, init, idle, sd_cas ); signal state : t_state; signal sdram_d_o : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal sdram_d_t : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal wdata_tri : std_logic_vector(8 downto 0) := (others => '1'); signal delay : integer range 0 to 15; signal inhibit_d : std_logic; signal mem_a_i : std_logic_vector(SDRAM_A'range) := (others => '0'); signal mem_ba_i : std_logic_vector(SDRAM_BA'range) := (others => '0'); signal cs_n_i : std_logic := '1'; signal col_addr : std_logic_vector(9 downto 0) := (others => '0'); signal refresh_cnt : integer range 0 to SDRAM_Refr_period-1; signal do_refresh : std_logic := '0'; signal do_refresh_d : std_logic := '0'; signal trigger_refresh : std_logic := '0'; signal not_clock : std_logic; signal not_clock_2x : std_logic; signal rdata_lo : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi_d : std_logic_vector(7 downto 0) := (others => '0'); signal wdata : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_i : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_av : std_logic; signal fifo_wdata_in : std_logic_vector(17 downto 0); signal wdqm : std_logic_vector(1 downto 0); signal dqm_override : std_logic := '1'; -- signal refr_delay : integer range 0 to 7; signal next_delay : integer range 0 to 7; signal boot_cnt : integer range 0 to SDRAM_WakeupTime-1 := SDRAM_WakeupTime-1; signal init_cnt : integer range 0 to c_init_array'high; signal enable_sdram : std_logic := '1'; signal req_i : std_logic; signal rack : std_logic; signal dack : std_logic_vector(5 downto 0) := "000000"; signal burst_start : std_logic_vector(5 downto 0) := "000000"; signal dnext : std_logic_vector(3 downto 0) := "0000"; signal last_bank : std_logic_vector(1 downto 0) := "10"; signal addr_bank : std_logic_vector(1 downto 0); signal same_bank : std_logic; signal last_row : std_logic_vector(12 downto 0) := "0101011010101"; signal addr_row : std_logic_vector(12 downto 0); signal same_row : std_logic; signal addr_column : std_logic_vector(9 downto 0); signal next_activate : std_logic; -- attribute fsm_encoding : string; -- attribute fsm_encoding of state : signal is "sequential"; -- attribute register_duplication : string; -- attribute register_duplication of mem_a_i : signal is "no"; attribute iob : string; attribute iob of SDRAM_CKE : signal is "false"; attribute iob of SDRAM_A : signal is "true"; attribute iob of SDRAM_BA : signal is "true"; attribute iob of SDRAM_RASn : signal is "true"; attribute iob of SDRAM_CASn : signal is "true"; attribute iob of SDRAM_WEn : signal is "true"; constant c_address_width : integer := req.address'length; constant c_data_width : integer := req.data'length; signal cmd_fifo_data_in : std_logic_vector(c_address_width downto 0); signal cmd_fifo_data_out : std_logic_vector(c_address_width downto 0); signal rwn_fifo : std_logic; signal rwn_i : std_logic := '1'; signal tag_fifo : std_logic_vector(7 downto 0); signal address_fifo : std_logic_vector(c_address_width-1 downto 0); signal cmd_af : std_logic; signal cmd_av : std_logic; signal rdata_af : std_logic := '0'; -- forced low for when there is no fifo signal push_cmd : std_logic; signal push_read_cmd : std_logic; signal crazy_index_slv : std_logic_vector(3 downto 0); signal crazy_index : integer range 0 to 15; signal sampled_dq : std_logic_vector(7 downto 0); begin is_idle <= '1' when state = idle else '0'; req_i <= cmd_av and not do_refresh_d; push_cmd <= req.request and not cmd_af; push_read_cmd <= push_cmd and req.read_writen; resp.ready <= not cmd_af; cmd_fifo_data_in <= req.read_writen & std_logic_vector(req.address); address_fifo <= cmd_fifo_data_out(address_fifo'range); rwn_fifo <= cmd_fifo_data_out(address_fifo'length); addr_bank <= address_fifo(14 downto 13); addr_row <= address_fifo(24 downto 15) & address_fifo(12 downto 10); addr_column <= address_fifo( 9 downto 0); i_command_fifo: entity work.srl_fifo generic map ( Width => c_address_width + 1, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => rack, PutElement => push_cmd, FlushFifo => '0', DataIn => cmd_fifo_data_in, DataOut => cmd_fifo_data_out, SpaceInFifo => open, AlmostFull => cmd_af, DataInFifo => cmd_av ); i_tag_fifo: entity work.srl_fifo generic map ( Width => 8, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => burst_start(1), PutElement => push_read_cmd, FlushFifo => '0', DataIn => req.request_tag, DataOut => tag_fifo, SpaceInFifo => open, AlmostFull => open, DataInFifo => open ); r_read_fifo: if g_read_fifo generate i_read_fifo: entity work.srl_fifo generic map ( Width => c_data_width, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => req.data_pop, PutElement => dack(0), FlushFifo => '0', DataIn(15 downto 8) => rdata_lo, DataIn(7 downto 0) => rdata_hi, DataOut => resp.data, SpaceInFifo => open, AlmostFull => rdata_af, DataInFifo => resp.rdata_av ); end generate; r_read_direct: if not g_read_fifo generate resp.data <= rdata_lo & rdata_hi; resp.rdata_av <= dack(0); end generate; fifo_wdata_in <= req.byte_en & req.data; wdqm <= (others => '1') when dqm_override='1' else (others => '0') when dnext(0)='0' else not wdata(17 downto 16); i_write_fifo: entity work.SRL_fifo generic map ( Width => (c_data_width*9)/8, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => dnext(0), PutElement => req.data_push, FlushFifo => '0', DataIn => fifo_wdata_in, DataOut => wdata_i, SpaceInFifo => open, AlmostFull => resp.wdata_full, DataInFifo => wdata_av ); wdata <= wdata_i after 1 ns; same_row <= '1' when addr_row = last_row else '0'; same_bank <= '1' when addr_bank = last_bank else '0'; crazy_index_slv <= not rwn_i & not rwn_fifo & same_row & same_bank; crazy_index <= to_integer(unsigned(crazy_index_slv)); trigger_refresh <= do_refresh_d and not (inhibit_d or inhibit); process(clock) procedure send_refresh_cmd is begin if next_delay = 0 then do_refresh <= '0'; do_refresh_d <= '0'; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; -- Auto Refresh next_delay <= 3; end if; end procedure; procedure accept_req is begin rwn_i <= rwn_fifo; col_addr <= addr_column; last_bank <= addr_bank; last_row <= addr_row; mem_a_i(addr_row'range) <= addr_row; mem_ba_i <= addr_bank; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; -- Command = ACTIVE delay <= 0; state <= sd_cas; end procedure; procedure issue_read_or_write is begin mem_a_i(9 downto 0) <= col_addr; do_refresh_d <= do_refresh; if req_i='0' or do_refresh='1' then if rwn_i='0' then next_delay <= 5; else next_delay <= 4; end if; mem_a_i(10) <= '1'; -- auto precharge next_activate <= '1'; else next_delay <= c_delays(crazy_index); mem_a_i(10) <= not (same_row and same_bank); -- do not AP when we'll continue in same row next_activate <= not (same_row and same_bank); -- only activate next time if we also AP. end if; if delay=0 then if rwn_i='0' then if wdata_av='1' then wdata_tri(7 downto 0) <= (others => '0') after 1 ns; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '0'; dnext <= "1111" after 1 ns; state <= idle; end if; else if rdata_af='0' then cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; dack(dack'high downto dack'high-3) <= (others => '1'); burst_start(2) <= '1'; state <= idle; end if; end if; end if; end procedure; begin if rising_edge(clock) then inhibit_d <= inhibit; rdata_hi_d <= rdata_hi; cs_n_i <= '1' after 1 ns; SDRAM_CKE <= enable_sdram; SDRAM_RASn <= '1'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; if burst_start(1)='1' then resp.data_tag <= tag_fifo; end if; if next_delay /= 0 then next_delay <= next_delay - 1; end if; if delay /= 0 then delay <= delay - 1; end if; wdata_tri <= "11" & wdata_tri(wdata_tri'high downto 2) after 1 ns; dack <= '0' & dack(dack'high downto 1); burst_start <= '0' & burst_start(burst_start'high downto 1); dnext <= '0' & dnext(dnext'high downto 1) after 1 ns; case state is when boot => enable_sdram <= '1'; if g_simulation then state <= init; elsif refresh_cnt = 0 then boot_cnt <= boot_cnt - 1; if boot_cnt = 1 then state <= init; end if; end if; when init => mem_a_i <= c_init_array(init_cnt).addr(mem_a_i'range); mem_ba_i <= (others => '0'); -- for DDR and such, maybe the upper 2/3 bits SDRAM_RASn <= c_init_array(init_cnt).cmd(0); SDRAM_CASn <= c_init_array(init_cnt).cmd(1); SDRAM_WEn <= c_init_array(init_cnt).cmd(2); if next_delay = 0 then next_delay <= 7; cs_n_i <= '0' after 1 ns; if init_cnt = c_init_array'high then state <= idle; dqm_override <= '0'; else init_cnt <= init_cnt + 1; end if; end if; when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then send_refresh_cmd; elsif inhibit='0' then if req_i='1' then if next_activate='1' and next_delay=0 then accept_req; elsif next_activate='0' and next_delay=1 then rwn_i <= rwn_fifo; col_addr <= addr_column; state <= sd_cas; end if; else do_refresh_d <= do_refresh; end if; end if; when sd_cas => issue_read_or_write; when others => null; end case; if refresh_cnt = SDRAM_Refr_period-1 then do_refresh <= '1'; refresh_cnt <= 0; else refresh_cnt <= refresh_cnt + 1; end if; if reset='1' then resp.data_tag <= (others => '0'); dqm_override <= '1'; state <= boot; wdata_tri <= (others => '0'); delay <= 0; next_delay <= 0; do_refresh <= '0'; do_refresh_d <= '0'; boot_cnt <= SDRAM_WakeupTime-1; init_cnt <= 0; enable_sdram <= '1'; next_activate <= '1'; rwn_i <= '1'; end if; end if; end process; -- Generate rack; the signal that indicates that a request is going to be issued -- and thus taken from the command fifo. process(state, trigger_refresh, inhibit, req_i, next_delay, next_activate) begin rack <= '0'; case state is when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then null; elsif inhibit='0' and req_i='1' then if next_activate='1' and next_delay = 0 then rack <= '1'; elsif next_activate='0' and next_delay = 1 then rack <= '1'; end if; end if; when others => null; end case; end process; SDRAM_A <= mem_a_i; SDRAM_BA <= mem_ba_i; not_clock_2x <= not clk_2x; not_clock <= not clock; clkout: FDDRRSE port map ( CE => '1', C0 => clk_2x, C1 => not_clock_2x, D0 => '0', D1 => enable_sdram, Q => SDRAM_CLK, R => '0', S => '0' ); r_data: for i in 0 to 7 generate i_dout: entity work.my_ioddr port map ( pin => SDRAM_DQ(i), clock => clock, D0 => wdata(8+i), D1 => wdata(i), T0 => wdata_tri(1), T1 => wdata_tri(0), Q0 => rdata_hi(i), Q1 => rdata_lo(i) ); end generate; select_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( CE => '1', C0 => clock, C1 => not_clock, D0 => '1', D1 => cs_n_i, Q => SDRAM_CSn, R => '0', S => '0' ); i_dqm_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( Q => SDRAM_DQM, C0 => clock, C1 => not_clock, CE => '1', D0 => wdqm(1), D1 => wdqm(0), R => '0', S => '0' ); end Gideon;
------------------------------------------------------------------------------- -- Title : External Memory controller for SDRAM ------------------------------------------------------------------------------- -- Description: This module implements a simple, single burst memory controller. -- User interface is 16 bit (burst of 2), externally 4x 8 bit. ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library unisim; use unisim.vcomponents.all; library work; use work.mem_bus_pkg.all; entity ext_mem_ctrl_v6 is generic ( g_simulation : boolean := false; g_read_fifo : boolean := false; q_tcko_data : time := 100 ps; A_Width : integer := 13; SDRAM_WakeupTime : integer := 40; -- refresh periods SDRAM_Refr_period : integer := 375 ); port ( clock : in std_logic := '0'; clk_2x : in std_logic := '0'; reset : in std_logic := '0'; inhibit : in std_logic := '0'; is_idle : out std_logic; -- clk_4x : in std_logic := '0'; -- dummy : out std_logic; req : in t_mem_burst_16_req; resp : out t_mem_burst_16_resp; SDRAM_CLK : out std_logic; SDRAM_CKE : out std_logic := '0'; SDRAM_CSn : out std_logic := '1'; SDRAM_RASn : out std_logic := '1'; SDRAM_CASn : out std_logic := '1'; SDRAM_WEn : out std_logic := '1'; SDRAM_DQM : out std_logic := '0'; SDRAM_BA : out std_logic_vector(1 downto 0); SDRAM_A : out std_logic_vector(A_Width-1 downto 0); SDRAM_DQ : inout std_logic_vector(7 downto 0) := (others => 'Z')); end ext_mem_ctrl_v6; architecture Gideon of ext_mem_ctrl_v6 is type t_init is record addr : std_logic_vector(15 downto 0); cmd : std_logic_vector(2 downto 0); -- we-cas-ras end record; type t_init_array is array(natural range <>) of t_init; constant c_init_array : t_init_array(0 to 7) := ( ( X"0400", "010" ), -- auto precharge ( X"002B", "000" ), -- mode register, burstlen=8, writelen=8, CAS lat = 2, interleaved ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ) ); type t_ints is array(natural range <>) of integer; constant c_delays : t_ints(0 to 15) := ( 2, 4, 2, 3, -- R2R (other row&other bank, other row, other bank, same row+bank) 4, 5, 4, 5, -- R2W 2, 5, 2, 3, -- W2R 2, 4, 2, 3 );-- W2W type t_state is (boot, init, idle, sd_cas ); signal state : t_state; signal sdram_d_o : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal sdram_d_t : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal wdata_tri : std_logic_vector(8 downto 0) := (others => '1'); signal delay : integer range 0 to 15; signal inhibit_d : std_logic; signal mem_a_i : std_logic_vector(SDRAM_A'range) := (others => '0'); signal mem_ba_i : std_logic_vector(SDRAM_BA'range) := (others => '0'); signal cs_n_i : std_logic := '1'; signal col_addr : std_logic_vector(9 downto 0) := (others => '0'); signal refresh_cnt : integer range 0 to SDRAM_Refr_period-1; signal do_refresh : std_logic := '0'; signal do_refresh_d : std_logic := '0'; signal trigger_refresh : std_logic := '0'; signal not_clock : std_logic; signal not_clock_2x : std_logic; signal rdata_lo : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi_d : std_logic_vector(7 downto 0) := (others => '0'); signal wdata : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_i : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_av : std_logic; signal fifo_wdata_in : std_logic_vector(17 downto 0); signal wdqm : std_logic_vector(1 downto 0); signal dqm_override : std_logic := '1'; -- signal refr_delay : integer range 0 to 7; signal next_delay : integer range 0 to 7; signal boot_cnt : integer range 0 to SDRAM_WakeupTime-1 := SDRAM_WakeupTime-1; signal init_cnt : integer range 0 to c_init_array'high; signal enable_sdram : std_logic := '1'; signal req_i : std_logic; signal rack : std_logic; signal dack : std_logic_vector(5 downto 0) := "000000"; signal burst_start : std_logic_vector(5 downto 0) := "000000"; signal dnext : std_logic_vector(3 downto 0) := "0000"; signal last_bank : std_logic_vector(1 downto 0) := "10"; signal addr_bank : std_logic_vector(1 downto 0); signal same_bank : std_logic; signal last_row : std_logic_vector(12 downto 0) := "0101011010101"; signal addr_row : std_logic_vector(12 downto 0); signal same_row : std_logic; signal addr_column : std_logic_vector(9 downto 0); signal next_activate : std_logic; -- attribute fsm_encoding : string; -- attribute fsm_encoding of state : signal is "sequential"; -- attribute register_duplication : string; -- attribute register_duplication of mem_a_i : signal is "no"; attribute iob : string; attribute iob of SDRAM_CKE : signal is "false"; attribute iob of SDRAM_A : signal is "true"; attribute iob of SDRAM_BA : signal is "true"; attribute iob of SDRAM_RASn : signal is "true"; attribute iob of SDRAM_CASn : signal is "true"; attribute iob of SDRAM_WEn : signal is "true"; constant c_address_width : integer := req.address'length; constant c_data_width : integer := req.data'length; signal cmd_fifo_data_in : std_logic_vector(c_address_width downto 0); signal cmd_fifo_data_out : std_logic_vector(c_address_width downto 0); signal rwn_fifo : std_logic; signal rwn_i : std_logic := '1'; signal tag_fifo : std_logic_vector(7 downto 0); signal address_fifo : std_logic_vector(c_address_width-1 downto 0); signal cmd_af : std_logic; signal cmd_av : std_logic; signal rdata_af : std_logic := '0'; -- forced low for when there is no fifo signal push_cmd : std_logic; signal push_read_cmd : std_logic; signal crazy_index_slv : std_logic_vector(3 downto 0); signal crazy_index : integer range 0 to 15; signal sampled_dq : std_logic_vector(7 downto 0); begin is_idle <= '1' when state = idle else '0'; req_i <= cmd_av and not do_refresh_d; push_cmd <= req.request and not cmd_af; push_read_cmd <= push_cmd and req.read_writen; resp.ready <= not cmd_af; cmd_fifo_data_in <= req.read_writen & std_logic_vector(req.address); address_fifo <= cmd_fifo_data_out(address_fifo'range); rwn_fifo <= cmd_fifo_data_out(address_fifo'length); addr_bank <= address_fifo(14 downto 13); addr_row <= address_fifo(24 downto 15) & address_fifo(12 downto 10); addr_column <= address_fifo( 9 downto 0); i_command_fifo: entity work.srl_fifo generic map ( Width => c_address_width + 1, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => rack, PutElement => push_cmd, FlushFifo => '0', DataIn => cmd_fifo_data_in, DataOut => cmd_fifo_data_out, SpaceInFifo => open, AlmostFull => cmd_af, DataInFifo => cmd_av ); i_tag_fifo: entity work.srl_fifo generic map ( Width => 8, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => burst_start(1), PutElement => push_read_cmd, FlushFifo => '0', DataIn => req.request_tag, DataOut => tag_fifo, SpaceInFifo => open, AlmostFull => open, DataInFifo => open ); r_read_fifo: if g_read_fifo generate i_read_fifo: entity work.srl_fifo generic map ( Width => c_data_width, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => req.data_pop, PutElement => dack(0), FlushFifo => '0', DataIn(15 downto 8) => rdata_lo, DataIn(7 downto 0) => rdata_hi, DataOut => resp.data, SpaceInFifo => open, AlmostFull => rdata_af, DataInFifo => resp.rdata_av ); end generate; r_read_direct: if not g_read_fifo generate resp.data <= rdata_lo & rdata_hi; resp.rdata_av <= dack(0); end generate; fifo_wdata_in <= req.byte_en & req.data; wdqm <= (others => '1') when dqm_override='1' else (others => '0') when dnext(0)='0' else not wdata(17 downto 16); i_write_fifo: entity work.SRL_fifo generic map ( Width => (c_data_width*9)/8, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => dnext(0), PutElement => req.data_push, FlushFifo => '0', DataIn => fifo_wdata_in, DataOut => wdata_i, SpaceInFifo => open, AlmostFull => resp.wdata_full, DataInFifo => wdata_av ); wdata <= wdata_i after 1 ns; same_row <= '1' when addr_row = last_row else '0'; same_bank <= '1' when addr_bank = last_bank else '0'; crazy_index_slv <= not rwn_i & not rwn_fifo & same_row & same_bank; crazy_index <= to_integer(unsigned(crazy_index_slv)); trigger_refresh <= do_refresh_d and not (inhibit_d or inhibit); process(clock) procedure send_refresh_cmd is begin if next_delay = 0 then do_refresh <= '0'; do_refresh_d <= '0'; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; -- Auto Refresh next_delay <= 3; end if; end procedure; procedure accept_req is begin rwn_i <= rwn_fifo; col_addr <= addr_column; last_bank <= addr_bank; last_row <= addr_row; mem_a_i(addr_row'range) <= addr_row; mem_ba_i <= addr_bank; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; -- Command = ACTIVE delay <= 0; state <= sd_cas; end procedure; procedure issue_read_or_write is begin mem_a_i(9 downto 0) <= col_addr; do_refresh_d <= do_refresh; if req_i='0' or do_refresh='1' then if rwn_i='0' then next_delay <= 5; else next_delay <= 4; end if; mem_a_i(10) <= '1'; -- auto precharge next_activate <= '1'; else next_delay <= c_delays(crazy_index); mem_a_i(10) <= not (same_row and same_bank); -- do not AP when we'll continue in same row next_activate <= not (same_row and same_bank); -- only activate next time if we also AP. end if; if delay=0 then if rwn_i='0' then if wdata_av='1' then wdata_tri(7 downto 0) <= (others => '0') after 1 ns; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '0'; dnext <= "1111" after 1 ns; state <= idle; end if; else if rdata_af='0' then cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; dack(dack'high downto dack'high-3) <= (others => '1'); burst_start(2) <= '1'; state <= idle; end if; end if; end if; end procedure; begin if rising_edge(clock) then inhibit_d <= inhibit; rdata_hi_d <= rdata_hi; cs_n_i <= '1' after 1 ns; SDRAM_CKE <= enable_sdram; SDRAM_RASn <= '1'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; if burst_start(1)='1' then resp.data_tag <= tag_fifo; end if; if next_delay /= 0 then next_delay <= next_delay - 1; end if; if delay /= 0 then delay <= delay - 1; end if; wdata_tri <= "11" & wdata_tri(wdata_tri'high downto 2) after 1 ns; dack <= '0' & dack(dack'high downto 1); burst_start <= '0' & burst_start(burst_start'high downto 1); dnext <= '0' & dnext(dnext'high downto 1) after 1 ns; case state is when boot => enable_sdram <= '1'; if g_simulation then state <= init; elsif refresh_cnt = 0 then boot_cnt <= boot_cnt - 1; if boot_cnt = 1 then state <= init; end if; end if; when init => mem_a_i <= c_init_array(init_cnt).addr(mem_a_i'range); mem_ba_i <= (others => '0'); -- for DDR and such, maybe the upper 2/3 bits SDRAM_RASn <= c_init_array(init_cnt).cmd(0); SDRAM_CASn <= c_init_array(init_cnt).cmd(1); SDRAM_WEn <= c_init_array(init_cnt).cmd(2); if next_delay = 0 then next_delay <= 7; cs_n_i <= '0' after 1 ns; if init_cnt = c_init_array'high then state <= idle; dqm_override <= '0'; else init_cnt <= init_cnt + 1; end if; end if; when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then send_refresh_cmd; elsif inhibit='0' then if req_i='1' then if next_activate='1' and next_delay=0 then accept_req; elsif next_activate='0' and next_delay=1 then rwn_i <= rwn_fifo; col_addr <= addr_column; state <= sd_cas; end if; else do_refresh_d <= do_refresh; end if; end if; when sd_cas => issue_read_or_write; when others => null; end case; if refresh_cnt = SDRAM_Refr_period-1 then do_refresh <= '1'; refresh_cnt <= 0; else refresh_cnt <= refresh_cnt + 1; end if; if reset='1' then resp.data_tag <= (others => '0'); dqm_override <= '1'; state <= boot; wdata_tri <= (others => '0'); delay <= 0; next_delay <= 0; do_refresh <= '0'; do_refresh_d <= '0'; boot_cnt <= SDRAM_WakeupTime-1; init_cnt <= 0; enable_sdram <= '1'; next_activate <= '1'; rwn_i <= '1'; end if; end if; end process; -- Generate rack; the signal that indicates that a request is going to be issued -- and thus taken from the command fifo. process(state, trigger_refresh, inhibit, req_i, next_delay, next_activate) begin rack <= '0'; case state is when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then null; elsif inhibit='0' and req_i='1' then if next_activate='1' and next_delay = 0 then rack <= '1'; elsif next_activate='0' and next_delay = 1 then rack <= '1'; end if; end if; when others => null; end case; end process; SDRAM_A <= mem_a_i; SDRAM_BA <= mem_ba_i; not_clock_2x <= not clk_2x; not_clock <= not clock; clkout: FDDRRSE port map ( CE => '1', C0 => clk_2x, C1 => not_clock_2x, D0 => '0', D1 => enable_sdram, Q => SDRAM_CLK, R => '0', S => '0' ); r_data: for i in 0 to 7 generate i_dout: entity work.my_ioddr port map ( pin => SDRAM_DQ(i), clock => clock, D0 => wdata(8+i), D1 => wdata(i), T0 => wdata_tri(1), T1 => wdata_tri(0), Q0 => rdata_hi(i), Q1 => rdata_lo(i) ); end generate; select_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( CE => '1', C0 => clock, C1 => not_clock, D0 => '1', D1 => cs_n_i, Q => SDRAM_CSn, R => '0', S => '0' ); i_dqm_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( Q => SDRAM_DQM, C0 => clock, C1 => not_clock, CE => '1', D0 => wdqm(1), D1 => wdqm(0), R => '0', S => '0' ); end Gideon;
------------------------------------------------------------------------------- -- Title : External Memory controller for SDRAM ------------------------------------------------------------------------------- -- Description: This module implements a simple, single burst memory controller. -- User interface is 16 bit (burst of 2), externally 4x 8 bit. ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library unisim; use unisim.vcomponents.all; library work; use work.mem_bus_pkg.all; entity ext_mem_ctrl_v6 is generic ( g_simulation : boolean := false; g_read_fifo : boolean := false; q_tcko_data : time := 100 ps; A_Width : integer := 13; SDRAM_WakeupTime : integer := 40; -- refresh periods SDRAM_Refr_period : integer := 375 ); port ( clock : in std_logic := '0'; clk_2x : in std_logic := '0'; reset : in std_logic := '0'; inhibit : in std_logic := '0'; is_idle : out std_logic; -- clk_4x : in std_logic := '0'; -- dummy : out std_logic; req : in t_mem_burst_16_req; resp : out t_mem_burst_16_resp; SDRAM_CLK : out std_logic; SDRAM_CKE : out std_logic := '0'; SDRAM_CSn : out std_logic := '1'; SDRAM_RASn : out std_logic := '1'; SDRAM_CASn : out std_logic := '1'; SDRAM_WEn : out std_logic := '1'; SDRAM_DQM : out std_logic := '0'; SDRAM_BA : out std_logic_vector(1 downto 0); SDRAM_A : out std_logic_vector(A_Width-1 downto 0); SDRAM_DQ : inout std_logic_vector(7 downto 0) := (others => 'Z')); end ext_mem_ctrl_v6; architecture Gideon of ext_mem_ctrl_v6 is type t_init is record addr : std_logic_vector(15 downto 0); cmd : std_logic_vector(2 downto 0); -- we-cas-ras end record; type t_init_array is array(natural range <>) of t_init; constant c_init_array : t_init_array(0 to 7) := ( ( X"0400", "010" ), -- auto precharge ( X"002B", "000" ), -- mode register, burstlen=8, writelen=8, CAS lat = 2, interleaved ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ), -- auto refresh ( X"0000", "100" ) ); type t_ints is array(natural range <>) of integer; constant c_delays : t_ints(0 to 15) := ( 2, 4, 2, 3, -- R2R (other row&other bank, other row, other bank, same row+bank) 4, 5, 4, 5, -- R2W 2, 5, 2, 3, -- W2R 2, 4, 2, 3 );-- W2W type t_state is (boot, init, idle, sd_cas ); signal state : t_state; signal sdram_d_o : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal sdram_d_t : std_logic_vector(SDRAM_DQ'range) := (others => '1'); signal wdata_tri : std_logic_vector(8 downto 0) := (others => '1'); signal delay : integer range 0 to 15; signal inhibit_d : std_logic; signal mem_a_i : std_logic_vector(SDRAM_A'range) := (others => '0'); signal mem_ba_i : std_logic_vector(SDRAM_BA'range) := (others => '0'); signal cs_n_i : std_logic := '1'; signal col_addr : std_logic_vector(9 downto 0) := (others => '0'); signal refresh_cnt : integer range 0 to SDRAM_Refr_period-1; signal do_refresh : std_logic := '0'; signal do_refresh_d : std_logic := '0'; signal trigger_refresh : std_logic := '0'; signal not_clock : std_logic; signal not_clock_2x : std_logic; signal rdata_lo : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi : std_logic_vector(7 downto 0) := (others => '0'); signal rdata_hi_d : std_logic_vector(7 downto 0) := (others => '0'); signal wdata : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_i : std_logic_vector(17 downto 0) := (others => '0'); signal wdata_av : std_logic; signal fifo_wdata_in : std_logic_vector(17 downto 0); signal wdqm : std_logic_vector(1 downto 0); signal dqm_override : std_logic := '1'; -- signal refr_delay : integer range 0 to 7; signal next_delay : integer range 0 to 7; signal boot_cnt : integer range 0 to SDRAM_WakeupTime-1 := SDRAM_WakeupTime-1; signal init_cnt : integer range 0 to c_init_array'high; signal enable_sdram : std_logic := '1'; signal req_i : std_logic; signal rack : std_logic; signal dack : std_logic_vector(5 downto 0) := "000000"; signal burst_start : std_logic_vector(5 downto 0) := "000000"; signal dnext : std_logic_vector(3 downto 0) := "0000"; signal last_bank : std_logic_vector(1 downto 0) := "10"; signal addr_bank : std_logic_vector(1 downto 0); signal same_bank : std_logic; signal last_row : std_logic_vector(12 downto 0) := "0101011010101"; signal addr_row : std_logic_vector(12 downto 0); signal same_row : std_logic; signal addr_column : std_logic_vector(9 downto 0); signal next_activate : std_logic; -- attribute fsm_encoding : string; -- attribute fsm_encoding of state : signal is "sequential"; -- attribute register_duplication : string; -- attribute register_duplication of mem_a_i : signal is "no"; attribute iob : string; attribute iob of SDRAM_CKE : signal is "false"; attribute iob of SDRAM_A : signal is "true"; attribute iob of SDRAM_BA : signal is "true"; attribute iob of SDRAM_RASn : signal is "true"; attribute iob of SDRAM_CASn : signal is "true"; attribute iob of SDRAM_WEn : signal is "true"; constant c_address_width : integer := req.address'length; constant c_data_width : integer := req.data'length; signal cmd_fifo_data_in : std_logic_vector(c_address_width downto 0); signal cmd_fifo_data_out : std_logic_vector(c_address_width downto 0); signal rwn_fifo : std_logic; signal rwn_i : std_logic := '1'; signal tag_fifo : std_logic_vector(7 downto 0); signal address_fifo : std_logic_vector(c_address_width-1 downto 0); signal cmd_af : std_logic; signal cmd_av : std_logic; signal rdata_af : std_logic := '0'; -- forced low for when there is no fifo signal push_cmd : std_logic; signal push_read_cmd : std_logic; signal crazy_index_slv : std_logic_vector(3 downto 0); signal crazy_index : integer range 0 to 15; signal sampled_dq : std_logic_vector(7 downto 0); begin is_idle <= '1' when state = idle else '0'; req_i <= cmd_av and not do_refresh_d; push_cmd <= req.request and not cmd_af; push_read_cmd <= push_cmd and req.read_writen; resp.ready <= not cmd_af; cmd_fifo_data_in <= req.read_writen & std_logic_vector(req.address); address_fifo <= cmd_fifo_data_out(address_fifo'range); rwn_fifo <= cmd_fifo_data_out(address_fifo'length); addr_bank <= address_fifo(14 downto 13); addr_row <= address_fifo(24 downto 15) & address_fifo(12 downto 10); addr_column <= address_fifo( 9 downto 0); i_command_fifo: entity work.srl_fifo generic map ( Width => c_address_width + 1, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => rack, PutElement => push_cmd, FlushFifo => '0', DataIn => cmd_fifo_data_in, DataOut => cmd_fifo_data_out, SpaceInFifo => open, AlmostFull => cmd_af, DataInFifo => cmd_av ); i_tag_fifo: entity work.srl_fifo generic map ( Width => 8, Depth => 15, Threshold => 3) port map ( clock => clock, reset => reset, GetElement => burst_start(1), PutElement => push_read_cmd, FlushFifo => '0', DataIn => req.request_tag, DataOut => tag_fifo, SpaceInFifo => open, AlmostFull => open, DataInFifo => open ); r_read_fifo: if g_read_fifo generate i_read_fifo: entity work.srl_fifo generic map ( Width => c_data_width, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => req.data_pop, PutElement => dack(0), FlushFifo => '0', DataIn(15 downto 8) => rdata_lo, DataIn(7 downto 0) => rdata_hi, DataOut => resp.data, SpaceInFifo => open, AlmostFull => rdata_af, DataInFifo => resp.rdata_av ); end generate; r_read_direct: if not g_read_fifo generate resp.data <= rdata_lo & rdata_hi; resp.rdata_av <= dack(0); end generate; fifo_wdata_in <= req.byte_en & req.data; wdqm <= (others => '1') when dqm_override='1' else (others => '0') when dnext(0)='0' else not wdata(17 downto 16); i_write_fifo: entity work.SRL_fifo generic map ( Width => (c_data_width*9)/8, Depth => 15, Threshold => 6 ) port map ( clock => clock, reset => reset, GetElement => dnext(0), PutElement => req.data_push, FlushFifo => '0', DataIn => fifo_wdata_in, DataOut => wdata_i, SpaceInFifo => open, AlmostFull => resp.wdata_full, DataInFifo => wdata_av ); wdata <= wdata_i after 1 ns; same_row <= '1' when addr_row = last_row else '0'; same_bank <= '1' when addr_bank = last_bank else '0'; crazy_index_slv <= not rwn_i & not rwn_fifo & same_row & same_bank; crazy_index <= to_integer(unsigned(crazy_index_slv)); trigger_refresh <= do_refresh_d and not (inhibit_d or inhibit); process(clock) procedure send_refresh_cmd is begin if next_delay = 0 then do_refresh <= '0'; do_refresh_d <= '0'; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; -- Auto Refresh next_delay <= 3; end if; end procedure; procedure accept_req is begin rwn_i <= rwn_fifo; col_addr <= addr_column; last_bank <= addr_bank; last_row <= addr_row; mem_a_i(addr_row'range) <= addr_row; mem_ba_i <= addr_bank; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '0'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; -- Command = ACTIVE delay <= 0; state <= sd_cas; end procedure; procedure issue_read_or_write is begin mem_a_i(9 downto 0) <= col_addr; do_refresh_d <= do_refresh; if req_i='0' or do_refresh='1' then if rwn_i='0' then next_delay <= 5; else next_delay <= 4; end if; mem_a_i(10) <= '1'; -- auto precharge next_activate <= '1'; else next_delay <= c_delays(crazy_index); mem_a_i(10) <= not (same_row and same_bank); -- do not AP when we'll continue in same row next_activate <= not (same_row and same_bank); -- only activate next time if we also AP. end if; if delay=0 then if rwn_i='0' then if wdata_av='1' then wdata_tri(7 downto 0) <= (others => '0') after 1 ns; cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '0'; dnext <= "1111" after 1 ns; state <= idle; end if; else if rdata_af='0' then cs_n_i <= '0' after 1 ns; SDRAM_RASn <= '1'; SDRAM_CASn <= '0'; SDRAM_WEn <= '1'; dack(dack'high downto dack'high-3) <= (others => '1'); burst_start(2) <= '1'; state <= idle; end if; end if; end if; end procedure; begin if rising_edge(clock) then inhibit_d <= inhibit; rdata_hi_d <= rdata_hi; cs_n_i <= '1' after 1 ns; SDRAM_CKE <= enable_sdram; SDRAM_RASn <= '1'; SDRAM_CASn <= '1'; SDRAM_WEn <= '1'; if burst_start(1)='1' then resp.data_tag <= tag_fifo; end if; if next_delay /= 0 then next_delay <= next_delay - 1; end if; if delay /= 0 then delay <= delay - 1; end if; wdata_tri <= "11" & wdata_tri(wdata_tri'high downto 2) after 1 ns; dack <= '0' & dack(dack'high downto 1); burst_start <= '0' & burst_start(burst_start'high downto 1); dnext <= '0' & dnext(dnext'high downto 1) after 1 ns; case state is when boot => enable_sdram <= '1'; if g_simulation then state <= init; elsif refresh_cnt = 0 then boot_cnt <= boot_cnt - 1; if boot_cnt = 1 then state <= init; end if; end if; when init => mem_a_i <= c_init_array(init_cnt).addr(mem_a_i'range); mem_ba_i <= (others => '0'); -- for DDR and such, maybe the upper 2/3 bits SDRAM_RASn <= c_init_array(init_cnt).cmd(0); SDRAM_CASn <= c_init_array(init_cnt).cmd(1); SDRAM_WEn <= c_init_array(init_cnt).cmd(2); if next_delay = 0 then next_delay <= 7; cs_n_i <= '0' after 1 ns; if init_cnt = c_init_array'high then state <= idle; dqm_override <= '0'; else init_cnt <= init_cnt + 1; end if; end if; when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then send_refresh_cmd; elsif inhibit='0' then if req_i='1' then if next_activate='1' and next_delay=0 then accept_req; elsif next_activate='0' and next_delay=1 then rwn_i <= rwn_fifo; col_addr <= addr_column; state <= sd_cas; end if; else do_refresh_d <= do_refresh; end if; end if; when sd_cas => issue_read_or_write; when others => null; end case; if refresh_cnt = SDRAM_Refr_period-1 then do_refresh <= '1'; refresh_cnt <= 0; else refresh_cnt <= refresh_cnt + 1; end if; if reset='1' then resp.data_tag <= (others => '0'); dqm_override <= '1'; state <= boot; wdata_tri <= (others => '0'); delay <= 0; next_delay <= 0; do_refresh <= '0'; do_refresh_d <= '0'; boot_cnt <= SDRAM_WakeupTime-1; init_cnt <= 0; enable_sdram <= '1'; next_activate <= '1'; rwn_i <= '1'; end if; end if; end process; -- Generate rack; the signal that indicates that a request is going to be issued -- and thus taken from the command fifo. process(state, trigger_refresh, inhibit, req_i, next_delay, next_activate) begin rack <= '0'; case state is when idle => -- first cycle after inhibit goes 0, do not do refresh -- this enables putting cartridge images in sdram if trigger_refresh='1' then null; elsif inhibit='0' and req_i='1' then if next_activate='1' and next_delay = 0 then rack <= '1'; elsif next_activate='0' and next_delay = 1 then rack <= '1'; end if; end if; when others => null; end case; end process; SDRAM_A <= mem_a_i; SDRAM_BA <= mem_ba_i; not_clock_2x <= not clk_2x; not_clock <= not clock; clkout: FDDRRSE port map ( CE => '1', C0 => clk_2x, C1 => not_clock_2x, D0 => '0', D1 => enable_sdram, Q => SDRAM_CLK, R => '0', S => '0' ); r_data: for i in 0 to 7 generate i_dout: entity work.my_ioddr port map ( pin => SDRAM_DQ(i), clock => clock, D0 => wdata(8+i), D1 => wdata(i), T0 => wdata_tri(1), T1 => wdata_tri(0), Q0 => rdata_hi(i), Q1 => rdata_lo(i) ); end generate; select_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( CE => '1', C0 => clock, C1 => not_clock, D0 => '1', D1 => cs_n_i, Q => SDRAM_CSn, R => '0', S => '0' ); i_dqm_out: ODDR2 generic map ( DDR_ALIGNMENT => "NONE", SRTYPE => "SYNC" ) port map ( Q => SDRAM_DQM, C0 => clock, C1 => not_clock, CE => '1', D0 => wdqm(1), D1 => wdqm(0), R => '0', S => '0' ); end Gideon;
--------------------------------------------------------------------- -- TITLE: Arithmetic Logic Unit -- AUTHOR: Steve Rhoads (rhoadss@yahoo.com) -- DATE CREATED: 2/8/01 -- FILENAME: alu.vhd -- PROJECT: Plasma CPU core -- COPYRIGHT: Software placed into the public domain by the author. -- Software 'as is' without warranty. Author liable for nothing. -- DESCRIPTION: -- Implements the ALU. --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.mlite_pack.all; entity function_1 is port( INPUT_1 : in std_logic_vector(31 downto 0); INPUT_2 : in std_logic_vector(31 downto 0); OUTPUT_1 : out std_logic_vector(31 downto 0) ); end; --comb_alu_1 architecture logic of function_1 is begin ------------------------------------------------------------------------- computation : process (INPUT_1, INPUT_2) variable rTemp1 : UNSIGNED(31 downto 0); variable rTemp2 : UNSIGNED(31 downto 0); variable rTemp3 : UNSIGNED(31 downto 0); begin if(INPUT_1 > INPUT_2) then OUTPUT_1 <= INPUT_1; else OUTPUT_1 <= INPUT_2; end if; end process; ------------------------------------------------------------------------- end; --architecture logic