repo_name
stringlengths
6
79
path
stringlengths
6
236
copies
int64
1
472
size
int64
137
1.04M
content
stringlengths
137
1.04M
license
stringclasses
15 values
hash
stringlengths
32
32
alpha_frac
float64
0.25
0.96
ratio
float64
1.51
17.5
autogenerated
bool
1 class
config_or_test
bool
2 classes
has_no_keywords
bool
1 class
has_few_assignments
bool
1 class
tgingold/ghdl
testsuite/synth/synth109/tb_ram1.vhdl
1
1,322
entity tb_ram1 is end tb_ram1; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_ram1 is signal clk : std_logic; signal en : std_logic; signal we : std_logic; signal addr : std_logic_vector(5 downto 0); signal rdat : std_logic_vector(31 downto 0); signal wdat : std_logic_vector(31 downto 0); begin dut: entity work.ram1 port map (clkB => clk, enB => en, weB => we, addrB => addr, diB => wdat, doB => rdat); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin en <= '1'; we <= '1'; addr <= b"00_0000"; wdat <= x"11_22_33_f0"; pulse; assert rdat = x"11_22_33_f0" severity failure; addr <= b"00_0001"; wdat <= x"11_22_33_f1"; pulse; assert rdat = x"11_22_33_f1" severity failure; -- Read. we <= '0'; addr <= b"00_0000"; wdat <= x"ff_22_33_f1"; pulse; assert rdat = x"11_22_33_f0" severity failure; addr <= b"00_0001"; wdat <= x"ff_22_33_f1"; pulse; assert rdat = x"11_22_33_f1" severity failure; -- Disable. en <= '0'; we <= '1'; addr <= b"00_0000"; wdat <= x"11_22_33_f0"; pulse; assert rdat = x"11_22_33_f1" severity failure; wait; end process; end behav;
gpl-2.0
080fb254052fc5faef36955dcb1ed43b
0.55295
2.905495
false
false
false
false
tgingold/ghdl
testsuite/gna/issue263/mac_test.vhdl
2
2,131
entity mac_test is end entity mac_test; library ieee; use ieee.std_logic_1164.all, ieee.fixed_pkg.all, ieee.math_complex.all; architecture bench_behavioral of mac_test is signal clk, reset, ovf : std_ulogic := '0'; signal x_real, x_imag, y_real, y_imag, s_real, s_imag : u_sfixed(0 downto -15); signal x, y, s : complex := (0.0, 0.0); constant Tpw_clk : time := 50 ns; begin x_real <= x.re; x_imag <= x.im; y_real <= y.re; y_imag <= y.im; dut : entity work.mac(behavioral) port map ( clk, reset, x_real, x_imag, y_real, y_imag, s_real, s_imag, ovf ); s <= (s_real, s_imag); clock_gen : process is begin clk <= '1' after Tpw_clk, '0' after 2 * Tpw_clk; wait for 2 * Tpw_clk; end process clock_gen; stimulus : process is begin -- first sequence reset <= '1'; wait until not clk; x <= (+0.5, +0.5); y <= (+0.5, +0.5); reset <= '1'; wait until not clk; x <= (+0.2, +0.2); y <= (+0.2, +0.2); reset <= '1'; wait until not clk; x <= (+0.1, -0.1); y <= (+0.1, +0.1); reset <= '1'; wait until not clk; x <= (+0.1, -0.1); y <= (+0.1, +0.1); reset <= '0'; wait until not clk; -- should be (0.04, 0.58) when it falls out the other end reset <= '0'; wait until not clk; x <= (+0.5, +0.5); y <= (+0.5, +0.5); reset <= '0'; wait until not clk; x <= (+0.5, +0.5); y <= (+0.1, +0.1); reset <= '0'; wait until not clk; x <= (+0.5, +0.5); y <= (+0.5, +0.5); reset <= '1'; wait until not clk; x <= (-0.5, +0.5); y <= (-0.5, +0.5); reset <= '0'; wait until not clk; reset <= '0'; wait until not clk; reset <= '0'; wait until not clk; reset <= '0'; wait until not clk; reset <= '1'; wait until not clk; wait; end process stimulus; end architecture bench_behavioral;
gpl-2.0
bb271b354b67b511a4377f7c8650bb9f
0.450493
3.026989
false
false
false
false
tgingold/ghdl
testsuite/gna/issue50/idct.d/output_split1.vhd
2
1,410
library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.numeric_std.all; entity output_split1 is port ( wa0_data : in std_logic_vector(7 downto 0); wa0_addr : in std_logic_vector(2 downto 0); ra0_data : out std_logic_vector(7 downto 0); ra0_addr : in std_logic_vector(2 downto 0); wa0_en : in std_logic; clk : in std_logic ); end output_split1; architecture augh of output_split1 is -- Embedded RAM type ram_type is array (0 to 7) of std_logic_vector(7 downto 0); signal ram : ram_type := (others => (others => '0')); -- Little utility functions to make VHDL syntactically correct -- with the syntax to_integer(unsigned(vector)) when 'vector' is a std_logic. -- This happens when accessing arrays with <= 2 cells, for example. function to_integer(B: std_logic) return integer is variable V: std_logic_vector(0 to 0); begin V(0) := B; return to_integer(unsigned(V)); end; function to_integer(V: std_logic_vector) return integer is begin return to_integer(unsigned(V)); end; begin -- Sequential process -- It handles the Writes process (clk) begin if rising_edge(clk) then -- Write to the RAM -- Note: there should be only one port. if wa0_en = '1' then ram( to_integer(wa0_addr) ) <= wa0_data; end if; end if; end process; -- The Read side (the outputs) ra0_data <= ram( to_integer(ra0_addr) ); end architecture;
gpl-2.0
a08b7845468ba9563ccfad94ca2964cb
0.673759
2.895277
false
false
false
false
tgingold/ghdl
testsuite/gna/issue156/compile_error.vhdl
2
1,929
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; package stream is subtype valid_t is std_logic; subtype ready_t is std_logic; type array_ready_t is array (natural range <>) of ready_t; type array_valid_t is array (natural range <>) of valid_t; -- dummy functionality which needs to be shared procedure split_stream ( signal outcomb : out array_valid_t; signal outalone : out ready_t; signal incomb : in array_ready_t; signal inalone : in valid_t); end package; package body stream is procedure split_stream ( signal outcomb : out array_valid_t; signal outalone : out ready_t; signal incomb : in array_ready_t; signal inalone : in valid_t) is begin outcomb <= (outcomb'range => '1'); outalone <= '1'; end procedure split_stream; end stream; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.stream.all; entity BFPD is port ( reset : in std_logic; -- asynchronous eset clock : in std_logic; -- clock clock_en : in std_logic; -- clock enable in_valid : in valid_t; in_ready : out ready_t; out_valid : out valid_t; out_ready : in ready_t ); end BFPD; architecture rtl of BFPD is type ctrl_t is (MANT_RET_IN, EXP_RET_IN, DIV_RET_IN, MANT_RET_OUT, EXP_RET_OUT, DIV_RET_OUT, MULT); subtype ctrl_range_t is integer range ctrl_t'pos(ctrl_t'left) to ctrl_t'pos(ctrl_t'right); subtype ret_split_t is integer range ctrl_t'pos(MANT_RET_IN) to ctrl_t'pos(DIV_RET_IN); signal ready: array_ready_t(ctrl_range_t); signal valid: array_valid_t(ctrl_range_t); begin split_stream (outcomb => valid(ret_split_t), outalone => in_ready, incomb => ready(ret_split_t), inalone => in_valid); end rtl;
gpl-2.0
a6b9e64353374594e11284c6e6ce223a
0.611716
3.204319
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc1523.vhd
4
3,438
-- 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: tc1523.vhd,v 1.2 2001-10-26 16:29:41 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c08s09b00x00p07n01i01523pkg is -- Global procedure. procedure proc1; -- Global function. function func1 return INTEGER; end c08s09b00x00p07n01i01523pkg; package body c08s09b00x00p07n01i01523pkg is procedure proc1 is -- Local variables variable INTV : INTEGER := 0; begin -- Check initialization. assert (INTV = 0); -- Loop until the indicated condition has been met. loop -- Execute some meaningful function. null; -- Increment the counter. INTV := INTV + 1; -- If the condition has been met, terminate the loop. if (INTV = 10) then return; end if; -- Verify that we have not exceeded the limits of the loop. assert (INTV < 10); end loop; -- Should NEVER get to this step. assert (FALSE) report "Return has not exited the procedure."; end proc1; function func1 return INTEGER is -- Local variables variable INTV : INTEGER := 0; begin -- Check initialization. assert (INTV = 0); -- Loop until the indicated condition has been met. loop -- Execute some meaningful function. null; -- Increment the counter. INTV := INTV + 1; -- If the condition has been met, terminate the loop. if (INTV = 10) then return( INTV ); end if; -- Verify that we have not exceeded the limits of the loop. assert (INTV < 10); end loop; -- Should NEVER get to this step. assert (FALSE) report "Return has not exited the procedure."; end func1; end c08s09b00x00p07n01i01523pkg; use work.c08s09b00x00p07n01i01523pkg.all; ENTITY c08s09b00x00p07n01i01523ent IS END c08s09b00x00p07n01i01523ent; ARCHITECTURE c08s09b00x00p07n01i01523arch OF c08s09b00x00p07n01i01523ent IS BEGIN TESTING: PROCESS variable k : integer := 0; BEGIN -- Call procedure to loop/return. proc1; assert NOT(func1=10) report "***PASSED TEST: c08s09b00x00p07n01i01523" severity NOTE; assert (func1=10) report "***PASSED TEST: c08s09b00x00p07n01i01523 - Function did not return proper value." severity NOTE; wait; END PROCESS TESTING; END c08s09b00x00p07n01i01523arch;
gpl-2.0
e1732a51904f7f696dc74764318147e5
0.646597
3.82
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc1030.vhd
4
2,272
-- 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: tc1030.vhd,v 1.2 2001-10-26 16:29:38 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c06s04b00x00p02n01i01030ent IS type THREE is range 1 to 3; type A1 is array (THREE) of BOOLEAN; type A2 is array (THREE, THREE) of BOOLEAN; type A3 is array (THREE) of A1; type R1 is record RE1: A1; end record; type R2 is record RE2: A2; end record; type R3 is record RE3: A3; end record; END c06s04b00x00p02n01i01030ent; ARCHITECTURE c06s04b00x00p02n01i01030arch OF c06s04b00x00p02n01i01030ent IS BEGIN TESTING: PROCESS variable V: BOOLEAN; variable V1: R1 ; -- := (RE1=>(others=>TRUE)); variable V2: R2 ; -- := (RE2=>(others=>(others=>TRUE))); variable V3: R3 ; -- := (RE3=>(others=>(others=>TRUE))); BEGIN V := V3.RE3(1)(3); assert NOT( V=false ) report "***PASSED TEST: c06s04b00x00p02n01i01030" severity NOTE; assert ( V=false ) report "***FAILED TEST: c06s04b00x00p02n01i01030 - The prefix of an indexed name can be a selected name." severity ERROR; wait; END PROCESS TESTING; END c06s04b00x00p02n01i01030arch;
gpl-2.0
ba78e76c1107f801bf08d96b0069aca0
0.630282
3.617834
false
true
false
false
nickg/nvc
test/sem/generics.vhd
1
2,837
entity bot is generic ( N : integer ); port ( o : out integer ); end entity; architecture a of bot is begin process is begin o <= N; wait; end process; end architecture; ------------------------------------------------------------------------------- entity top is end entity; architecture test of top is signal x : integer; begin bot0: entity work.bot -- OK generic map ( N => 5 ) port map ( o => x ); bot1: entity work.bot -- OK generic map ( 5 ) port map ( o => x ); bot3: entity work.bot port map ( o => x ); -- Missing N bot4: entity work.bot generic map ( 1, 2 ) -- Too many generics port map ( o => x ); end architecture; ------------------------------------------------------------------------------- entity bad is generic ( X : integer; Y : integer := X + 1 ); -- X not visible port ( p : in integer := X ); end entity; ------------------------------------------------------------------------------- entity class is generic ( constant X : integer; -- OK signal Y : integer ); -- Error end entity; ------------------------------------------------------------------------------- package p is component c is generic ( X : integer ); -- OK port ( p : in integer range 1 to X; -- OK q : in integer range 1 to Y ); -- Error end component; end package; ------------------------------------------------------------------------------- entity static is generic ( X : integer ); end entity; architecture a of static is constant k : integer := X + 1; signal s : bit_vector(1 to 3); alias sx : bit is s(X); alias sx1 : bit is s(X + 1); alias sx2 : bit_vector is s(k to 3); function f(x : bit_vector) return integer; component c is generic ( x : bit_vector(2 downto 0) ); end component; component d is generic ( t : time ); end component; begin i1: entity work.bot generic map ( N => f("100") ) port map ( o => open ); i2: component c generic map ( x => "00" & '1' ); -- OK i3: component c generic map ( x => "00" & sx ); -- Error i4: component d generic map ( t => 100 ns ); -- OK i5: component c generic map ( 6 => 1 ); -- Error i6: component c generic map ( "not"(x) => "101" ); -- Error i7: component c generic map ( i6 ); -- Error i8: component c generic map ( a ); -- Error i9: component c generic map ( std.standard ); -- Error end architecture;
gpl-3.0
e3661d0979bc7761b0f2034d3cc608de
0.419457
4.378086
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_lite_ipif_v3_0/hdl/src/vhdl/slave_attachment.vhd
8
24,073
------------------------------------------------------------------- -- (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: slave_attachment.vhd -- Version: v2.0 -- Description: AXI slave attachment supporting single transfers ------------------------------------------------------------------------------- -- 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 -- updated to reduce the utilization -- 1. State machine is re-designed -- 2. R and B channels are registered and AW, AR, W channels are non-registered -- 3. Address decoding is done only for the required address bits and not complete -- 32 bits -- 4. combined the response signals like ip2bus_error in optimzed code to remove the mux -- 5. Added local function "clog2" with "integer" as input in place of proc_common_pkg -- function. -- ^^^^^^ -- ~~~~~~ -- 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" -- access_cs 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.numeric_std.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_misc.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.proc_common_pkg.clog2; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0_3; use axi_lite_ipif_v3_0_3.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_IPIF_ABUS_WIDTH -- IPIF Address bus width -- C_IPIF_DBUS_WIDTH -- IPIF Data 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_ARESET -- 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 slave_attachment is generic ( C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := ( 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 := ( 1, -- User0 CE Number 8 -- User1 CE Number ); C_IPIF_ABUS_WIDTH : integer := 32; C_IPIF_DBUS_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 := 16; C_FAMILY : string := "virtex6" ); port( -- AXI signals S_AXI_ACLK : in std_logic; S_AXI_ARESETN : in std_logic; S_AXI_AWADDR : in std_logic_vector (C_IPIF_ABUS_WIDTH-1 downto 0); S_AXI_AWVALID : in std_logic; S_AXI_AWREADY : out std_logic; S_AXI_WDATA : in std_logic_vector (C_IPIF_DBUS_WIDTH-1 downto 0); S_AXI_WSTRB : in std_logic_vector ((C_IPIF_DBUS_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_IPIF_ABUS_WIDTH-1 downto 0); S_AXI_ARVALID : in std_logic; S_AXI_ARREADY : out std_logic; S_AXI_RDATA : out std_logic_vector (C_IPIF_DBUS_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_IPIF_ABUS_WIDTH-1 downto 0); Bus2IP_RNW : out std_logic; Bus2IP_BE : out std_logic_vector (((C_IPIF_DBUS_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_IPIF_DBUS_WIDTH-1) downto 0); IP2Bus_Data : in std_logic_vector ((C_IPIF_DBUS_WIDTH-1) downto 0); IP2Bus_WrAck : in std_logic; IP2Bus_RdAck : in std_logic; IP2Bus_Error : in std_logic ); end entity slave_attachment; ------------------------------------------------------------------------------- architecture imp of slave_attachment is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Get_Addr_Bits: Function Declarations ------------------------------------------------------------------------------- function Get_Addr_Bits (y : std_logic_vector(31 downto 0)) return integer is variable i : integer := 0; begin for i in 31 downto 0 loop if y(i)='1' then return (i); end if; end loop; return -1; end function Get_Addr_Bits; ------------------------------------------------------------------------------- -- Constant Declarations ------------------------------------------------------------------------------- constant CS_BUS_SIZE : integer := C_ARD_ADDR_RANGE_ARRAY'length/2; constant CE_BUS_SIZE : integer := calc_num_ce(C_ARD_NUM_CE_ARRAY); constant C_ADDR_DECODE_BITS : integer := Get_Addr_Bits(C_S_AXI_MIN_SIZE); constant C_NUM_DECODE_BITS : integer := C_ADDR_DECODE_BITS +1; constant ZEROS : std_logic_vector((C_IPIF_ABUS_WIDTH-1) downto (C_ADDR_DECODE_BITS+1)) := (others=>'0'); ------------------------------------------------------------------------------- -- Signal and Type Declarations ------------------------------------------------------------------------------- signal s_axi_bvalid_i : std_logic:= '0'; signal s_axi_arready_i : std_logic; signal s_axi_rvalid_i : std_logic:= '0'; signal start : std_logic; signal start2 : std_logic; -- Intermediate IPIC signals signal bus2ip_addr_i : std_logic_vector ((C_IPIF_ABUS_WIDTH-1) downto 0); signal timeout : std_logic; signal rd_done,wr_done : std_logic; signal rd_done1,wr_done1 : std_logic; --signal rd_done2,wr_done2 : std_logic; signal wrack_1,rdack_1 : std_logic; --signal wrack_2,rdack_2 : std_logic; signal rst : std_logic; signal temp_i : std_logic; type BUS_ACCESS_STATES is ( SM_IDLE, SM_READ, SM_WRITE, SM_RESP ); signal state : BUS_ACCESS_STATES; signal cs_for_gaps_i : std_logic; signal bus2ip_rnw_i : std_logic; signal s_axi_bresp_i : std_logic_vector(1 downto 0):=(others => '0'); signal s_axi_rresp_i : std_logic_vector(1 downto 0):=(others => '0'); signal s_axi_rdata_i : std_logic_vector (C_IPIF_DBUS_WIDTH-1 downto 0):=(others => '0'); signal is_read, is_write : std_logic; ------------------------------------------------------------------------------- -- begin the architecture logic ------------------------------------------------------------------------------- begin ------------------------------------------------------------------------------- -- Address registered ------------------------------------------------------------------------------- Bus2IP_Clk <= S_AXI_ACLK; Bus2IP_Resetn <= S_AXI_ARESETN; --bus2ip_rnw_i <= '1' when S_AXI_ARVALID='1' -- else -- '0'; BUS2IP_RNW <= bus2ip_rnw_i; Bus2IP_BE <= S_AXI_WSTRB when ((C_USE_WSTRB = 1) and (bus2ip_rnw_i = '0')) else (others => '1'); Bus2IP_Data <= S_AXI_WDATA; Bus2IP_Addr <= bus2ip_addr_i; -- For AXI Lite interface, interconnect will duplicate the addresses on both the -- read and write channel. so onlyone address is used for decoding as well as -- passing it to IP. --bus2ip_addr_i <= ZEROS & S_AXI_ARADDR(C_ADDR_DECODE_BITS downto 0) -- when (S_AXI_ARVALID='1') -- else -- ZEROS & S_AXI_AWADDR(C_ADDR_DECODE_BITS downto 0); -------------------------------------------------------------------------------- -- start signal will be used to latch the incoming address --start<= (S_AXI_ARVALID or (S_AXI_AWVALID and S_AXI_WVALID)) -- when (state = SM_IDLE) -- else -- '0'; -- x_done signals are used to release the hold from AXI, it will generate "ready" -- signal on the read and write address channels. rd_done <= IP2Bus_RdAck or (timeout and is_read); wr_done <= IP2Bus_WrAck or (timeout and is_write); --wr_done1 <= (not (wrack_1) and IP2Bus_WrAck) or timeout; --rd_done1 <= (not (rdack_1) and IP2Bus_RdAck) or timeout; temp_i <= rd_done or wr_done; ------------------------------------------------------------------------------- -- Address Decoder Component Instance -- -- This component decodes the specified base address pairs and outputs the -- specified number of chip enables and the target bus size. ------------------------------------------------------------------------------- I_DECODER : entity axi_lite_ipif_v3_0_3.address_decoder generic map ( C_BUS_AWIDTH => C_NUM_DECODE_BITS, C_S_AXI_MIN_SIZE => C_S_AXI_MIN_SIZE, C_ARD_ADDR_RANGE_ARRAY=> C_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => C_ARD_NUM_CE_ARRAY, C_FAMILY => "nofamily" ) port map ( Bus_clk => S_AXI_ACLK, Bus_rst => S_AXI_ARESETN, Address_In_Erly => bus2ip_addr_i(C_ADDR_DECODE_BITS downto 0), Address_Valid_Erly => start2, Bus_RNW => bus2ip_rnw_i, --S_AXI_ARVALID, Bus_RNW_Erly => bus2ip_rnw_i, --S_AXI_ARVALID, CS_CE_ld_enable => start2, Clear_CS_CE_Reg => temp_i, RW_CE_ld_enable => start2, CS_for_gaps => open, -- Decode output signals CS_Out => Bus2IP_CS, RdCE_Out => Bus2IP_RdCE, WrCE_Out => Bus2IP_WrCE ); -- REGISTERING_RESET_P: Invert the reset coming from AXI ----------------------- REGISTERING_RESET_P : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then rst <= not S_AXI_ARESETN; end if; end process REGISTERING_RESET_P; REGISTERING_RESET_P2 : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then if (rst = '1') then -- wrack_1 <= '0'; -- rdack_1 <= '0'; -- wrack_2 <= '0'; -- rdack_2 <= '0'; -- wr_done2 <= '0'; -- rd_done2 <= '0'; bus2ip_rnw_i <= '0'; bus2ip_addr_i <= (others => '0'); start2 <= '0'; else -- wrack_1 <= IP2Bus_WrAck; -- rdack_1 <= IP2Bus_RdAck; -- wrack_2 <= wrack_1; -- rdack_2 <= rdack_1; -- wr_done2 <= wr_done1; -- rd_done2 <= rd_done1; if (state = SM_IDLE and S_AXI_ARVALID='1') then bus2ip_addr_i <= ZEROS & S_AXI_ARADDR(C_ADDR_DECODE_BITS downto 0); bus2ip_rnw_i <= '1'; start2 <= '1'; elsif (state = SM_IDLE and (S_AXI_AWVALID = '1' and S_AXI_WVALID = '1')) then bus2ip_addr_i <= ZEROS & S_AXI_AWADDR(C_ADDR_DECODE_BITS downto 0); bus2ip_rnw_i <= '0'; start2 <= '1'; else bus2ip_rnw_i <= bus2ip_rnw_i; bus2ip_addr_i <= bus2ip_addr_i; start2 <= '0'; end if; end if; end if; end process REGISTERING_RESET_P2; ------------------------------------------------------------------------------- -- AXI Transaction Controller ------------------------------------------------------------------------------- -- Access_Control: As per suggestion to optimize the core, the below state machine -- is re-coded. Latches are removed from original suggestions Access_Control : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then if rst = '1' then state <= SM_IDLE; is_read <= '0'; is_write <= '0'; else case state is when SM_IDLE => if (S_AXI_ARVALID = '1') then -- Read precedence over write state <= SM_READ; is_read <='1'; is_write <= '0'; elsif (S_AXI_AWVALID = '1' and S_AXI_WVALID = '1') then state <= SM_WRITE; is_read <='0'; is_write <= '1'; else state <= SM_IDLE; is_read <='0'; is_write <= '0'; end if; when SM_READ => if rd_done = '1' then state <= SM_RESP; else state <= SM_READ; end if; when SM_WRITE=> if (wr_done = '1') then state <= SM_RESP; else state <= SM_WRITE; end if; when SM_RESP => if ((s_axi_bvalid_i and S_AXI_BREADY) or (s_axi_rvalid_i and S_AXI_RREADY)) = '1' then state <= SM_IDLE; is_read <='0'; is_write <= '0'; else state <= SM_RESP; end if; -- coverage off when others => state <= SM_IDLE; -- coverage on end case; end if; end if; end process Access_Control; ------------------------------------------------------------------------------- -- AXI Transaction Controller signals registered ------------------------------------------------------------------------------- -- S_AXI_RDATA_RESP_P : BElow process generates the RRESP and RDATA on AXI ----------------------- S_AXI_RDATA_RESP_P : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then if (rst = '1') then s_axi_rresp_i <= (others => '0'); s_axi_rdata_i <= (others => '0'); elsif state = SM_READ then s_axi_rresp_i <= (IP2Bus_Error) & '0'; s_axi_rdata_i <= IP2Bus_Data; end if; end if; end process S_AXI_RDATA_RESP_P; S_AXI_RRESP <= s_axi_rresp_i; S_AXI_RDATA <= s_axi_rdata_i; ----------------------------- -- S_AXI_RVALID_I_P : below process generates the RVALID response on read channel ---------------------- S_AXI_RVALID_I_P : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then if (rst = '1') then s_axi_rvalid_i <= '0'; elsif ((state = SM_READ) and rd_done = '1') then s_axi_rvalid_i <= '1'; elsif (S_AXI_RREADY = '1') then s_axi_rvalid_i <= '0'; end if; end if; end process S_AXI_RVALID_I_P; -- -- S_AXI_BRESP_P: Below process provides logic for write response -- ----------------- S_AXI_BRESP_P : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then if (rst = '1') then s_axi_bresp_i <= (others => '0'); elsif (state = SM_WRITE) then s_axi_bresp_i <= (IP2Bus_Error) & '0'; end if; end if; end process S_AXI_BRESP_P; S_AXI_BRESP <= s_axi_bresp_i; --S_AXI_BVALID_I_P: below process provides logic for valid write response signal ------------------- S_AXI_BVALID_I_P : process (S_AXI_ACLK) is begin if S_AXI_ACLK'event and S_AXI_ACLK = '1' then if rst = '1' then s_axi_bvalid_i <= '0'; elsif ((state = SM_WRITE) and wr_done = '1') then s_axi_bvalid_i <= '1'; elsif (S_AXI_BREADY = '1') then s_axi_bvalid_i <= '0'; end if; end if; end process S_AXI_BVALID_I_P; ----------------------------------------------------------------------------- -- INCLUDE_DPHASE_TIMER: Data timeout counter included only when its value is non-zero. -------------- INCLUDE_DPHASE_TIMER: if C_DPHASE_TIMEOUT /= 0 generate constant COUNTER_WIDTH : integer := clog2((C_DPHASE_TIMEOUT)); signal dpto_cnt : std_logic_vector (COUNTER_WIDTH downto 0); -- dpto_cnt is one bit wider then COUNTER_WIDTH, which allows the timeout -- condition to be captured as a carry into this "extra" bit. begin DPTO_CNT_P : process (S_AXI_ACLK) is begin if (S_AXI_ACLK'event and S_AXI_ACLK = '1') then if ((state = SM_IDLE) or (state = SM_RESP)) then dpto_cnt <= (others=>'0'); else dpto_cnt <= dpto_cnt + 1; end if; end if; end process DPTO_CNT_P; timeout <= '1' when (dpto_cnt = C_DPHASE_TIMEOUT) else '0'; end generate INCLUDE_DPHASE_TIMER; EXCLUDE_DPHASE_TIMER: if C_DPHASE_TIMEOUT = 0 generate timeout <= '0'; end generate EXCLUDE_DPHASE_TIMER; ----------------------------------------------------------------------------- S_AXI_BVALID <= s_axi_bvalid_i; S_AXI_RVALID <= s_axi_rvalid_i; ----------------------------------------------------------------------------- S_AXI_ARREADY <= rd_done; S_AXI_AWREADY <= wr_done; S_AXI_WREADY <= wr_done; ------------------------------------------------------------------------------- end imp;
gpl-3.0
d8ccfe9846aac9886cb2647b03583a9b
0.497445
3.884622
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_timer_v2_0/hdl/src/vhdl/timer_control.vhd
3
28,023
------------------------------------------------------------------------------- -- timer_control - entity/architecture pair ------------------------------------------------------------------------------- -- -- *************************************************************************** -- DISCLAIMER OF LIABILITY -- -- This file contains proprietary and confidential information of -- Xilinx, Inc. ("Xilinx"), that is distributed under a license -- from Xilinx, and may be used, copied and/or disclosed only -- pursuant to the terms of a valid license agreement with Xilinx. -- -- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION -- ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER -- EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT -- LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT, -- MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx -- does not warrant that functions included in the Materials will -- meet the requirements of Licensee, or that the operation of the -- Materials will be uninterrupted or error-free, or that defects -- in the Materials will be corrected. Furthermore, Xilinx does -- not warrant or make any representations regarding use, or the -- results of the use, of the Materials in terms of correctness, -- accuracy, reliability or otherwise. -- -- 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. -- -- Copyright 2001, 2002, 2003, 2004, 2008, 2009 Xilinx, Inc. -- All rights reserved. -- -- This disclaimer and copyright notice must be retained as part -- of this file at all times. -- *************************************************************************** -- ------------------------------------------------------------------------------- -- Filename :timer_control.vhd -- Company :Xilinx -- Version :v2.0 -- Description :Control logic for Peripheral Timer/Counter -- Standard :VHDL-93 -- ------------------------------------------------------------------------------- -- Structure: -- timer_control.vhd ------------------------------------------------------------------------------- -- ^^^^^^ -- Author: BSB -- History: -- BSB 03/18/2010 -- Ceated the version v1.00.a -- ^^^^^^ -- Author: BSB -- History: -- BSB 09/18/2010 -- Ceated the version v1.01.a -- -- axi lite ipif v1.01.a used -- ^^^ ------------------------------------------------------------------------------- -- 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> ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_TRIG0_ASSERT -- Assertion Level of captureTrig0 -- C_TRIG1_ASSERT -- Assertion Level of captureTrig1 -- C_GEN0_ASSERT -- Assertion Level for GenerateOut0 -- C_GEN1_ASSERT -- Assertion Level for GenerateOut1 -- C_ARD_NUM_CE_ARRAY -- Number of chip enable ------------------------------------------------------------------------------- -- Definition of Ports ------------------------------------------------------------------------------- -- Clk -- system clock -- Reset -- system reset -- CaptureTrig0 -- Capture Trigger 0 -- CaptureTrig1 -- Capture Trigger 1 -- GenerateOut0 -- Generate Output 0 -- GenerateOut1 -- Generate Output 1 -- Interrupt -- Interrupt -- Counter_TC -- Carry out signal of counter -- Bus2ip_data -- bus2ip data bus -- BE -- te enab les -- Load_Counter_Reg -- Load counter register control -- Load_Load_Reg -- Load load register control -- Write_Load_Reg -- write control of TLR reg -- CaptGen_Mux_Sel -- mux select for capture and generate -- Counter_En -- counter enable signal -- Count_Down -- count down signal -- Bus2ip_rdce -- read select -- Bus2ip_wrce -- write select -- Freeze -- freeze -- TCSR0_Reg -- Control/Status register 0 -- TCSR1_Reg -- Control/Status register 1 ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library axi_lite_ipif_v3_0_3; library lib_cdc_v1_0_2; library lib_pkg_v1_0_2; use axi_lite_ipif_v3_0_3.ipif_pkg.calc_num_ce; use axi_lite_ipif_v3_0_3.ipif_pkg.INTEGER_ARRAY_TYPE; use lib_pkg_v1_0_2.lib_pkg.RESET_ACTIVE; library unisim; use unisim.vcomponents.FDRSE; library axi_timer_v2_0_10; use axi_timer_v2_0_10.TC_Types.QUADLET_TYPE; use axi_timer_v2_0_10.TC_Types.TWELVE_BIT_TYPE; use axi_timer_v2_0_10.TC_Types.ELEVEN_BIT_TYPE; use axi_timer_v2_0_10.TC_Types.ARHT0_POS; use axi_timer_v2_0_10.TC_Types.ARHT1_POS; use axi_timer_v2_0_10.TC_Types.CAPT0_POS; use axi_timer_v2_0_10.TC_Types.CAPT1_POS; use axi_timer_v2_0_10.TC_Types.CMPT0_POS; use axi_timer_v2_0_10.TC_Types.CMPT1_POS; use axi_timer_v2_0_10.TC_Types.ENALL_POS; use axi_timer_v2_0_10.TC_Types.ENIT0_POS; use axi_timer_v2_0_10.TC_Types.ENIT1_POS; use axi_timer_v2_0_10.TC_Types.ENT0_POS; use axi_timer_v2_0_10.TC_Types.ENT1_POS; use axi_timer_v2_0_10.TC_Types.LOAD0_POS; use axi_timer_v2_0_10.TC_Types.LOAD1_POS; use axi_timer_v2_0_10.TC_Types.MDT0_POS; use axi_timer_v2_0_10.TC_Types.MDT1_POS; use axi_timer_v2_0_10.TC_Types.PWMA0_POS; use axi_timer_v2_0_10.TC_Types.PWMB0_POS; use axi_timer_v2_0_10.TC_Types.T0INT_POS; use axi_timer_v2_0_10.TC_Types.T1INT_POS; use axi_timer_v2_0_10.TC_Types.UDT0_POS; use axi_timer_v2_0_10.TC_Types.UDT1_POS; use axi_timer_v2_0_10.TC_Types.CASC_POS; ------------------------------------------------------------------------------- -- Entity declarations ------------------------------------------------------------------------------- entity timer_control is generic ( C_TRIG0_ASSERT : std_logic := '1'; C_TRIG1_ASSERT : std_logic := '1'; C_GEN0_ASSERT : std_logic := '1'; C_GEN1_ASSERT : std_logic := '1'; C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE ); port ( Clk : in std_logic; Reset : in std_logic; CaptureTrig0 : in std_logic; CaptureTrig1 : in std_logic; GenerateOut0 : out std_logic; GenerateOut1 : out std_logic; Interrupt : out std_logic; Counter_TC : in std_logic_vector(0 to 1); Bus2ip_data : in std_logic_vector(0 to 31); BE : in std_logic_vector(0 to 3); Load_Counter_Reg : out std_logic_vector(0 to 1); Load_Load_Reg : out std_logic_vector(0 to 1); Write_Load_Reg : out std_logic_vector(0 to 1); CaptGen_Mux_Sel : out std_logic_vector(0 to 1); Counter_En : out std_logic_vector(0 to 1); Count_Down : out std_logic_vector(0 to 1); Bus2ip_rdce : in std_logic_vector(0 to calc_num_ce(C_ARD_NUM_CE_ARRAY)-1); Bus2ip_wrce : in std_logic_vector(0 to calc_num_ce(C_ARD_NUM_CE_ARRAY)-1); Freeze : in std_logic; TCSR0_Reg : out TWELVE_BIT_TYPE; TCSR1_Reg : out ELEVEN_BIT_TYPE ); end entity timer_control; ------------------------------------------------------------------------------- -- Architecture section ------------------------------------------------------------------------------- architecture imp of timer_control is -- Pragma Added to supress synth warnings attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ------------------------------------------------------------------------------- -- Signal declaration ------------------------------------------------------------------------------- signal TCSR0_In : TWELVE_BIT_TYPE; signal TCSR0_Reset : TWELVE_BIT_TYPE; signal TCSR0_Set : TWELVE_BIT_TYPE; signal TCSR0_CE : TWELVE_BIT_TYPE; signal TCSR0 : TWELVE_BIT_TYPE; signal TCSR1_In : ELEVEN_BIT_TYPE; signal TCSR1_Reset : ELEVEN_BIT_TYPE; signal TCSR1_Set : ELEVEN_BIT_TYPE; signal TCSR1_CE : ELEVEN_BIT_TYPE; signal TCSR1 : ELEVEN_BIT_TYPE; signal captureTrig0_d : std_logic; signal captureTrig1_d : std_logic; signal captureTrig0_d2 : std_logic; signal captureTrig1_d2 : std_logic; signal captureTrig0_Edge : std_logic; signal captureTrig1_Edge : std_logic; signal captureTrig0_pulse: std_logic; signal captureTrig0_pulse_d1: std_logic; signal captureTrig0_pulse_d2: std_logic; signal captureTrig1_pulse: std_logic; signal read_done0 : std_logic; signal read_done1 : std_logic; signal generateOutPre0 : std_logic; signal generateOutPre1 : std_logic; signal pair0_Select : std_logic; signal counter_TC_Reg : std_logic_vector(0 to 1); signal counter_TC_Reg2 : std_logic; signal tccr0_select : std_logic; signal tccr1_select : std_logic; signal interrupt_reg : std_logic; signal CaptureTrig0_int : std_logic := '0'; signal CaptureTrig1_int : std_logic := '0'; signal Freeze_int : std_logic := '0'; ------------------------------------------------------------------------------- -- Bits in Timer Control Status Register 0 (TCSR0) ------------------------------------------------------------------------------- alias CASC : std_logic is TCSR0(CASC_POS); alias T0INT : std_logic is TCSR0(T0INT_POS); alias ENT0 : std_logic is TCSR0(ENT0_POS); alias ENIT0 : std_logic is TCSR0(ENIT0_POS); alias LOAD0 : std_logic is TCSR0(LOAD0_POS); alias ARHT0 : std_logic is TCSR0(ARHT0_POS); alias CAPT0 : std_logic is TCSR0(CAPT0_POS); alias CMPT0 : std_logic is TCSR0(CMPT0_POS); alias UDT0 : std_logic is TCSR0(UDT0_POS); alias MDT0 : std_logic is TCSR0(MDT0_POS); alias PWMA0 : std_logic is TCSR0(PWMA0_POS); ------------------------------------------------------------------------------- -- Bits in Timer Control Status Register 1 (TCSR1) ------------------------------------------------------------------------------- alias T1INT : std_logic is TCSR1(T1INT_POS); alias ENT1 : std_logic is TCSR1(ENT1_POS); alias ENIT1 : std_logic is TCSR1(ENIT1_POS); alias LOAD1 : std_logic is TCSR1(LOAD1_POS); alias ARHT1 : std_logic is TCSR1(ARHT1_POS); alias CAPT1 : std_logic is TCSR1(CAPT1_POS); alias CMPT1 : std_logic is TCSR1(CMPT1_POS); alias UDT1 : std_logic is TCSR1(UDT1_POS); alias MDT1 : std_logic is TCSR1(MDT1_POS); alias PWMB0 : std_logic is TCSR1(PWMB0_POS); ------------------------------------------------------------------------------- -- Begin architecture ------------------------------------------------------------------------------- begin -- architecture imp pair0_Select <= (Bus2ip_wrce(0) or Bus2ip_wrce(4)); --------------------------------------------------- --Creating TCSR0 Register --------------------------------------------------- TCSR0_GENERATE: for i in TWELVE_BIT_TYPE'range generate TCSR0_FF_I: component FDRSE port map ( Q => TCSR0(i), -- [out] C => Clk, -- [in] CE => TCSR0_CE(i), -- [in] D => TCSR0_In(i), -- [in] R => TCSR0_Reset(i), -- [in] S => TCSR0_Set(i) -- [in] ); end generate TCSR0_GENERATE; ------------------------------------------------------------------------------------ ---Interrupt bit (23-bit) of TCSR0 register is cleared by writing 1 to Interrupt bit ------------------------------------------------------------------------------------ TCSR0_Reset <= (others => '1') when Reset = RESET_ACTIVE else "000100000000" when Bus2ip_data(T0INT_POS)='1' and Bus2ip_wrce(0)='1' else (others => '0') ; ---------------------------------------------------- --TCSR0 PROCESS: --TO GENERATE CLOCK ENABLES, AND RESET --OF TCSR0 REGISTER ---------------------------------------------------- TCSR0_PROCESS: process (Bus2ip_wrce,Bus2ip_data,MDT0, captureTrig0_Edge,generateOutPre0,TCSR0, pair0_select,Reset,BE,ENT0,CASC,generateOutPre1) is begin TCSR0_Set <= (others => '0'); --------------------------------------------- --Generating clock enables for TCSR0 register --------------------------------------------- TCSR0_CE(31) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(30) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(29) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(28) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(27) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(26) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(25) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(24) <= Bus2ip_wrce(0) and BE(3); TCSR0_CE(23) <= Bus2ip_wrce(0) and BE(2); TCSR0_CE(22) <= Bus2ip_wrce(0) and BE(2); TCSR0_CE(21) <= Bus2ip_wrce(0) and BE(2); TCSR0_CE(20) <= Bus2ip_wrce(0) and BE(2); TCSR0_In <= Bus2ip_data(20 to 31); TCSR0_In(T0INT_POS) <= TCSR0(T0INT_POS); ---------------------------------------------------- ---interrupt bit (23-bit) of TCSR1 register is set to 1 ---------------------------------------------------- if (CASC = '0') then if (((MDT0='1' and captureTrig0_Edge='1' and ENT0='1') or (MDT0='0' and generateOutPre0='1'))) then TCSR0_Set(T0INT_POS) <= '1'; else TCSR0_Set(T0INT_POS) <= '0'; end if; else if (((MDT0='1' and captureTrig0_Edge='1' and ENT0='1') or (MDT0='0' and generateOutPre1='1'))) then TCSR0_Set(T0INT_POS) <= '1'; else TCSR0_Set(T0INT_POS) <= '0'; end if; end if; TCSR0_CE(ENALL_POS) <= pair0_Select and BE(2); TCSR0_CE(ENT0_POS) <= pair0_Select; TCSR0_In(ENT0_POS) <= (Bus2ip_data(ENT0_POS) and Bus2ip_wrce(0) and BE(3)) or (Bus2ip_data(ENALL_POS) and BE(2)) or (TCSR0(ENT0_POS) and (not Bus2ip_wrce(0))); end process TCSR0_PROCESS; --------------------------------------------------- --Creating TCSR1 Register --------------------------------------------------- TCSR1_GENERATE: for i in ELEVEN_BIT_TYPE'range generate TCSR1_FF_I: component FDRSE port map ( Q => TCSR1(i), -- [out] C => Clk, -- [in] CE => TCSR1_CE(i), -- [in] D => TCSR1_In(i), -- [in] R => TCSR1_Reset(i), -- [in] S => TCSR1_Set(i) -- [in] ); end generate TCSR1_GENERATE; ------------------------------------------------------------------------------------ ---Interrupt bit (23-bit) of TCSR1 register is cleared by writing 1 to Interrupt bit ------------------------------------------------------------------------------------ TCSR1_Reset <= (others => '1') when Reset = RESET_ACTIVE else "00100000000" when Bus2ip_data(T1INT_POS)='1' and Bus2ip_wrce(4)='1' else (others => '0') ; ------------------------------------------------------------------------ ---------------------------------------------------- --TCSR1 PROCESS: --TO GENERATE CLOCK ENABLES, AND RESET --OF TCSR1 REGISTER ---------------------------------------------------- TCSR1_PROCESS: process (Bus2ip_data,Bus2ip_wrce,MDT1, captureTrig1_Edge,generateOutPre1,TCSR1, pair0_Select,Reset,BE,ENT1,CASC, MDT0,captureTrig0_Edge,ENT0) is begin TCSR1_Set <= (others => '0'); --------------------------------------------- --Generating clock enables for TCSR1 register --------------------------------------------- TCSR1_CE(31) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(30) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(29) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(28) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(27) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(26) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(25) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(24) <= Bus2ip_wrce(4) and BE(3); TCSR1_CE(23) <= Bus2ip_wrce(4) and BE(2); TCSR1_CE(22) <= Bus2ip_wrce(4) and BE(2); TCSR1_CE(21) <= Bus2ip_wrce(4) and BE(2); TCSR1_In <= Bus2ip_data(21 to 31); TCSR1_In(T1INT_POS) <= TCSR1(T1INT_POS); ---------------------------------------------------------------- ---interrupt bit of TCSR1 register is set to 1 ---------------------------------------------------------------- if (((MDT1='1' and captureTrig1_Edge='1' and ENT1='1') or (MDT1='0' and generateOutPre1='1')) and CASC='0') then TCSR1_Set(T1INT_POS) <= '1'; else TCSR1_Set(T1INT_POS) <= '0'; end if; TCSR1_CE(ENALL_POS) <= pair0_Select and BE(2); TCSR1_CE(ENT1_POS) <= pair0_Select; TCSR1_In(ENT1_POS) <= (Bus2ip_data(ENT1_POS) and Bus2ip_wrce(4) and BE(3)) or (Bus2ip_data(ENALL_POS) and BE(2)) or (TCSR1(ENT1_POS) and (not Bus2ip_wrce(4))); end process TCSR1_PROCESS; ------------------------------------------------------------------------------- -- Counter Controls ------------------------------------------------------------------------------- READ_DONE0_I: component FDRSE port map ( Q => read_done0, -- [out] C => Clk, -- [in] CE => '1', -- [in] D => read_done0, -- [in] R => captureTrig0_Edge, -- [in] S => tccr0_select -- [in] ); READ_DONE1_I: component FDRSE port map ( Q => read_done1, -- [out] C => Clk, -- [in] CE => '1', -- [in] D => read_done1, -- [in] R => captureTrig1_Edge, -- [in] S => tccr1_select -- [in] ); INPUT_DOUBLE_REGS3 : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => 4 ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => Freeze, prmry_vect_in => (others => '0'), scndry_aclk => Clk, scndry_resetn => '0', scndry_out => Freeze_int, scndry_vect_out => open ); ------------------------------------------------------- ---Generating count enable and count down for counter 0 ------------------------------------------------------- Counter_En(0) <= (not Freeze_int and ENT0 and (MDT0 or (not Counter_TC(0) or (ARHT0 or PWMA0)))) when (CASC = '0') else ((not Freeze_int) and ENT0 and (MDT0 or (not Counter_TC(1)) or ARHT0)); Count_Down(0) <= UDT0; ------------------------------------------------------- ------------------------------------------------------- ---Generating count enable and count down for counter 1 ------------------------------------------------------- Counter_En(1) <= (not Freeze_int and ENT1 and (MDT1 or (not Counter_TC(1) or (ARHT1 or PWMB0)))) when (CASC = '0') else ((not Freeze_int) and ENT0 and generateOutPre0 and (MDT0 or (not Counter_TC(1)) or ARHT0)); Count_Down(1) <= UDT1 when (CASC = '0') else UDT0; ------------------------------------------------------- ------------------------------------------------------- ---Load counter0 and counter1 with TLR register value ------------------------------------------------------- Load_Counter_Reg(0) <= ((Counter_TC(0) and (ARHT0 or PWMA0) and (not MDT0)) or LOAD0) when (CASC = '0') else ((Counter_TC(1) and ARHT0 and (not MDT0)) or LOAD0) ; Load_Counter_Reg(1) <= ((Counter_TC(1) and ARHT1 and not PWMB0 and (not MDT1)) or LOAD1 or (Counter_TC(0) and PWMB0)) when (CASC = '0') else ((Counter_TC(1) and ARHT0 and (not MDT0)) or LOAD1) ; ------------------------------------------------------- Load_Load_Reg(0) <= (MDT0 and captureTrig0_Edge and ARHT0) or (MDT0 and captureTrig0_Edge and not ARHT0 and read_done0); Load_Load_Reg(1) <= ((MDT1 and captureTrig1_Edge and ARHT1) or (MDT1 and captureTrig1_Edge and not ARHT1 and read_done1)) when (CASC = '0') else ((MDT0 and captureTrig1_Edge and ARHT0) or (MDT0 and captureTrig1_Edge and not ARHT0 and read_done1)); ------------------------------------------------------- Write_Load_Reg(0) <= Bus2ip_wrce(1); Write_Load_Reg(1) <= Bus2ip_wrce(5); CaptGen_Mux_Sel(0)<= Bus2ip_wrce(1); CaptGen_Mux_Sel(1)<= Bus2ip_wrce(5); tccr0_select <= (Bus2ip_wrce(1) or Bus2ip_rdce(1)); tccr1_select <= (Bus2ip_wrce(5) or Bus2ip_rdce(5)); ------------------------------------------------------- ---CAPTGEN_SYNC_PROCESS: -- Process to register the signals ------------------------------------------------------- INPUT_DOUBLE_REGS : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => 4 ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => CaptureTrig0, prmry_vect_in => (others => '0'), scndry_aclk => Clk, scndry_resetn => '0', scndry_out => CaptureTrig0_int, scndry_vect_out => open ); INPUT_DOUBLE_REGS2 : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => 4 ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => CaptureTrig1, prmry_vect_in => (others => '0'), scndry_aclk => Clk, scndry_resetn => '0', scndry_out => CaptureTrig1_int, scndry_vect_out => open ); CAPTGEN_SYNC_PROCESS: process(Clk) is begin if Clk'event and Clk='1' then if Reset='1' then captureTrig0_d <= not C_TRIG0_ASSERT; captureTrig1_d <= not C_TRIG1_ASSERT; captureTrig0_d2 <= '0'; captureTrig1_d2 <= '0'; counter_TC_Reg(0) <= '0'; counter_TC_Reg(1) <= '0'; counter_TC_Reg2 <= '0'; -- counter_TC_Reg2(1) <= '0'; generateOutPre0 <= '0'; generateOutPre1 <= '0'; GenerateOut0 <= not C_GEN0_ASSERT; GenerateOut1 <= not C_GEN1_ASSERT; Interrupt <= '0'; else captureTrig0_d <= (CaptureTrig0_int xor not(C_TRIG0_ASSERT)) and CAPT0; captureTrig1_d <= (CaptureTrig1_int xor not(C_TRIG1_ASSERT)) and CAPT1; captureTrig0_d2 <= captureTrig0_d; captureTrig1_d2 <= captureTrig1_d; counter_TC_Reg(0) <= Counter_TC(0); counter_TC_Reg(1) <= Counter_TC(1); counter_TC_Reg2 <= counter_TC_Reg(0); -- counter_TC_Reg2(1) <= counter_TC_Reg(1); generateOutPre0 <= Counter_TC(0) and (not counter_TC_Reg(0)); generateOutPre1 <= Counter_TC(1) and (not counter_TC_Reg(1)); GenerateOut0 <= ((((generateOutPre0 and CMPT0) xor not(C_GEN0_ASSERT)) and (not CASC)) or (((generateOutPre1 and CMPT0) xor not(C_GEN0_ASSERT)) and CASC)); GenerateOut1 <= ((((generateOutPre1 and CMPT1) xor not(C_GEN1_ASSERT)) and (not CASC)) or (((generateOutPre0 and CMPT0) xor not(C_GEN0_ASSERT)) and CASC)); Interrupt <= (ENIT0 and T0INT) or (ENIT1 and T1INT); -- for edge-sensitive interrupt --interrupt_reg<= (ENIT0 and T0INT) or (ENIT1 and T1INT); --Interrupt <= ((ENIT0 and T0INT) or (ENIT1 and T1INT)) -- and (not interrupt_reg); end if; end if; end process CAPTGEN_SYNC_PROCESS; captureTrig0_pulse <= captureTrig0_d and not captureTrig0_d2; captureTrig1_pulse <= captureTrig1_d and not captureTrig1_d2; captureTrig0_Edge <= captureTrig0_pulse when (CASC = '0') else (((not Counter_TC(0)) and (not counter_TC_Reg(0)) and captureTrig0_pulse) or (captureTrig0_pulse_d2 and counter_TC_Reg2) or (captureTrig0_pulse_d1 and counter_TC_Reg2)); captureTrig1_Edge <= captureTrig1_pulse when (CASC = '0') else captureTrig0_Edge; DELAY_CAPT_TRIG_PROCESS: process(Clk) is begin if Clk'event and Clk='1' then if Reset='1' then captureTrig0_pulse_d1 <= '0'; captureTrig0_pulse_d2 <= '0'; else captureTrig0_pulse_d1 <= captureTrig0_pulse; captureTrig0_pulse_d2 <= captureTrig0_pulse_d1; end if; end if; end process DELAY_CAPT_TRIG_PROCESS; TCSR0_Reg <= TCSR0; TCSR1_Reg <= TCSR1; end architecture imp;
gpl-3.0
d51687b52caa5356c699aac717eadf69
0.466046
3.88453
false
false
false
false
nickg/nvc
test/parse/seq.vhd
1
3,943
entity bb is end entity; architecture aa of bb is signal x, y, z : integer; signal w : bit_vector(1 to 3); begin -- Wait statements process is begin wait for 1 ns; block_forever: wait; wait on x; wait on x, y, z(1 downto 0); wait on w(1) for 2 ns; wait until x = 3; wait until y = x for 5 ns; wait on x until x = 2 for 1 ns; end process; -- Blocking assignment process is variable a : integer; begin a := 2; a := a + (a * 3); end process; -- Assert and report process is begin assert true; assert false severity note; assert 1 > 2 report "oh no" severity failure; report "hello"; report "boo" severity error; end process; -- Function calls process is variable a, b : integer; function foo (x, y, z : integer) return integer; begin x := foo(1, 2, 3); a := "abs"(b); end process; -- If process is variable x, y : integer; begin if true then x := 1; end if; test: if true then x := y; end if test; if x > 2 then x := 5; else y := 2; end if; if x > 3 then null; elsif x > 5 then null; elsif true then null; else x := 2; end if; end process; -- Null process is begin null; end process; -- Return process is begin return 4 * 4; end process; -- While process is variable n : integer; begin while n > 0 loop n := n - 1; end loop; loop null; end loop; end process; -- Delayed assignment process is begin x <= 4 after 5 ns; x <= 5 after 1 ns, 7 after 8 ns; x <= 5, 7 after 8 ns; x <= inertial 5; x <= transport 4 after 2 ns; x <= reject 4 ns inertial 6 after 10 ns; end process; -- For process is type foo is (A, B, C); begin for i in 0 to 10 loop null; end loop; for i in foo'range loop null; end loop; end process; -- Exit process is begin exit; exit when x = 1; end process; -- Procedure call process is procedure foo (a, b, c : integer); procedure bar; begin foo(x, y, 1); bar; foo(a => 1, b => 2, 3); end process; -- Case process is begin case x is when 1 => null; when 2 => null; when 3 | 4 => null; when others => null; end case; end process; -- Next process is begin next; next when x = 5; end process; -- Signal assignment to aggregate process is type int_vec is array (natural range <>) of integer; constant foo : int_vec := (1, 2, 3); begin ( x, y, z ) <= foo; end process; -- Case statement range bug process is begin case y is when 1 => for i in integer'range loop end loop; end case; end process; -- 2008: all-sensitive process process (all) is begin x <= y; end process; -- Variable assignment with aggregate target process is type int_vec is array (natural range <>) of integer; variable v : int_vec(1 to 2); variable a, b : integer; begin (a, b) := v; -- OK end process; -- Signal assignment with null transaction process is begin x <= 1, null after 2 ns; -- OK end process; end architecture;
gpl-3.0
6b343f13195b33daee70189e5d9da85b
0.462085
4.221627
false
false
false
false
nickg/nvc
test/regress/wait12.vhd
5
659
entity wait12 is end entity; architecture test of wait12 is signal x, y : integer; begin a: process is begin wait for 1 ns; x <= 1; wait for 0 ns; x <= 2; wait for 0 ns; x <= 3; wait for 1 ns; x <= 4; wait on y; report "wake up other process"; assert y = 2; wait; end process; b: postponed process is begin wait on x; report "wake up postponed process 1"; assert x = 3; wait on x; report "wake up postponed process 2"; y <= 2 after 1 ns; wait; end process; end architecture;
gpl-3.0
f66821c65e9e8773ac5b8053f1fbc2e8
0.497724
3.96988
false
false
false
false
tgingold/ghdl
testsuite/synth/issue1319/repro.vhdl
1
1,463
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library work; entity repro is port ( insn_i : in std_ulogic_vector(31 downto 0); ispr1_o : out std_ulogic_vector(5 downto 0); spr_o : out std_ulogic_vector (9 downto 0) ); end entity repro; architecture behaviour of repro is -- SPR numbers subtype spr_num_t is integer range 0 to 1023; function decode_spr_num(insn: std_ulogic_vector(31 downto 0)) return spr_num_t; constant SPR_XER : spr_num_t := 1; constant SPR_LR : spr_num_t := 8; constant SPR_CTR : spr_num_t := 9; -- Extended GPR indice (can hold an SPR) subtype gspr_index_t is std_ulogic_vector(5 downto 0); function decode_spr_num(insn: std_ulogic_vector(31 downto 0)) return spr_num_t is begin return to_integer(unsigned(insn(15 downto 11) & insn(20 downto 16))); end; function fast_spr_num(spr: spr_num_t) return gspr_index_t is variable n : integer range 0 to 31; begin case spr is when SPR_LR => n := 0; when SPR_CTR => n:= 1; when SPR_XER => n := 12; when others => n := 0; return "000000"; end case; return "1" & std_ulogic_vector(to_unsigned(n, 5)); end; begin ispr1_o <= fast_spr_num(decode_spr_num(insn_i)); spr_o <= std_ulogic_vector (to_unsigned (decode_spr_num(insn_i), 10)); end architecture behaviour;
gpl-2.0
37d4e93cc2b9427d0b01f5de9912f81d
0.602871
3.222467
false
false
false
false
tgingold/ghdl
testsuite/gna/bug019/PoC/src/io/uart/uart_bclk.vhdl
4
3,727
-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -- vim: tabstop=2:shiftwidth=2:noexpandtab -- kate: tab-width 2; replace-tabs off; indent-width 2; -- -- ============================================================================ -- Authors: Martin Zabel -- Patrick Lehmann -- -- Module: UART bit clock / baud rate generator -- -- Description: -- ------------------------------------ -- TODO -- -- old comments: -- UART BAUD rate generator -- bclk_r = bit clock is rising -- bclk_x8_r = bit clock times 8 is rising -- -- -- License: -- ============================================================================ -- Copyright 2008-2015 Technische Universitaet Dresden - Germany -- Chair for VLSI-Design, Diagnostics and Architecture -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ============================================================================ library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library PoC; use PoC.utils.all; use PoC.strings.all; use PoC.physical.all; use PoC.components.all; use PoC.uart.all; entity uart_bclk is generic ( CLOCK_FREQ : FREQ := 100 MHz; BAUDRATE : BAUD := 115200 Bd ); port ( clk : in std_logic; rst : in std_logic; bclk : out std_logic; bclk_x8 : out std_logic ); end entity; architecture rtl of uart_bclk is constant UART_OVERSAMPLING_RATE : POSITIVE := 8; constant TIME_UNIT_INTERVAL : TIME := 1 sec / (to_real(BAUDRATE, 1 Bd) * real(UART_OVERSAMPLING_RATE)); constant BAUDRATE_COUNTER_MAX : POSITIVE := TimingToCycles(TIME_UNIT_INTERVAL, CLOCK_FREQ); constant BAUDRATE_COUNTER_BITS : POSITIVE := log2ceilnz(BAUDRATE_COUNTER_MAX + 1); -- registers signal x8_cnt : unsigned(BAUDRATE_COUNTER_BITS - 1 downto 0) := (others => '0'); signal x1_cnt : unsigned(2 downto 0) := (others => '0'); -- control signals signal x8_cnt_done : std_logic; signal x1_cnt_done : std_logic; signal bclk_r : STD_LOGIC := '0'; signal bclk_x8_r : STD_LOGIC := '0'; begin assert FALSE -- LF works in QuartusII report "uart_bclk:" & LF & " CLOCK_FREQ=" & to_string(CLOCK_FREQ, 3) & LF & " BAUDRATE=" & to_string(BAUDRATE, 3) & LF & " COUNTER_MAX=" & INTEGER'image(BAUDRATE_COUNTER_MAX) & LF & " COUNTER_BITS=" & INTEGER'image(BAUDRATE_COUNTER_BITS) severity NOTE; assert io_UART_IsTypicalBaudRate(BAUDRATE) report "The baudrate " & to_string(BAUDRATE, 3) & " is not known to be a typical baudrate!" severity WARNING; x8_cnt <= upcounter_next(cnt => x8_cnt, rst => (rst or x8_cnt_done)) when rising_edge(clk); x8_cnt_done <= upcounter_equal(cnt => x8_cnt, value => BAUDRATE_COUNTER_MAX - 1); x1_cnt <= upcounter_next(cnt => x1_cnt, rst => rst, en => x8_cnt_done) when rising_edge(clk); x1_cnt_done <= comp_allzero(x1_cnt); -- outputs -- --------------------------------------------------------------------------- -- only x8_cnt_done is pulsed for one clock cycle! bclk_r <= (x1_cnt_done and x8_cnt_done) when rising_edge(clk); bclk_x8_r <= x8_cnt_done when rising_edge(clk); bclk <= bclk_r; bclk_x8 <= bclk_x8_r; end;
gpl-2.0
40ee1e59be1d36b72b21efc0e504cc59
0.591092
3.263573
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/Hist_Stretch/Hist_Stretch.srcs/sources_1/bd/design_1/hdl/design_1_wrapper.vhd
1
3,455
--Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. ---------------------------------------------------------------------------------- --Tool Version: Vivado v.2016.1 (lin64) Build 1538259 Fri Apr 8 15:45:23 MDT 2016 --Date : Thu Jun 23 01:53:38 2016 --Host : darkin-UX303LN running 64-bit elementary OS Freya --Command : generate_target design_1_wrapper.bd --Design : design_1_wrapper --Purpose : IP block netlist ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; library UNISIM; use UNISIM.VCOMPONENTS.ALL; entity design_1_wrapper is port ( DDR_addr : inout STD_LOGIC_VECTOR ( 14 downto 0 ); DDR_ba : inout STD_LOGIC_VECTOR ( 2 downto 0 ); DDR_cas_n : inout STD_LOGIC; DDR_ck_n : inout STD_LOGIC; DDR_ck_p : inout STD_LOGIC; DDR_cke : inout STD_LOGIC; DDR_cs_n : inout STD_LOGIC; DDR_dm : inout STD_LOGIC_VECTOR ( 3 downto 0 ); DDR_dq : inout STD_LOGIC_VECTOR ( 31 downto 0 ); DDR_dqs_n : inout STD_LOGIC_VECTOR ( 3 downto 0 ); DDR_dqs_p : inout STD_LOGIC_VECTOR ( 3 downto 0 ); DDR_odt : inout STD_LOGIC; DDR_ras_n : inout STD_LOGIC; DDR_reset_n : inout STD_LOGIC; DDR_we_n : inout STD_LOGIC; FIXED_IO_ddr_vrn : inout STD_LOGIC; FIXED_IO_ddr_vrp : inout STD_LOGIC; FIXED_IO_mio : inout STD_LOGIC_VECTOR ( 53 downto 0 ); FIXED_IO_ps_clk : inout STD_LOGIC; FIXED_IO_ps_porb : inout STD_LOGIC; FIXED_IO_ps_srstb : inout STD_LOGIC ); end design_1_wrapper; architecture STRUCTURE of design_1_wrapper is component design_1 is port ( DDR_cas_n : inout STD_LOGIC; DDR_cke : inout STD_LOGIC; DDR_ck_n : inout STD_LOGIC; DDR_ck_p : inout STD_LOGIC; DDR_cs_n : inout STD_LOGIC; DDR_reset_n : inout STD_LOGIC; DDR_odt : inout STD_LOGIC; DDR_ras_n : inout STD_LOGIC; DDR_we_n : inout STD_LOGIC; DDR_ba : inout STD_LOGIC_VECTOR ( 2 downto 0 ); DDR_addr : inout STD_LOGIC_VECTOR ( 14 downto 0 ); DDR_dm : inout STD_LOGIC_VECTOR ( 3 downto 0 ); DDR_dq : inout STD_LOGIC_VECTOR ( 31 downto 0 ); DDR_dqs_n : inout STD_LOGIC_VECTOR ( 3 downto 0 ); DDR_dqs_p : inout STD_LOGIC_VECTOR ( 3 downto 0 ); FIXED_IO_mio : inout STD_LOGIC_VECTOR ( 53 downto 0 ); FIXED_IO_ddr_vrn : inout STD_LOGIC; FIXED_IO_ddr_vrp : inout STD_LOGIC; FIXED_IO_ps_srstb : inout STD_LOGIC; FIXED_IO_ps_clk : inout STD_LOGIC; FIXED_IO_ps_porb : inout STD_LOGIC ); end component design_1; begin design_1_i: component design_1 port map ( DDR_addr(14 downto 0) => DDR_addr(14 downto 0), DDR_ba(2 downto 0) => DDR_ba(2 downto 0), DDR_cas_n => DDR_cas_n, DDR_ck_n => DDR_ck_n, DDR_ck_p => DDR_ck_p, DDR_cke => DDR_cke, DDR_cs_n => DDR_cs_n, DDR_dm(3 downto 0) => DDR_dm(3 downto 0), DDR_dq(31 downto 0) => DDR_dq(31 downto 0), DDR_dqs_n(3 downto 0) => DDR_dqs_n(3 downto 0), DDR_dqs_p(3 downto 0) => DDR_dqs_p(3 downto 0), DDR_odt => DDR_odt, DDR_ras_n => DDR_ras_n, DDR_reset_n => DDR_reset_n, DDR_we_n => DDR_we_n, FIXED_IO_ddr_vrn => FIXED_IO_ddr_vrn, FIXED_IO_ddr_vrp => FIXED_IO_ddr_vrp, FIXED_IO_mio(53 downto 0) => FIXED_IO_mio(53 downto 0), FIXED_IO_ps_clk => FIXED_IO_ps_clk, FIXED_IO_ps_porb => FIXED_IO_ps_porb, FIXED_IO_ps_srstb => FIXED_IO_ps_srstb ); end STRUCTURE;
gpl-3.0
9db4e8cf6d8ee5d0fec6819c9a22f8f8
0.589001
3.065661
false
false
false
false
tgingold/ghdl
testsuite/synth/psl02/assert2.vhdl
1
444
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity assert2 is port (clk, rst: std_logic; cnt : out unsigned(3 downto 0)); end assert2; architecture behav of assert2 is signal val : unsigned (3 downto 0); begin process(clk) begin if rising_edge(clk) then if rst = '1' then val <= (others => '0'); else val <= val + 1; end if; end if; end process; cnt <= val; end behav;
gpl-2.0
3c857297473ce56c5bd2f049ffda168f
0.619369
3.148936
false
false
false
false
tgingold/ghdl
testsuite/synth/issue1322/issue.vhdl
1
2,012
library ieee; use ieee.std_logic_1164.all; entity sequencer is generic ( seq : string ); port ( clk : in std_logic; data : out std_logic ); end entity sequencer; architecture rtl of sequencer is signal index : natural := seq'low; function to_bit (a : in character) return std_logic is variable ret : std_logic; begin case a is when '0' | '_' => ret := '0'; when '1' | '-' => ret := '1'; when others => ret := 'X'; end case; return ret; end function to_bit; begin process (clk) is begin if rising_edge(clk) then if (index < seq'high) then index <= index + 1; end if; end if; end process; data <= to_bit(seq(index)); end architecture rtl; library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity issue is port ( clk : in std_logic ); end entity issue; architecture psl of issue is component sequencer is generic ( seq : string ); port ( clk : in std_logic; data : out std_logic ); end component sequencer; signal req, busy, done : std_logic; begin -- 0123456789 SEQ_REQ : sequencer generic map ("_-_______") port map (clk, req); SEQ_BUSY : sequencer generic map ("__-_-_-__") port map (clk, busy); SEQ_DONE : sequencer generic map ("_______-_") port map (clk, done); -- All is sensitive to rising edge of clk default clock is rising_edge(clk); -- Non consecutive repetition of 3 cycles without padding -- busy has to hold on 3 cycles between req & done -- This assertion holds -- Not yet supported SERE_0_a : assert always {req} |=> {busy[->3]; done}; -- Non consecutive repetition of 2 to 4 cycles without padding -- busy has to hold on 2 to 4 cycles between req & done -- This assertion holds -- Not yet supported SERE_1_a : assert always {req} |=> {busy[->2 to 4]; done}; end architecture psl;
gpl-2.0
e38223d4a65bb2211d0edbefcdf256f7
0.599901
3.631769
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc1598.vhd
4
1,991
-- 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: tc1598.vhd,v 1.2 2001-10-26 16:29:42 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c08s11b00x00p03n01i01598ent IS END c08s11b00x00p03n01i01598ent; ARCHITECTURE c08s11b00x00p03n01i01598arch OF c08s11b00x00p03n01i01598ent IS BEGIN TESTING: PROCESS variable p : integer := 0; variable done : boolean := false; BEGIN L1 : for i in boolean loop while not done loop done := true ; exit ; p := 0; end loop ; p := p + 1; end loop L1; assert NOT( p=2 ) report "***PASSED TEST: c08s11b00x00p03n01i01598" severity NOTE; assert ( p=2 ) report "***FAILED TEST: c08s11b00x00p03n01i01598 - An exit statement used without a loop label only occurs within a loop and refers only to the lowest level, or innermost, loop." severity ERROR; wait; END PROCESS TESTING; END c08s11b00x00p03n01i01598arch;
gpl-2.0
e93f6de8ba4bb62068b4f4fc53773a36
0.650929
3.770833
false
true
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc2454.vhd
4
2,136
-- 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: tc2454.vhd,v 1.2 2001-10-26 16:29:48 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c07s03b02x02p03n02i02454pkg is type UN_ARR is array (integer range <>) of character; subtype CON_ARR is UN_ARR( 1 to 5) ; end c07s03b02x02p03n02i02454pkg; use work.c07s03b02x02p03n02i02454pkg.all; ENTITY c07s03b02x02p03n02i02454ent IS port (P : in CON_ARR := (others => 'A')); --- No_failure_here END c07s03b02x02p03n02i02454ent; ARCHITECTURE c07s03b02x02p03n02i02454arch OF c07s03b02x02p03n02i02454ent IS BEGIN TESTING: PROCESS BEGIN assert NOT(P(1)='A' and P(2)='A' and P(3)='A' and P(4)='A' and P(5)='A') report "***PASSED TEST: c07s03b02x02p03n02i02454" severity NOTE; assert (P(1)='A' and P(2)='A' and P(3)='A' and P(4)='A' and P(5)='A') report "***FAILED TEST: c07s03b02x02p03n02i02454 - As the default expression defining the default initial value of a port declared to be of a constrained array subtype." severity ERROR; wait; END PROCESS TESTING; END c07s03b02x02p03n02i02454arch;
gpl-2.0
41e15256c4202d08e1e1bc6b2e00954b
0.670412
3.358491
false
true
false
false
tgingold/ghdl
testsuite/synth/int01/int_operators.vhdl
1
385
library ieee; use ieee.std_logic_1164.all; entity int_operators is generic ( gen_a : integer := 5; gen_b : integer := 3 ); port ( sig_a : in integer range 0 to 7; sig_b : out std_logic; sig_c : out integer ); end int_operators; architecture rtl of int_operators is begin sig_b <= '0' when sig_a /= gen_a else '1'; sig_c <= gen_a rem gen_b; end rtl;
gpl-2.0
31cd8b5e7d1ed8d6cfa1379dc4ea3055
0.605195
2.894737
false
false
false
false
nickg/nvc
test/regress/issue13.vhd
5
464
entity issue13 is end entity; architecture test of issue13 is constant c0: bit_vector(7 downto 0) := "10101010"; type t_array is array (1 downto 0) of bit_vector(7 downto 0); constant c1 : t_array := ( 1 => c0, --error 0 => "10101010"); begin process is variable cmp : bit_vector(7 downto 0) := "10101010"; begin assert c1(1) = c0; assert c1(0) = cmp; wait; end process; end architecture;
gpl-3.0
1a31c364d1e445148c463652749b53fa
0.581897
3.437037
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_dma_v7_1/hdl/src/vhdl/axi_dma_cmd_split.vhd
3
22,816
-- (c) Copyright 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. ------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; library unisim; use unisim.vcomponents.all; library lib_cdc_v1_0_2; library axi_dma_v7_1_9; use axi_dma_v7_1_9.axi_dma_pkg.all; entity axi_dma_cmd_split is generic ( C_ADDR_WIDTH : integer range 32 to 64 := 32; C_DM_STATUS_WIDTH : integer range 8 to 32 := 8; C_INCLUDE_S2MM : integer range 0 to 1 := 0 ); port ( clock : in std_logic; sgresetn : in std_logic; clock_sec : in std_logic; aresetn : in std_logic; -- command coming from _MNGR s_axis_cmd_tvalid : in std_logic; s_axis_cmd_tready : out std_logic; s_axis_cmd_tdata : in std_logic_vector ((C_ADDR_WIDTH-32+2*32+CMD_BASE_WIDTH+46)-1 downto 0); -- split command to DM s_axis_cmd_tvalid_s : out std_logic; s_axis_cmd_tready_s : in std_logic; s_axis_cmd_tdata_s : out std_logic_vector ((C_ADDR_WIDTH+CMD_BASE_WIDTH+8)-1 downto 0); -- Tvalid from Datamover tvalid_from_datamover : in std_logic; status_in : in std_logic_vector (C_DM_STATUS_WIDTH-1 downto 0); tvalid_unsplit : out std_logic; status_out : out std_logic_vector (C_DM_STATUS_WIDTH-1 downto 0); -- Tlast of stream data from Datamover tlast_stream_data : in std_logic; tready_stream_data : in std_logic; tlast_unsplit : out std_logic; tlast_unsplit_user : out std_logic ); end entity axi_dma_cmd_split; architecture implementation of axi_dma_cmd_split is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; type SPLIT_MM2S_STATE_TYPE is ( IDLE, SEND, SPLIT ); signal mm2s_cs : SPLIT_MM2S_STATE_TYPE; signal mm2s_ns : SPLIT_MM2S_STATE_TYPE; signal mm2s_cmd : std_logic_vector (C_ADDR_WIDTH-32+2*32+CMD_BASE_WIDTH+46-1 downto 0); signal command_ns : std_logic_vector (C_ADDR_WIDTH-32+2*32+CMD_BASE_WIDTH-1 downto 0); signal command : std_logic_vector (C_ADDR_WIDTH-32+2*32+CMD_BASE_WIDTH-1 downto 0); signal cache_info : std_logic_vector (31 downto 0); signal vsize_data : std_logic_vector (22 downto 0); signal vsize_data_int : std_logic_vector (22 downto 0); signal vsize : std_logic_vector (22 downto 0); signal counter : std_logic_vector (22 downto 0); signal counter_tlast : std_logic_vector (22 downto 0); signal split_cmd : std_logic_vector (31+(C_ADDR_WIDTH-32) downto 0); signal stride_data : std_logic_vector (22 downto 0); signal vsize_over : std_logic; signal cmd_proc_cdc_from : std_logic; signal cmd_proc_cdc_to : std_logic; signal cmd_proc_cdc : std_logic; signal cmd_proc_ns : std_logic; ATTRIBUTE async_reg : STRING; -- ATTRIBUTE async_reg OF cmd_proc_cdc_to : SIGNAL IS "true"; -- ATTRIBUTE async_reg OF cmd_proc_cdc : SIGNAL IS "true"; signal cmd_out : std_logic; signal cmd_out_ns : std_logic; signal split_out : std_logic; signal split_out_ns : std_logic; signal command_valid : std_logic; signal command_valid_ns : std_logic; signal command_ready : std_logic; signal reset_lock : std_logic; signal reset_lock_tlast : std_logic; signal tvalid_unsplit_int : std_logic; signal tlast_stream_data_int : std_logic; signal ready_for_next_cmd : std_logic; signal ready_for_next_cmd_tlast : std_logic; signal ready_for_next_cmd_tlast_cdc_from : std_logic; signal ready_for_next_cmd_tlast_cdc_to : std_logic; signal ready_for_next_cmd_tlast_cdc : std_logic; -- ATTRIBUTE async_reg OF ready_for_next_cmd_tlast_cdc_to : SIGNAL IS "true"; -- ATTRIBUTE async_reg OF ready_for_next_cmd_tlast_cdc : SIGNAL IS "true"; signal tmp1, tmp2, tmp3, tmp4 : std_logic; signal tlast_int : std_logic; signal eof_bit : std_logic; signal eof_bit_cdc_from : std_logic; signal eof_bit_cdc_to : std_logic; signal eof_bit_cdc : std_logic; signal eof_set : std_logic; signal over_ns, over : std_logic; signal cmd_in : std_logic; signal status_out_int : std_logic_vector (C_DM_STATUS_WIDTH-1 downto 0); begin s_axis_cmd_tvalid_s <= command_valid; command_ready <= s_axis_cmd_tready_s; s_axis_cmd_tdata_s <= command (103+(C_ADDR_WIDTH-32) downto 96+(C_ADDR_WIDTH-32)) & command (71+(C_ADDR_WIDTH-32) downto 0); REGISTER_STATE_MM2S : process(clock) begin if(clock'EVENT and clock = '1')then if(sgresetn = '0')then mm2s_cs <= IDLE; cmd_proc_cdc_from <= '0'; cmd_out <= '0'; command <= (others => '0'); command_valid <= '0'; split_out <= '0'; over <= '0'; else mm2s_cs <= mm2s_ns; cmd_proc_cdc_from <= cmd_proc_ns; cmd_out <= cmd_out_ns; command <= command_ns; command_valid <= command_valid_ns; split_out <= split_out_ns; over <= over_ns; end if; end if; end process REGISTER_STATE_MM2S; -- grab the MM2S command coming from MM2S_mngr REGISTER_MM2S_CMD : process(clock) begin if(clock'EVENT and clock = '1')then if(sgresetn = '0')then mm2s_cmd <= (others => '0'); s_axis_cmd_tready <= '0'; cache_info <= (others => '0'); vsize_data <= (others => '0'); vsize_data_int <= (others => '0'); stride_data <= (others => '0'); eof_bit_cdc_from <= '0'; cmd_in <= '0'; elsif (s_axis_cmd_tvalid = '1' and ready_for_next_cmd = '1' and cmd_proc_cdc_from = '0' and ready_for_next_cmd_tlast_cdc = '1') then -- when there is no processing being done, means it is ready to accept mm2s_cmd <= s_axis_cmd_tdata; s_axis_cmd_tready <= '1'; cache_info <= s_axis_cmd_tdata (149+(C_ADDR_WIDTH-32) downto 118+(C_ADDR_WIDTH-32)); vsize_data <= s_axis_cmd_tdata (117+(C_ADDR_WIDTH-32) downto 95+(C_ADDR_WIDTH-32)); vsize_data_int <= s_axis_cmd_tdata (117+(C_ADDR_WIDTH-32) downto 95+(C_ADDR_WIDTH-32)) - '1'; stride_data <= s_axis_cmd_tdata (94+(C_ADDR_WIDTH-32) downto 72+(C_ADDR_WIDTH-32)); eof_bit_cdc_from <= s_axis_cmd_tdata (30); cmd_in <= '1'; else mm2s_cmd <= mm2s_cmd; --split_cmd; vsize_data <= vsize_data; vsize_data_int <= vsize_data_int; stride_data <= stride_data; cache_info <= cache_info; s_axis_cmd_tready <= '0'; eof_bit_cdc_from <= eof_bit_cdc_from; cmd_in <= '0'; end if; end if; end process REGISTER_MM2S_CMD; REGISTER_DECR_VSIZE : process(clock) begin if(clock'EVENT and clock = '1')then if(sgresetn = '0')then vsize <= "00000000000000000000000"; elsif (command_valid = '1' and command_ready = '1' and (vsize < vsize_data_int)) then -- sending a cmd out to DM vsize <= vsize + '1'; elsif (cmd_proc_cdc_from = '0') then -- idle or when all cmd are sent to DM vsize <= "00000000000000000000000"; else vsize <= vsize; end if; end if; end process REGISTER_DECR_VSIZE; vsize_over <= '1' when (vsize = vsize_data_int) else '0'; -- eof_set <= eof_bit when (vsize = vsize_data_int) else '0'; REGISTER_SPLIT : process(clock) begin if(clock'EVENT and clock = '1')then if(sgresetn = '0')then split_cmd <= (others => '0'); elsif (s_axis_cmd_tvalid = '1' and cmd_proc_cdc_from = '0' and ready_for_next_cmd = '1' and ready_for_next_cmd_tlast_cdc = '1') then split_cmd <= s_axis_cmd_tdata (63+(C_ADDR_WIDTH-32) downto 32); -- capture the ba when a new cmd arrives elsif (split_out = '1') then -- add stride to previous ba split_cmd <= split_cmd + stride_data; else split_cmd <= split_cmd; end if; end if; end process REGISTER_SPLIT; MM2S_MACHINE : process(mm2s_cs, s_axis_cmd_tvalid, cmd_proc_cdc_from, vsize_over, command_ready, cache_info, mm2s_cmd, split_cmd, eof_set, cmd_in, command ) begin over_ns <= '0'; cmd_proc_ns <= '0'; -- ready to receive new command split_out_ns <= '0'; command_valid_ns <= '0'; mm2s_ns <= mm2s_cs; command_ns <= command; -- Default signal assignment case mm2s_cs is ------------------------------------------------------------------- when IDLE => command_ns <= cache_info & mm2s_cmd (72+(C_ADDR_WIDTH-32) downto 65+(C_ADDR_WIDTH-32)) & split_cmd & mm2s_cmd (31) & eof_set & mm2s_cmd (29 downto 0); -- buf length remains the same -- command_ns <= cache_info & mm2s_cmd (72 downto 65) & split_cmd & mm2s_cmd (31 downto 0); -- buf length remains the same if (cmd_in = '1' and cmd_proc_cdc_from = '0') then cmd_proc_ns <= '1'; -- new command has come in and i need to start processing mm2s_ns <= SEND; over_ns <= '0'; split_out_ns <= '1'; command_valid_ns <= '1'; else mm2s_ns <= IDLE; over_ns <= '0'; cmd_proc_ns <= '0'; -- ready to receive new command split_out_ns <= '0'; command_valid_ns <= '0'; end if; ------------------------------------------------------------------- when SEND => cmd_out_ns <= '1'; command_ns <= command; if (vsize_over = '1' and command_ready = '1') then mm2s_ns <= IDLE; cmd_proc_ns <= '1'; command_valid_ns <= '0'; split_out_ns <= '0'; over_ns <= '1'; elsif (command_ready = '0') then --(command_valid = '1' and command_ready = '0') then mm2s_ns <= SEND; command_valid_ns <= '1'; cmd_proc_ns <= '1'; split_out_ns <= '0'; over_ns <= '0'; else mm2s_ns <= SPLIT; command_valid_ns <= '0'; cmd_proc_ns <= '1'; over_ns <= '0'; split_out_ns <= '0'; end if; ------------------------------------------------------------------- when SPLIT => cmd_proc_ns <= '1'; mm2s_ns <= SEND; command_ns <= cache_info & mm2s_cmd (72+(C_ADDR_WIDTH-32) downto 65+(C_ADDR_WIDTH-32)) & split_cmd & mm2s_cmd (31) & eof_set & mm2s_cmd (29 downto 0); -- buf length remains the same -- command_ns <= cache_info & mm2s_cmd (72 downto 65) & split_cmd & mm2s_cmd (31 downto 0); -- buf length remains the same cmd_out_ns <= '0'; split_out_ns <= '1'; command_valid_ns <= '1'; ------------------------------------------------------------------- -- coverage off when others => mm2s_ns <= IDLE; -- coverage on end case; end process MM2S_MACHINE; SWALLOW_TVALID : process(clock) begin if(clock'EVENT and clock = '1')then if(sgresetn = '0')then counter <= (others => '0'); -- tvalid_unsplit_int <= '0'; reset_lock <= '1'; ready_for_next_cmd <= '0'; elsif (vsize_data_int = "00000000000000000000000") then -- tvalid_unsplit_int <= '0'; ready_for_next_cmd <= '1'; reset_lock <= '0'; elsif ((tvalid_from_datamover = '1') and (counter < vsize_data_int)) then counter <= counter + '1'; -- tvalid_unsplit_int <= '0'; ready_for_next_cmd <= '0'; reset_lock <= '0'; elsif ((counter = vsize_data_int) and (reset_lock = '0') and (tvalid_from_datamover = '1')) then counter <= (others => '0'); -- tvalid_unsplit_int <= '1'; ready_for_next_cmd <= '1'; else counter <= counter; -- tvalid_unsplit_int <= '0'; if (cmd_proc_cdc_from = '1') then ready_for_next_cmd <= '0'; else ready_for_next_cmd <= ready_for_next_cmd; end if; end if; end if; end process SWALLOW_TVALID; tvalid_unsplit_int <= tvalid_from_datamover when (counter = vsize_data_int) else '0'; --tvalid_unsplit_int; SWALLOW_TDATA : process(clock) begin if(clock'EVENT and clock = '1')then if (sgresetn = '0' or cmd_in = '1') then tvalid_unsplit <= '0'; status_out_int <= (others => '0'); else tvalid_unsplit <= tvalid_unsplit_int; if (tvalid_from_datamover = '1') then status_out_int (C_DM_STATUS_WIDTH-2 downto 0) <= status_in (C_DM_STATUS_WIDTH-2 downto 0) or status_out_int (C_DM_STATUS_WIDTH-2 downto 0); else status_out_int <= status_out_int; end if; if (tvalid_unsplit_int = '1') then status_out_int (C_DM_STATUS_WIDTH-1) <= status_in (C_DM_STATUS_WIDTH-1); end if; end if; end if; end process SWALLOW_TDATA; status_out <= status_out_int; SWALLOW_TLAST_GEN : if C_INCLUDE_S2MM = 0 generate begin eof_set <= '1'; --eof_bit when (vsize = vsize_data_int) else '0'; CDC_CMD_PROC1 : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => cmd_proc_cdc_from, prmry_vect_in => (others => '0'), scndry_aclk => clock_sec, scndry_resetn => '0', scndry_out => cmd_proc_cdc, scndry_vect_out => open ); CDC_CMD_PROC2 : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => eof_bit_cdc_from, prmry_vect_in => (others => '0'), scndry_aclk => clock_sec, scndry_resetn => '0', scndry_out => eof_bit_cdc, scndry_vect_out => open ); CDC_CMD_PROC : process (clock_sec) begin if (clock_sec'EVENT and clock_sec = '1') then if (aresetn = '0') then -- cmd_proc_cdc_to <= '0'; -- cmd_proc_cdc <= '0'; -- eof_bit_cdc_to <= '0'; -- eof_bit_cdc <= '0'; ready_for_next_cmd_tlast_cdc_from <= '0'; else -- cmd_proc_cdc_to <= cmd_proc_cdc_from; -- cmd_proc_cdc <= cmd_proc_cdc_to; -- eof_bit_cdc_to <= eof_bit_cdc_from; -- eof_bit_cdc <= eof_bit_cdc_to; ready_for_next_cmd_tlast_cdc_from <= ready_for_next_cmd_tlast; end if; end if; end process CDC_CMD_PROC; CDC_CMDTLAST_PROC : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => ready_for_next_cmd_tlast_cdc_from, prmry_vect_in => (others => '0'), scndry_aclk => clock, scndry_resetn => '0', scndry_out => ready_for_next_cmd_tlast_cdc, scndry_vect_out => open ); --CDC_CMDTLAST_PROC : process (clock) -- begin -- if (clock'EVENT and clock = '1') then -- if (sgresetn = '0') then -- ready_for_next_cmd_tlast_cdc_to <= '0'; -- ready_for_next_cmd_tlast_cdc <= '0'; -- else -- ready_for_next_cmd_tlast_cdc_to <= ready_for_next_cmd_tlast_cdc_from; -- ready_for_next_cmd_tlast_cdc <= ready_for_next_cmd_tlast_cdc_to; -- end if; -- end if; --end process CDC_CMDTLAST_PROC; SWALLOW_TLAST : process(clock_sec) begin if(clock_sec'EVENT and clock_sec = '1')then if(aresetn = '0')then counter_tlast <= (others => '0'); tlast_stream_data_int <= '0'; reset_lock_tlast <= '1'; ready_for_next_cmd_tlast <= '1'; elsif ((tlast_stream_data = '1' and tready_stream_data = '1') and vsize_data_int = "00000000000000000000000") then tlast_stream_data_int <= '0'; ready_for_next_cmd_tlast <= '1'; reset_lock_tlast <= '0'; elsif ((tlast_stream_data = '1' and tready_stream_data = '1') and (counter_tlast < vsize_data_int)) then counter_tlast <= counter_tlast + '1'; tlast_stream_data_int <= '0'; ready_for_next_cmd_tlast <= '0'; reset_lock_tlast <= '0'; elsif ((counter_tlast = vsize_data_int) and (reset_lock_tlast = '0') and (tlast_stream_data = '1' and tready_stream_data = '1')) then counter_tlast <= (others => '0'); tlast_stream_data_int <= '1'; ready_for_next_cmd_tlast <= '1'; else counter_tlast <= counter_tlast; tlast_stream_data_int <= '0'; if (cmd_proc_cdc = '1') then ready_for_next_cmd_tlast <= '0'; else ready_for_next_cmd_tlast <= ready_for_next_cmd_tlast; end if; end if; end if; end process SWALLOW_TLAST; tlast_unsplit <= tlast_stream_data when (counter_tlast = vsize_data_int and eof_bit_cdc = '1') else '0'; tlast_unsplit_user <= tlast_stream_data when (counter_tlast = vsize_data_int) else '0'; -- tlast_unsplit <= tlast_stream_data; -- when (counter_tlast = vsize_data_int) else '0'; end generate SWALLOW_TLAST_GEN; SWALLOW_TLAST_GEN_S2MM : if C_INCLUDE_S2MM = 1 generate begin eof_set <= eof_bit_cdc_from; ready_for_next_cmd_tlast_cdc <= '1'; end generate SWALLOW_TLAST_GEN_S2MM; end implementation;
gpl-3.0
f300f1e308430c854e9a976b3391e775
0.504427
3.72263
false
false
false
false
mistryalok/FPGA
Xilinx/ISE/Basics/T_flipflop/asdf_selfcheck_beh.vhd
1
2,853
-------------------------------------------------------------------------------- -- Copyright (c) 1995-2007 Xilinx, Inc. -- All Right Reserved. -------------------------------------------------------------------------------- -- ____ ____ -- / /\/ / -- /___/ \ / Vendor: Xilinx -- \ \ \/ Version : 9.2i -- \ \ Application : ISE -- / / Filename : asdf_selfcheck.vhw -- /___/ /\ Timestamp : Thu May 02 19:20:37 2013 -- \ \ / \ -- \___\/\___\ -- --Command: --Design Name: asdf_selfcheck_beh --Device: Xilinx -- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_TEXTIO.ALL; USE STD.TEXTIO.ALL; ENTITY asdf_selfcheck_beh IS END asdf_selfcheck_beh; ARCHITECTURE testbench_arch OF asdf_selfcheck_beh IS COMPONENT T_flipflop PORT ( clk : In std_logic; T : In std_logic; Q : InOut std_logic; Qn : InOut std_logic ); END COMPONENT; SIGNAL clk : std_logic := '0'; SIGNAL T : std_logic := '0'; SIGNAL Q : std_logic := 'Z'; SIGNAL Qn : std_logic := 'Z'; SHARED VARIABLE TX_ERROR : INTEGER := 0; SHARED VARIABLE TX_OUT : LINE; constant PERIOD : time := 200 ns; constant DUTY_CYCLE : real := 0.5; constant OFFSET : time := 100 ns; BEGIN UUT : T_flipflop PORT MAP ( clk => clk, T => T, Q => Q, Qn => Qn ); PROCESS -- clock process for clk BEGIN WAIT for OFFSET; CLOCK_LOOP : LOOP clk <= '0'; WAIT FOR (PERIOD - (PERIOD * DUTY_CYCLE)); clk <= '1'; WAIT FOR (PERIOD * DUTY_CYCLE); END LOOP CLOCK_LOOP; END PROCESS; PROCESS BEGIN -- ------------- Current Time: 185ns WAIT FOR 185 ns; T <= '1'; -- ------------------------------------- WAIT FOR 1015 ns; IF (TX_ERROR = 0) THEN STD.TEXTIO.write(TX_OUT, string'("No errors or warnings")); ASSERT (FALSE) REPORT "Simulation successful (not a failure). No problems detected." SEVERITY FAILURE; ELSE STD.TEXTIO.write(TX_OUT, TX_ERROR); STD.TEXTIO.write(TX_OUT, string'(" errors found in simulation")); ASSERT (FALSE) REPORT "Errors found during simulation" SEVERITY FAILURE; END IF; END PROCESS; END testbench_arch;
gpl-3.0
1ed118581f0640b88543836e38a8e092
0.419909
4.389231
false
false
false
false
tgingold/ghdl
testsuite/gna/issue616/repro2.vhdl
1
461
package repro2 is procedure return_true (res : out boolean); end repro2; package body repro2 is function slv_ones(constant width : in integer) return bit_vector is begin return (1 to width => '1'); end function; procedure return_true (res : out boolean) is constant ones_c : bit_vector(31 downto 0) := (others => '1'); constant two_c : bit_vector := slv_ones(32); begin wait for 1 ns; res := ones_c = two_c; end; end repro2;
gpl-2.0
b2ff0c241fa437e1084b471a0b004839
0.652928
3.364964
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_sg_v4_1/hdl/src/vhdl/axi_sg_ftch_sm.vhd
7
47,596
-- ************************************************************************* -- -- (c) Copyright 2010-2011 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_sg_ftch_sm.vhd -- Description: This entity manages fetching of descriptors. -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library unisim; use unisim.vcomponents.all; library axi_sg_v4_1_2; use axi_sg_v4_1_2.axi_sg_pkg.all; library lib_pkg_v1_0_2; use lib_pkg_v1_0_2.lib_pkg.clog2; ------------------------------------------------------------------------------- entity axi_sg_ftch_sm is generic ( C_M_AXI_SG_ADDR_WIDTH : integer range 32 to 64 := 32; -- Master AXI Memory Map Address Width for Scatter Gather R/W Port C_ENABLE_MULTI_CHANNEL : integer range 0 to 1 := 0; C_INCLUDE_CH1 : integer range 0 to 1 := 1; -- Include or Exclude channel 1 scatter gather engine -- 0 = Exclude Channel 1 SG Engine -- 1 = Include Channel 1 SG Engine C_INCLUDE_CH2 : integer range 0 to 1 := 1; -- Include or Exclude channel 2 scatter gather engine -- 0 = Exclude Channel 2 SG Engine -- 1 = Include Channel 2 SG Engine C_SG_CH1_WORDS_TO_FETCH : integer range 4 to 16 := 8; -- Number of words to fetch C_SG_CH2_WORDS_TO_FETCH : integer range 4 to 16 := 8; -- Number of words to fetch C_SG_FTCH_DESC2QUEUE : integer range 0 to 8 := 0; -- Number of descriptors to fetch and queue for each channel. -- A value of zero excludes the fetch queues. C_SG_CH1_ENBL_STALE_ERROR : integer range 0 to 1 := 1; -- Enable or disable stale descriptor check -- 0 = Disable stale descriptor error check -- 1 = Enable stale descriptor error check C_SG_CH2_ENBL_STALE_ERROR : integer range 0 to 1 := 1 -- Enable or disable stale descriptor check -- 0 = Disable stale descriptor error check -- 1 = Enable stale descriptor error check ); port ( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk : in std_logic ; -- m_axi_sg_aresetn : in std_logic ; -- -- updt_error : in std_logic ; -- -- -- Channel 1 Control and Status -- ch1_run_stop : in std_logic ; -- ch1_desc_flush : in std_logic ; -- ch1_updt_done : in std_logic ; -- ch1_sg_idle : in std_logic ; -- ch1_tailpntr_enabled : in std_logic ; -- ch1_ftch_queue_full : in std_logic ; -- ch1_ftch_queue_empty : in std_logic ; -- ch1_ftch_pause : in std_logic ; -- ch1_fetch_address : in std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- ch1_ftch_active : out std_logic ; -- ch1_ftch_idle : out std_logic ; -- ch1_ftch_interr_set : out std_logic ; -- ch1_ftch_slverr_set : out std_logic ; -- ch1_ftch_decerr_set : out std_logic ; -- ch1_ftch_err_early : out std_logic ; -- ch1_ftch_stale_desc : out std_logic ; -- -- -- Channel 2 Control and Status -- ch2_run_stop : in std_logic ; -- ch2_desc_flush : in std_logic ; -- ch2_updt_done : in std_logic ; -- ch2_sg_idle : in std_logic ; -- ch2_tailpntr_enabled : in std_logic ; -- ch2_ftch_queue_full : in std_logic ; -- ch2_ftch_queue_empty : in std_logic ; -- ch2_ftch_pause : in std_logic ; -- ch2_fetch_address : in std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- ch2_ftch_active : out std_logic ; -- ch2_ftch_idle : out std_logic ; -- ch2_ftch_interr_set : out std_logic ; -- ch2_ftch_slverr_set : out std_logic ; -- ch2_ftch_decerr_set : out std_logic ; -- ch2_ftch_err_early : out std_logic ; -- ch2_ftch_stale_desc : out std_logic ; -- -- -- DataMover Command -- ftch_cmnd_wr : out std_logic ; -- ftch_cmnd_data : out std_logic_vector -- ((C_M_AXI_SG_ADDR_WIDTH+CMD_BASE_WIDTH)-1 downto 0); -- -- DataMover Status -- ftch_done : in std_logic ; -- ftch_error : in std_logic ; -- ftch_interr : in std_logic ; -- ftch_slverr : in std_logic ; -- ftch_decerr : in std_logic ; -- ftch_stale_desc : in std_logic ; -- ftch_error_early : in std_logic ; -- ftch_error_addr : out std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) -- ); end axi_sg_ftch_sm; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_sg_ftch_sm is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- DataMover Command Type constant FETCH_CMD_TYPE : std_logic := '1'; -- DataMover Cmnd Reserved Bits constant FETCH_MSB_IGNORED : std_logic_vector(7 downto 0) := (others => '0'); -- DataMover Cmnd Reserved Bits constant FETCH_LSB_IGNORED : std_logic_vector(15 downto 0) := (others => '0'); -- DataMover Cmnd Bytes to Xfer for Channel 1 constant FETCH_CH1_CMD_BTT : std_logic_vector(SG_BTT_WIDTH-1 downto 0) := std_logic_vector(to_unsigned( (C_SG_CH1_WORDS_TO_FETCH*4),SG_BTT_WIDTH)); -- DataMover Cmnd Bytes to Xfer for Channel 2 constant FETCH_CH2_CMD_BTT : std_logic_vector(SG_BTT_WIDTH-1 downto 0) := std_logic_vector(to_unsigned( (C_SG_CH2_WORDS_TO_FETCH*4),SG_BTT_WIDTH)); -- DataMover Cmnd Reserved Bits constant FETCH_CMD_RSVD : std_logic_vector( DATAMOVER_CMD_RSVMSB_BOFST + C_M_AXI_SG_ADDR_WIDTH downto DATAMOVER_CMD_RSVLSB_BOFST + C_M_AXI_SG_ADDR_WIDTH) := (others => '0'); -- CR585958 Constant declaration in axi_sg_ftch_sm needs to move under associated generate -- Required width in bits for C_SG_FTCH_DESC2QUEUE --constant SG_FTCH_DESC2QUEUE_WIDTH : integer := clog2(C_SG_FTCH_DESC2QUEUE+1); -- ---- Vector version of C_SG_FTCH_DESC2QUEUE --constant SG_FTCH_DESC2QUEUE_VEC : std_logic_vector(SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) -- := std_logic_vector(to_unsigned -- (C_SG_FTCH_DESC2QUEUE,SG_FTCH_DESC2QUEUE_WIDTH)); ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- -- DataMover Commmand TAG signal fetch_tag : std_logic_vector(3 downto 0) := (others => '0'); type SG_FTCH_STATE_TYPE is ( IDLE, FETCH_DESCRIPTOR, FETCH_STATUS, FETCH_ERROR ); signal ftch_cs : SG_FTCH_STATE_TYPE; signal ftch_ns : SG_FTCH_STATE_TYPE; -- State Machine Signals signal ch1_active_set : std_logic := '0'; signal ch2_active_set : std_logic := '0'; signal write_cmnd_cmb : std_logic := '0'; signal ch1_ftch_sm_idle : std_logic := '0'; signal ch2_ftch_sm_idle : std_logic := '0'; signal ch1_pause_fetch : std_logic := '0'; signal ch2_pause_fetch : std_logic := '0'; signal ch2_pause_fetch1 : std_logic := '0'; signal ch2_pause_fetch2 : std_logic := '0'; signal ch2_pause_fetch3 : std_logic := '0'; signal ch2_updt_done1 : std_logic := '0'; signal ch2_updt_done2 : std_logic := '0'; -- Misc Signals signal fetch_cmd_addr : std_logic_vector (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal ch1_active_i : std_logic := '0'; signal service_ch1 : std_logic := '0'; signal ch2_active_i : std_logic := '0'; signal service_ch2 : std_logic := '0'; signal fetch_cmd_btt : std_logic_vector (SG_BTT_WIDTH-1 downto 0) := (others => '0'); signal ch1_stale_descriptor : std_logic := '0'; signal ch2_stale_descriptor : std_logic := '0'; signal ch1_ftch_interr_set_i : std_logic := '0'; signal ch2_ftch_interr_set_i : std_logic := '0'; -- CR585958 Constant declaration in axi_sg_ftch_sm needs to move under associated generate -- counts for keeping track of queue descriptors to prevent -- fifo fill --signal ch1_desc_ftched_count : std_logic_vector -- (SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) := (others => '0'); --signal ch2_desc_ftched_count : std_logic_vector -- (SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) := (others => '0'); ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ch1_ftch_active <= ch1_active_i; ch2_ftch_active <= ch2_active_i; ------------------------------------------------------------------------------- -- Scatter Gather Fetch State Machine ------------------------------------------------------------------------------- SG_FTCH_MACHINE : process(ftch_cs, ch1_active_i, ch2_active_i, service_ch1, service_ch2, ftch_error, ftch_done) begin -- Default signal assignment ch1_active_set <= '0'; ch2_active_set <= '0'; write_cmnd_cmb <= '0'; ch1_ftch_sm_idle <= '0'; ch2_ftch_sm_idle <= '0'; ftch_ns <= ftch_cs; case ftch_cs is ------------------------------------------------------------------- when IDLE => ch1_ftch_sm_idle <= not service_ch1; ch2_ftch_sm_idle <= not service_ch2; -- sg error during fetch - shut down if(ftch_error = '1')then ftch_ns <= FETCH_ERROR; -- If channel 1 is running and not idle and queue is not full -- then fetch descriptor for channel 1 elsif(service_ch1 = '1')then ch1_active_set <= '1'; ftch_ns <= FETCH_DESCRIPTOR; -- If channel 2 is running and not idle and queue is not full -- then fetch descriptor for channel 2 elsif(service_ch2 = '1')then ch2_active_set <= '1'; ftch_ns <= FETCH_DESCRIPTOR; else ftch_ns <= IDLE; end if; ------------------------------------------------------------------- when FETCH_DESCRIPTOR => -- sg error during fetch - shut down if(ftch_error = '1')then ftch_ns <= FETCH_ERROR; else ch1_ftch_sm_idle <= not ch1_active_i and not service_ch1; ch2_ftch_sm_idle <= not ch2_active_i and not service_ch2; write_cmnd_cmb <= '1'; ftch_ns <= FETCH_STATUS; end if; ------------------------------------------------------------------- when FETCH_STATUS => ch1_ftch_sm_idle <= not ch1_active_i and not service_ch1; ch2_ftch_sm_idle <= not ch2_active_i and not service_ch2; -- sg error during fetch - shut down if(ftch_error = '1')then ftch_ns <= FETCH_ERROR; elsif(ftch_done = '1')then -- If just finished fethcing for channel 2 then... if(ch2_active_i = '1')then -- If ready, fetch descriptor for channel 1 if(service_ch1 = '1')then ch1_active_set <= '1'; ftch_ns <= FETCH_DESCRIPTOR; -- Else if channel 2 still ready then fetch -- another descriptor for channel 2 elsif(service_ch2 = '1')then ch1_ftch_sm_idle <= '1'; ftch_ns <= FETCH_DESCRIPTOR; -- Otherwise return to IDLE else ftch_ns <= IDLE; end if; -- If just finished fethcing for channel 1 then... elsif(ch1_active_i = '1')then -- If ready, fetch descriptor for channel 2 if(service_ch2 = '1')then ch2_active_set <= '1'; ftch_ns <= FETCH_DESCRIPTOR; -- Else if channel 1 still ready then fetch -- another descriptor for channel 1 elsif(service_ch1 = '1')then ch2_ftch_sm_idle <= '1'; ftch_ns <= FETCH_DESCRIPTOR; -- Otherwise return to IDLE else ftch_ns <= IDLE; end if; else ftch_ns <= IDLE; end if; else ftch_ns <= FETCH_STATUS; end if; ------------------------------------------------------------------- when FETCH_ERROR => ch1_ftch_sm_idle <= '1'; ch2_ftch_sm_idle <= '1'; ftch_ns <= FETCH_ERROR; ------------------------------------------------------------------- -- coverage off when others => ftch_ns <= IDLE; -- coverage on end case; end process SG_FTCH_MACHINE; ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- REGISTER_STATE : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then ftch_cs <= IDLE; else ftch_cs <= ftch_ns; end if; end if; end process REGISTER_STATE; ------------------------------------------------------------------------------- -- Channel included therefore generate fetch logic ------------------------------------------------------------------------------- GEN_CH1_FETCH : if C_INCLUDE_CH1 = 1 generate begin ------------------------------------------------------------------------------- -- Active channel flag. Indicates which channel is active. -- 0 = channel active -- 1 = channel active ------------------------------------------------------------------------------- CH1_ACTIVE_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' or ch2_active_set = '1')then ch1_active_i <= '0'; elsif(ch1_active_set = '1')then ch1_active_i <= '1'; end if; end if; end process CH1_ACTIVE_PROCESS; ------------------------------------------------------------------------------- -- Channel 1 IDLE process. Indicates channel 1 fetch process is IDLE -- This is 1 part of determining IDLE for a channel ------------------------------------------------------------------------------- CH1_IDLE_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch1_ftch_idle <= '1'; -- SG Error therefore force IDLE -- CR564855 - fetch idle asserted too soon when update error occured. -- fetch idle does not need to be concerned with updt_error. This is -- because on going fetch is guarentteed to complete regardless of dma -- controller or sg update engine. --elsif(updt_error = '1' or ftch_error = '1' elsif(ftch_error = '1' or ch1_ftch_interr_set_i = '1')then ch1_ftch_idle <= '1'; -- When SG Fetch no longer idle then clear fetch idle elsif(ch1_sg_idle = '0')then ch1_ftch_idle <= '0'; -- If tail = cur and fetch queue is empty then elsif(ch1_sg_idle = '1' and ch1_ftch_queue_empty = '1' and ch1_ftch_sm_idle = '1')then ch1_ftch_idle <= '1'; end if; end if; end process CH1_IDLE_PROCESS; ------------------------------------------------------------------------------- -- For No Fetch Queue, generate pause logic to prevent partial descriptor from -- being fetched and then endless throttle on AXI read bus ------------------------------------------------------------------------------- GEN_CH1_FETCH_PAUSE : if C_SG_FTCH_DESC2QUEUE = 0 generate begin REG_PAUSE_FETCH : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- On descriptor update done clear pause if(m_axi_sg_aresetn = '0' or ch1_updt_done = '1')then ch1_pause_fetch <= '0'; -- If channel active and command written then pause elsif(ch1_active_i='1' and write_cmnd_cmb = '1')then ch1_pause_fetch <= '1'; end if; end if; end process REG_PAUSE_FETCH; end generate GEN_CH1_FETCH_PAUSE; -- Fetch queues so do not need to pause GEN_CH1_NO_FETCH_PAUSE : if C_SG_FTCH_DESC2QUEUE /= 0 generate -- -- CR585958 -- -- Required width in bits for C_SG_FTCH_DESC2QUEUE -- constant SG_FTCH_DESC2QUEUE_WIDTH : integer := clog2(C_SG_FTCH_DESC2QUEUE+1); -- -- Vector version of C_SG_FTCH_DESC2QUEUE -- constant SG_FTCH_DESC2QUEUE_VEC : std_logic_vector(SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) -- := std_logic_vector(to_unsigned -- (C_SG_FTCH_DESC2QUEUE,SG_FTCH_DESC2QUEUE_WIDTH)); -- signal desc_queued_incr : std_logic := '0'; -- signal desc_queued_decr : std_logic := '0'; -- -- -- CR585958 -- signal ch1_desc_ftched_count: std_logic_vector -- (SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) := (others => '0'); -- begin -- -- desc_queued_incr <= '1' when ch1_active_i = '1' -- and write_cmnd_cmb = '1' -- and ch1_ftch_descpulled = '0' -- else '0'; -- -- desc_queued_decr <= '1' when ch1_ftch_descpulled = '1' -- and not (ch1_active_i = '1' and write_cmnd_cmb = '1') -- else '0'; -- -- -- Keep track of descriptors queued version descriptors updated -- DESC_FETCHED_CNTR : process(m_axi_sg_aclk) -- begin -- if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- if(m_axi_sg_aresetn = '0')then -- ch1_desc_ftched_count <= (others => '0'); -- elsif(desc_queued_incr = '1')then -- ch1_desc_ftched_count <= std_logic_vector(unsigned(ch1_desc_ftched_count) + 1); -- elsif(desc_queued_decr = '1')then -- ch1_desc_ftched_count <= std_logic_vector(unsigned(ch1_desc_ftched_count) - 1); -- end if; -- end if; -- end process DESC_FETCHED_CNTR; -- -- REG_PAUSE_FETCH : process(m_axi_sg_aclk) -- begin -- if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- if(m_axi_sg_aresetn = '0')then -- ch1_pause_fetch <= '0'; -- elsif(ch1_desc_ftched_count >= SG_FTCH_DESC2QUEUE_VEC)then -- ch1_pause_fetch <= '1'; -- else -- ch1_pause_fetch <= '0'; -- end if; -- end if; -- end process REG_PAUSE_FETCH; -- -- -- ch1_pause_fetch <= ch1_ftch_pause; end generate GEN_CH1_NO_FETCH_PAUSE; ------------------------------------------------------------------------------- -- Channel 1 ready to be serviced? ------------------------------------------------------------------------------- service_ch1 <= '1' when ch1_run_stop = '1' -- Channel running and ch1_sg_idle = '0' -- SG Engine running and ch1_ftch_queue_full = '0' -- Queue not full and updt_error = '0' -- No SG Update error and ch1_stale_descriptor = '0' -- No Stale Descriptors and ch1_desc_flush = '0' -- Not flushing desc and ch1_pause_fetch = '0' -- Not pausing else '0'; ------------------------------------------------------------------------------- -- Log Fetch Errors ------------------------------------------------------------------------------- INT_ERROR_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch1_ftch_interr_set_i <= '0'; -- Channel active and datamover int error or fetch done and descriptor stale elsif((ch1_active_i = '1' and ftch_interr = '1') or ((ftch_done = '1' or ftch_error = '1') and ch1_stale_descriptor = '1'))then ch1_ftch_interr_set_i <= '1'; end if; end if; end process INT_ERROR_PROCESS; ch1_ftch_interr_set <= ch1_ftch_interr_set_i; SLV_ERROR_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch1_ftch_slverr_set <= '0'; elsif(ch1_active_i = '1' and ftch_slverr = '1')then ch1_ftch_slverr_set <= '1'; end if; end if; end process SLV_ERROR_PROCESS; DEC_ERROR_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch1_ftch_decerr_set <= '0'; elsif(ch1_active_i = '1' and ftch_decerr = '1')then ch1_ftch_decerr_set <= '1'; end if; end if; end process DEC_ERROR_PROCESS; -- Early detection of SlvErr or DecErr, used to prevent error'ed descriptor -- from being used by dma controller ch1_ftch_err_early <= '1' when ftch_error_early = '1' and ch1_active_i = '1' else '0'; -- Enable stale descriptor check GEN_CH1_STALE_CHECK : if C_SG_CH1_ENBL_STALE_ERROR = 1 generate begin ----------------------------------------------------------------------- -- Stale Descriptor Error ----------------------------------------------------------------------- CH1_STALE_DESC : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset then clear flag if(m_axi_sg_aresetn = '0')then ch1_stale_descriptor <= '0'; elsif(ftch_stale_desc = '1' and ch1_active_i = '1' )then ch1_stale_descriptor <= '1'; end if; end if; end process CH1_STALE_DESC; end generate GEN_CH1_STALE_CHECK; -- Disable stale descriptor check GEN_CH1_NO_STALE_CHECK : if C_SG_CH1_ENBL_STALE_ERROR = 0 generate begin ch1_stale_descriptor <= '0'; end generate GEN_CH1_NO_STALE_CHECK; -- Early detection of Stale Descriptor (valid only in tailpntr mode) used -- to prevent error'ed descriptor from being used. ch1_ftch_stale_desc <= ch1_stale_descriptor; end generate GEN_CH1_FETCH; ------------------------------------------------------------------------------- -- Channel excluded therefore do not generate fetch logic ------------------------------------------------------------------------------- GEN_NO_CH1_FETCH : if C_INCLUDE_CH1 = 0 generate begin service_ch1 <= '0'; ch1_active_i <= '0'; ch1_ftch_idle <= '0'; ch1_ftch_interr_set <= '0'; ch1_ftch_slverr_set <= '0'; ch1_ftch_decerr_set <= '0'; ch1_ftch_err_early <= '0'; ch1_ftch_stale_desc <= '0'; end generate GEN_NO_CH1_FETCH; ------------------------------------------------------------------------------- -- Channel included therefore generate fetch logic ------------------------------------------------------------------------------- GEN_CH2_FETCH : if C_INCLUDE_CH2 = 1 generate begin ------------------------------------------------------------------------------- -- Active channel flag. Indicates which channel is active. -- 0 = channel active -- 1 = channel active ------------------------------------------------------------------------------- CH2_ACTIVE_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0' or ch1_active_set = '1')then ch2_active_i <= '0'; elsif(ch2_active_set = '1')then ch2_active_i <= '1'; end if; end if; end process CH2_ACTIVE_PROCESS; ------------------------------------------------------------------------------- -- Channel 2 IDLE process. Indicates channel 2 fetch process is IDLE -- This is 1 part of determining IDLE for a channel ------------------------------------------------------------------------------- CH2_IDLE_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch2_ftch_idle <= '1'; -- SG Error therefore force IDLE -- CR564855 - fetch idle asserted too soon when update error occured. -- fetch idle does not need to be concerned with updt_error. This is -- because on going fetch is guarentteed to complete regardless of dma -- controller or sg update engine. -- elsif(updt_error = '1' or ftch_error = '1' elsif(ftch_error = '1' or ch2_ftch_interr_set_i = '1')then ch2_ftch_idle <= '1'; -- When SG Fetch no longer idle then clear fetch idle elsif(ch2_sg_idle = '0')then ch2_ftch_idle <= '0'; -- If tail = cur and fetch queue is empty then elsif(ch2_sg_idle = '1' and ch2_ftch_queue_empty = '1' and ch2_ftch_sm_idle = '1')then ch2_ftch_idle <= '1'; end if; end if; end process CH2_IDLE_PROCESS; ------------------------------------------------------------------------------- -- For No Fetch Queue, generate pause logic to prevent partial descriptor from -- being fetched and then endless throttle on AXI read bus ------------------------------------------------------------------------------- GEN_CH2_FETCH_PAUSE : if C_SG_FTCH_DESC2QUEUE = 0 generate begin REG_PAUSE_FETCH : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- On descriptor update done clear pause if(m_axi_sg_aresetn = '0' or ch2_updt_done = '1')then ch2_pause_fetch <= '0'; -- If channel active and command written then pause elsif(ch2_active_i='1' and write_cmnd_cmb = '1')then ch2_pause_fetch <= '1'; end if; ch2_pause_fetch1 <= ch2_pause_fetch; ch2_pause_fetch2 <= ch2_pause_fetch1; ch2_pause_fetch3 <= ch2_pause_fetch2; end if; end process REG_PAUSE_FETCH; end generate GEN_CH2_FETCH_PAUSE; -- Fetch queues so do not need to pause GEN_CH2_NO_FETCH_PAUSE : if C_SG_FTCH_DESC2QUEUE /= 0 generate -- -- CR585958 -- -- Required width in bits for C_SG_FTCH_DESC2QUEUE -- constant SG_FTCH_DESC2QUEUE_WIDTH : integer := clog2(C_SG_FTCH_DESC2QUEUE+1); -- -- Vector version of C_SG_FTCH_DESC2QUEUE -- constant SG_FTCH_DESC2QUEUE_VEC : std_logic_vector(SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) -- := std_logic_vector(to_unsigned -- (C_SG_FTCH_DESC2QUEUE,SG_FTCH_DESC2QUEUE_WIDTH)); -- signal desc_queued_incr : std_logic := '0'; -- signal desc_queued_decr : std_logic := '0'; -- -- -- CR585958 -- signal ch2_desc_ftched_count: std_logic_vector -- (SG_FTCH_DESC2QUEUE_WIDTH-1 downto 0) := (others => '0'); -- -- begin -- -- desc_queued_incr <= '1' when ch2_active_i = '1' -- and write_cmnd_cmb = '1' -- and ch2_ftch_descpulled = '0' -- else '0'; -- -- desc_queued_decr <= '1' when ch2_ftch_descpulled = '1' -- and not (ch2_active_i = '1' and write_cmnd_cmb = '1') -- else '0'; -- -- -- Keep track of descriptors queued version descriptors updated -- DESC_FETCHED_CNTR : process(m_axi_sg_aclk) -- begin -- if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- if(m_axi_sg_aresetn = '0')then -- ch2_desc_ftched_count <= (others => '0'); -- elsif(desc_queued_incr = '1')then -- ch2_desc_ftched_count <= std_logic_vector(unsigned(ch2_desc_ftched_count) + 1); -- elsif(desc_queued_decr = '1')then -- ch2_desc_ftched_count <= std_logic_vector(unsigned(ch2_desc_ftched_count) - 1); -- end if; -- end if; -- end process DESC_FETCHED_CNTR; -- -- REG_PAUSE_FETCH : process(m_axi_sg_aclk) -- begin -- if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- if(m_axi_sg_aresetn = '0')then -- ch2_pause_fetch <= '0'; -- elsif(ch2_desc_ftched_count >= SG_FTCH_DESC2QUEUE_VEC)then -- ch2_pause_fetch <= '1'; -- else -- ch2_pause_fetch <= '0'; -- end if; -- end if; -- end process REG_PAUSE_FETCH; -- ch2_pause_fetch <= ch2_ftch_pause; end generate GEN_CH2_NO_FETCH_PAUSE; ------------------------------------------------------------------------------- -- Channel 2 ready to be serviced? ------------------------------------------------------------------------------- MCDMA : if (C_ENABLE_MULTI_CHANNEL = 1) generate NOQUEUE : if (C_SG_FTCH_DESC2QUEUE = 0) generate service_ch2 <= '1' when ch2_run_stop = '1' -- Channel running and ch2_sg_idle = '0' -- SG Engine running and ch2_ftch_queue_full = '0' -- Queue not full and updt_error = '0' -- No SG Update error and ch2_stale_descriptor = '0' -- No Stale Descriptors and ch2_desc_flush = '0' -- Not flushing desc and ch2_pause_fetch3 = '0' -- No fetch pause else '0'; end generate NOQUEUE; QUEUE : if (C_SG_FTCH_DESC2QUEUE /= 0) generate service_ch2 <= '1' when ch2_run_stop = '1' -- Channel running and ch2_sg_idle = '0' -- SG Engine running and ch2_ftch_queue_full = '0' -- Queue not full and updt_error = '0' -- No SG Update error and ch2_stale_descriptor = '0' -- No Stale Descriptors and ch2_desc_flush = '0' -- Not flushing desc and ch2_pause_fetch = '0' -- No fetch pause else '0'; end generate QUEUE; end generate MCDMA; NO_MCDMA : if (C_ENABLE_MULTI_CHANNEL = 0) generate service_ch2 <= '1' when ch2_run_stop = '1' -- Channel running and ch2_sg_idle = '0' -- SG Engine running and ch2_ftch_queue_full = '0' -- Queue not full and updt_error = '0' -- No SG Update error and ch2_stale_descriptor = '0' -- No Stale Descriptors and ch2_desc_flush = '0' -- Not flushing desc and ch2_pause_fetch = '0' -- No fetch pause else '0'; end generate NO_MCDMA; ------------------------------------------------------------------------------- -- Log Fetch Errors ------------------------------------------------------------------------------- INT_ERROR_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch2_ftch_interr_set_i <= '0'; -- Channel active and datamover int error or fetch done and descriptor stale elsif((ch2_active_i = '1' and ftch_interr = '1') or ((ftch_done = '1' or ftch_error = '1') and ch2_stale_descriptor = '1'))then ch2_ftch_interr_set_i <= '1'; end if; end if; end process INT_ERROR_PROCESS; ch2_ftch_interr_set <= ch2_ftch_interr_set_i; SLV_ERROR_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch2_ftch_slverr_set <= '0'; elsif(ch2_active_i = '1' and ftch_slverr = '1')then ch2_ftch_slverr_set <= '1'; end if; end if; end process SLV_ERROR_PROCESS; DEC_ERROR_PROCESS : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset or stopped then clear idle bit if(m_axi_sg_aresetn = '0')then ch2_ftch_decerr_set <= '0'; elsif(ch2_active_i = '1' and ftch_decerr = '1')then ch2_ftch_decerr_set <= '1'; end if; end if; end process DEC_ERROR_PROCESS; -- Early detection of SlvErr or DecErr, used to prevent error'ed descriptor -- from being used by dma controller ch2_ftch_err_early <= '1' when ftch_error_early = '1' and ch2_active_i = '1' else '0'; -- Enable stale descriptor check GEN_CH2_STALE_CHECK : if C_SG_CH2_ENBL_STALE_ERROR = 1 generate begin ----------------------------------------------------------------------- -- Stale Descriptor Error ----------------------------------------------------------------------- CH2_STALE_DESC : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- If reset then clear flag if(m_axi_sg_aresetn = '0')then ch2_stale_descriptor <= '0'; elsif(ftch_stale_desc = '1' and ch2_active_i = '1' )then ch2_stale_descriptor <= '1'; end if; end if; end process CH2_STALE_DESC; end generate GEN_CH2_STALE_CHECK; -- Disable stale descriptor check GEN_CH2_NO_STALE_CHECK : if C_SG_CH2_ENBL_STALE_ERROR = 0 generate begin ch2_stale_descriptor <= '0'; end generate GEN_CH2_NO_STALE_CHECK; -- Early detection of Stale Descriptor (valid only in tailpntr mode) used -- to prevent error'ed descriptor from being used. ch2_ftch_stale_desc <= ch2_stale_descriptor; end generate GEN_CH2_FETCH; ------------------------------------------------------------------------------- -- Channel excluded therefore do not generate fetch logic ------------------------------------------------------------------------------- GEN_NO_CH2_FETCH : if C_INCLUDE_CH2 = 0 generate begin service_ch2 <= '0'; ch2_active_i <= '0'; ch2_ftch_idle <= '0'; ch2_ftch_interr_set <= '0'; ch2_ftch_slverr_set <= '0'; ch2_ftch_decerr_set <= '0'; ch2_ftch_err_early <= '0'; ch2_ftch_stale_desc <= '0'; end generate GEN_NO_CH2_FETCH; ------------------------------------------------------------------------------- -- Build DataMover command ------------------------------------------------------------------------------- -- Assign fetch address fetch_cmd_addr <= ch1_fetch_address when ch1_active_i = '1' else ch2_fetch_address; -- Assign bytes to transfer (BTT) fetch_cmd_btt <= FETCH_CH1_CMD_BTT when ch1_active_i = '1' else FETCH_CH2_CMD_BTT; fetch_tag <= "0001" when ch1_active_i = '1' else "0000"; -- When command by sm, drive command to ftch_cmdsts_if --GEN_DATAMOVER_CMND : process(m_axi_sg_aclk) -- begin -- if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- if(m_axi_sg_aresetn = '0')then -- ftch_cmnd_wr <= '0'; -- ftch_cmnd_data <= (others => '0'); -- -- Fetch SM issued a command write -- elsif(write_cmnd_cmb = '1')then -- ftch_cmnd_wr <= '1'; -- ftch_cmnd_data <= FETCH_CMD_RSVD -- & fetch_tag -- & fetch_cmd_addr -- & FETCH_MSB_IGNORED -- & FETCH_CMD_TYPE -- & FETCH_LSB_IGNORED -- & fetch_cmd_btt; -- else -- ftch_cmnd_wr <= '0'; -- end if; -- end if; -- end process GEN_DATAMOVER_CMND; ftch_cmnd_wr <= write_cmnd_cmb; ftch_cmnd_data <= FETCH_CMD_RSVD & fetch_tag & fetch_cmd_addr & FETCH_MSB_IGNORED & FETCH_CMD_TYPE & FETCH_LSB_IGNORED & fetch_cmd_btt; ------------------------------------------------------------------------------- -- Capture and hold fetch address in case an error occurs ------------------------------------------------------------------------------- LOG_ERROR_ADDR : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(m_axi_sg_aresetn = '0')then ftch_error_addr (C_M_AXI_SG_ADDR_WIDTH-1 downto SG_ADDR_LSB) <= (others => '0'); elsif(write_cmnd_cmb = '1')then ftch_error_addr (C_M_AXI_SG_ADDR_WIDTH-1 downto SG_ADDR_LSB) <= fetch_cmd_addr (C_M_AXI_SG_ADDR_WIDTH-1 downto SG_ADDR_LSB); end if; end if; end process LOG_ERROR_ADDR; ftch_error_addr (5 downto 0) <= "000000"; end implementation;
gpl-3.0
fb9d265aa4d726429e827b770a9ac343
0.423754
4.423009
false
false
false
false
nickg/nvc
test/regress/bounds26.vhd
1
601
entity bounds26 is end entity; architecture test of bounds26 is type char_map is array (character range <>) of integer; function func (right : character) return integer is variable r : char_map('a' to 'c') := ('a' to right => 1); begin return r('a') + r('b') + r('c'); end function; signal n : character := 'c'; begin main: process is begin assert func('c') = 3; -- OK assert func(n) = 3; -- OK n <= DEL; wait for 1 ns; assert func(n) = 3; -- Error wait; end process; end architecture;
gpl-3.0
679996f8ef9f8dace39378b0cab80631
0.532446
3.664634
false
false
false
false
tgingold/ghdl
testsuite/gna/issue301/src/recursion.vhd
2
2,910
--! --! Copyright (C) 2011 - 2014 Creonic GmbH --! --! This file is part of the Creonic Viterbi Decoder, which is distributed --! under the terms of the GNU General Public License version 2. --! --! @file --! @brief Recursion unit for recursive code. --! @author Markus Fehrenz --! @date 2011/01/12 --! --! @details The recusion handling buffers the reorder ouput and --! calculates the correct output depending on the feedback polynomial. --! library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library dec_viterbi; use dec_viterbi.pkg_param.all; use dec_viterbi.pkg_param_derived.all; entity recursionx is port( clk : in std_logic; rst : in std_logic; -- -- Decoded bits input from the reordering units in std_logic -- s_axis_input_tvalid : in std_logic; s_axis_input_tdata : in std_logic; s_axis_input_tlast : in std_logic; s_axis_input_tready : out std_logic; -- -- Output decoded bits convolved with the feedback polynomial -- m_axis_output_tvalid : out std_logic; m_axis_output_tdata : out std_logic; m_axis_output_tlast : out std_logic; m_axis_output_tready : in std_logic ); end entity recursionx; architecture rtl of recursionx is signal recursion_sreg : unsigned(ENCODER_MEMORY_DEPTH downto 0); signal s_axis_input_tready_int : std_logic; signal m_axis_output_tvalid_int : std_logic; begin s_axis_input_tready_int <= '1' when m_axis_output_tready = '1' or m_axis_output_tvalid_int = '0' else '0'; s_axis_input_tready <= s_axis_input_tready_int; m_axis_output_tvalid <= m_axis_output_tvalid_int; -- Use the feedback polynomial to convolve the global path. pr_recursion : process(clk) is variable v_bit : std_logic := '0'; variable v_recursion_state : unsigned(ENCODER_MEMORY_DEPTH downto 0); begin if rising_edge(clk) then if rst = '1' then recursion_sreg <= (others => '0'); m_axis_output_tdata <= '0'; m_axis_output_tlast <= '0'; else m_axis_output_tvalid_int <= s_axis_input_tvalid; if s_axis_input_tvalid = '1' and s_axis_input_tready_int = '1' then -- move current decoded output bits into shift register and reset if last flag is valid if s_axis_input_tlast = '1' then recursion_sreg <= (others => '0'); else recursion_sreg <= s_axis_input_tdata & recursion_sreg(ENCODER_MEMORY_DEPTH downto 1); end if; -- convolve with feedback polynomial with the output register. v_bit := '0'; v_recursion_state := (s_axis_input_tdata & recursion_sreg(ENCODER_MEMORY_DEPTH downto 1)) and ('1' & to_unsigned(FEEDBACK_POLYNOMIAL, ENCODER_MEMORY_DEPTH)); for i in ENCODER_MEMORY_DEPTH downto 0 loop v_bit := v_bit xor v_recursion_state(i); end loop; m_axis_output_tdata <= v_bit; m_axis_output_tlast <= s_axis_input_tlast; end if; end if; end if; end process pr_recursion; end architecture rtl;
gpl-2.0
b1573e643075755b9892c6163f8d2fd0
0.676289
3.095745
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc757.vhd
4
21,308
-- 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: tc757.vhd,v 1.2 2001-10-26 16:30:00 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c01s01b01x01p05n02i00757ent IS generic( zero : integer := 0; one : integer := 1; two : integer := 2; three: integer := 3; four : integer := 4; five : integer := 5; six : integer := 6; seven: integer := 7; eight: integer := 8; nine : integer := 9; fifteen:integer:= 15; C1 : boolean := true; C2 : bit := '1'; C3 : character := 's'; C4 : severity_level := note; C5 : integer := 3; C6 : real := 3.0; C7 : time := 3 ns; C8 : natural := 1; C9 : positive := 1; C10 : string := "shishir"; C11 : bit_vector := B"0011" ); END c01s01b01x01p05n02i00757ent; ARCHITECTURE c01s01b01x01p05n02i00757arch OF c01s01b01x01p05n02i00757ent IS subtype hi_to_low_range is integer range zero to seven; 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; subtype boolean_vector_st is boolean_vector(zero to fifteen); subtype severity_level_vector_st is severity_level_vector(zero to fifteen); subtype integer_vector_st is integer_vector(zero to fifteen); subtype real_vector_st is real_vector(zero to fifteen); subtype time_vector_st is time_vector(zero to fifteen); subtype natural_vector_st is natural_vector(zero to fifteen); subtype positive_vector_st is positive_vector(zero to fifteen); type boolean_cons_vector is array (fifteen downto zero) of boolean; type severity_level_cons_vector is array (fifteen downto zero) of severity_level; type integer_cons_vector is array (fifteen downto zero) of integer; type real_cons_vector is array (fifteen downto zero) of real; type time_cons_vector is array (fifteen downto zero) of time; type natural_cons_vector is array (fifteen downto zero) of natural; type positive_cons_vector is array (fifteen downto zero) of positive; type boolean_cons_vectorofvector is array (zero to fifteen) of boolean_cons_vector; type severity_level_cons_vectorofvector is array (zero to fifteen) of severity_level_cons_vector; type integer_cons_vectorofvector is array (zero to fifteen) of integer_cons_vector ; type real_cons_vectorofvector is array (zero to fifteen) of real_cons_vector; type time_cons_vectorofvector is array (zero to fifteen) of time_cons_vector; type natural_cons_vectorofvector is array (zero to fifteen) of natural_cons_vector; type positive_cons_vectorofvector is array (zero to fifteen) of positive_cons_vector; subtype column is integer range one to two; subtype row is integer range one to eight; type s2boolean_cons_vector is array (row,column) of boolean; type s2bit_cons_vector is array (row,column) of bit; type s2char_cons_vector is array (row,column) of character; type s2severity_level_cons_vector is array (row,column) of severity_level; type s2integer_cons_vector is array (row,column) of integer; type s2real_cons_vector is array (row,column) of real; type s2time_cons_vector is array (row,column) of time; type s2natural_cons_vector is array (row,column) of natural; type s2positive_cons_vector is array (row,column) 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; j:string(one to seven); k:bit_vector(zero to three); end record; type record_array_st is record a:boolean_vector_st; b:severity_level_vector_st; c:integer_vector_st; d:real_vector_st; e:time_vector_st; f:natural_vector_st; g:positive_vector_st; end record; type record_cons_array is record a:boolean_cons_vector; b:severity_level_cons_vector; c:integer_cons_vector; d:real_cons_vector; e:time_cons_vector; f:natural_cons_vector; g:positive_cons_vector; end record; type record_2cons_array is record a:s2boolean_cons_vector; b:s2bit_cons_vector; c:s2char_cons_vector; d:s2severity_level_cons_vector; e:s2integer_cons_vector; f:s2real_cons_vector; g:s2time_cons_vector; h:s2natural_cons_vector; i:s2positive_cons_vector; end record; type record_cons_arrayofarray is record a:boolean_cons_vectorofvector; b:severity_level_cons_vectorofvector; c:integer_cons_vectorofvector; d:real_cons_vectorofvector; e:time_cons_vectorofvector; f:natural_cons_vectorofvector; g:positive_cons_vectorofvector; end record; type record_array_new is record a:boolean_vector(zero to fifteen); b:severity_level_vector(zero to fifteen); c:integer_vector(zero to fifteen); d:real_vector(zero to fifteen); e:time_vector(zero to fifteen); f:natural_vector(zero to fifteen); g:positive_vector(zero to fifteen); end record; type record_of_records is record a: record_std_package; c: record_cons_array; e: record_2cons_array; g: record_cons_arrayofarray; i: record_array_st; j: record_array_new; end record; subtype boolean_vector_range is boolean_vector(hi_to_low_range); subtype severity_level_vector_range is severity_level_vector(hi_to_low_range); subtype integer_vector_range is integer_vector(hi_to_low_range); subtype real_vector_range is real_vector(hi_to_low_range); subtype time_vector_range is time_vector(hi_to_low_range); subtype natural_vector_range is natural_vector(hi_to_low_range); subtype positive_vector_range is positive_vector(hi_to_low_range); type array_rec_std is array (integer range <>) of record_std_package; type array_rec_cons is array (integer range <>) of record_cons_array; type array_rec_2cons is array (integer range <>) of record_2cons_array; type array_rec_rec is array (integer range <>) of record_of_records; subtype array_rec_std_st is array_rec_std (hi_to_low_range); subtype array_rec_cons_st is array_rec_cons (hi_to_low_range); subtype array_rec_2cons_st is array_rec_2cons (hi_to_low_range); subtype array_rec_rec_st is array_rec_rec (hi_to_low_range); type record_of_arr_of_record is record a: array_rec_std(zero to seven); b: array_rec_cons(zero to seven); c: array_rec_2cons(zero to seven); d: array_rec_rec(zero to seven); end record; type four_value is ('Z','0','1','X'); --enumerated type type four_value_vector is array (natural range <>) of four_value; subtype four_value_vector_range is four_value_vector(hi_to_low_range); type current is range -2147483647 to +2147483647 units nA; uA = 1000 nA; mA = 1000 uA; A = 1000 mA; end units; type current_vector is array (natural range <>) of current; subtype current_vector_range is current_vector(hi_to_low_range); type resistance is range -2147483647 to +2147483647 units uOhm; mOhm = 1000 uOhm; Ohm = 1000 mOhm; KOhm = 1000 Ohm; end units; type resistance_vector is array (natural range <>) of resistance; subtype resistance_vector_range is resistance_vector(hi_to_low_range); -- function resolution14(i:in four_value_vector) return four_value; --bus resolution -- subtype four_value_state is resolution14 four_value; --function type type four_value_map is array(four_value) of boolean; subtype binary is four_value range '0' to '1'; type byte is array(zero to seven) of bit; subtype word is bit_vector(zero to fifteen); --constrained array constant size :integer := seven; type primary_memory is array(zero to size) of word; --array of an array type primary_memory_module is --record with field record --as an array enable:binary; memory_number:primary_memory; end record; type whole_memory is array(0 to size) of primary_memory_module; --array of a complex record subtype delay is integer range one to 10; constant C12 : boolean_vector := (C1,false); constant C13 : severity_level_vector := (C4,error); constant C14 : integer_vector := (one,two,three,four); constant C15 : real_vector := (1.0,2.0,C6,4.0); constant C16 : time_vector := (1 ns, 2 ns,C7, 4 ns); constant C17 : natural_vector := (one,2,3,4); constant C18 : positive_vector := (one,2,3,4); constant C19 : boolean_cons_vector := (others => C1); constant C20 : severity_level_cons_vector := (others => C4); constant C21 : integer_cons_vector := (others => C5); constant C22 : real_cons_vector := (others => C6); constant C23 : time_cons_vector := (others => C7); constant C24 : natural_cons_vector := (others => C8); constant C25 : positive_cons_vector := (others => C9); constant C26 : boolean_cons_vectorofvector := (others => (others => C1)); constant C27 : severity_level_cons_vectorofvector := (others => (others => C4)); constant C28 : integer_cons_vectorofvector := (others => (others => C5)); constant C29 : real_cons_vectorofvector := (others => (others => C6)); constant C30 : time_cons_vectorofvector := (others => (others => C7)); constant C31 : natural_cons_vectorofvector := (others => (others => C8)); constant C32 : positive_cons_vectorofvector := (others => (others => C9)); BEGIN assert (hi_to_low_range'left = 0) report "generic for left bound of hi_to_low_range not working" severity failure; assert (hi_to_low_range'right = 7) report "generic for right bound of hi_to_low_range not working" severity failure; assert (row'left = 1) report "generic constrained for left bound of row not working" severity failure; assert (row'right = 8) report "generic constrained for right bound of row not working" severity failure; assert (column'left = 1) report "generic constrained for left bound of column not working" severity failure; assert (column'right = 2) report "generic constrained for right bound of column not working" severity failure; assert (boolean_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (severity_level_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (integer_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (real_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (time_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (natural_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (positive_cons_vector'left = 15) report "generic constrained for left bound of array not working" severity failure; assert (boolean_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (severity_level_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (integer_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (real_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (time_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (natural_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (positive_cons_vector'right = 0) report "generic constrained for right bound of array not working" severity failure; assert (boolean_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (severity_level_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (integer_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (real_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (time_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (natural_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (positive_cons_vectorofvector'left = 0) report "generic constrained for left bound of array not working" severity failure; assert (boolean_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; assert (severity_level_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; assert (integer_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; assert (real_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; assert (time_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; assert (natural_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; assert (positive_cons_vectorofvector'right = 15) report "generic constrained for right bound of array not working" severity failure; TESTING: PROCESS BEGIN assert NOT( (hi_to_low_range'left = 0) and (hi_to_low_range'right = 7) and (row'left = 1) and (row'right = 8) and (column'left = 1) and (column'right = 2) and (boolean_cons_vector'left = 15) and (severity_level_cons_vector'left = 15) and (integer_cons_vector'left = 15) and (real_cons_vector'left = 15) and (time_cons_vector'left = 15) and (natural_cons_vector'left = 15) and (positive_cons_vector'left = 15) and (boolean_cons_vector'right = 0) and (severity_level_cons_vector'right = 0) and (integer_cons_vector'right = 0) and (real_cons_vector'right = 0) and (time_cons_vector'right = 0) and (natural_cons_vector'right = 0) and (positive_cons_vector'right = 0) and (boolean_cons_vectorofvector'left = 0) and (severity_level_cons_vectorofvector'left = 0) and (integer_cons_vectorofvector'left = 0) and (real_cons_vectorofvector'left = 0) and (time_cons_vectorofvector'left = 0) and (natural_cons_vectorofvector'left = 0) and (positive_cons_vectorofvector'left = 0) and (boolean_cons_vectorofvector'right = 15) and (severity_level_cons_vectorofvector'right = 15) and (integer_cons_vectorofvector'right = 15) and (real_cons_vectorofvector'right = 15) and (time_cons_vectorofvector'right = 15) and (natural_cons_vectorofvector'right = 15) and (positive_cons_vectorofvector'right = 15) ) report "***PASSED TEST: c01s01b01x01p05n02i00757" severity NOTE; assert ( (hi_to_low_range'left = 0) and (hi_to_low_range'right = 7) and (row'left = 1) and (row'right = 8) and (column'left = 1) and (column'right = 2) and (boolean_cons_vector'left = 15) and (severity_level_cons_vector'left = 15) and (integer_cons_vector'left = 15) and (real_cons_vector'left = 15) and (time_cons_vector'left = 15) and (natural_cons_vector'left = 15) and (positive_cons_vector'left = 15) and (boolean_cons_vector'right = 0) and (severity_level_cons_vector'right = 0) and (integer_cons_vector'right = 0) and (real_cons_vector'right = 0) and (time_cons_vector'right = 0) and (natural_cons_vector'right = 0) and (positive_cons_vector'right = 0) and (boolean_cons_vectorofvector'left = 0) and (severity_level_cons_vectorofvector'left = 0) and (integer_cons_vectorofvector'left = 0) and (real_cons_vectorofvector'left = 0) and (time_cons_vectorofvector'left = 0) and (natural_cons_vectorofvector'left = 0) and (positive_cons_vectorofvector'left = 0) and (boolean_cons_vectorofvector'right = 15) and (severity_level_cons_vectorofvector'right = 15) and (integer_cons_vectorofvector'right = 15) and (real_cons_vectorofvector'right = 15) and (time_cons_vectorofvector'right = 15) and (natural_cons_vectorofvector'right = 15) and (positive_cons_vectorofvector'right = 15) ) report "***FAILED TEST: c01s01b01x01p05n02i00757 - Generic can be used to specify the size of ports." severity ERROR; wait; END PROCESS TESTING; END c01s01b01x01p05n02i00757arch;
gpl-2.0
cf74736eb9b6a10c29f1476e220e0188
0.598226
4.243776
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_sg_v4_1/hdl/src/vhdl/axi_sg_mm2s_basic_wrap.vhd
7
43,265
-- ************************************************************************* -- -- (c) Copyright 2010-2011 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_sg_mm2s_basic_wrap.vhd -- -- Description: -- This file implements the DataMover MM2S Basic Wrapper. -- -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; -- axi_sg Library Modules library axi_sg_v4_1_2; use axi_sg_v4_1_2.axi_sg_reset; use axi_sg_v4_1_2.axi_sg_cmd_status; use axi_sg_v4_1_2.axi_sg_scc; use axi_sg_v4_1_2.axi_sg_addr_cntl; use axi_sg_v4_1_2.axi_sg_rddata_cntl; use axi_sg_v4_1_2.axi_sg_rd_status_cntl; use axi_sg_v4_1_2.axi_sg_skid_buf; ------------------------------------------------------------------------------- entity axi_sg_mm2s_basic_wrap is generic ( C_INCLUDE_MM2S : Integer range 0 to 2 := 2; -- Specifies the type of MM2S function to include -- 0 = Omit MM2S functionality -- 1 = Full MM2S Functionality -- 2 = Basic MM2S functionality C_MM2S_ARID : Integer range 0 to 255 := 8; -- Specifies the constant value to output on -- the ARID output port C_MM2S_ID_WIDTH : Integer range 1 to 8 := 4; -- Specifies the width of the MM2S ID port C_MM2S_ADDR_WIDTH : Integer range 32 to 64 := 32; -- Specifies the width of the MMap Read Address Channel -- Address bus C_MM2S_MDATA_WIDTH : Integer range 32 to 64 := 32; -- Specifies the width of the MMap Read Data Channel -- data bus C_MM2S_SDATA_WIDTH : Integer range 8 to 64 := 32; -- Specifies the width of the MM2S Master Stream Data -- Channel data bus C_INCLUDE_MM2S_STSFIFO : Integer range 0 to 1 := 1; -- Specifies if a Status FIFO is to be implemented -- 0 = Omit MM2S Status FIFO -- 1 = Include MM2S Status FIFO C_MM2S_STSCMD_FIFO_DEPTH : Integer range 1 to 16 := 1; -- Specifies the depth of the MM2S Command FIFO and the -- optional Status FIFO -- Valid values are 1,4,8,16 C_MM2S_STSCMD_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the Status and Command interfaces need to -- be asynchronous to the primary data path clocking -- 0 = Use same clocking as data path -- 1 = Use special Status/Command clock for the interfaces C_INCLUDE_MM2S_DRE : Integer range 0 to 1 := 0; -- Specifies if DRE is to be included in the MM2S function -- 0 = Omit DRE -- 1 = Include DRE C_MM2S_BURST_SIZE : Integer range 16 to 64 := 16; -- Specifies the max number of databeats to use for MMap -- burst transfers by the MM2S function C_MM2S_BTT_USED : Integer range 8 to 23 := 16; -- Specifies the number of bits used from the BTT field -- of the input Command Word of the MM2S Command Interface C_MM2S_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 1; -- This parameter specifies the depth of the MM2S internal -- child command queues in the Read Address Controller and -- the Read Data Controller. Increasing this value will -- allow more Read Addresses to be issued to the AXI4 Read -- Address Channel before receipt of the associated read -- data on the Read Data Channel. C_ENABLE_MULTI_CHANNEL : Integer range 0 to 1 := 1; C_ENABLE_EXTRA_FIELD : integer range 0 to 1 := 0; C_TAG_WIDTH : Integer range 1 to 8 := 4 ; -- Width of the TAG field C_FAMILY : String := "virtex7" -- Specifies the target FPGA family type ); port ( -- MM2S Primary Clock and Reset inputs ----------------------- mm2s_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- MM2S Primary Reset input -- mm2s_aresetn : in std_logic; -- -- Reset used for the internal master logic -- -------------------------------------------------------------- sg_ctl : in std_logic_vector (7 downto 0); -- MM2S Halt request input control --------------------------- mm2s_halt : in std_logic; -- -- Active high soft shutdown request -- -- -- MM2S Halt Complete status flag -- mm2s_halt_cmplt : Out std_logic; -- -- Active high soft shutdown complete status -- -------------------------------------------------------------- -- Error discrete output ------------------------------------- mm2s_err : Out std_logic; -- -- Composite Error indication -- -------------------------------------------------------------- -- Optional MM2S Command and Status Clock and Reset ---------- -- These are used when C_MM2S_STSCMD_IS_ASYNC = 1 -- mm2s_cmdsts_awclk : in std_logic; -- -- Secondary Clock input for async CMD/Status interface -- -- mm2s_cmdsts_aresetn : in std_logic; -- -- Secondary Reset input for async CMD/Status interface -- -------------------------------------------------------------- -- User Command Interface Ports (AXI Stream) ------------------------------------------------- mm2s_cmd_wvalid : in std_logic; -- mm2s_cmd_wready : out std_logic; -- mm2s_cmd_wdata : in std_logic_vector((C_TAG_WIDTH+(1+C_ENABLE_MULTI_CHANNEL)*C_MM2S_ADDR_WIDTH+36)-1 downto 0); -- ---------------------------------------------------------------------------------------------- -- User Status Interface Ports (AXI Stream) ----------------- mm2s_sts_wvalid : out std_logic; -- mm2s_sts_wready : in std_logic; -- mm2s_sts_wdata : out std_logic_vector(7 downto 0); -- mm2s_sts_wstrb : out std_logic_vector(0 downto 0); -- mm2s_sts_wlast : out std_logic; -- ------------------------------------------------------------- -- Address Posting contols ---------------------------------- mm2s_allow_addr_req : in std_logic; -- mm2s_addr_req_posted : out std_logic; -- mm2s_rd_xfer_cmplt : out std_logic; -- ------------------------------------------------------------- -- MM2S AXI Address Channel I/O -------------------------------------- mm2s_arid : out std_logic_vector(C_MM2S_ID_WIDTH-1 downto 0); -- -- AXI Address Channel ID output -- -- mm2s_araddr : out std_logic_vector(C_MM2S_ADDR_WIDTH-1 downto 0); -- -- AXI Address Channel Address output -- -- mm2s_arlen : out std_logic_vector(7 downto 0); -- -- AXI Address Channel LEN output -- -- Sized to support 256 data beat bursts -- -- mm2s_arsize : out std_logic_vector(2 downto 0); -- -- AXI Address Channel SIZE output -- -- mm2s_arburst : out std_logic_vector(1 downto 0); -- -- AXI Address Channel BURST output -- -- mm2s_arprot : out std_logic_vector(2 downto 0); -- -- AXI Address Channel PROT output -- -- mm2s_arcache : out std_logic_vector(3 downto 0); -- -- AXI Address Channel CACHE output -- mm2s_aruser : out std_logic_vector(3 downto 0); -- -- AXI Address Channel USER output -- -- mm2s_arvalid : out std_logic; -- -- AXI Address Channel VALID output -- -- mm2s_arready : in std_logic; -- -- AXI Address Channel READY input -- ----------------------------------------------------------------------- -- Currently unsupported AXI Address Channel output signals ------- -- addr2axi_alock : out std_logic_vector(2 downto 0); -- -- addr2axi_acache : out std_logic_vector(4 downto 0); -- -- addr2axi_aqos : out std_logic_vector(3 downto 0); -- -- addr2axi_aregion : out std_logic_vector(3 downto 0); -- ------------------------------------------------------------------- -- MM2S AXI MMap Read Data Channel I/O ------------------------------------------ mm2s_rdata : In std_logic_vector(C_MM2S_MDATA_WIDTH-1 downto 0); -- mm2s_rresp : In std_logic_vector(1 downto 0); -- mm2s_rlast : In std_logic; -- mm2s_rvalid : In std_logic; -- mm2s_rready : Out std_logic; -- ---------------------------------------------------------------------------------- -- MM2S AXI Master Stream Channel I/O ----------------------------------------------- mm2s_strm_wdata : Out std_logic_vector(C_MM2S_SDATA_WIDTH-1 downto 0); -- mm2s_strm_wstrb : Out std_logic_vector((C_MM2S_SDATA_WIDTH/8)-1 downto 0); -- mm2s_strm_wlast : Out std_logic; -- mm2s_strm_wvalid : Out std_logic; -- mm2s_strm_wready : In std_logic; -- -------------------------------------------------------------------------------------- -- Testing Support I/O -------------------------------------------- mm2s_dbg_sel : in std_logic_vector( 3 downto 0); -- mm2s_dbg_data : out std_logic_vector(31 downto 0) -- ------------------------------------------------------------------- ); end entity axi_sg_mm2s_basic_wrap; architecture implementation of axi_sg_mm2s_basic_wrap is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; -- Function Declarations ---------------------------------------- ------------------------------------------------------------------- -- Function -- -- Function Name: func_calc_rdmux_sel_bits -- -- Function Description: -- This function calculates the number of address bits needed for -- the Read data mux select control. -- ------------------------------------------------------------------- function func_calc_rdmux_sel_bits (mmap_dwidth_value : integer) return integer is Variable num_addr_bits_needed : Integer range 1 to 5 := 1; begin case mmap_dwidth_value is when 32 => num_addr_bits_needed := 2; -- coverage off when 64 => num_addr_bits_needed := 3; when 128 => num_addr_bits_needed := 4; when others => -- 256 bits num_addr_bits_needed := 5; -- coverage on end case; Return (num_addr_bits_needed); end function func_calc_rdmux_sel_bits; -- Constant Declarations ---------------------------------------- Constant LOGIC_LOW : std_logic := '0'; Constant LOGIC_HIGH : std_logic := '1'; Constant INCLUDE_MM2S : integer range 0 to 2 := 2; Constant MM2S_ARID_VALUE : integer range 0 to 255 := C_MM2S_ARID; Constant MM2S_ARID_WIDTH : integer range 1 to 8 := C_MM2S_ID_WIDTH; Constant MM2S_ADDR_WIDTH : integer range 32 to 64 := C_MM2S_ADDR_WIDTH; Constant MM2S_MDATA_WIDTH : integer range 32 to 256 := C_MM2S_MDATA_WIDTH; Constant MM2S_SDATA_WIDTH : integer range 8 to 256 := C_MM2S_SDATA_WIDTH; Constant MM2S_CMD_WIDTH : integer := (C_TAG_WIDTH+C_MM2S_ADDR_WIDTH+32); Constant MM2S_STS_WIDTH : integer := 8; -- always 8 for MM2S Constant INCLUDE_MM2S_STSFIFO : integer range 0 to 1 := 1; Constant MM2S_STSCMD_FIFO_DEPTH : integer range 1 to 64 := 1; Constant MM2S_STSCMD_IS_ASYNC : integer range 0 to 1 := 0; Constant INCLUDE_MM2S_DRE : integer range 0 to 1 := 0; Constant DRE_ALIGN_WIDTH : integer range 1 to 3 := 2; Constant MM2S_BURST_SIZE : integer range 16 to 256 := 16; Constant RD_ADDR_CNTL_FIFO_DEPTH : integer range 1 to 30 := C_MM2S_ADDR_PIPE_DEPTH; Constant RD_DATA_CNTL_FIFO_DEPTH : integer range 1 to 30 := C_MM2S_ADDR_PIPE_DEPTH; Constant SEL_ADDR_WIDTH : integer := func_calc_rdmux_sel_bits(MM2S_MDATA_WIDTH); Constant DRE_ALIGN_ZEROS : std_logic_vector(DRE_ALIGN_WIDTH-1 downto 0) := (others => '0'); -- obsoleted Constant DISABLE_WAIT_FOR_DATA : integer := 0; -- Signal Declarations ------------------------------------------ signal sig_cmd_stat_rst_user : std_logic := '0'; signal sig_cmd_stat_rst_int : std_logic := '0'; signal sig_mmap_rst : std_logic := '0'; signal sig_stream_rst : std_logic := '0'; signal sig_mm2s_cmd_wdata : std_logic_vector(MM2S_CMD_WIDTH-1 downto 0); signal sig_mm2s_cache_data : std_logic_vector(7 downto 0); signal sig_cmd2mstr_command : std_logic_vector(MM2S_CMD_WIDTH-1 downto 0) := (others => '0'); signal sig_cmd2mstr_cmd_valid : std_logic := '0'; signal sig_mst2cmd_cmd_ready : std_logic := '0'; signal sig_mstr2addr_addr : std_logic_vector(MM2S_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_mstr2addr_len : std_logic_vector(7 downto 0) := (others => '0'); signal sig_mstr2addr_size : std_logic_vector(2 downto 0) := (others => '0'); signal sig_mstr2addr_burst : std_logic_vector(1 downto 0) := (others => '0'); signal sig_mstr2addr_cache : std_logic_vector(3 downto 0) := (others => '0'); signal sig_mstr2addr_user : std_logic_vector(3 downto 0) := (others => '0'); signal sig_mstr2addr_cmd_cmplt : std_logic := '0'; signal sig_mstr2addr_calc_error : std_logic := '0'; signal sig_mstr2addr_cmd_valid : std_logic := '0'; signal sig_addr2mstr_cmd_ready : std_logic := '0'; signal sig_mstr2data_saddr_lsb : std_logic_vector(SEL_ADDR_WIDTH-1 downto 0) := (others => '0'); signal sig_mstr2data_len : std_logic_vector(7 downto 0) := (others => '0'); signal sig_mstr2data_strt_strb : std_logic_vector((MM2S_SDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_mstr2data_last_strb : std_logic_vector((MM2S_SDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_mstr2data_drr : std_logic := '0'; signal sig_mstr2data_eof : std_logic := '0'; signal sig_mstr2data_sequential : std_logic := '0'; signal sig_mstr2data_calc_error : std_logic := '0'; signal sig_mstr2data_cmd_cmplt : std_logic := '0'; signal sig_mstr2data_cmd_valid : std_logic := '0'; signal sig_data2mstr_cmd_ready : std_logic := '0'; signal sig_addr2data_addr_posted : std_logic := '0'; signal sig_data2all_dcntlr_halted : std_logic := '0'; signal sig_addr2rsc_calc_error : std_logic := '0'; signal sig_addr2rsc_cmd_fifo_empty : std_logic := '0'; signal sig_data2rsc_tag : std_logic_vector(C_TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_data2rsc_calc_err : std_logic := '0'; signal sig_data2rsc_okay : std_logic := '0'; signal sig_data2rsc_decerr : std_logic := '0'; signal sig_data2rsc_slverr : std_logic := '0'; signal sig_data2rsc_cmd_cmplt : std_logic := '0'; signal sig_rsc2data_ready : std_logic := '0'; signal sig_data2rsc_valid : std_logic := '0'; signal sig_calc2dm_calc_err : std_logic := '0'; signal sig_data2skid_wvalid : std_logic := '0'; signal sig_data2skid_wready : std_logic := '0'; signal sig_data2skid_wdata : std_logic_vector(MM2S_SDATA_WIDTH-1 downto 0) := (others => '0'); signal sig_data2skid_wstrb : std_logic_vector((MM2S_SDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_data2skid_wlast : std_logic := '0'; signal sig_rsc2stat_status : std_logic_vector(MM2S_STS_WIDTH-1 downto 0) := (others => '0'); signal sig_stat2rsc_status_ready : std_logic := '0'; signal sig_rsc2stat_status_valid : std_logic := '0'; signal sig_rsc2mstr_halt_pipe : std_logic := '0'; signal sig_mstr2data_tag : std_logic_vector(C_TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_mstr2addr_tag : std_logic_vector(C_TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_dbg_data_mux_out : std_logic_vector(31 downto 0) := (others => '0'); signal sig_dbg_data_0 : std_logic_vector(31 downto 0) := (others => '0'); signal sig_dbg_data_1 : std_logic_vector(31 downto 0) := (others => '0'); signal sig_rst2all_stop_request : std_logic := '0'; signal sig_data2rst_stop_cmplt : std_logic := '0'; signal sig_addr2rst_stop_cmplt : std_logic := '0'; signal sig_data2addr_stop_req : std_logic := '0'; signal sig_data2skid_halt : std_logic := '0'; signal sig_cache2mstr_command : std_logic_vector (7 downto 0) := (others => '0'); signal mm2s_arcache_int : std_logic_vector (3 downto 0); begin --(architecture implementation) -- Debug Support ------------------------------------------ mm2s_dbg_data <= sig_dbg_data_mux_out; -- Note that only the mm2s_dbg_sel(0) is used at this time sig_dbg_data_mux_out <= sig_dbg_data_1 When (mm2s_dbg_sel(0) = '1') else sig_dbg_data_0 ; sig_dbg_data_0 <= X"BEEF2222" ; -- 32 bit Constant indicating MM2S Basic type sig_dbg_data_1(0) <= sig_cmd_stat_rst_user ; sig_dbg_data_1(1) <= sig_cmd_stat_rst_int ; sig_dbg_data_1(2) <= sig_mmap_rst ; sig_dbg_data_1(3) <= sig_stream_rst ; sig_dbg_data_1(4) <= sig_cmd2mstr_cmd_valid ; sig_dbg_data_1(5) <= sig_mst2cmd_cmd_ready ; sig_dbg_data_1(6) <= sig_stat2rsc_status_ready; sig_dbg_data_1(7) <= sig_rsc2stat_status_valid; sig_dbg_data_1(11 downto 8) <= sig_data2rsc_tag ; -- Current TAG of active data transfer sig_dbg_data_1(15 downto 12) <= sig_rsc2stat_status(3 downto 0); -- Internal status tag field sig_dbg_data_1(16) <= sig_rsc2stat_status(4) ; -- Internal error sig_dbg_data_1(17) <= sig_rsc2stat_status(5) ; -- Decode Error sig_dbg_data_1(18) <= sig_rsc2stat_status(6) ; -- Slave Error sig_dbg_data_1(19) <= sig_rsc2stat_status(7) ; -- OKAY sig_dbg_data_1(20) <= sig_stat2rsc_status_ready ; -- Status Ready Handshake sig_dbg_data_1(21) <= sig_rsc2stat_status_valid ; -- Status Valid Handshake -- Spare bits in debug1 sig_dbg_data_1(31 downto 22) <= (others => '0') ; -- spare bits GEN_CACHE : if (C_ENABLE_MULTI_CHANNEL = 0) generate begin -- Cache signal tie-off mm2s_arcache <= "0011"; -- Per Interface-X guidelines for Masters mm2s_aruser <= "0000"; -- Per Interface-X guidelines for Masters sig_mm2s_cache_data <= (others => '0'); --mm2s_cmd_wdata(103 downto 96); end generate GEN_CACHE; GEN_CACHE2 : if (C_ENABLE_MULTI_CHANNEL = 1) generate begin -- Cache signal tie-off mm2s_arcache <= sg_ctl (3 downto 0); -- SG Cache from register mm2s_aruser <= sg_ctl (7 downto 4); -- Per Interface-X guidelines for Masters sig_mm2s_cache_data <= mm2s_cmd_wdata(103 downto 96); end generate GEN_CACHE2; -- Cache signal tie-off -- Internal error output discrete ------------------------------ mm2s_err <= sig_calc2dm_calc_err; -- Rip the used portion of the Command Interface Command Data -- and throw away the padding sig_mm2s_cmd_wdata <= mm2s_cmd_wdata(MM2S_CMD_WIDTH-1 downto 0); ------------------------------------------------------------ -- Instance: I_RESET -- -- Description: -- Reset Block -- ------------------------------------------------------------ I_RESET : entity axi_sg_v4_1_2.axi_sg_reset generic map ( C_STSCMD_IS_ASYNC => MM2S_STSCMD_IS_ASYNC ) port map ( primary_aclk => mm2s_aclk , primary_aresetn => mm2s_aresetn , secondary_awclk => mm2s_cmdsts_awclk , secondary_aresetn => mm2s_cmdsts_aresetn , halt_req => mm2s_halt , halt_cmplt => mm2s_halt_cmplt , flush_stop_request => sig_rst2all_stop_request , data_cntlr_stopped => sig_data2rst_stop_cmplt , addr_cntlr_stopped => sig_addr2rst_stop_cmplt , aux1_stopped => LOGIC_HIGH , aux2_stopped => LOGIC_HIGH , cmd_stat_rst_user => sig_cmd_stat_rst_user , cmd_stat_rst_int => sig_cmd_stat_rst_int , mmap_rst => sig_mmap_rst , stream_rst => sig_stream_rst ); ------------------------------------------------------------ -- Instance: I_CMD_STATUS -- -- Description: -- Command and Status Interface Block -- ------------------------------------------------------------ I_CMD_STATUS : entity axi_sg_v4_1_2.axi_sg_cmd_status generic map ( C_ADDR_WIDTH => MM2S_ADDR_WIDTH , C_INCLUDE_STSFIFO => INCLUDE_MM2S_STSFIFO , C_STSCMD_FIFO_DEPTH => MM2S_STSCMD_FIFO_DEPTH , C_STSCMD_IS_ASYNC => MM2S_STSCMD_IS_ASYNC , C_CMD_WIDTH => MM2S_CMD_WIDTH , C_STS_WIDTH => MM2S_STS_WIDTH , C_FAMILY => C_FAMILY ) port map ( primary_aclk => mm2s_aclk , secondary_awclk => mm2s_cmdsts_awclk , user_reset => sig_cmd_stat_rst_user , internal_reset => sig_cmd_stat_rst_int , cmd_wvalid => mm2s_cmd_wvalid , cmd_wready => mm2s_cmd_wready , cmd_wdata => sig_mm2s_cmd_wdata , cache_data => sig_mm2s_cache_data , sts_wvalid => mm2s_sts_wvalid , sts_wready => mm2s_sts_wready , sts_wdata => mm2s_sts_wdata , sts_wstrb => mm2s_sts_wstrb , sts_wlast => mm2s_sts_wlast , cmd2mstr_command => sig_cmd2mstr_command , mst2cmd_cmd_valid => sig_cmd2mstr_cmd_valid , cmd2mstr_cmd_ready => sig_mst2cmd_cmd_ready , mstr2stat_status => sig_rsc2stat_status , stat2mstr_status_ready => sig_stat2rsc_status_ready , mst2stst_status_valid => sig_rsc2stat_status_valid ); ------------------------------------------------------------ -- Instance: I_RD_STATUS_CNTLR -- -- Description: -- Read Status Controller Block -- ------------------------------------------------------------ I_RD_STATUS_CNTLR : entity axi_sg_v4_1_2.axi_sg_rd_status_cntl generic map ( C_STS_WIDTH => MM2S_STS_WIDTH , C_TAG_WIDTH => C_TAG_WIDTH ) port map ( primary_aclk => mm2s_aclk , mmap_reset => sig_mmap_rst , calc2rsc_calc_error => sig_calc2dm_calc_err , addr2rsc_calc_error => sig_addr2rsc_calc_error , addr2rsc_fifo_empty => sig_addr2rsc_cmd_fifo_empty , data2rsc_tag => sig_data2rsc_tag , data2rsc_calc_error => sig_data2rsc_calc_err , data2rsc_okay => sig_data2rsc_okay , data2rsc_decerr => sig_data2rsc_decerr , data2rsc_slverr => sig_data2rsc_slverr , data2rsc_cmd_cmplt => sig_data2rsc_cmd_cmplt , rsc2data_ready => sig_rsc2data_ready , data2rsc_valid => sig_data2rsc_valid , rsc2stat_status => sig_rsc2stat_status , stat2rsc_status_ready => sig_stat2rsc_status_ready , rsc2stat_status_valid => sig_rsc2stat_status_valid , rsc2mstr_halt_pipe => sig_rsc2mstr_halt_pipe ); ------------------------------------------------------------ -- Instance: I_MSTR_SCC -- -- Description: -- Simple Command Calculator Block -- ------------------------------------------------------------ I_MSTR_SCC : entity axi_sg_v4_1_2.axi_sg_scc generic map ( C_SEL_ADDR_WIDTH => SEL_ADDR_WIDTH , C_ADDR_WIDTH => MM2S_ADDR_WIDTH , C_STREAM_DWIDTH => MM2S_SDATA_WIDTH , C_MAX_BURST_LEN => C_MM2S_BURST_SIZE , C_CMD_WIDTH => MM2S_CMD_WIDTH , C_ENABLE_EXTRA_FIELD => C_ENABLE_EXTRA_FIELD , C_TAG_WIDTH => C_TAG_WIDTH ) port map ( -- Clock input primary_aclk => mm2s_aclk , mmap_reset => sig_mmap_rst , cmd2mstr_command => sig_cmd2mstr_command , cache2mstr_command => sig_cache2mstr_command , cmd2mstr_cmd_valid => sig_cmd2mstr_cmd_valid , mst2cmd_cmd_ready => sig_mst2cmd_cmd_ready , mstr2addr_tag => sig_mstr2addr_tag , mstr2addr_addr => sig_mstr2addr_addr , mstr2addr_len => sig_mstr2addr_len , mstr2addr_size => sig_mstr2addr_size , mstr2addr_burst => sig_mstr2addr_burst , mstr2addr_calc_error => sig_mstr2addr_calc_error , mstr2addr_cmd_cmplt => sig_mstr2addr_cmd_cmplt , mstr2addr_cmd_valid => sig_mstr2addr_cmd_valid , addr2mstr_cmd_ready => sig_addr2mstr_cmd_ready , mstr2data_tag => sig_mstr2data_tag , mstr2data_saddr_lsb => sig_mstr2data_saddr_lsb , mstr2data_len => sig_mstr2data_len , mstr2data_strt_strb => sig_mstr2data_strt_strb , mstr2data_last_strb => sig_mstr2data_last_strb , mstr2data_sof => sig_mstr2data_drr , mstr2data_eof => sig_mstr2data_eof , mstr2data_calc_error => sig_mstr2data_calc_error , mstr2data_cmd_cmplt => sig_mstr2data_cmd_cmplt , mstr2data_cmd_valid => sig_mstr2data_cmd_valid , data2mstr_cmd_ready => sig_data2mstr_cmd_ready , calc_error => sig_calc2dm_calc_err ); ------------------------------------------------------------ -- Instance: I_ADDR_CNTL -- -- Description: -- Address Controller Block -- ------------------------------------------------------------ I_ADDR_CNTL : entity axi_sg_v4_1_2.axi_sg_addr_cntl generic map ( -- obsoleted C_ENABlE_WAIT_FOR_DATA => DISABLE_WAIT_FOR_DATA , --C_ADDR_FIFO_DEPTH => MM2S_STSCMD_FIFO_DEPTH , C_ADDR_FIFO_DEPTH => RD_ADDR_CNTL_FIFO_DEPTH , C_ADDR_WIDTH => MM2S_ADDR_WIDTH , C_ADDR_ID => MM2S_ARID_VALUE , C_ADDR_ID_WIDTH => MM2S_ARID_WIDTH , C_TAG_WIDTH => C_TAG_WIDTH ) port map ( primary_aclk => mm2s_aclk , mmap_reset => sig_mmap_rst , addr2axi_aid => mm2s_arid , addr2axi_aaddr => mm2s_araddr , addr2axi_alen => mm2s_arlen , addr2axi_asize => mm2s_arsize , addr2axi_aburst => mm2s_arburst , addr2axi_aprot => mm2s_arprot , addr2axi_avalid => mm2s_arvalid , addr2axi_acache => open , addr2axi_auser => open , axi2addr_aready => mm2s_arready , mstr2addr_tag => sig_mstr2addr_tag , mstr2addr_addr => sig_mstr2addr_addr , mstr2addr_len => sig_mstr2addr_len , mstr2addr_size => sig_mstr2addr_size , mstr2addr_burst => sig_mstr2addr_burst , mstr2addr_cache => sig_mstr2addr_cache , mstr2addr_user => sig_mstr2addr_user , mstr2addr_cmd_cmplt => sig_mstr2addr_cmd_cmplt , mstr2addr_calc_error => sig_mstr2addr_calc_error , mstr2addr_cmd_valid => sig_mstr2addr_cmd_valid , addr2mstr_cmd_ready => sig_addr2mstr_cmd_ready , addr2rst_stop_cmplt => sig_addr2rst_stop_cmplt , allow_addr_req => mm2s_allow_addr_req , addr_req_posted => mm2s_addr_req_posted , addr2data_addr_posted => sig_addr2data_addr_posted , data2addr_data_rdy => LOGIC_LOW , data2addr_stop_req => sig_data2addr_stop_req , addr2stat_calc_error => sig_addr2rsc_calc_error , addr2stat_cmd_fifo_empty => sig_addr2rsc_cmd_fifo_empty ); ------------------------------------------------------------ -- Instance: I_RD_DATA_CNTL -- -- Description: -- Read Data Controller Block -- ------------------------------------------------------------ I_RD_DATA_CNTL : entity axi_sg_v4_1_2.axi_sg_rddata_cntl generic map ( C_INCLUDE_DRE => INCLUDE_MM2S_DRE , C_ALIGN_WIDTH => DRE_ALIGN_WIDTH , C_SEL_ADDR_WIDTH => SEL_ADDR_WIDTH , C_DATA_CNTL_FIFO_DEPTH => RD_DATA_CNTL_FIFO_DEPTH , C_MMAP_DWIDTH => MM2S_MDATA_WIDTH , C_STREAM_DWIDTH => MM2S_SDATA_WIDTH , C_TAG_WIDTH => C_TAG_WIDTH , C_FAMILY => C_FAMILY ) port map ( -- Clock and Reset ----------------------------------- primary_aclk => mm2s_aclk , mmap_reset => sig_mmap_rst , -- Soft Shutdown Interface ----------------------------- rst2data_stop_request => sig_rst2all_stop_request , data2addr_stop_req => sig_data2addr_stop_req , data2rst_stop_cmplt => sig_data2rst_stop_cmplt , -- External Address Pipelining Contol support mm2s_rd_xfer_cmplt => mm2s_rd_xfer_cmplt , -- AXI Read Data Channel I/O ------------------------------- mm2s_rdata => mm2s_rdata , mm2s_rresp => mm2s_rresp , mm2s_rlast => mm2s_rlast , mm2s_rvalid => mm2s_rvalid , mm2s_rready => mm2s_rready , -- MM2S DRE Control ----------------------------------- mm2s_dre_new_align => open , mm2s_dre_use_autodest => open , mm2s_dre_src_align => open , mm2s_dre_dest_align => open , mm2s_dre_flush => open , -- AXI Master Stream ----------------------------------- mm2s_strm_wvalid => mm2s_strm_wvalid , mm2s_strm_wready => mm2s_strm_wready , mm2s_strm_wdata => mm2s_strm_wdata , mm2s_strm_wstrb => mm2s_strm_wstrb , mm2s_strm_wlast => mm2s_strm_wlast , -- MM2S Store and Forward Supplimental Control ----------- mm2s_data2sf_cmd_cmplt => open , -- Command Calculator Interface -------------------------- mstr2data_tag => sig_mstr2data_tag , mstr2data_saddr_lsb => sig_mstr2data_saddr_lsb , mstr2data_len => sig_mstr2data_len , mstr2data_strt_strb => sig_mstr2data_strt_strb , mstr2data_last_strb => sig_mstr2data_last_strb , mstr2data_drr => sig_mstr2data_drr , mstr2data_eof => sig_mstr2data_eof , mstr2data_sequential => LOGIC_LOW , mstr2data_calc_error => sig_mstr2data_calc_error , mstr2data_cmd_cmplt => sig_mstr2data_cmd_cmplt , mstr2data_cmd_valid => sig_mstr2data_cmd_valid , data2mstr_cmd_ready => sig_data2mstr_cmd_ready , mstr2data_dre_src_align => DRE_ALIGN_ZEROS , mstr2data_dre_dest_align => DRE_ALIGN_ZEROS , -- Address Controller Interface -------------------------- addr2data_addr_posted => sig_addr2data_addr_posted , -- Data Controller Halted Status data2all_dcntlr_halted => sig_data2all_dcntlr_halted, -- Output Stream Skid Buffer Halt control data2skid_halt => sig_data2skid_halt , -- Read Status Controller Interface -------------------------- data2rsc_tag => sig_data2rsc_tag , data2rsc_calc_err => sig_data2rsc_calc_err , data2rsc_okay => sig_data2rsc_okay , data2rsc_decerr => sig_data2rsc_decerr , data2rsc_slverr => sig_data2rsc_slverr , data2rsc_cmd_cmplt => sig_data2rsc_cmd_cmplt , rsc2data_ready => sig_rsc2data_ready , data2rsc_valid => sig_data2rsc_valid , rsc2mstr_halt_pipe => sig_rsc2mstr_halt_pipe ); ------------------------------------------------------------ -- Instance: I_MM2S_SKID_BUF -- -- Description: -- Instance for the MM2S Skid Buffer which provides for -- registerd Master Stream outputs and supports bi-dir -- throttling. -- ------------------------------------------------------------ -- I_MM2S_SKID_BUF : entity axi_sg_v4_1_2.axi_sg_skid_buf -- generic map ( -- -- C_WDATA_WIDTH => MM2S_SDATA_WIDTH -- -- ) -- port map ( -- -- -- System Ports -- aclk => mm2s_aclk , -- arst => sig_stream_rst , -- -- -- Shutdown control (assert for 1 clk pulse) -- skid_stop => sig_data2skid_halt , -- -- -- Slave Side (Stream Data Input) -- s_valid => sig_data2skid_wvalid , -- s_ready => sig_data2skid_wready , -- s_data => sig_data2skid_wdata , -- s_strb => sig_data2skid_wstrb , -- s_last => sig_data2skid_wlast , -- -- -- Master Side (Stream Data Output -- m_valid => mm2s_strm_wvalid , -- m_ready => mm2s_strm_wready , -- m_data => mm2s_strm_wdata , -- m_strb => mm2s_strm_wstrb , -- m_last => mm2s_strm_wlast -- -- ); -- end implementation;
gpl-3.0
7018d334901d5ce0fa0cd8edadb4b5ec
0.443592
4.112252
false
false
false
false
nickg/nvc
test/sem/issue225.vhd
1
1,191
package p1 is constant c1 : integer := 1; end package; package p2 is constant c2 : integer := 2; end package; package p3 is constant c3 : integer := 3; end package; package p4 is constant c4 : integer := 4; end package; package p5 is constant c5 : integer := 5; end package; package p6 is constant c6 : integer := 6; end package; entity issue225 is use work.p1.all; end entity issue225; architecture test of issue225 is use work.p2.all; -- doesn't work begin g1: if true generate use work.p3.all; -- doesn't work begin b1: block use work.p4.all; -- doesn't work begin pp1: process use work.p5.all; -- doesn't work procedure doit is use work.p6.all; -- doesn't work variable x : integer; begin x := c1 + c2 + c3 + c4 + c5 + c6; wait; end procedure doit; begin doit; end process pp1; end block b1; end generate g1; end architecture test;
gpl-3.0
f0548c76437a775b4dcbc2fdd0ef44b8
0.502099
3.930693
false
false
false
false
nickg/nvc
test/regress/gensub3.vhd
1
1,179
package pack1 is function adder generic (type t; function "+"(l, r : t) return t is <>; n : t) (x : t) return t; end package; package body pack1 is function adder generic (type t; function "+"(l, r : t) return t is <>; n : t) (x : t) return t is begin return x + n; end function; end package body; ------------------------------------------------------------------------------- use work.pack1.all; package pack2 is function add1 is new adder generic map (t => integer, n => 1); function add1 is new adder generic map (t => real, n => 1.0); end package; ------------------------------------------------------------------------------- entity gensub3 is end entity; use work.pack2.all; architecture test of gensub3 is signal s : integer; signal r : real; begin p1: process is begin assert add1(1) = 2; assert add1(2.0) = 3.0; s <= 5; r <= 4.0; wait for 1 ns; assert add1(s) = 6; assert add1(r) = 5.0; wait; end process; end architecture;
gpl-3.0
84588be975b44b06b24dc12ea5fae185
0.442748
4.023891
false
false
false
false
tgingold/ghdl
testsuite/gna/issue676/adder.vhdl
1
660
library ieee ; use ieee.std_logic_1164.all; use ieee.numeric_std_unsigned.all; entity Adder is generic( N : positive := 4 ); port( A : in std_logic_vector(N-1 downto 0); B : in std_logic_vector(N-1 downto 0); Cin : in std_logic; Sum : out std_logic_vector(N-1 downto 0); Cout : out std_logic ); end Adder; architecture RTL of Adder is signal cout_sum: std_logic_vector(Sum'length downto 0); begin -- This works fine: -- cout_sum <= ("0" & A) + B + Cin; -- Cout <= cout_sum(Sum'length); -- Sum <= cout_sum(Sum'length-1 downto 0); -- This crashes GHDL: (Cout, Sum) <= ("0" & A) + B + Cin; end RTL;
gpl-2.0
7748c7ce7dd012f1ecbacda9d3fc4376
0.592424
2.738589
false
false
false
false
nickg/nvc
test/bounds/bounds2.vhd
1
3,770
entity bounds2 is end entity; architecture test of bounds2 is begin asssignment_delays: block signal b1,b2,b3,b4,b5,b6,b7 : boolean; begin b1 <= true; -- OK b2 <= true after 10 ns; -- OK b3 <= true after 0 ns; -- OK b4 <= true after -1 ns; -- Error process begin b5 <= true; -- OK b5 <= true after 0 ns; -- OK b5 <= true after 1 fs; -- OK b5 <= true after -1 fs; -- Error wait; end process; b6 <= true after -10 ns when now = 5 ns else false; b7 <= true when now = 1 ns else false after -10 ns; end block; rejection_limits: block signal b1,b2,b3 : boolean; begin b1 <= reject 10 ns inertial true after 10 ns; -- OK b2 <= reject -10 ns inertial true; -- Error b3 <= reject 10 ns inertial true after 5 ns; -- Error end block; process begin wait for -10 ns; -- Error wait; end process; default_values: block type r is range 0 to 1; constant ok1 : integer range 0 to 1 := 1; -- OK constant ok2 : character range 'a' to 'z' := 'b'; -- OK constant ok3 : real range 0.0 to 1.0 := 0.0; -- OK constant ok4 : time range 10 ns to 20 ns := 10 ns; -- OK constant ok5 : r := 0; -- OK signal s : integer range 0 to 9 := 20; -- Error constant c1 : character range 'a' to 'z' := 'Z'; -- Error shared variable v : real range 0.0 to 5.0 := 10.0; -- Error constant t : time range 10 ns to 10 us := 0 fs; -- Error constant c2 : r := 10; -- Error subtype subint is integer range 1 to 10; procedure test(a : subint := 30) is begin end procedure; function test(a : character range 'a' to 'b' := 'c') return integer is begin return 1; end function; component comp is generic ( g2 : integer range 10 downto 0 := 20 ); port ( p2 : in integer range 0 to 1 := 2 ); end component; begin process is variable v2 : real range 0.0 to 5.0 := 5.1; -- Error begin end process; end block; ascending_time: block signal s : integer; signal del : time; begin process begin s <= 0 after 10 ns, 1 after 11 ns; -- OK s <= 0, 1 after 1 ns; -- OK s <= 10 after del; -- OK s <= 10 after del, 20 after del + 1 ns; -- OK s <= 0, 1; -- Error s <= 0 after 1 ns, 1; -- Error s <= 0 after 2 ns, 1 after 1 ns; -- Error s <= 0 after 1 ns, 1 after del, 2; -- Error s <= 1 after del, 2; -- Error wait; end process; end block; textio1: block is function unit_string (unit : time) return string is begin if unit = fs then -- OK return " fs"; elsif unit = ps then return " ps"; elsif unit = ns then return " ns"; else report "invalid unit " & time'image(unit); end if; end function; begin end block; end architecture;
gpl-3.0
52adbcfc2849d27d7990ad554a46fbfd
0.426525
4.151982
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ip/design_1_axi_timer_0_0/synth/design_1_axi_timer_0_0.vhd
1
9,209
-- (c) Copyright 1995-2016 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. -- -- DO NOT MODIFY THIS FILE. -- IP VLNV: xilinx.com:ip:axi_timer:2.0 -- IP Revision: 10 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; ENTITY design_1_axi_timer_0_0 IS PORT ( capturetrig0 : IN STD_LOGIC; capturetrig1 : IN STD_LOGIC; generateout0 : OUT STD_LOGIC; generateout1 : OUT STD_LOGIC; pwm0 : OUT STD_LOGIC; interrupt : OUT STD_LOGIC; freeze : IN STD_LOGIC; s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awaddr : IN STD_LOGIC_VECTOR(4 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(4 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 ); END design_1_axi_timer_0_0; ARCHITECTURE design_1_axi_timer_0_0_arch OF design_1_axi_timer_0_0 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : STRING; ATTRIBUTE DowngradeIPIdentifiedWarnings OF design_1_axi_timer_0_0_arch: ARCHITECTURE IS "yes"; COMPONENT axi_timer IS GENERIC ( C_FAMILY : STRING; C_COUNT_WIDTH : INTEGER; C_ONE_TIMER_ONLY : INTEGER; C_TRIG0_ASSERT : STD_LOGIC; C_TRIG1_ASSERT : STD_LOGIC; C_GEN0_ASSERT : STD_LOGIC; C_GEN1_ASSERT : STD_LOGIC; C_S_AXI_DATA_WIDTH : INTEGER; C_S_AXI_ADDR_WIDTH : INTEGER ); PORT ( capturetrig0 : IN STD_LOGIC; capturetrig1 : IN STD_LOGIC; generateout0 : OUT STD_LOGIC; generateout1 : OUT STD_LOGIC; pwm0 : OUT STD_LOGIC; interrupt : OUT STD_LOGIC; freeze : IN STD_LOGIC; s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awaddr : IN STD_LOGIC_VECTOR(4 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(4 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 ); END COMPONENT axi_timer; ATTRIBUTE X_CORE_INFO : STRING; ATTRIBUTE X_CORE_INFO OF design_1_axi_timer_0_0_arch: ARCHITECTURE IS "axi_timer,Vivado 2016.1"; ATTRIBUTE CHECK_LICENSE_TYPE : STRING; ATTRIBUTE CHECK_LICENSE_TYPE OF design_1_axi_timer_0_0_arch : ARCHITECTURE IS "design_1_axi_timer_0_0,axi_timer,{}"; ATTRIBUTE CORE_GENERATION_INFO : STRING; ATTRIBUTE CORE_GENERATION_INFO OF design_1_axi_timer_0_0_arch: ARCHITECTURE IS "design_1_axi_timer_0_0,axi_timer,{x_ipProduct=Vivado 2016.1,x_ipVendor=xilinx.com,x_ipLibrary=ip,x_ipName=axi_timer,x_ipVersion=2.0,x_ipCoreRevision=10,x_ipLanguage=VHDL,x_ipSimLanguage=MIXED,C_FAMILY=zynq,C_COUNT_WIDTH=32,C_ONE_TIMER_ONLY=0,C_TRIG0_ASSERT=1,C_TRIG1_ASSERT=1,C_GEN0_ASSERT=1,C_GEN1_ASSERT=1,C_S_AXI_DATA_WIDTH=32,C_S_AXI_ADDR_WIDTH=5}"; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF interrupt: SIGNAL IS "xilinx.com:signal:interrupt:1.0 INTERRUPT INTERRUPT"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 S_AXI_ACLK CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aresetn: SIGNAL IS "xilinx.com:signal:reset:1.0 S_AXI_RST RST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awaddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wstrb: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WSTRB"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_wready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_bready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_araddr: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARADDR"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARREADY"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rdata: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rresp: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RRESP"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rvalid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_rready: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RREADY"; BEGIN U0 : axi_timer GENERIC MAP ( C_FAMILY => "zynq", C_COUNT_WIDTH => 32, C_ONE_TIMER_ONLY => 0, C_TRIG0_ASSERT => '1', C_TRIG1_ASSERT => '1', C_GEN0_ASSERT => '1', C_GEN1_ASSERT => '1', C_S_AXI_DATA_WIDTH => 32, C_S_AXI_ADDR_WIDTH => 5 ) PORT MAP ( capturetrig0 => capturetrig0, capturetrig1 => capturetrig1, generateout0 => generateout0, generateout1 => generateout1, pwm0 => pwm0, interrupt => interrupt, freeze => freeze, 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 ); END design_1_axi_timer_0_0_arch;
gpl-3.0
0d863fccbb88c7fc64aa183ceb62d878
0.690955
3.290104
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-ams/ashenden/compliant/generics/reg.vhd
4
1,346
-- 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 entity reg is generic ( width : positive ); port ( d : in bit_vector(0 to width - 1); q : out bit_vector(0 to width - 1); clk, reset : in bit ); end entity reg; -------------------------------------------------- architecture behavioral of reg is begin behavior : process (clk, reset) is constant zero : bit_vector(0 to width - 1) := (others => '0'); begin if reset = '1' then q <= zero; elsif clk'event and clk = '1' then q <= d; end if; end process behavior; end architecture behavioral;
gpl-2.0
3a40fe4195ef77f7233d74b3b7539d5c
0.658247
4.02994
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc2959.vhd
4
4,857
-- 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: tc2959.vhd,v 1.2 2001-10-26 16:29:50 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c02s03b00x00p02n01i02959pkg is FUNCTION boo ( PARM_VAL : bit_vector) RETURN bit; FUNCTION boo ( PARM_VAL : bit_vector) RETURN bit_vector; FUNCTION boo ( PARM_VAL : bit_vector) RETURN boolean; FUNCTION boo ( PARM_VAL : bit_vector) RETURN character; FUNCTION boo ( PARM_VAL : bit_vector) RETURN integer; FUNCTION boo ( PARM_VAL : bit_vector) RETURN real; FUNCTION boo ( PARM_VAL : bit_vector) RETURN string; FUNCTION boo ( PARM_VAL : bit_vector) RETURN time; end c02s03b00x00p02n01i02959pkg; package body c02s03b00x00p02n01i02959pkg is FUNCTION boo ( PARM_VAL : bit_vector) RETURN time IS BEGIN assert false report "boo with TIME returned" severity note; RETURN 10 ns; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN string IS BEGIN assert false report "boo with STRING returned" severity note; RETURN "STRING"; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN real IS BEGIN assert false report "boo with REAL returned" severity note; RETURN 10.01; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN integer IS BEGIN assert false report "boo with INTEGER returned" severity note; RETURN 55; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN character IS BEGIN assert false report "boo with CHARACTER returned" severity note; RETURN 'Z'; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN boolean IS BEGIN assert false report "boo with BOOLEAN returned" severity note; RETURN TRUE; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN bit_vector IS BEGIN assert false report "boo with BIT_VECTOR returned" severity note; RETURN "1010"; END; FUNCTION boo ( PARM_VAL : bit_vector) RETURN bit IS BEGIN assert false report "boo with BIT returned" severity note; RETURN '1'; END; end c02s03b00x00p02n01i02959pkg; ENTITY c02s03b00x00p02n01i02959ent IS PORT (bb: INOUT bit; bv: INOUT bit_vector(0 TO 3); bo: INOUT boolean; cc: INOUT character; ii: INOUT integer; rr: INOUT real; ss: INOUT string(1 TO 6); tt: INOUT time); SUBTYPE bv_4 IS bit_vector(1 TO 4); SUBTYPE bv_6 IS bit_vector(1 TO 6); FUNCTION foo ( PARM_VAL : bv_4) RETURN bit_vector IS BEGIN assert false report "function foo in entity e" severity note; RETURN PARM_VAL; END; END c02s03b00x00p02n01i02959ent; use work.c02s03b00x00p02n01i02959pkg.all; ARCHITECTURE c02s03b00x00p02n01i02959arch OF c02s03b00x00p02n01i02959ent IS SIGNAL c1 : bv_4; BEGIN TESTING: PROCESS BEGIN WAIT FOR 1 ns; c1 <= boo ( bv_6'(OTHERS => '1')); bb <= boo (c1); bv <= boo (c1); bo <= boo (c1); cc <= boo (c1); ii <= boo (c1); rr <= boo (c1); ss <= boo (c1); tt <= boo (c1); WAIT FOR 1 ns; assert NOT( (c1 = "1010") AND (bb = '1') AND (bv = "1010") AND (bo = TRUE) AND (cc = 'Z') AND (ii = 55) AND (rr = 10.01) AND (ss = "STRING") AND (tt = 10 ns)) report "***PASSED TEST: c02s03b00x00p02n01i02959" severity NOTE; assert ( (c1 = "1010") AND (bb = '1') AND (bv = "1010") AND (bo = TRUE) AND (cc = 'Z') AND (ii = 55) AND (rr = 10.01) AND (ss = "STRING") AND (tt = 10 ns)) report "***FAILED TEST: c02s03b00x00p02n01i02959 - Overloaded functions test failed." severity ERROR; wait; END PROCESS TESTING; END c02s03b00x00p02n01i02959arch;
gpl-2.0
051daed07ac0ecba8d1a2f2dd3f0f39a
0.614783
3.613839
false
false
false
false
tgingold/ghdl
testsuite/synth/issue1080/repro2_1.vhdl
1
1,548
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity repro2_1 is port ( clk : std_logic; rst : std_logic; tx : out std_logic_vector(7 downto 0)); end repro2_1; architecture behav of repro2_1 is subtype byte_t is std_logic_vector(7 downto 0); -- Define terminal newline characters (CR+LF) constant NEWLINE_CR : byte_t := x"0d"; constant NEWLINE_LF : byte_t := x"0a"; -- Create ROM array with all concatenated messages. type array_t is array(0 to 15) of byte_t; impure function get_msg_array return array_t is variable result : array_t := (others => (others => '0')); variable ridx : integer := 0; procedure append(constant msg : string) is begin -- Append the message to the output array. for c in 0 to msg'length-1 loop result(ridx) := x"00"; ridx := ridx + 1; end loop; -- Then append the CR+LF characters. result(ridx+0) := NEWLINE_CR; result(ridx+1) := NEWLINE_LF; ridx := ridx + 2; end procedure; begin -- For each fixed message... append("xx"); return result; end function; constant MESSAGE_ROM : array_t := get_msg_array; begin process (clk) variable p : natural; begin if rising_edge(clk) then if rst = '1' then p := 0; else tx <= message_rom (p); if p = message_rom'right then p := message_rom'left; else p := p + 1; end if; end if; end if; end process; end behav;
gpl-2.0
b4b218579bd28a8afbb6ebbff1416c72
0.583979
3.526196
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-ams/ashenden/compliant/composite-data/inline_06a.vhd
4
1,420
-- 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 entity inline_06a is end entity inline_06a; ---------------------------------------------------------------- architecture test of inline_06a is -- code from book: subtype resistance is real tolerance "default_resistance"; type resistance_array is array (1 to 4) of resistance; quantity resistances : resistance_array := (10.0, 20.0, 50.0, 75.0); -- end of code from book begin block_1_f : block is -- code from book: quantity resistances : resistance_array := (1 => 10.0, 2 => 20.0, 3 => 50.0, 4 => 75.0); -- end of code from book begin end block block_1_f; end architecture test;
gpl-2.0
95a1da6f7950f5c4fd8a353c96d0eb7e
0.674648
3.988764
false
true
false
false
tgingold/ghdl
libraries/openieee/v93/numeric_bit.vhdl
2
9,907
-- This -*- vhdl -*- file is part of GHDL. -- IEEE 1076.3 compliant numeric bit package. -- Copyright (C) 2015 Tristan Gingold -- -- GHDL 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, or (at your option) any later -- version. -- -- GHDL 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 GCC; see the file COPYING2. If not see -- <http://www.gnu.org/licenses/>. package NUMERIC_BIT is type UNSIGNED is array (natural range <>) of BIT; type SIGNED is array (natural range <>) of BIT; function TO_INTEGER (ARG : UNSIGNED) return NATURAL; function TO_INTEGER (ARG : SIGNED) return INTEGER; -- Convert ARG to an integer. -- Simulation is aborted in case of overflow. -- Issue a warning in case of non-logical value. function TO_UNSIGNED (ARG, SIZE : NATURAL) return UNSIGNED; -- Convert ARG to unsigned. -- Result index range is SIZE - 1 downto 0. -- Issue a warning if value is truncated. function TO_SIGNED (ARG : INTEGER; SIZE : NATURAL) return SIGNED; -- Convert ARG to signed. -- Result index range is SIZE - 1 downto 0. -- Issue a warning if value is truncated. function resize (ARG : UNSIGNED; NEW_SIZE: natural) return UNSIGNED; function resize (ARG : SIGNED; NEW_SIZE: natural) return SIGNED; -- Result index range is NEW_SIZE - 1 downto 0 (unless null array). -- For SIGNED, the sign of the result is the sign of ARG. function "=" (L, R : UNSIGNED) return BOOLEAN; function "=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "/=" (L, R : UNSIGNED) return BOOLEAN; function "/=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "/=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "<" (L, R : UNSIGNED) return BOOLEAN; function "<" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "<" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "<=" (L, R : UNSIGNED) return BOOLEAN; function "<=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "<=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function ">" (L, R : UNSIGNED) return BOOLEAN; function ">" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function ">" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function ">=" (L, R : UNSIGNED) return BOOLEAN; function ">=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function ">=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "=" (L, R : SIGNED) return BOOLEAN; function "=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "=" (L : INTEGER; R : SIGNED) return BOOLEAN; function "/=" (L, R : SIGNED) return BOOLEAN; function "/=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "/=" (L : INTEGER; R : SIGNED) return BOOLEAN; function "<" (L, R : SIGNED) return BOOLEAN; function "<" (L : SIGNED; R : INTEGER) return BOOLEAN; function "<" (L : INTEGER; R : SIGNED) return BOOLEAN; function "<=" (L, R : SIGNED) return BOOLEAN; function "<=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "<=" (L : INTEGER; R : SIGNED) return BOOLEAN; function ">" (L, R : SIGNED) return BOOLEAN; function ">" (L : SIGNED; R : INTEGER) return BOOLEAN; function ">" (L : INTEGER; R : SIGNED) return BOOLEAN; function ">=" (L, R : SIGNED) return BOOLEAN; function ">=" (L : SIGNED; R : INTEGER) return BOOLEAN; function ">=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Issue a warning in case of non-logical value. function "-" (ARG : SIGNED) return SIGNED; -- Compute -ARG. -- Result index range is Arg'length - 1 downto 0. function "abs" (ARG : SIGNED) return SIGNED; -- Compute abs ARG. -- Result index range is Arg'length - 1 downto 0. function "+" (L, R : UNSIGNED) return UNSIGNED; function "+" (L, R : SIGNED) return SIGNED; function "-" (L, R : UNSIGNED) return UNSIGNED; function "-" (L, R : SIGNED) return SIGNED; -- Compute L +/- R. -- Result index range is max (L'Length, R'Length) - 1 downto 0. -- Issue a warning in case of non-logical value. function "+" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "+" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "+" (L : SIGNED; R : INTEGER) return SIGNED; function "+" (L : INTEGER; R : SIGNED) return SIGNED; function "-" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "-" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "-" (L : SIGNED; R : INTEGER) return SIGNED; function "-" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L +/- R. -- Result index range is V'Length - 1 downto 0, where V is the vector -- parameter. -- Issue a warning in case of non-logical value. -- Issue a warning if value is truncated. function "*" (L, R : UNSIGNED) return UNSIGNED; function "*" (L, R : SIGNED) return SIGNED; -- Compute L * R -- Result index range is L'Length + R'Length - 1 downto 0. function "*" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "*" (L : SIGNED; R : INTEGER) return SIGNED; -- Compute L * R -- R is converted to a vector of length L'length function "*" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "*" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L * R -- L is converted to a vector of length R'length function "/" (L, R : UNSIGNED) return UNSIGNED; function "/" (L, R : SIGNED) return SIGNED; function "rem" (L, R : UNSIGNED) return UNSIGNED; function "rem" (L, R : SIGNED) return SIGNED; function "mod" (L, R : UNSIGNED) return UNSIGNED; function "mod" (L, R : SIGNED) return SIGNED; -- Compute L op R -- Result index range is L'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. function "/" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "/" (L : SIGNED; R : INTEGER) return SIGNED; function "rem" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "rem" (L : SIGNED; R : INTEGER) return SIGNED; function "mod" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "mod" (L : SIGNED; R : INTEGER) return SIGNED; -- Compute L op R. -- Result index range is L'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. function "/" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "/" (L : INTEGER; R : SIGNED) return SIGNED; function "rem" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "rem" (L : INTEGER; R : SIGNED) return SIGNED; function "mod" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "mod" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L op R. -- Result index range is R'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. -- Result may be truncated. function "not" (l : UNSIGNED) return UNSIGNED; function "not" (l : SIGNED) return SIGNED; function "and" (l, r : UNSIGNED) return UNSIGNED; function "and" (l, r : SIGNED) return SIGNED; function "nand" (l, r : UNSIGNED) return UNSIGNED; function "nand" (l, r : SIGNED) return SIGNED; function "or" (l, r : UNSIGNED) return UNSIGNED; function "or" (l, r : SIGNED) return SIGNED; function "nor" (l, r : UNSIGNED) return UNSIGNED; function "nor" (l, r : SIGNED) return SIGNED; function "xor" (l, r : UNSIGNED) return UNSIGNED; function "xor" (l, r : SIGNED) return SIGNED; function "xnor" (l, r : UNSIGNED) return UNSIGNED; function "xnor" (l, r : SIGNED) return SIGNED; -- Compute L OP R. -- Result index range is L'Length - 1 downto 0. -- No specific handling of null array: the index range of the result -- would be -1 downto 0 (without warning). This it not what is specified -- in 1076.3, but corresponds to the standard implementation. -- No specific handling of non-logical values. Behaviour is compatible -- with std_logic_1164. function shift_left (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function shift_left (ARG : SIGNED; COUNT: NATURAL) return SIGNED; function shift_right (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function shift_right (ARG : SIGNED; COUNT: NATURAL) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function rotate_left (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function rotate_left (ARG : SIGNED; COUNT: NATURAL) return SIGNED; function rotate_right (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function rotate_right (ARG : SIGNED; COUNT: NATURAL) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function "sll" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "sll" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; function "srl" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "srl" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function "rol" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "rol" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; function "ror" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "ror" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function rising_edge (signal s : bit) return boolean; function falling_edge (signal s : bit) return boolean; end NUMERIC_BIT;
gpl-2.0
06d72c3cfd9290503bc0493697405159
0.648329
3.631598
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_sg_v4_1/hdl/src/vhdl/axi_sg_datamover.vhd
7
51,616
-- ************************************************************************* -- -- (c) Copyright 2010-2011 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_sg.vhd -- -- Description: -- Top level VHDL wrapper for the AXI DataMover -- -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library axi_sg_v4_1_2; use axi_sg_v4_1_2.axi_sg_mm2s_basic_wrap; use axi_sg_v4_1_2.axi_sg_s2mm_basic_wrap; ------------------------------------------------------------------------------- entity axi_sg_datamover is generic ( C_INCLUDE_MM2S : Integer range 0 to 2 := 2; -- Specifies the type of MM2S function to include -- 0 = Omit MM2S functionality -- 1 = Full MM2S Functionality -- 2 = Basic MM2S functionality C_M_AXI_MM2S_ARID : Integer range 0 to 255 := 0; -- Specifies the constant value to output on -- the ARID output port C_M_AXI_MM2S_ID_WIDTH : Integer range 1 to 8 := 4; -- Specifies the width of the MM2S ID port C_M_AXI_MM2S_ADDR_WIDTH : Integer range 32 to 64 := 32; -- Specifies the width of the MMap Read Address Channel -- Address bus C_M_AXI_MM2S_DATA_WIDTH : Integer range 32 to 1024 := 32; -- Specifies the width of the MMap Read Data Channel -- data bus C_M_AXIS_MM2S_TDATA_WIDTH : Integer range 8 to 1024 := 32; -- Specifies the width of the MM2S Master Stream Data -- Channel data bus C_INCLUDE_MM2S_STSFIFO : Integer range 0 to 1 := 1; -- Specifies if a Status FIFO is to be implemented -- 0 = Omit MM2S Status FIFO -- 1 = Include MM2S Status FIFO C_MM2S_STSCMD_FIFO_DEPTH : Integer range 1 to 16 := 4; -- Specifies the depth of the MM2S Command FIFO and the -- optional Status FIFO -- Valid values are 1,4,8,16 C_MM2S_STSCMD_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the Status and Command interfaces need to -- be asynchronous to the primary data path clocking -- 0 = Use same clocking as data path -- 1 = Use special Status/Command clock for the interfaces C_INCLUDE_MM2S_DRE : Integer range 0 to 1 := 1; -- Specifies if DRE is to be included in the MM2S function -- 0 = Omit DRE -- 1 = Include DRE C_MM2S_BURST_SIZE : Integer range 16 to 256 := 16; -- Specifies the max number of databeats to use for MMap -- burst transfers by the MM2S function C_MM2S_BTT_USED : Integer range 8 to 23 := 16; -- Specifies the number of bits used from the BTT field -- of the input Command Word of the MM2S Command Interface C_MM2S_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 3; -- This parameter specifies the depth of the MM2S internal -- child command queues in the Read Address Controller and -- the Read Data Controller. Increasing this value will -- allow more Read Addresses to be issued to the AXI4 Read -- Address Channel before receipt of the associated read -- data on the Read Data Channel. C_MM2S_INCLUDE_SF : Integer range 0 to 1 := 1 ; -- This parameter specifies the inclusion/omission of the -- MM2S (Read) Store and Forward function -- 0 = Omit MM2S Store and Forward -- 1 = Include MM2S Store and Forward C_INCLUDE_S2MM : Integer range 0 to 4 := 2; -- Specifies the type of S2MM function to include -- 0 = Omit S2MM functionality -- 1 = Full S2MM Functionality -- 2 = Basic S2MM functionality C_M_AXI_S2MM_AWID : Integer range 0 to 255 := 1; -- Specifies the constant value to output on -- the ARID output port C_M_AXI_S2MM_ID_WIDTH : Integer range 1 to 8 := 4; -- Specifies the width of the S2MM ID port C_M_AXI_S2MM_ADDR_WIDTH : Integer range 32 to 64 := 32; -- Specifies the width of the MMap Read Address Channel -- Address bus C_M_AXI_S2MM_DATA_WIDTH : Integer range 32 to 1024 := 32; -- Specifies the width of the MMap Read Data Channel -- data bus C_S_AXIS_S2MM_TDATA_WIDTH : Integer range 8 to 1024 := 32; -- Specifies the width of the S2MM Master Stream Data -- Channel data bus C_INCLUDE_S2MM_STSFIFO : Integer range 0 to 1 := 1; -- Specifies if a Status FIFO is to be implemented -- 0 = Omit S2MM Status FIFO -- 1 = Include S2MM Status FIFO C_S2MM_STSCMD_FIFO_DEPTH : Integer range 1 to 16 := 4; -- Specifies the depth of the S2MM Command FIFO and the -- optional Status FIFO -- Valid values are 1,4,8,16 C_S2MM_STSCMD_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the Status and Command interfaces need to -- be asynchronous to the primary data path clocking -- 0 = Use same clocking as data path -- 1 = Use special Status/Command clock for the interfaces C_INCLUDE_S2MM_DRE : Integer range 0 to 1 := 1; -- Specifies if DRE is to be included in the S2MM function -- 0 = Omit DRE -- 1 = Include DRE C_S2MM_BURST_SIZE : Integer range 16 to 256 := 16; -- Specifies the max number of databeats to use for MMap -- burst transfers by the S2MM function C_S2MM_BTT_USED : Integer range 8 to 23 := 16; -- Specifies the number of bits used from the BTT field -- of the input Command Word of the S2MM Command Interface C_S2MM_SUPPORT_INDET_BTT : Integer range 0 to 1 := 0; -- Specifies if support for indeterminate packet lengths -- are to be received on the input Stream interface -- 0 = Omit support (User MUST transfer the exact number of -- bytes on the Stream interface as specified in the BTT -- field of the Corresponding DataMover Command) -- 1 = Include support for indeterminate packet lengths -- This causes FIFOs to be added and "Store and Forward" -- behavior of the S2MM function C_S2MM_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 3; -- This parameter specifies the depth of the S2MM internal -- address pipeline queues in the Write Address Controller -- and the Write Data Controller. Increasing this value will -- allow more Write Addresses to be issued to the AXI4 Write -- Address Channel before transmission of the associated -- write data on the Write Data Channel. C_S2MM_INCLUDE_SF : Integer range 0 to 1 := 1 ; -- This parameter specifies the inclusion/omission of the -- S2MM (Write) Store and Forward function -- 0 = Omit S2MM Store and Forward -- 1 = Include S2MM Store and Forward C_ENABLE_MULTI_CHANNEL : integer range 0 to 1 := 1; C_ENABLE_EXTRA_FIELD : integer range 0 to 1 := 0; C_FAMILY : String := "virtex7" -- Specifies the target FPGA family type ); port ( -- MM2S Primary Clock input ---------------------------------- m_axi_mm2s_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- MM2S Primary Reset input -- m_axi_mm2s_aresetn : in std_logic; -- -- Reset used for the internal master logic -- -------------------------------------------------------------- sg_ctl : in std_logic_vector (7 downto 0) ; -- MM2S Halt request input control -------------------- mm2s_halt : in std_logic; -- -- Active high soft shutdown request -- -- -- MM2S Halt Complete status flag -- mm2s_halt_cmplt : Out std_logic; -- -- Active high soft shutdown complete status -- ------------------------------------------------------- -- Error discrete output ------------------------- mm2s_err : Out std_logic; -- -- Composite Error indication -- -------------------------------------------------- -- Memory Map to Stream Command FIFO and Status FIFO I/O --------- m_axis_mm2s_cmdsts_aclk : in std_logic; -- -- Secondary Clock input for async CMD/Status interface -- -- m_axis_mm2s_cmdsts_aresetn : in std_logic; -- -- Secondary Reset input for async CMD/Status interface -- ------------------------------------------------------------------ -- User Command Interface Ports (AXI Stream) ------------------------------------------------- s_axis_mm2s_cmd_tvalid : in std_logic; -- s_axis_mm2s_cmd_tready : out std_logic; -- s_axis_mm2s_cmd_tdata : in std_logic_vector(((1+C_ENABLE_MULTI_CHANNEL)*C_M_AXI_MM2S_ADDR_WIDTH+40)-1 downto 0); -- ---------------------------------------------------------------------------------------------- -- User Status Interface Ports (AXI Stream) ------------------------ m_axis_mm2s_sts_tvalid : out std_logic; -- m_axis_mm2s_sts_tready : in std_logic; -- m_axis_mm2s_sts_tdata : out std_logic_vector(7 downto 0); -- m_axis_mm2s_sts_tkeep : out std_logic_vector(0 downto 0); -- m_axis_mm2s_sts_tlast : out std_logic; -- -------------------------------------------------------------------- -- Address Posting contols ----------------------- mm2s_allow_addr_req : in std_logic; -- mm2s_addr_req_posted : out std_logic; -- mm2s_rd_xfer_cmplt : out std_logic; -- -------------------------------------------------- -- MM2S AXI Address Channel I/O -------------------------------------------------- m_axi_mm2s_arid : out std_logic_vector(C_M_AXI_MM2S_ID_WIDTH-1 downto 0); -- -- AXI Address Channel ID output -- -- m_axi_mm2s_araddr : out std_logic_vector(C_M_AXI_MM2S_ADDR_WIDTH-1 downto 0); -- -- AXI Address Channel Address output -- -- m_axi_mm2s_arlen : out std_logic_vector(7 downto 0); -- -- AXI Address Channel LEN output -- -- Sized to support 256 data beat bursts -- -- m_axi_mm2s_arsize : out std_logic_vector(2 downto 0); -- -- AXI Address Channel SIZE output -- -- m_axi_mm2s_arburst : out std_logic_vector(1 downto 0); -- -- AXI Address Channel BURST output -- -- m_axi_mm2s_arprot : out std_logic_vector(2 downto 0); -- -- AXI Address Channel PROT output -- -- m_axi_mm2s_arcache : out std_logic_vector(3 downto 0); -- -- AXI Address Channel CACHE output -- m_axi_mm2s_aruser : out std_logic_vector(3 downto 0); -- -- AXI Address Channel USER output -- -- m_axi_mm2s_arvalid : out std_logic; -- -- AXI Address Channel VALID output -- -- m_axi_mm2s_arready : in std_logic; -- -- AXI Address Channel READY input -- ----------------------------------------------------------------------------------- -- Currently unsupported AXI Address Channel output signals ------- -- m_axi_mm2s_alock : out std_logic_vector(2 downto 0); -- -- m_axi_mm2s_acache : out std_logic_vector(4 downto 0); -- -- m_axi_mm2s_aqos : out std_logic_vector(3 downto 0); -- -- m_axi_mm2s_aregion : out std_logic_vector(3 downto 0); -- ------------------------------------------------------------------- -- MM2S AXI MMap Read Data Channel I/O ------------------------------------------------ m_axi_mm2s_rdata : In std_logic_vector(C_M_AXI_MM2S_DATA_WIDTH-1 downto 0); -- m_axi_mm2s_rresp : In std_logic_vector(1 downto 0); -- m_axi_mm2s_rlast : In std_logic; -- m_axi_mm2s_rvalid : In std_logic; -- m_axi_mm2s_rready : Out std_logic; -- ---------------------------------------------------------------------------------------- -- MM2S AXI Master Stream Channel I/O ------------------------------------------------------- m_axis_mm2s_tdata : Out std_logic_vector(C_M_AXIS_MM2S_TDATA_WIDTH-1 downto 0); -- m_axis_mm2s_tkeep : Out std_logic_vector((C_M_AXIS_MM2S_TDATA_WIDTH/8)-1 downto 0); -- m_axis_mm2s_tlast : Out std_logic; -- m_axis_mm2s_tvalid : Out std_logic; -- m_axis_mm2s_tready : In std_logic; -- ---------------------------------------------------------------------------------------------- -- Testing Support I/O -------------------------------------------------------- mm2s_dbg_sel : in std_logic_vector( 3 downto 0); -- mm2s_dbg_data : out std_logic_vector(31 downto 0) ; -- ------------------------------------------------------------------------------- -- S2MM Primary Clock input --------------------------------- m_axi_s2mm_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- S2MM Primary Reset input -- m_axi_s2mm_aresetn : in std_logic; -- -- Reset used for the internal master logic -- ------------------------------------------------------------- -- S2MM Halt request input control ------------------ s2mm_halt : in std_logic; -- -- Active high soft shutdown request -- -- -- S2MM Halt Complete status flag -- s2mm_halt_cmplt : out std_logic; -- -- Active high soft shutdown complete status -- ----------------------------------------------------- -- S2MM Error discrete output ------------------ s2mm_err : Out std_logic; -- -- Composite Error indication -- ------------------------------------------------ -- Memory Map to Stream Command FIFO and Status FIFO I/O ----------------- m_axis_s2mm_cmdsts_awclk : in std_logic; -- -- Secondary Clock input for async CMD/Status interface -- -- m_axis_s2mm_cmdsts_aresetn : in std_logic; -- -- Secondary Reset input for async CMD/Status interface -- -------------------------------------------------------------------------- -- User Command Interface Ports (AXI Stream) -------------------------------------------------- s_axis_s2mm_cmd_tvalid : in std_logic; -- s_axis_s2mm_cmd_tready : out std_logic; -- s_axis_s2mm_cmd_tdata : in std_logic_vector(((1+C_ENABLE_MULTI_CHANNEL)*C_M_AXI_S2MM_ADDR_WIDTH+40)-1 downto 0); -- ----------------------------------------------------------------------------------------------- -- User Status Interface Ports (AXI Stream) ----------------------------------------------------------- m_axis_s2mm_sts_tvalid : out std_logic; -- m_axis_s2mm_sts_tready : in std_logic; -- m_axis_s2mm_sts_tdata : out std_logic_vector(((C_S2MM_SUPPORT_INDET_BTT*24)+8)-1 downto 0); -- m_axis_s2mm_sts_tkeep : out std_logic_vector((((C_S2MM_SUPPORT_INDET_BTT*24)+8)/8)-1 downto 0); -- m_axis_s2mm_sts_tlast : out std_logic; -- ------------------------------------------------------------------------------------------------------- -- Address posting controls ----------------------------------------- s2mm_allow_addr_req : in std_logic; -- s2mm_addr_req_posted : out std_logic; -- s2mm_wr_xfer_cmplt : out std_logic; -- s2mm_ld_nxt_len : out std_logic; -- s2mm_wr_len : out std_logic_vector(7 downto 0); -- --------------------------------------------------------------------- -- S2MM AXI Address Channel I/O ---------------------------------------------------- m_axi_s2mm_awid : out std_logic_vector(C_M_AXI_S2MM_ID_WIDTH-1 downto 0); -- -- AXI Address Channel ID output -- -- m_axi_s2mm_awaddr : out std_logic_vector(C_M_AXI_S2MM_ADDR_WIDTH-1 downto 0); -- -- AXI Address Channel Address output -- -- m_axi_s2mm_awlen : out std_logic_vector(7 downto 0); -- -- AXI Address Channel LEN output -- -- Sized to support 256 data beat bursts -- -- m_axi_s2mm_awsize : out std_logic_vector(2 downto 0); -- -- AXI Address Channel SIZE output -- -- m_axi_s2mm_awburst : out std_logic_vector(1 downto 0); -- -- AXI Address Channel BURST output -- -- m_axi_s2mm_awprot : out std_logic_vector(2 downto 0); -- -- AXI Address Channel PROT output -- -- m_axi_s2mm_awcache : out std_logic_vector(3 downto 0); -- -- AXI Address Channel CACHE output -- m_axi_s2mm_awuser : out std_logic_vector(3 downto 0); -- -- AXI Address Channel USER output -- -- m_axi_s2mm_awvalid : out std_logic; -- -- AXI Address Channel VALID output -- -- m_axi_s2mm_awready : in std_logic; -- -- AXI Address Channel READY input -- ------------------------------------------------------------------------------------- -- Currently unsupported AXI Address Channel output signals ------- -- m_axi_s2mm__awlock : out std_logic_vector(2 downto 0); -- -- m_axi_s2mm__awcache : out std_logic_vector(4 downto 0); -- -- m_axi_s2mm__awqos : out std_logic_vector(3 downto 0); -- -- m_axi_s2mm__awregion : out std_logic_vector(3 downto 0); -- ------------------------------------------------------------------- -- S2MM AXI MMap Write Data Channel I/O -------------------------------------------------- m_axi_s2mm_wdata : Out std_logic_vector(C_M_AXI_S2MM_DATA_WIDTH-1 downto 0); -- m_axi_s2mm_wstrb : Out std_logic_vector((C_M_AXI_S2MM_DATA_WIDTH/8)-1 downto 0); -- m_axi_s2mm_wlast : Out std_logic; -- m_axi_s2mm_wvalid : Out std_logic; -- m_axi_s2mm_wready : In std_logic; -- ------------------------------------------------------------------------------------------- -- S2MM AXI MMap Write response Channel I/O ------------------------- m_axi_s2mm_bresp : In std_logic_vector(1 downto 0); -- m_axi_s2mm_bvalid : In std_logic; -- m_axi_s2mm_bready : Out std_logic; -- ---------------------------------------------------------------------- -- S2MM AXI Slave Stream Channel I/O ------------------------------------------------------- s_axis_s2mm_tdata : In std_logic_vector(C_S_AXIS_S2MM_TDATA_WIDTH-1 downto 0); -- s_axis_s2mm_tkeep : In std_logic_vector((C_S_AXIS_S2MM_TDATA_WIDTH/8)-1 downto 0); -- s_axis_s2mm_tlast : In std_logic; -- s_axis_s2mm_tvalid : In std_logic; -- s_axis_s2mm_tready : Out std_logic; -- --------------------------------------------------------------------------------------------- -- Testing Support I/O ------------------------------------------------ s2mm_dbg_sel : in std_logic_vector( 3 downto 0); -- s2mm_dbg_data : out std_logic_vector(31 downto 0) -- ------------------------------------------------------------------------ ); end entity axi_sg_datamover; architecture implementation of axi_sg_datamover is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; -- Function Declarations ------------------------------------------------------------------- -- Function -- -- Function Name: funct_clip_brst_len -- -- Function Description: -- This function is used to limit the parameterized max burst -- databeats when the tranfer data width is 256 bits or greater. -- This is required to keep from crossing the 4K byte xfer -- boundary required by AXI. This process is further complicated -- by the inclusion/omission of upsizers or downsizers in the -- data path. -- ------------------------------------------------------------------- function funct_clip_brst_len (param_burst_beats : integer; mmap_transfer_bit_width : integer; stream_transfer_bit_width : integer; down_up_sizers_enabled : integer) return integer is constant FCONST_SIZERS_ENABLED : boolean := (down_up_sizers_enabled > 0); Variable fvar_max_burst_dbeats : Integer; begin -- coverage off if (FCONST_SIZERS_ENABLED) then -- use MMap dwidth for calc If (mmap_transfer_bit_width <= 128) Then -- allowed fvar_max_burst_dbeats := param_burst_beats; Elsif (mmap_transfer_bit_width <= 256) Then If (param_burst_beats <= 128) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 128; End if; Elsif (mmap_transfer_bit_width <= 512) Then If (param_burst_beats <= 64) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 64; End if; Else -- 1024 bit mmap width case If (param_burst_beats <= 32) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 32; End if; End if; else -- use stream dwidth for calc If (stream_transfer_bit_width <= 128) Then -- allowed fvar_max_burst_dbeats := param_burst_beats; Elsif (stream_transfer_bit_width <= 256) Then If (param_burst_beats <= 128) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 128; End if; Elsif (stream_transfer_bit_width <= 512) Then If (param_burst_beats <= 64) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 64; End if; Else -- 1024 bit stream width case If (param_burst_beats <= 32) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 32; End if; -- coverage on End if; end if; Return (fvar_max_burst_dbeats); end function funct_clip_brst_len; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_fix_depth_16 -- -- Function Description: -- This function is used to fix the Command and Status FIFO depths to -- 16 entries when Async clocking mode is enabled. This is required -- due to the way the async_fifo_fg.vhd design in proc_common is -- implemented. ------------------------------------------------------------------- function funct_fix_depth_16 (async_clocking_mode : integer; requested_depth : integer) return integer is Variable fvar_depth_2_use : Integer; begin -- coverage off If (async_clocking_mode = 1) Then -- async mode so fix at 16 fvar_depth_2_use := 16; Elsif (requested_depth > 16) Then -- limit at 16 fvar_depth_2_use := 16; -- coverage on Else -- use requested depth fvar_depth_2_use := requested_depth; End if; Return (fvar_depth_2_use); end function funct_fix_depth_16; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_min_btt_width -- -- Function Description: -- This function calculates the minimum required value -- for the used width of the command BTT field. -- ------------------------------------------------------------------- function funct_get_min_btt_width (max_burst_beats : integer; bytes_per_beat : integer ) return integer is Variable var_min_btt_needed : Integer; Variable var_max_bytes_per_burst : Integer; begin var_max_bytes_per_burst := max_burst_beats*bytes_per_beat; -- coverage off if (var_max_bytes_per_burst <= 16) then var_min_btt_needed := 5; elsif (var_max_bytes_per_burst <= 32) then var_min_btt_needed := 6; -- coverage on elsif (var_max_bytes_per_burst <= 64) then var_min_btt_needed := 7; -- coverage off elsif (var_max_bytes_per_burst <= 128) then var_min_btt_needed := 8; elsif (var_max_bytes_per_burst <= 256) then var_min_btt_needed := 9; elsif (var_max_bytes_per_burst <= 512) then var_min_btt_needed := 10; elsif (var_max_bytes_per_burst <= 1024) then var_min_btt_needed := 11; elsif (var_max_bytes_per_burst <= 2048) then var_min_btt_needed := 12; elsif (var_max_bytes_per_burst <= 4096) then var_min_btt_needed := 13; else -- 8K byte range var_min_btt_needed := 14; end if; -- coverage on Return (var_min_btt_needed); end function funct_get_min_btt_width; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_xfer_bytes_per_dbeat -- -- Function Description: -- Calculates the nuber of bytes that will transfered per databeat -- on the AXI4 MMap Bus. -- ------------------------------------------------------------------- function funct_get_xfer_bytes_per_dbeat (mmap_transfer_bit_width : integer; stream_transfer_bit_width : integer; down_up_sizers_enabled : integer) return integer is Variable temp_bytes_per_dbeat : Integer := 4; begin -- coverage off if (down_up_sizers_enabled > 0) then -- down/up sizers are in use, use full mmap dwidth temp_bytes_per_dbeat := mmap_transfer_bit_width/8; -- coverage on else -- No down/up sizers so use Stream data width temp_bytes_per_dbeat := stream_transfer_bit_width/8; end if; Return (temp_bytes_per_dbeat); end function funct_get_xfer_bytes_per_dbeat; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_fix_btt_used -- -- Function Description: -- THis function makes sure the BTT width used is at least the -- minimum needed. -- ------------------------------------------------------------------- function funct_fix_btt_used (requested_btt_width : integer; min_btt_width : integer) return integer is Variable var_corrected_btt_width : Integer; begin -- coverage off If (requested_btt_width < min_btt_width) Then var_corrected_btt_width := min_btt_width; -- coverage on else var_corrected_btt_width := requested_btt_width; End if; Return (var_corrected_btt_width); end function funct_fix_btt_used; ------------------------------------------------------------------- -- Constant Declarations ------------------------------------------------------------------- Constant MM2S_TAG_WIDTH : integer := 4; Constant S2MM_TAG_WIDTH : integer := 4; Constant MM2S_DOWNSIZER_ENABLED : integer := C_MM2S_INCLUDE_SF; Constant S2MM_UPSIZER_ENABLED : integer := C_S2MM_INCLUDE_SF + C_S2MM_SUPPORT_INDET_BTT; Constant MM2S_MAX_BURST_BEATS : integer := funct_clip_brst_len(C_MM2S_BURST_SIZE, C_M_AXI_MM2S_DATA_WIDTH, C_M_AXIS_MM2S_TDATA_WIDTH, MM2S_DOWNSIZER_ENABLED); Constant S2MM_MAX_BURST_BEATS : integer := funct_clip_brst_len(C_S2MM_BURST_SIZE, C_M_AXI_S2MM_DATA_WIDTH, C_S_AXIS_S2MM_TDATA_WIDTH, S2MM_UPSIZER_ENABLED); Constant MM2S_CMDSTS_FIFO_DEPTH : integer := funct_fix_depth_16(C_MM2S_STSCMD_IS_ASYNC, C_MM2S_STSCMD_FIFO_DEPTH); Constant S2MM_CMDSTS_FIFO_DEPTH : integer := funct_fix_depth_16(C_S2MM_STSCMD_IS_ASYNC, C_S2MM_STSCMD_FIFO_DEPTH); Constant MM2S_BYTES_PER_BEAT : integer := funct_get_xfer_bytes_per_dbeat(C_M_AXI_MM2S_DATA_WIDTH, C_M_AXIS_MM2S_TDATA_WIDTH, MM2S_DOWNSIZER_ENABLED); Constant MM2S_MIN_BTT_NEEDED : integer := funct_get_min_btt_width(MM2S_MAX_BURST_BEATS, MM2S_BYTES_PER_BEAT); Constant MM2S_CORRECTED_BTT_USED : integer := funct_fix_btt_used(C_MM2S_BTT_USED, MM2S_MIN_BTT_NEEDED); Constant S2MM_BYTES_PER_BEAT : integer := funct_get_xfer_bytes_per_dbeat(C_M_AXI_S2MM_DATA_WIDTH, C_S_AXIS_S2MM_TDATA_WIDTH, S2MM_UPSIZER_ENABLED); Constant S2MM_MIN_BTT_NEEDED : integer := funct_get_min_btt_width(S2MM_MAX_BURST_BEATS, S2MM_BYTES_PER_BEAT); Constant S2MM_CORRECTED_BTT_USED : integer := funct_fix_btt_used(C_S2MM_BTT_USED, S2MM_MIN_BTT_NEEDED); -- Signals signal sig_mm2s_tstrb : std_logic_vector((C_M_AXIS_MM2S_TDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_mm2s_sts_tstrb : std_logic_vector(0 downto 0) := (others => '0'); signal sig_s2mm_tstrb : std_logic_vector((C_S_AXIS_S2MM_TDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_s2mm_sts_tstrb : std_logic_vector((((C_S2MM_SUPPORT_INDET_BTT*24)+8)/8)-1 downto 0) := (others => '0'); begin --(architecture implementation) ------------------------------------------------------------- -- Conversion to tkeep for external stream connnections ------------------------------------------------------------- -- MM2S Stream Output m_axis_mm2s_tkeep <= sig_mm2s_tstrb ; -- MM2S Status Stream Output m_axis_mm2s_sts_tkeep <= sig_mm2s_sts_tstrb ; -- S2MM Stream Input sig_s2mm_tstrb <= s_axis_s2mm_tkeep ; -- S2MM Status Stream Output m_axis_s2mm_sts_tkeep <= sig_s2mm_sts_tstrb ; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_MM2S_BASIC -- -- If Generate Description: -- Instantiate the MM2S Basic Wrapper -- -- ------------------------------------------------------------ GEN_MM2S_BASIC : if (C_INCLUDE_MM2S = 2) generate begin ------------------------------------------------------------ -- Instance: I_MM2S_BASIC_WRAPPER -- -- Description: -- Read Basic Wrapper Instance -- ------------------------------------------------------------ I_MM2S_BASIC_WRAPPER : entity axi_sg_v4_1_2.axi_sg_mm2s_basic_wrap generic map ( C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_MM2S_ARID => C_M_AXI_MM2S_ARID , C_MM2S_ID_WIDTH => C_M_AXI_MM2S_ID_WIDTH , C_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH , C_MM2S_MDATA_WIDTH => C_M_AXI_MM2S_DATA_WIDTH , C_MM2S_SDATA_WIDTH => C_M_AXIS_MM2S_TDATA_WIDTH , C_INCLUDE_MM2S_STSFIFO => C_INCLUDE_MM2S_STSFIFO , C_MM2S_STSCMD_FIFO_DEPTH => MM2S_CMDSTS_FIFO_DEPTH , C_MM2S_STSCMD_IS_ASYNC => C_MM2S_STSCMD_IS_ASYNC , C_INCLUDE_MM2S_DRE => C_INCLUDE_MM2S_DRE , C_MM2S_BURST_SIZE => MM2S_MAX_BURST_BEATS , C_MM2S_BTT_USED => MM2S_CORRECTED_BTT_USED , C_MM2S_ADDR_PIPE_DEPTH => C_MM2S_ADDR_PIPE_DEPTH , C_TAG_WIDTH => MM2S_TAG_WIDTH , C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL , C_ENABLE_EXTRA_FIELD => C_ENABLE_EXTRA_FIELD, C_FAMILY => C_FAMILY ) port map ( mm2s_aclk => m_axi_mm2s_aclk , mm2s_aresetn => m_axi_mm2s_aresetn , sg_ctl => sg_ctl , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , mm2s_err => mm2s_err , mm2s_cmdsts_awclk => m_axis_mm2s_cmdsts_aclk , mm2s_cmdsts_aresetn => m_axis_mm2s_cmdsts_aresetn , mm2s_cmd_wvalid => s_axis_mm2s_cmd_tvalid , mm2s_cmd_wready => s_axis_mm2s_cmd_tready , mm2s_cmd_wdata => s_axis_mm2s_cmd_tdata , mm2s_sts_wvalid => m_axis_mm2s_sts_tvalid , mm2s_sts_wready => m_axis_mm2s_sts_tready , mm2s_sts_wdata => m_axis_mm2s_sts_tdata , mm2s_sts_wstrb => sig_mm2s_sts_tstrb , mm2s_sts_wlast => m_axis_mm2s_sts_tlast , mm2s_allow_addr_req => mm2s_allow_addr_req , mm2s_addr_req_posted => mm2s_addr_req_posted , mm2s_rd_xfer_cmplt => mm2s_rd_xfer_cmplt , mm2s_arid => m_axi_mm2s_arid , mm2s_araddr => m_axi_mm2s_araddr , mm2s_arlen => m_axi_mm2s_arlen , mm2s_arsize => m_axi_mm2s_arsize , mm2s_arburst => m_axi_mm2s_arburst , mm2s_arprot => m_axi_mm2s_arprot , mm2s_arcache => m_axi_mm2s_arcache , mm2s_aruser => m_axi_mm2s_aruser , mm2s_arvalid => m_axi_mm2s_arvalid , mm2s_arready => m_axi_mm2s_arready , mm2s_rdata => m_axi_mm2s_rdata , mm2s_rresp => m_axi_mm2s_rresp , mm2s_rlast => m_axi_mm2s_rlast , mm2s_rvalid => m_axi_mm2s_rvalid , mm2s_rready => m_axi_mm2s_rready , mm2s_strm_wdata => m_axis_mm2s_tdata , mm2s_strm_wstrb => sig_mm2s_tstrb , mm2s_strm_wlast => m_axis_mm2s_tlast , mm2s_strm_wvalid => m_axis_mm2s_tvalid , mm2s_strm_wready => m_axis_mm2s_tready , mm2s_dbg_sel => mm2s_dbg_sel , mm2s_dbg_data => mm2s_dbg_data ); end generate GEN_MM2S_BASIC; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_S2MM_BASIC -- -- If Generate Description: -- Instantiate the S2MM Basic Wrapper -- -- ------------------------------------------------------------ GEN_S2MM_BASIC : if (C_INCLUDE_S2MM = 2) generate begin ------------------------------------------------------------ -- Instance: I_S2MM_BASIC_WRAPPER -- -- Description: -- Write Basic Wrapper Instance -- ------------------------------------------------------------ I_S2MM_BASIC_WRAPPER : entity axi_sg_v4_1_2.axi_sg_s2mm_basic_wrap generic map ( C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_S2MM_AWID => C_M_AXI_S2MM_AWID , C_S2MM_ID_WIDTH => C_M_AXI_S2MM_ID_WIDTH , C_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH , C_S2MM_MDATA_WIDTH => C_M_AXI_S2MM_DATA_WIDTH , C_S2MM_SDATA_WIDTH => C_S_AXIS_S2MM_TDATA_WIDTH , C_INCLUDE_S2MM_STSFIFO => C_INCLUDE_S2MM_STSFIFO , C_S2MM_STSCMD_FIFO_DEPTH => S2MM_CMDSTS_FIFO_DEPTH , C_S2MM_STSCMD_IS_ASYNC => C_S2MM_STSCMD_IS_ASYNC , C_INCLUDE_S2MM_DRE => C_INCLUDE_S2MM_DRE , C_S2MM_BURST_SIZE => S2MM_MAX_BURST_BEATS , C_S2MM_ADDR_PIPE_DEPTH => C_S2MM_ADDR_PIPE_DEPTH , C_TAG_WIDTH => S2MM_TAG_WIDTH , C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL , C_ENABLE_EXTRA_FIELD => C_ENABLE_EXTRA_FIELD, C_FAMILY => C_FAMILY ) port map ( s2mm_aclk => m_axi_s2mm_aclk , s2mm_aresetn => m_axi_s2mm_aresetn , sg_ctl => sg_ctl , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , s2mm_err => s2mm_err , s2mm_cmdsts_awclk => m_axis_s2mm_cmdsts_awclk , s2mm_cmdsts_aresetn => m_axis_s2mm_cmdsts_aresetn , s2mm_cmd_wvalid => s_axis_s2mm_cmd_tvalid , s2mm_cmd_wready => s_axis_s2mm_cmd_tready , s2mm_cmd_wdata => s_axis_s2mm_cmd_tdata , s2mm_sts_wvalid => m_axis_s2mm_sts_tvalid , s2mm_sts_wready => m_axis_s2mm_sts_tready , s2mm_sts_wdata => m_axis_s2mm_sts_tdata , s2mm_sts_wstrb => sig_s2mm_sts_tstrb , s2mm_sts_wlast => m_axis_s2mm_sts_tlast , s2mm_allow_addr_req => s2mm_allow_addr_req , s2mm_addr_req_posted => s2mm_addr_req_posted , s2mm_wr_xfer_cmplt => s2mm_wr_xfer_cmplt , s2mm_ld_nxt_len => s2mm_ld_nxt_len , s2mm_wr_len => s2mm_wr_len , s2mm_awid => m_axi_s2mm_awid , s2mm_awaddr => m_axi_s2mm_awaddr , s2mm_awlen => m_axi_s2mm_awlen , s2mm_awsize => m_axi_s2mm_awsize , s2mm_awburst => m_axi_s2mm_awburst , s2mm_awprot => m_axi_s2mm_awprot , s2mm_awcache => m_axi_s2mm_awcache , s2mm_awuser => m_axi_s2mm_awuser , s2mm_awvalid => m_axi_s2mm_awvalid , s2mm_awready => m_axi_s2mm_awready , s2mm_wdata => m_axi_s2mm_wdata , s2mm_wstrb => m_axi_s2mm_wstrb , s2mm_wlast => m_axi_s2mm_wlast , s2mm_wvalid => m_axi_s2mm_wvalid , s2mm_wready => m_axi_s2mm_wready , s2mm_bresp => m_axi_s2mm_bresp , s2mm_bvalid => m_axi_s2mm_bvalid , s2mm_bready => m_axi_s2mm_bready , s2mm_strm_wdata => s_axis_s2mm_tdata , s2mm_strm_wstrb => sig_s2mm_tstrb , s2mm_strm_wlast => s_axis_s2mm_tlast , s2mm_strm_wvalid => s_axis_s2mm_tvalid , s2mm_strm_wready => s_axis_s2mm_tready , s2mm_dbg_sel => s2mm_dbg_sel , s2mm_dbg_data => s2mm_dbg_data ); end generate GEN_S2MM_BASIC; end implementation;
gpl-3.0
3f1358abb595736e82f040c620b98f6c
0.407645
4.605693
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_datamover_v5_1/hdl/src/vhdl/axi_datamover_mssai_skid_buf.vhd
3
24,689
------------------------------------------------------------------------------- -- axi_datamover_mssai_skid_buf.vhd ------------------------------------------------------------------------------- -- -- ************************************************************************* -- -- (c) Copyright 2010-2011 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_datamover_mssai_skid_buf.vhd -- -- Description: -- Implements the AXi Skid Buffer in the Option 2 (Registerd outputs) mode that -- also incorporates the MS Strobe Asserted detection function needed by the -- module. This provides a register isolation of the MS asserted strobe index -- Scatter needed to improve Fmax. -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library axi_datamover_v5_1_10; Use axi_datamover_v5_1_10.axi_datamover_ms_strb_set; ------------------------------------------------------------------------------- entity axi_datamover_mssai_skid_buf is generic ( C_WDATA_WIDTH : INTEGER range 8 to 1024 := 32 ; -- Width of the Stream Data bus (in bits) C_INDEX_WIDTH : Integer range 1 to 8 := 2 -- Sets the width of the MS asserted strobe index output value ); port ( -- Clock and Reset Ports ----------------------- aclk : In std_logic ; -- arst : In std_logic ; -- ------------------------------------------------ -- Shutdown control (assert for 1 clk pulse) --- skid_stop : In std_logic ; -- ------------------------------------------------ -- Slave Side (Stream Data Input) ------------------------------------ s_valid : In std_logic ; -- s_ready : Out std_logic ; -- s_data : In std_logic_vector(C_WDATA_WIDTH-1 downto 0); -- s_strb : In std_logic_vector((C_WDATA_WIDTH/8)-1 downto 0); -- s_last : In std_logic ; -- ---------------------------------------------------------------------- -- Master Side (Stream Data Output ----------------------------------- m_valid : Out std_logic ; -- m_ready : In std_logic ; -- m_data : Out std_logic_vector(C_WDATA_WIDTH-1 downto 0); -- m_strb : Out std_logic_vector((C_WDATA_WIDTH/8)-1 downto 0); -- m_last : Out std_logic ; -- -- m_mssa_index : Out std_logic_vector(C_INDEX_WIDTH-1 downto 0); -- m_strb_error : Out std_logic -- ---------------------------------------------------------------------- ); end entity axi_datamover_mssai_skid_buf; architecture implementation of axi_datamover_mssai_skid_buf is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; -- Constant declarations ------------------------- Constant STROBE_WIDTH : integer := C_WDATA_WIDTH/8; -- Signals declarations ------------------------- Signal sig_reset_reg : std_logic := '0'; signal sig_spcl_s_ready_set : std_logic := '0'; signal sig_data_skid_reg : std_logic_vector(C_WDATA_WIDTH-1 downto 0) := (others => '0'); signal sig_strb_skid_reg : std_logic_vector(STROBE_WIDTH-1 downto 0) := (others => '0'); signal sig_last_skid_reg : std_logic := '0'; signal sig_skid_reg_en : std_logic := '0'; signal sig_data_skid_mux_out : std_logic_vector(C_WDATA_WIDTH-1 downto 0) := (others => '0'); signal sig_strb_skid_mux_out : std_logic_vector(STROBE_WIDTH-1 downto 0) := (others => '0'); signal sig_last_skid_mux_out : std_logic := '0'; signal sig_data_reg_out : std_logic_vector(C_WDATA_WIDTH-1 downto 0) := (others => '0'); signal sig_strb_reg_out : std_logic_vector(STROBE_WIDTH-1 downto 0) := (others => '0'); signal sig_last_reg_out : std_logic := '0'; signal sig_data_reg_out_en : std_logic := '0'; signal sig_m_valid_out : std_logic := '0'; signal sig_m_valid_dup : std_logic := '0'; signal sig_m_valid_comb : std_logic := '0'; signal sig_s_ready_out : std_logic := '0'; signal sig_s_ready_comb : std_logic := '0'; signal sig_stop_request : std_logic := '0'; signal sig_stopped : std_logic := '0'; signal sig_sready_stop : std_logic := '0'; signal sig_sready_early_stop : std_logic := '0'; signal sig_sready_stop_set : std_logic := '0'; signal sig_sready_stop_reg : std_logic := '0'; signal sig_mvalid_stop_reg : std_logic := '0'; signal sig_mvalid_stop : std_logic := '0'; signal sig_mvalid_early_stop : std_logic := '0'; signal sig_mvalid_stop_set : std_logic := '0'; signal sig_slast_with_stop : std_logic := '0'; signal sig_sstrb_stop_mask : std_logic_vector(STROBE_WIDTH-1 downto 0) := (others => '0'); signal sig_sstrb_with_stop : std_logic_vector(STROBE_WIDTH-1 downto 0) := (others => '0'); signal sig_mssa_index_out : std_logic_vector(C_INDEX_WIDTH-1 downto 0) := (others => '0'); signal sig_mssa_index_reg_out : std_logic_vector(C_INDEX_WIDTH-1 downto 0) := (others => '0'); signal sig_strb_error : std_logic := '0'; signal sig_strb_error_reg_out : std_logic := '0'; -- Fmax improvements signal sig_s_ready_dup : std_logic := '0'; signal sig_s_ready_dup2 : std_logic := '0'; signal sig_s_ready_dup3 : std_logic := '0'; signal sig_s_ready_dup4 : std_logic := '0'; signal sig_skid_mux_sel : std_logic := '0'; signal sig_skid_mux_sel2 : std_logic := '0'; signal sig_skid_mux_sel3 : std_logic := '0'; signal sig_skid_mux_sel4 : std_logic := '0'; -- Register duplication attribute assignments to control fanout -- on handshake output signals Attribute KEEP : string; -- declaration Attribute EQUIVALENT_REGISTER_REMOVAL : string; -- declaration Attribute KEEP of sig_m_valid_out : signal is "TRUE"; -- definition Attribute KEEP of sig_m_valid_dup : signal is "TRUE"; -- definition Attribute KEEP of sig_s_ready_out : signal is "TRUE"; -- definition Attribute KEEP of sig_s_ready_dup : signal is "TRUE"; -- definition Attribute KEEP of sig_s_ready_dup2 : signal is "TRUE"; -- definition Attribute KEEP of sig_s_ready_dup3 : signal is "TRUE"; -- definition Attribute KEEP of sig_s_ready_dup4 : signal is "TRUE"; -- definition Attribute EQUIVALENT_REGISTER_REMOVAL of sig_m_valid_out : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of sig_m_valid_dup : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of sig_s_ready_out : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of sig_s_ready_dup : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of sig_s_ready_dup2 : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of sig_s_ready_dup3 : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of sig_s_ready_dup4 : signal is "no"; begin --(architecture implementation) m_valid <= sig_m_valid_out; s_ready <= sig_s_ready_out; m_strb <= sig_strb_reg_out; m_last <= sig_last_reg_out; m_data <= sig_data_reg_out; m_mssa_index <= sig_mssa_index_reg_out; m_strb_error <= sig_strb_error_reg_out; -- Special shutdown logic version of Slast. -- A halt request forces a tlast through the skig buffer sig_slast_with_stop <= s_last or sig_stop_request; sig_sstrb_with_stop <= s_strb or sig_sstrb_stop_mask; -- Assign the special s_ready FLOP set signal sig_spcl_s_ready_set <= sig_reset_reg; -- Generate the ouput register load enable control sig_data_reg_out_en <= m_ready or not(sig_m_valid_dup); -- Generate the skid input register load enable control sig_skid_reg_en <= sig_s_ready_dup; -- Generate the skid mux select control sig_skid_mux_sel2 <= not(sig_s_ready_dup2); sig_skid_mux_sel3 <= not(sig_s_ready_dup3); sig_skid_mux_sel4 <= not(sig_s_ready_dup4); -- Skid Mux sig_data_skid_mux_out <= sig_data_skid_reg When (sig_skid_mux_sel2 = '1') Else s_data; sig_strb_skid_mux_out <= sig_strb_skid_reg When (sig_skid_mux_sel3 = '1') Else sig_sstrb_with_stop; sig_last_skid_mux_out <= sig_last_skid_reg When (sig_skid_mux_sel4 = '1') Else sig_slast_with_stop; -- m_valid combinational logic sig_m_valid_comb <= s_valid or (sig_m_valid_dup and (not(sig_s_ready_dup) or not(m_ready))); -- s_ready combinational logic sig_s_ready_comb <= m_ready or (sig_s_ready_dup and (not(sig_m_valid_dup) or not(s_valid))); ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: REG_THE_RST -- -- Process Description: -- Register input reset -- ------------------------------------------------------------- REG_THE_RST : process (aclk) begin if (aclk'event and aclk = '1') then sig_reset_reg <= arst; end if; end process REG_THE_RST; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: S_READY_FLOP -- -- Process Description: -- Registers s_ready handshake signals per Skid Buffer -- Option 2 scheme -- ------------------------------------------------------------- S_READY_FLOP : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1' or sig_sready_stop = '1' or sig_sready_early_stop = '1') then -- Special stop condition sig_s_ready_out <= '0'; sig_s_ready_dup <= '0'; sig_s_ready_dup2 <= '0'; sig_s_ready_dup3 <= '0'; sig_s_ready_dup4 <= '0'; Elsif (sig_spcl_s_ready_set = '1') Then sig_s_ready_out <= '1'; sig_s_ready_dup <= '1'; sig_s_ready_dup2 <= '1'; sig_s_ready_dup3 <= '1'; sig_s_ready_dup4 <= '1'; else sig_s_ready_out <= sig_s_ready_comb; sig_s_ready_dup <= sig_s_ready_comb; sig_s_ready_dup2 <= sig_s_ready_comb; sig_s_ready_dup3 <= sig_s_ready_comb; sig_s_ready_dup4 <= sig_s_ready_comb; end if; end if; end process S_READY_FLOP; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: M_VALID_FLOP -- -- Process Description: -- Registers m_valid handshake signals per Skid Buffer -- Option 2 scheme -- ------------------------------------------------------------- M_VALID_FLOP : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1' or sig_spcl_s_ready_set = '1' or -- Fix from AXI DMA sig_mvalid_stop = '1' or sig_mvalid_stop_set = '1') then -- Special stop condition sig_m_valid_out <= '0'; sig_m_valid_dup <= '0'; else sig_m_valid_out <= sig_m_valid_comb; sig_m_valid_dup <= sig_m_valid_comb; end if; end if; end process M_VALID_FLOP; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: SKID_DATA_REG -- -- Process Description: -- This process implements the skid register for the -- Skid Buffer Data signals. Note that reset has been removed -- to reduce route of resets for very wide data buses. -- ------------------------------------------------------------- SKID_DATA_REG : process (aclk) begin if (aclk'event and aclk = '1') then if (sig_skid_reg_en = '1') then sig_data_skid_reg <= s_data; else null; -- hold current state end if; end if; end process SKID_DATA_REG; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: SKID_CNTL_REG -- -- Process Description: -- This process implements the skid registers for the -- Skid Buffer control signals -- ------------------------------------------------------------- SKID_CNTL_REG : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1') then sig_strb_skid_reg <= (others => '0'); sig_last_skid_reg <= '0'; elsif (sig_skid_reg_en = '1') then sig_strb_skid_reg <= sig_sstrb_with_stop; sig_last_skid_reg <= sig_slast_with_stop; else null; -- hold current state end if; end if; end process SKID_CNTL_REG; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: OUTPUT_DATA_REG -- -- Process Description: -- This process implements the output register for the -- Skid Buffer Data signals. Note that reset has been removed -- to reduce route of resets for very wide data buses. -- ------------------------------------------------------------- OUTPUT_DATA_REG : process (aclk) begin if (aclk'event and aclk = '1') then if (sig_data_reg_out_en = '1') then sig_data_reg_out <= sig_data_skid_mux_out; else null; -- hold current state end if; end if; end process OUTPUT_DATA_REG; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: OUTPUT_CNTL_REG -- -- Process Description: -- This process implements the output registers for the -- Skid Buffer Control signals. -- ------------------------------------------------------------- OUTPUT_CNTL_REG : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1' or sig_mvalid_stop_reg = '1') then sig_strb_reg_out <= (others => '0'); sig_last_reg_out <= '0'; elsif (sig_data_reg_out_en = '1') then sig_strb_reg_out <= sig_strb_skid_mux_out; sig_last_reg_out <= sig_last_skid_mux_out; else null; -- hold current state end if; end if; end process OUTPUT_CNTL_REG; -------- Special Stop Logic -------------------------------------- sig_sready_stop <= sig_sready_stop_reg; sig_sready_early_stop <= skid_stop; -- deassert S_READY immediately sig_sready_stop_set <= sig_sready_early_stop; sig_mvalid_stop <= sig_mvalid_stop_reg; sig_mvalid_early_stop <= sig_m_valid_dup and m_ready and skid_stop; sig_mvalid_stop_set <= sig_mvalid_early_stop or (sig_stop_request and not(sig_m_valid_dup)) or (sig_m_valid_dup and m_ready and sig_stop_request); ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_STOP_REQ_FLOP -- -- Process Description: -- This process implements the Stop request flop. It is a -- sample and hold register that can only be cleared by reset. -- ------------------------------------------------------------- IMP_STOP_REQ_FLOP : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1') then sig_stop_request <= '0'; sig_sstrb_stop_mask <= (others => '0'); elsif (skid_stop = '1') then sig_stop_request <= '1'; sig_sstrb_stop_mask <= (others => '1'); else null; -- hold current state end if; end if; end process IMP_STOP_REQ_FLOP; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_CLR_SREADY_FLOP -- -- Process Description: -- This process implements the flag to clear the s_ready -- flop at a stop condition. -- ------------------------------------------------------------- IMP_CLR_SREADY_FLOP : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1') then sig_sready_stop_reg <= '0'; elsif (sig_sready_stop_set = '1') then sig_sready_stop_reg <= '1'; else null; -- hold current state end if; end if; end process IMP_CLR_SREADY_FLOP; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_CLR_MVALID_FLOP -- -- Process Description: -- This process implements the flag to clear the m_valid -- flop at a stop condition. -- ------------------------------------------------------------- IMP_CLR_MVALID_FLOP : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1') then sig_mvalid_stop_reg <= '0'; elsif (sig_mvalid_stop_set = '1') then sig_mvalid_stop_reg <= '1'; else null; -- hold current state end if; end if; end process IMP_CLR_MVALID_FLOP; ---------------------------------------------------------------------------- -- Logic for the detection of the most significant asserted strobe bit and -- the formulation of the index of that strobe bit. ---------------------------------------------------------------------------- ------------------------------------------------------------ -- Instance: I_MSSAI_DETECTION -- -- Description: -- This module detects the most significant asserted strobe -- and outputs the bit index of the strobe. -- ------------------------------------------------------------ I_MSSAI_DETECTION : entity axi_datamover_v5_1_10.axi_datamover_ms_strb_set generic map ( C_STRB_WIDTH => STROBE_WIDTH , C_INDEX_WIDTH => C_INDEX_WIDTH ) port map ( -- Input Stream Strobes strbs_in => sig_strb_skid_mux_out , -- Index of the most significant strobe asserted ms_strb_index => sig_mssa_index_out , -- Output flag for a detected error associated Strobe assertions strb_error => sig_strb_error ); ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_MSSAI_REG -- -- Process Description: -- This process implements the output register for the -- Skid Buffer's MSSAI value and the strobe error bit -- that is needed by the Scatter module. -- ------------------------------------------------------------- IMP_MSSAI_REG : process (aclk) begin if (aclk'event and aclk = '1') then if (arst = '1' or sig_mvalid_stop_reg = '1') then sig_mssa_index_reg_out <= (others => '0'); sig_strb_error_reg_out <= '0'; elsif (sig_data_reg_out_en = '1') then sig_mssa_index_reg_out <= sig_mssa_index_out; sig_strb_error_reg_out <= sig_strb_error; else null; -- hold current state end if; end if; end process IMP_MSSAI_REG; end implementation;
gpl-3.0
c8b439065cf33f341ef1e7af8f5db389
0.464498
4.456498
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-ams/ashenden/compliant/design-processing/tb_volume_sensor.vhd
4
2,265
-- 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 -- created by: Veribest WaveBench Version 16.00.00.02 library work; use work.all; library ieee_proposed; use ieee_proposed.electrical_systems.all; library ieee; use ieee.std_logic_1164.all; entity tb_volume_sensor is end tb_volume_sensor; architecture test_bench of tb_volume_sensor is -- Component declarations -- Signal declarations signal clk, full, rst : std_logic; terminal flow, minus_ref : electrical; begin -- Signal assignments -- Component instances vol1 : entity work.volume_sensor(structural) port map( clk => clk, full => full, rst => rst, flow => flow, minus_ref => minus_ref ); vio : entity work.v_sine(ideal) generic map( freq => 1.0, amplitude => 16.0 ) port map( pos => flow, neg => ELECTRICAL_REF ); vm_ref : entity work.v_constant(ideal) generic map( level => -10.0 ) port map( pos => minus_ref, neg => ELECTRICAL_REF ); -- Test code generation processes -- clk P_clk : process begin clk <= '1'; wait for 500000.000 ns; clk <= '0'; wait for 500000.000 ns; end process P_clk; -- rst P_rst : process begin wait for 0.0 ms; rst <= '0'; wait for 2.0 ms; rst <= '1'; wait for 2.0 ms; rst <= '0'; wait; end process; end test_bench;
gpl-2.0
74734565c8adb8411add6340b63bedf3
0.615453
3.826014
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/clifton-labs/compliant/functional/generics/entity-generic-defines-port-type.vhdl
3
1,012
entity test_bench is end test_bench; entity generic_defines_port_type is generic( width : natural ); port( input : in bit_vector( width - 1 downto 0 ); finished : in boolean ); end entity; architecture only of generic_defines_port_type is begin -- only p: process( finished ) begin -- process p if finished = true then for i in input'range loop assert input(i) = '1' report "TEST FAILED" severity FAILURE; end loop; -- i end if; end process p; end only; architecture only of test_bench is signal gdpt1_input : bit_vector( 3 downto 0 ) := "0000"; signal gdpt1_finished : boolean := false; begin -- only gdpt1: entity work.generic_defines_port_type generic map ( width => 4 ) port map ( input => gdpt1_input, finished => gdpt1_finished ); doit: process begin -- process doit gdpt1_input <= "1111"; wait for 1 fs; gdpt1_finished <= true; wait for 1 fs; report "TEST PASSED"; wait; end process doit; end only;
gpl-2.0
d29caacfc796753f5368f1b5d74eab4a
0.643281
3.489655
false
true
false
false
tgingold/ghdl
testsuite/gna/bug24064/er_pack.vhd
2
30,057
-------------------------------------------------------------------------------- --! @file --! @brief A bunch of useful functions for (non)synthesizable VHDL -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.math_real.all; library std; use std.textio.all; package er_pack is -- constants used inside function 'rt' constant simres : time := 1 ps; -- simulation resolution (time) constant resreal : real := 1.0e-12; -- simulation resolution (real) ---------------------------------------------------------------------------- -- Types, Subtypes, and constants ---------------------------------------------------------------------------- type integer_vector is array (integer range <>) of integer; type natural_vector is array (integer range <>) of natural; type real_vector is array (integer range <>) of real; ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- synthesis off function print_nibble(arg : std_logic_vector(3 downto 0)) return character; function print_message(arg : string) return boolean; -- synthesis on ---------------------------------------------------------------------------- -- print function ---------------------------------------------------------------------------- -- synthesis off function slv2string (arg : in std_logic_vector) return string; -- synthesis on ---------------------------------------------------------------------------- --! Return a vector of all ones. --! @param arg The number of bits in the output vector. --! @returns A vector of all ones. ---------------------------------------------------------------------------- function ones (arg : natural) return std_logic_vector; ---------------------------------------------------------------------------- --! Return a vector of all zeros. --! @param arg The number of bits in the output vector. --! @returns A vector of all zeros. ---------------------------------------------------------------------------- function zeros(arg : natural) return std_logic_vector; ---------------------------------------------------------------------------- --! Return the maximum (max positive) 2's complement value that can be --! expressed in the given number of bits. This is defined as {0,1,...,1}. --! @param arg The number of bits in the output vector. --! @returns The maximum 2's complement value. ---------------------------------------------------------------------------- function max (arg : natural) return std_logic_vector; ---------------------------------------------------------------------------- --! Return the minimum (max negative) 2's complement value that can be --! expressed in the given number of bits. This is defined as {1,0,...,0}. --! @param arg The number of bits in the output vector. --! @returns The minimum 2's complement value. ---------------------------------------------------------------------------- function min (arg : natural) return std_logic_vector; ---------------------------------------------------------------------------- --! Return the maximum value of two input values. --! @param a The first input value --! @param b The second input value --! @returns The maximum value of a and b ---------------------------------------------------------------------------- function max(a:natural; b:natural) return natural; ---------------------------------------------------------------------------- --! Return the minimum value of two input values. --! @param a The first input value --! @param b The second input value --! @returns The minimum value of a and b ---------------------------------------------------------------------------- function min(a:natural; b:natural) return natural; ---------------------------------------------------------------------------- --! Return the next multiple of the given variable --! @param arg The input value --! @param mult The multiple --! @returns arg rounded up to the next multiple of mult ---------------------------------------------------------------------------- function next_multiple (arg : natural; mult : natural) return natural; ---------------------------------------------------------------------------- --! Log function --! This might be the single most useful function in all of VHDL. It simply --! returns the log of a value --! @param base The base to use for the log. --! @param arg The value to log. --! @returns The log (arg) ---------------------------------------------------------------------------- function log (base : positive; arg : positive) return natural; ---------------------------------------------------------------------------- --! Log2 function --! This might be the single most useful function in all of VHDL. It simply --! returns the log2 of a value --! @param arg The value to log. --! @returns The log2 (arg) ---------------------------------------------------------------------------- function log2 (arg : positive) return natural; ---------------------------------------------------------------------------- --! Number of Bits function --! Return the number of bits necessary to hold a particular values. This --! is the log2 function rounded up --! @param arg The value to store --! @returns The number of bits necessary to hold arg ---------------------------------------------------------------------------- function num_bits (arg : positive) return natural; ---------------------------------------------------------------------------- --! delay via register --! This function should take place in a clocked process, but is an easy --! way to delay a signal --! @param reg The shift register that is doing the delaying --! @param sig The signal that is being delayed. This is put in the low --! address of the signal. --! @returns This will return the shifted (delayed) vector ---------------------------------------------------------------------------- function delay ( reg : natural_vector; sig : natural) return natural_vector; ---------------------------------------------------------------------------- --! delay via register --! This function should take place in a clocked process, but is an easy --! way to delay a signal --! @param reg The shift register that is doing the delaying --! @param sig The signal that is being delayed. This is put in the low --! address of the signal. --! @returns This will return the shifted (delayed) vector ---------------------------------------------------------------------------- function delay ( reg : integer_vector; sig : integer) return integer_vector; ---------------------------------------------------------------------------- --! delay via register --! This function should take place in a clocked process, but is an easy --! way to delay a signal --! @param reg The shift register that is doing the delaying --! @param sig The signal that is being delayed. This is put in the low --! address of the signal. --! @returns This will return the shifted (delayed) vector ---------------------------------------------------------------------------- function delay ( reg : std_logic_vector; sig : std_logic) return std_logic_vector; ---------------------------------------------------------------------------- --! Return a std_logic that is the result of a rising edge detector. There --! will need to be an input register with at least two values in it, since --! different indexes are used to derive the output. --! @param reg The input shift/Delay register --! @param idx (Optional) The index of the input reg register to start the --! the detection. The default value is the highest most index. --! @return not reg(idx) and reg(idx-1); ---------------------------------------------------------------------------- function rising_edge (reg : std_logic_vector; idx : integer) return std_logic; function rising_edge (reg : std_logic_vector) return std_logic; ---------------------------------------------------------------------------- --! Return a std_logic that is the result of a falling edge detector. There --! will need to be an input register with at least two values in it, since --! different indexes are used to derive the output. --! @param reg The input shift/Delay register --! @param idx (Optional) The index of the input reg register to start the --! the detection. The default value is the highest most index. --! @return reg(idx) and not reg(idx-1); ---------------------------------------------------------------------------- function falling_edge (reg : std_logic_vector; idx : integer) return std_logic; function falling_edge (reg : std_logic_vector) return std_logic; ---------------------------------------------------------------------------- --! Return a std_logic that is the result of an edge detector. There will --! need to be an input register with at least two values in it, since --! different indexes are used to derive the output. --! @param reg The input shift/Delay register --! @param idx (Optional) The index of the input reg register to start the --! the detection. The default value is the highest most index. --! @return reg(idx) xor reg(idx-1); ---------------------------------------------------------------------------- function edge (reg : std_logic_vector) return std_logic; function edge (reg : std_logic_vector; idx : integer) return std_logic; ---------------------------------------------------------------------------- --! Flip a register. This will put the high bits in the low positions, --! producing a mirror image of the bits. It will preserve the range of the --! input vector. --! @param ret The input register. --! @return The flipped version of the input register. ---------------------------------------------------------------------------- function flip (reg : std_logic_vector) return std_logic_vector; ---------------------------------------------------------------------------- --! Convert a real number to a std_logic_vector with a given number of bits. --! The input real should be a value between 1.0 and -1.0. Any value --! outside of this range will saturate the output vector. --! @param l The real number --! @param b The number of bits for the std_logic_vector ---------------------------------------------------------------------------- function to_slv(l:real; b:natural) return std_logic_vector; ---------------------------------------------------------------------------- -- Convert a time to a real representation for the number of seconds -- @param t The time to convert -- @return The real time (in seconds) ---------------------------------------------------------------------------- function rt(t : time) return real; ---------------------------------------------------------------------------- --! Divide two times. Return a real --! @param l The numerator --! @param r The denominator --! @returns The result of the divide in a real number ---------------------------------------------------------------------------- function "/" (l, r : time) return real; ---------------------------------------------------------------------------- --! Priority decoder --! Return the lowest index that is set high. --! @param reg the register to decode --! @returns The index of the highest bit set. If the whole register is --! zero, then it returns an out-of-bound integer ---------------------------------------------------------------------------- function priority_decode(reg : std_logic_vector) return integer; ---------------------------------------------------------------------------- --! Saturate an unsigned value to the given number of bits. --! @param val The unsigned value --! @param bits The number of bits --! @returns If the input value is greater than the requested number of bits --! can hold, it will return 2^bits-1. All other cases will return the --! original number. ---------------------------------------------------------------------------- function saturate(val : unsigned; bits : natural) return unsigned; function usat(val : std_logic_vector; bits : natural ) return std_logic_vector; ---------------------------------------------------------------------------- --! Saturate a signed value to the given number of bits. --! @param val The signed value --! @param bits The number of bits --! @returns If the absolute value of the input value is greater than --! 2^(bits-1)-1, then return the appriate signed version of 2^(bits-1)-1. --! All other cases will return the original number. ---------------------------------------------------------------------------- function saturate(val : signed; bits : natural) return signed; function ssat(val : std_logic_vector; bits : natural ) return std_logic_vector; ---------------------------------------------------------------------------- --! numeric_std helper functions --! (un)signed shift left/right ---------------------------------------------------------------------------- --! unsigned shift left function usl (val : std_logic_vector; bits : natural) return std_logic_vector; --! unsigned shift right function usr (val : std_logic_vector; bits : natural) return std_logic_vector; --! signed shift left function ssl (val : std_logic_vector; bits : natural) return std_logic_vector; --! signed shift right function ssr (val : std_logic_vector; bits : natural) return std_logic_vector; end package er_pack; -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Package body -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- package body er_pack is ---------------------------------------------------------------------------- -- synthesis off function print_nibble(arg : std_logic_vector(3 downto 0)) return character is variable ret : character; variable num : natural; -- status variables variable is_x : boolean; variable is_u : boolean; variable is_dash : boolean; variable is_z : boolean; variable is_w : boolean; begin for idx in arg'range loop -- take care of the special cases case arg(idx) is when 'X' => is_x := true; when 'U' => is_u := true; when '-' => is_dash := true; when 'Z' => is_z := true; when 'W' => is_w := true; when others => NULL; end case; end loop; -- Print it if is_x then ret := 'X'; elsif is_u then ret := 'U'; elsif is_dash then ret := '-'; elsif is_z then ret := 'Z'; elsif is_w then ret := 'W'; else num := to_integer(unsigned(arg)); case num is when 15 => ret := 'F'; when 14 => ret := 'E'; when 13 => ret := 'D'; when 12 => ret := 'C'; when 11 => ret := 'B'; when 10 => ret := 'A'; when 9 => ret := '9'; when 8 => ret := '8'; when 7 => ret := '7'; when 6 => ret := '6'; when 5 => ret := '5'; when 4 => ret := '4'; when 3 => ret := '3'; when 2 => ret := '2'; when 1 => ret := '1'; when 0 => ret := '0'; when others => ret := 'J'; end case; end if; -- we're done return ret; end function print_nibble; --! Just print a string. It's not hard, but it takes more than one line --! without the function function print_message(arg : string) return boolean is variable out_line : line; begin write(out_line, arg); writeline(output, out_line); return true; end function print_message; -- print function function slv2string (arg : in std_logic_vector) return string is variable ret : string (1 to arg'length/4+1); variable jdx : integer; variable tmp_nibble : std_logic_vector(3 downto 0); variable kdx : natural := 1; begin -- Try to get a useful hex value jdx := 0; kdx := ret'high; for idx in arg'reverse_range loop -- fill the next value of the nibble tmp_nibble(jdx) := arg(idx); -- correct jdx and print accordingly if jdx = 3 then -- reset the jdx value jdx := 0; ret(kdx) := print_nibble(tmp_nibble); -- correct kdx kdx := kdx - 1; else -- decrement jdx jdx := jdx + 1; end if; end loop; -- edge cases if jdx /= 0 then tmp_nibble(3 downto jdx) := (others => '0'); ret(kdx) := print_nibble(tmp_nibble); return ret; end if; -- if we got here, then we have an exact number of nibbles. Give back -- all but one character. return ret(2 to ret'high); end function slv2string; -- synthesis on ---------------------------------------------------------------------------- function ones (arg : natural) return std_logic_vector is variable ret : std_logic_vector(arg-1 downto 0) := (others => '1'); begin return ret; end function ones; ---------------------------------------------------------------------------- function zeros(arg : natural) return std_logic_vector is variable ret : std_logic_vector(arg-1 downto 0) := (others => '0'); begin return ret; end function zeros; ---------------------------------------------------------------------------- function max (arg : natural) return std_logic_vector is variable ret : std_logic_vector(arg-1 downto 0) := '0' & ones(arg-1); begin return ret; end function max; ---------------------------------------------------------------------------- function min (arg : natural) return std_logic_vector is variable ret : std_logic_vector(arg-1 downto 0) := '1' & zeros(arg-1); begin return ret; end function min; ---------------------------------------------------------------------------- function max(a:natural; b:natural) return natural is begin if a > b then return a; end if; return b; end function max; ---------------------------------------------------------------------------- function min(a:natural; b:natural) return natural is begin if a < b then return a; end if; return b; end function min; ---------------------------------------------------------------------------- function next_multiple (arg : natural; mult : natural) return natural is begin return (arg / mult) * mult; end function next_multiple; ---------------------------------------------------------------------------- function log (base : positive; arg : positive) return natural is variable div : positive := arg; variable ret : natural := 0; begin while div > 1 loop div := div / base; ret := ret + 1; end loop; return ret; end function log; ---------------------------------------------------------------------------- function log2 (arg : positive) return natural is begin return log(2, arg); end function log2; ---------------------------------------------------------------------------- function num_bits (arg : positive) return natural is variable ret : natural := log2(arg); begin if 2**ret /= arg then ret := ret + 1; end if; return ret; end function num_bits; ---------------------------------------------------------------------------- function delay ( reg : integer_vector; sig : integer) return integer_vector is variable ret : integer_vector(reg'range); begin if ret'ascending then ret := sig & reg(reg'low to reg'high-1); else ret := reg(reg'high-1 downto reg'low) & sig; end if; return ret; end function; function delay ( reg : natural_vector; sig : natural) return natural_vector is variable ret : natural_vector(reg'range); begin if ret'ascending then ret := sig & reg(reg'low to reg'high-1); else ret := reg(reg'high-1 downto reg'low) & sig; end if; return ret; end function; function delay ( reg : std_logic_vector; sig : std_logic) return std_logic_vector is variable ret : std_logic_vector(reg'range); begin if ret'ascending then ret := sig & reg(reg'low to reg'high-1); else ret := reg(reg'high-1 downto reg'low) & sig; end if; return ret; end function; ---------------------------------------------------------------------------- function rising_edge ( reg : std_logic_vector) return std_logic is variable idx : integer := reg'high; begin return rising_edge(reg, idx); end function; ---------------------------------------------------------------------------- function rising_edge ( reg : std_logic_vector; idx : integer) return std_logic is begin -- Check the input for validity assert reg'length >= 2 report "input vector not long enough" severity error; assert idx <= reg'high and idx > reg'low report "input vector not long enough" severity error; -- now just return the answer return not reg(idx) and reg(idx-1); end function; ---------------------------------------------------------------------------- function falling_edge ( reg : std_logic_vector) return std_logic is variable idx : integer := reg'high; begin return falling_edge(reg, idx); end function falling_edge; ---------------------------------------------------------------------------- function falling_edge ( reg : std_logic_vector; idx : integer) return std_logic is begin -- Check the input for validity assert reg'length >= 2 report "input vector not long enough" severity error; assert idx <= reg'high and idx > reg'low report "input vector not long enough" severity error; -- now just return the answer return reg(idx) and not reg(idx-1); end function falling_edge; ---------------------------------------------------------------------------- function edge ( reg : std_logic_vector) return std_logic is variable idx : integer := reg'high; begin return edge(reg, idx); end function edge; ---------------------------------------------------------------------------- function edge ( reg : std_logic_vector; idx : integer) return std_logic is begin -- Check the input for validity assert reg'length >= 2 report "input vector not long enough" severity error; assert idx <= reg'high and idx > reg'low report "input vector not long enough" severity error; -- now just return the answer return reg(idx) xor reg(idx-1); end function edge; ---------------------------------------------------------------------------- function flip (reg : std_logic_vector) return std_logic_vector is variable ret : std_logic_vector(reg'range); variable idx : integer := reg'high; variable jdx : integer := reg'low; begin while jdx < idx loop -- Populate ret with the reg bits backwards ret(idx) := reg(jdx); ret(jdx) := reg(idx); -- update the counters idx := idx + 1; jdx := jdx + 1; end loop; -- return the flipped register return ret; end function flip; ---------------------------------------------------------------------------- function to_slv(l:real; b:natural) return std_logic_vector is variable slv : std_logic_vector(b-1 downto 0); variable temp_r : real; variable temp_i : integer; begin -- Check the bounds and saturate when necessary if l <= -1.0 then slv := min(b); elsif l >= 1.0 then slv := max(b); else -- Compute the answer temp_r := l * real(2**(b-1)-1); -- Scale the real to not overflow temp_i := integer(round(temp_r)); -- round it and turn it into an integer slv := std_logic_vector(to_signed(temp_i, b)); -- Turn it to an slv end if; -- Now just return it return slv; end function to_slv; ---------------------------------------------------------------------------- function rt(t : time) return real is variable nat_time : natural := t / simres; variable real_time : real := real(nat_time); begin return real_time * resreal; end; ---------------------------------------------------------------------------- function "/" (l, r : time) return real is variable real_l : real := rt(l); variable real_r : real := rt(r); begin return real_l / real_r; end function "/"; ---------------------------------------------------------------------------- function priority_decode(reg : std_logic_vector) return integer is variable ret : integer; begin -- Start with the default value if reg'ascending then ret := reg'right + 1; else ret := reg'right - 1; end if; -- now determine which one is lit for idx in reg'reverse_range loop if reg(idx) = '1' then ret := idx; end if; end loop; -- return it return ret; end function priority_decode; ---------------------------------------------------------------------------- function saturate(val : unsigned; bits : natural) return unsigned is variable max_val : unsigned(bits-1 downto 0) := unsigned(ones(bits)); begin -- Check the value over the max if val > max_val then return resize(max_val, val'length); end if; -- If we got here, we just return the value return val; end function saturate; -- The std_logic_vector version function usat(val : std_logic_vector; bits : natural ) return std_logic_vector is begin return std_logic_vector(saturate(unsigned(val), bits)); end function usat; ---------------------------------------------------------------------------- function saturate(val : signed; bits : natural) return signed is variable max_val : signed(bits-1 downto 0) := '0' & signed(ones (bits-2)) & '1'; variable min_val : signed(bits-1 downto 0) := '1' & signed(zeros(bits-2)) & '1'; begin -- Check the value over the max if val > max_val then return resize(max_val, val'length); elsif val < min_val then return resize(min_val, val'length); end if; -- If we got here, we just return the value return val; end function saturate; -- The std_logic_vector version function ssat(val : std_logic_vector; bits : natural ) return std_logic_vector is begin return std_logic_vector(saturate(signed(val), bits)); end function ssat; ---------------------------------------------------------------------------- -- numeric_std helper functions ---------------------------------------------------------------------------- function usl (val : std_logic_vector; bits : natural) return std_logic_vector is begin return std_logic_vector(shift_left(unsigned(val), bits)); end function usl; function usr (val : std_logic_vector; bits : natural) return std_logic_vector is begin return std_logic_vector(shift_right(unsigned(val), bits)); end function usr; function ssl (val : std_logic_vector; bits : natural) return std_logic_vector is begin return std_logic_vector(shift_left(signed(val), bits)); end function ssl; function ssr (val : std_logic_vector; bits : natural) return std_logic_vector is begin return std_logic_vector(shift_right(signed(val), bits)); end function ssr; end package body;
gpl-2.0
7ab03fc7adbff7a51ac5beac618b8ddd
0.452274
5.261159
false
false
false
false
nickg/nvc
test/lower/assign2.vhd
1
474
entity assign2 is end entity; architecture test of assign2 is begin p1: process is variable x : bit_vector(7 downto 0) := (1 => '1', others => '0'); subtype myint is integer range 1 to 10; type myint_array is array (integer range <>) of myint; variable y : myint_array(1 to 3); begin assert x(0) = '0'; assert x(4) = x(7); x(2) := '1'; y(1) := y(3); wait; end process; end architecture;
gpl-3.0
6659ad353a158bd034bf20e4a0a7bb40
0.540084
3.410072
false
false
false
false
tgingold/ghdl
testsuite/gna/issue317/PoC/src/common/protected.v08.vhdl
2
7,824
-- EMACS settings: -*- tab-width: 2;indent-tabs-mode: t -*- -- vim: tabstop=2:shiftwidth=2:noexpandtab -- kate: tab-width 2;replace-tabs off;indent-width 2; -- ============================================================================= -- Authors: Patrick Lehmann -- -- Package: Protected type implementations. -- -- Description: -- ------------------------------------- -- .. TODO:: No documentation available. -- -- License: -- ============================================================================= -- Copyright 2007-2016 Technische Universitaet Dresden - Germany, -- Chair of VLSI-Design, Diagnostics and Architecture -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ============================================================================= library IEEE; use IEEE.math_real.all; library PoC; -- use PoC.my_project.all; -- use PoC.utils.all; package ProtectedTypes is -- protected BOOLEAN implementation -- =========================================================================== type P_BOOLEAN is protected procedure Clear; procedure Set(Value : boolean := TRUE); impure function Get return boolean; impure function Toggle return boolean; end protected; -- protected INTEGER implementation -- =========================================================================== -- TODO: Mult, Div, Pow, Mod, Rem type P_INTEGER is protected procedure Clear; procedure Set(Value : integer); impure function Get return integer; procedure Add(Value : integer); impure function Add(Value : integer) return integer; procedure Sub(Value : integer); impure function Sub(Value : integer) return integer; end protected; -- protected NATURAL implementation -- =========================================================================== -- TODO: Mult, Div, Pow, Mod, Rem type P_NATURAL is protected procedure Clear; procedure Set(Value : natural); impure function Get return natural; procedure Add(Value : natural); impure function Add(Value : natural) return natural; procedure Sub(Value : natural); impure function Sub(Value : natural) return natural; end protected; -- protected POSITIVE implementation -- =========================================================================== -- TODO: Mult, Div, Pow, Mod, Rem type P_POSITIVE is protected procedure Clear; procedure Set(Value : positive); impure function Get return positive; procedure Add(Value : positive); impure function Add(Value : positive) return positive; procedure Sub(Value : positive); impure function Sub(Value : positive) return positive; end protected; -- protected REAL implementation -- =========================================================================== -- TODO: Round, Mult, Div, Pow, Mod type P_REAL is protected procedure Clear; procedure Set(Value : REAL); impure function Get return REAL; procedure Add(Value : REAL); impure function Add(Value : REAL) return REAL; procedure Sub(Value : REAL); impure function Sub(Value : REAL) return REAL; end protected; end package; package body ProtectedTypes is -- protected BOOLEAN implementation -- =========================================================================== type P_BOOLEAN is protected body variable InnerValue : boolean := FALSE; procedure Clear is begin InnerValue := FALSE; end procedure; procedure Set(Value : boolean := TRUE) is begin InnerValue := Value; end procedure; impure function Get return boolean is begin return InnerValue; end function; impure function Toggle return boolean is begin InnerValue := not InnerValue; return InnerValue; end function; end protected body; -- protected INTEGER implementation -- =========================================================================== type P_INTEGER is protected body variable InnerValue : integer := 0; procedure Clear is begin InnerValue := 0; end procedure; procedure Set(Value : integer) is begin InnerValue := Value; end procedure; impure function Get return integer is begin return InnerValue; end function; procedure Add(Value : integer) is begin InnerValue := InnerValue + Value; end procedure; impure function Add(Value : integer) return integer is begin Add(Value); return InnerValue; end function; procedure Sub(Value : integer) is begin InnerValue := InnerValue - Value; end procedure; impure function Sub(Value : integer) return integer is begin Sub(Value); return InnerValue; end function; end protected body; -- protected NATURAL implementation -- =========================================================================== type P_NATURAL is protected body variable InnerValue : natural := 0; procedure Clear is begin InnerValue := 0; end procedure; procedure Set(Value : natural) is begin InnerValue := Value; end procedure; impure function Get return natural is begin return InnerValue; end function; procedure Add(Value : natural) is begin InnerValue := InnerValue + Value; end procedure; impure function Add(Value : natural) return natural is begin Add(Value); return InnerValue; end function; procedure Sub(Value : natural) is begin InnerValue := InnerValue - Value; end procedure; impure function Sub(Value : natural) return natural is begin Sub(Value); return InnerValue; end function; end protected body; -- protected POSITIVE implementation -- =========================================================================== type P_POSITIVE is protected body variable InnerValue : positive := 1; procedure Clear is begin InnerValue := 1; end procedure; procedure Set(Value : positive) is begin InnerValue := Value; end procedure; impure function Get return positive is begin return InnerValue; end function; procedure Add(Value : positive) is begin InnerValue := InnerValue + Value; end procedure; impure function Add(Value : positive) return positive is begin Add(Value); return InnerValue; end function; procedure Sub(Value : positive) is begin InnerValue := InnerValue - Value; end procedure; impure function Sub(Value : positive) return positive is begin Sub(Value); return InnerValue; end function; end protected body; -- protected REAL implementation -- =========================================================================== type P_REAL is protected body variable InnerValue : REAL := 0.0; procedure Clear is begin InnerValue := 0.0; end procedure; procedure Set(Value : REAL) is begin InnerValue := Value; end procedure; impure function Get return REAL is begin return InnerValue; end function; procedure Add(Value : REAL) is begin InnerValue := InnerValue + Value; end procedure; impure function Add(Value : REAL) return REAL is begin Add(Value); return InnerValue; end function; procedure Sub(Value : REAL) is begin InnerValue := InnerValue - Value; end procedure; impure function Sub(Value : REAL) return REAL is begin Sub(Value); return InnerValue; end function; end protected body; end package body;
gpl-2.0
9c33eeb6f79e43f94d81347155f6a269
0.611324
4.183957
false
false
false
false
nickg/nvc
test/regress/bounds33.vhd
1
654
entity bounds33 is end entity; architecture test of bounds33 is type rec is record x : bit_vector; end record; procedure assign (p : out rec) is begin p := (x => "1111111111111111"); end procedure; begin main: process is variable s : rec(x(1 to 3)); begin assert s.x = "000"; assert s = (x => "000"); s.x := "101"; assert s.x = "101"; assert s = (x => "101"); assign(s); -- Error report to_string(s.x'length); assert s.x = "111"; assert s = (x => "111"); wait; end process; end architecture;
gpl-3.0
e3495a332d892a84f148c5202eac6524
0.489297
3.694915
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/ashenden/compliant/ch_06_mact-br.vhd
4
3,200
-- Copyright (C) 1996 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 -- --------------------------------------------------------------------- -- -- $Id: ch_06_mact-br.vhd,v 1.3 2001-11-03 23:19:37 paw Exp $ -- $Revision: 1.3 $ -- -- --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; architecture bench_rtl of mac_test is signal clk, clr, ovf : std_ulogic := '0'; signal x_real, x_imag, y_real, y_imag, s_real, s_imag : std_ulogic_vector(15 downto 0); type complex is record re, im : real; end record; signal x, y, s : complex := (0.0, 0.0); constant Tpw_clk : time := 50 ns; begin x_real_converter : entity work.to_vector(behavioral) port map (x.re, x_real); x_imag_converter : entity work.to_vector(behavioral) port map (x.im, x_imag); y_real_converter : entity work.to_vector(behavioral) port map (y.re, y_real); y_imag_converter : entity work.to_vector(behavioral) port map (y.im, y_imag); dut : entity work.mac(rtl) port map (clk, clr, x_real, x_imag, y_real, y_imag, s_real, s_imag, ovf ); s_real_converter : entity work.to_fp(behavioral) port map (s_real, s.re); s_imag_converter : entity work.to_fp(behavioral) port map (s_imag, s.im); clock_gen : process is begin clk <= '1' after Tpw_clk, '0' after 2 * Tpw_clk; wait for 2 * Tpw_clk; end process clock_gen; stimulus : process is begin -- first sequence clr <= '1'; wait until clk = '0'; x <= (+0.5, +0.5); y <= (+0.5, +0.5); clr <= '1'; wait until clk = '0'; x <= (+0.2, +0.2); y <= (+0.2, +0.2); clr <= '1'; wait until clk = '0'; x <= (+0.1, -0.1); y <= (+0.1, +0.1); clr <= '1'; wait until clk = '0'; x <= (+0.1, -0.1); y <= (+0.1, +0.1); clr <= '0'; wait until clk = '0'; -- should be (0.4, 0.58) when it falls out the other end clr <= '0'; wait until clk = '0'; x <= ( 0.5, 0.5); y <= ( 0.5, 0.5); clr <= '0'; wait until clk = '0'; x <= ( 0.5, 0.5); y <= ( 0.1, 0.1); clr <= '0'; wait until clk = '0'; x <= ( 0.5, 0.5); y <= ( 0.5, 0.5); clr <= '1'; wait until clk = '0'; x <= (-0.5, 0.5); y <= (-0.5, 0.5); clr <= '0'; wait until clk = '0'; clr <= '0'; wait until clk = '0'; clr <= '0'; wait until clk = '0'; clr <= '0'; wait until clk = '0'; clr <= '1'; wait until clk = '0'; wait; end process stimulus; end architecture bench_rtl;
gpl-2.0
19e579506449d31a460a19e2cedc4b2e
0.55875
2.985075
false
false
false
false
tgingold/ghdl
testsuite/gna/issue301/src/generic_sp_ram.vhd
1
2,057
--! --! Copyright (C) 2010 - 2012 Creonic GmbH --! --! This file is part of the Creonic Viterbi Decoder, which is distributed --! under the terms of the GNU General Public License version 2. --! --! @file --! @brief Generic single port RAM with a single read/write port --! @author Matthias Alles --! @date 2010/09/28 --! library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library dec_viterbi; use dec_viterbi.pkg_helper.all; entity generic_sp_ram is generic( DISTR_RAM : boolean := false; WORDS : integer := 8; BITWIDTH : integer := 8 ); port( clk : in std_logic; rst : in std_logic; wen : in std_logic; en : in std_logic; a : in std_logic_vector(no_bits_natural(WORDS - 1) - 1 downto 0); d : in std_logic_vector(BITWIDTH - 1 downto 0); q : out std_logic_vector(BITWIDTH - 1 downto 0) ); end generic_sp_ram; architecture rtl of generic_sp_ram is type t_ram is array(WORDS - 1 downto 0) of std_logic_vector(BITWIDTH - 1 downto 0); signal sp_ram : t_ram := (others => (others => '0')); function get_ram_style_xilinx(dist_ram : in boolean) return string is begin if dist_ram then return "pipe_distributed"; else return "block"; end if; end function; function get_ram_style_altera(dist_ram : in boolean) return string is begin if dist_ram then return "MLAB, no_rw_check"; else return "AUTO"; end if; end function; attribute RAM_STYLE : string; attribute RAM_STYLE of sp_ram : signal is get_ram_style_xilinx(DISTR_RAM); attribute ramstyle : string; attribute ramstyle of sp_ram : signal is get_ram_style_altera(DISTR_RAM); begin -- -- Do not register the address for reading, since the synthesis doesn't -- recognize then that this is a single-port RAM. -- pr_sp_ram_rw: process(clk) begin if rising_edge(clk) then if en = '1' then if wen = '1' then sp_ram(to_integer(UNSIGNED(a))) <= d; else q <= sp_ram(to_integer(UNSIGNED(a))); end if; end if; end if; end process pr_sp_ram_rw; end rtl;
gpl-2.0
d8d148f2e7af2c99f64999d5fffdefef
0.656296
2.963977
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/ashenden/compliant/ch_18_ch_18_06.vhd
4
3,594
-- Copyright (C) 1996 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 -- --------------------------------------------------------------------- -- -- $Id: ch_18_ch_18_06.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- entity ch_18_06 is end entity ch_18_06; ---------------------------------------------------------------- architecture test of ch_18_06 is type integer_file is file of integer; begin process is -- code from book: file lookup_table_file, result_file : integer_file; -- end of code from book begin wait; end process; process is type element_type is (t1, t2, t3); -- code from book: type file_type is file of element_type; procedure file_open ( file f : file_type; external_name : in string; open_kind : in file_open_kind := read_mode ); -- end of code from book procedure file_open ( file f : file_type; external_name : in string; open_kind : in file_open_kind := read_mode ) is begin end; begin wait; end process; process is -- code from book: file lookup_table_file : integer_file open read_mode is "lookup-values"; -- end of code from book begin wait; end process; process is -- code from book: file lookup_table_file : integer_file; -- . . . -- end of code from book begin -- code from book: file_open ( lookup_table_file, external_name => "lookup-values", open_kind => read_mode ); -- end of code from book wait; end process; process is type element_type is (t1, t2, t3); type file_type is file of element_type; -- code from book: type file_open_status is (open_ok, status_error, name_error, mode_error); procedure file_open ( status : out file_open_status; file f : file_type; external_name : in string; open_kind : in file_open_kind := read_mode ); procedure file_close ( file f : file_type ); -- end of code from book procedure file_open ( status : out file_open_status; file f : file_type; external_name : in string; open_kind : in file_open_kind := read_mode ) is begin end; procedure file_close ( file f : file_type ) is begin end; begin wait; end process; end architecture test;
gpl-2.0
c7fe0ffe97d165d20197a0c4bca84e60
0.520868
4.464596
false
false
false
false
hubertokf/VHDL-Fast-Adders
CSA/16bits/CSA16bits/CSA16bits.vhd
1
3,730
-- Somador 8_bits -- LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY CSA16bits IS PORT ( CarryIn: in std_logic; val1,val2: in std_logic_vector (15 downto 0); SomaResult: out std_logic_vector (15 downto 0); rst:in std_logic; clk:in std_logic; CarryOut: out std_logic ); END CSA16bits ; ARCHITECTURE strc_CSA16bits OF CSA16bits IS SIGNAL Cin_sig, Cout_sig: STD_LOGIC; SIGNAL Outs10, Outs11, Outs20, Outs21, Outs30, Outs31, Outs40, Outs41: STD_LOGIC_VECTOR(3 DOWNTO 0); SIGNAL Couts10, Couts11, Couts20, Couts21, Couts30, Couts31, Couts40, Couts41: STD_LOGIC; SIGNAL sel1,sel2,sel3: STD_LOGIC; SIGNAL A_sig, B_sig, Out_sig: STD_LOGIC_VECTOR(15 DOWNTO 0); SIGNAL SomaT1,SomaT2,SomaT3,SomaT4:STD_LOGIC_VECTOR(3 DOWNTO 0); COMPONENT Reg1Bit port( valIn: in std_logic; clk: in std_logic; rst: in std_logic; valOut: out std_logic ); END COMPONENT ; COMPONENT Reg16Bit port( valIn: in std_logic_vector(15 downto 0); clk: in std_logic; rst: in std_logic; valOut: out std_logic_vector(15 downto 0) ); END COMPONENT ; COMPONENT RCA port ( CarryIn: in std_logic; val1,val2: in std_logic_vector (3 downto 0); SomaResult: out std_logic_vector (3 downto 0); CarryOut: out std_logic ); END COMPONENT ; COMPONENT mux84 port ( In0, In1: in std_logic_vector(3 downto 0); sel: in std_logic; Outs : out std_logic_vector(3 downto 0) ); END COMPONENT ; BEGIN --registradores-- Reg_CarryIn: Reg1Bit PORT MAP ( valIn=>CarryIn, clk=>clk, rst=>rst, valOut=>Cin_sig ); Reg_A: Reg16Bit PORT MAP ( valIn=>val1, clk=>clk, rst=>rst, valOut=>A_sig ); Reg_B: Reg16Bit PORT MAP ( valIn=>val2, clk=>clk, rst=>rst, valOut=>B_sig ); Reg_CarryOut: Reg1Bit PORT MAP ( valIn=>Cout_sig, clk=>clk, rst=>rst, valOut=>CarryOut ); Reg_Ssoma: Reg16Bit PORT MAP ( valIn=>Out_sig, clk=>clk, rst=>rst, valOut=>SomaResult ); Som10: RCA PORT MAP ( val1 => A_sig(3 DOWNTO 0), val2 => B_sig(3 DOWNTO 0), CarryIn=>'0', CarryOut=>Couts10, SomaResult=>Outs10 ); Som11: RCA PORT MAP ( val1 => A_sig(3 DOWNTO 0), val2 => B_sig(3 DOWNTO 0), CarryIn=>'1', CarryOut=>Couts11, SomaResult=>Outs11 ); Mux1: mux84 PORT MAP ( In1=>Outs11, In0=>Outs10, sel=>Cin_sig, Outs=>SomaT1 ); sel1 <= Couts10 OR (Couts11 AND Cin_sig); Som20: RCA PORT MAP ( val1 => A_sig(7 DOWNTO 4), val2 => B_sig(7 DOWNTO 4), CarryIn=>'0', CarryOut=>Couts20, SomaResult=>Outs20 ); Som21: RCA PORT MAP ( val1 => A_sig(7 DOWNTO 4), val2 => B_sig(7 DOWNTO 4), CarryIn=>'1', CarryOut=>Couts21, SomaResult=>Outs21 ); Mux2: mux84 PORT MAP ( In1=>Outs21, In0=>Outs20, sel=>sel1, Outs=>SomaT2 ); sel2 <= Couts20 OR (Couts21 AND sel1); --asdfasdf Som30: RCA PORT MAP ( val1 => A_sig(11 DOWNTO 8), val2 => B_sig(11 DOWNTO 8), CarryIn=>'0', CarryOut=>Couts30, SomaResult=>Outs30 ); Som31: RCA PORT MAP ( val1 => A_sig(11 DOWNTO 8), val2 => B_sig(11 DOWNTO 8), CarryIn=>'1', CarryOut=>Couts31, SomaResult=>Outs31 ); Mux3: mux84 PORT MAP ( In1=>Outs31, In0=>Outs30, sel=>sel2, Outs=>SomaT3 ); sel3 <= Couts30 OR (Couts31 AND sel2); Som40: RCA PORT MAP ( val1 => A_sig(15 DOWNTO 12), val2 => B_sig(15 DOWNTO 12), CarryIn=>'0', CarryOut=>Couts40, SomaResult=>Outs40 ); Som41: RCA PORT MAP ( val1 => A_sig(15 DOWNTO 12), val2 => B_sig(15 DOWNTO 12), CarryIn=>'1', CarryOut=>Couts41, SomaResult=>Outs41 ); Mux4: mux84 PORT MAP ( In1=>Outs41, In0=>Outs40, sel=>sel3, Outs=>SomaT4 ); Cout_sig <= Couts40 OR (Couts41 AND sel3); Out_sig <= SomaT4 & SomaT3 & SomaT2 & SomaT1; END strc_CSA16bits ;
mit
e6a30d1ea2f63af08f67f6da5a48ded6
0.632976
2.563574
false
false
false
false
snow4life/PipelinedDLX
flip_flop.vhd
1
578
library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; use WORK.all; entity flip_flop is port( CK: in std_logic; RESET: in std_logic; ENABLE: in std_logic; D: in std_logic; Q: out std_logic); end flip_flop; architecture BEHAVIORAL of flip_flop is begin REGISTER_PROCESS: process(CK, RESET) begin if CK'event and CK='1' then -- positive edge triggered: if RESET='1' then -- active high reset Q <= '0'; else if ENABLE = '1' then Q <= D; end if; end if; end if; end process; end BEHAVIORAL;
lgpl-2.1
13ac21c686eba3af58ba672a555842f6
0.631488
2.639269
false
false
false
false
tgingold/ghdl
testsuite/synth/oper01/snum01.vhdl
1
429
entity snum01 is port (ok : out boolean); end snum01; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; architecture behav of snum01 is -- add uns uns constant a : unsigned (7 downto 0) := x"1e"; constant b : unsigned (3 downto 0) := x"2"; constant r1 : unsigned (7 downto 0) := a + b; signal er1 : unsigned (7 downto 0); begin er1 <= x"20"; -- ok <= r1 = x"20"; ok <= r1 = er1; end behav;
gpl-2.0
747a350822414d26baef8c6e5e9c6f7d
0.62704
2.822368
false
false
false
false
tgingold/ghdl
testsuite/synth/if01/tb_if02.vhdl
1
477
entity tb_if02 is end tb_if02; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_if02 is signal i, o: std_logic_vector(7 downto 0); signal s : std_logic; begin dut: entity work.if02 port map (i, s, o); process begin i <= b"01011010"; s <= '0'; wait for 1 ns; assert o = x"2d" severity failure; i <= b"01011010"; s <= '1'; wait for 1 ns; assert o = x"b4" severity failure; wait; end process; end behav;
gpl-2.0
198a1ed9c0b9caf957e27138816a86c5
0.603774
2.944444
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/ashenden/compliant/ch_14_fg_14_13.vhd
4
5,128
-- Copyright (C) 1996 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 -- --------------------------------------------------------------------- -- -- $Id: ch_14_fg_14_13.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; entity ms_flipflop is port ( phi1, phi2 : in std_logic; d : in std_logic; q : out std_logic ); end entity ms_flipflop; architecture normal_drive of ms_flipflop is signal master_d : std_logic; begin master_d <= d when phi1 = '1'; q <= master_d when phi2 = '1'; end architecture normal_drive; architecture high_drive of ms_flipflop is signal master_d : std_logic; begin master_d <= d when phi1 = '1'; q <= master_d when phi2 = '1'; end architecture high_drive; -- code from book library cell_lib; configuration last_high_drive of shift_reg is for cell_level -- workaround for MTI bug mt026 -- for reg_array ( 0 to parallel_data'length - 2 ) for reg_array ( 0 to 2 ) -- end workaround for first_cell for cell : master_slave_flipflop use entity cell_lib.ms_flipflop(normal_drive); end for; end for; for other_cell for cell : master_slave_flipflop use entity cell_lib.ms_flipflop(normal_drive); end for; end for; end for; -- workaround for MTI bug mt026 -- for reg_array ( parallel_data'length - 1 ) for reg_array ( 3 ) -- end workaround for other_cell for cell : master_slave_flipflop use entity cell_lib.ms_flipflop(high_drive); end for; end for; end for; end for; end configuration last_high_drive; -- end code from book library ieee; use ieee.std_logic_1164.all; entity fg_14_13 is end entity fg_14_13; architecture test of fg_14_13 is signal phi1, phi2, serial_data_in : std_logic := '0'; signal parallel_data : std_logic_vector(3 downto 0); begin dut : configuration work.last_high_drive port map ( phi1 => phi1, phi2 => phi2, serial_data_in => serial_data_in, parallel_data => parallel_data ); clock_gen : process is begin phi1 <= '1', '0' after 4 ns; phi2 <= '1' after 5 ns, '0' after 9 ns; wait for 10 ns; end process clock_gen; stimulus : process is begin serial_data_in <= '0'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '0'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '0'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '0'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '0'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '1'; wait until phi2 = '1'; serial_data_in <= '0'; wait; end process stimulus; end architecture test;
gpl-2.0
4082e66f226e8ce9409d5aca6a64ebd0
0.467434
4.455256
false
false
false
false
nickg/nvc
test/regress/vests11.vhd
1
5,816
-- 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: tc485.vhd,v 1.2 2001-10-26 16:29:55 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c03s02b01x01p19n01i00485ent_a IS PORT ( F1: OUT integer := 3; F2: INOUT integer := 3; F3: IN integer ); END c03s02b01x01p19n01i00485ent_a; architecture c03s02b01x01p19n01i00485ent_a of c03s02b01x01p19n01i00485ent_a is begin process begin wait for 1 ns; assert F3= 3 report"wrong initialization of F3 through type conversion" severity failure; assert F2 = 3 report"wrong initialization of F2 through type conversion" severity failure; wait; end process; end; ENTITY vests11 IS END vests11; ARCHITECTURE c03s02b01x01p19n01i00485arch OF vests11 IS type column is range 1 to 2; type row is range 1 to 8; type s2boolean_cons_vector is array (row,column) of boolean; type s2bit_cons_vector is array (row,column) of bit; type s2char_cons_vector is array (row,column) of character; type s2severity_level_cons_vector is array (row,column) of severity_level; type s2integer_cons_vector is array (row,column) of integer; type s2real_cons_vector is array (row,column) of real; type s2time_cons_vector is array (row,column) of time; type s2natural_cons_vector is array (row,column) of natural; type s2positive_cons_vector is array (row,column) of positive; type record_2cons_array is record a:s2boolean_cons_vector; b:s2bit_cons_vector; c:s2char_cons_vector; d:s2severity_level_cons_vector; e:s2integer_cons_vector; f:s2real_cons_vector; g:s2time_cons_vector; h:s2natural_cons_vector; i:s2positive_cons_vector; end record; 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 C41 : s2boolean_cons_vector := (others => (others => C1)); constant C42 : s2bit_cons_vector := (others => (others => C2)); constant C43 : s2char_cons_vector := (others => (others => C3)); constant C44 : s2severity_level_cons_vector := (others => (others => C4)); constant C45 : s2integer_cons_vector := (others => (others => C5)); constant C46 : s2real_cons_vector := (others => (others => C6)); constant C47 : s2time_cons_vector := (others => (others => C7)); constant C48 : s2natural_cons_vector := (others => (others => C8)); constant C49 : s2positive_cons_vector := (others => (others => C9)); constant C52 : record_2cons_array := (C41,C42,C43,C44,C45,C46,C47,C48,C49); type array_rec_2cons is array (integer range <>) of record_2cons_array; function resolution12(i:in array_rec_2cons) return record_2cons_array is variable temp : record_2cons_array := C52; begin return temp; end resolution12; subtype array_rec_2cons_state is resolution12 record_2cons_array; constant C66 : array_rec_2cons_state:= C52; function complex_scalar(s : array_rec_2cons_state) return integer is begin return 3; end complex_scalar; function scalar_complex(s : integer) return array_rec_2cons_state is begin return C66; end scalar_complex; component c03s02b01x01p19n01i00485ent_a1 PORT ( F1: OUT integer; F2: INOUT integer; F3: IN integer ); end component; for T1 : c03s02b01x01p19n01i00485ent_a1 use entity work.c03s02b01x01p19n01i00485ent_a(c03s02b01x01p19n01i00485ent_a); signal S1 : array_rec_2cons_state; signal S2 : array_rec_2cons_state; signal S3 : array_rec_2cons_state:= C66; BEGIN T1: c03s02b01x01p19n01i00485ent_a1 port map ( scalar_complex(F1) => S1, scalar_complex(F2) => complex_scalar(S2), F3 => complex_scalar(S3) ); TESTING: PROCESS BEGIN wait for 1 ns; assert NOT((S1 = C66) and (S2 = C66)) report "***PASSED TEST: c03s02b01x01p19n01i00485" severity NOTE; assert ((S1 = C66) and (S2 = C66)) report "***FAILED TEST: c03s02b01x01p19n01i00485 - For an interface object of mode out, buffer, inout, or linkage, if the formal part includes a type conversion function, then the parameter subtype of that function must be a constrained array subtype." severity ERROR; wait; END PROCESS TESTING; END c03s02b01x01p19n01i00485arch;
gpl-3.0
08e6e7954e93b65592e8ff61df807b58
0.634285
3.395213
false
false
false
false
tgingold/ghdl
testsuite/gna/bug037/sim_protected.v08.vhdl
2
7,877
-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -- vim: tabstop=2:shiftwidth=2:noexpandtab -- kate: tab-width 2; replace-tabs off; indent-width 2; -- -- ============================================================================= -- Authors: Patrick Lehmann -- Thomas B. Preusser -- -- Package: Simulation constants, functions and utilities. -- -- Description: -- ------------------------------------ -- TODO -- -- License: -- ============================================================================= -- Copyright 2007-2016 Technische Universitaet Dresden - Germany -- Chair for VLSI-Design, Diagnostics and Architecture -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ============================================================================= use STD.TextIO.all; library IEEE; use IEEE.STD_LOGIC_1164.all; library PoC; use PoC.utils.all; use PoC.strings.all; use PoC.vectors.all; use PoC.physical.all; use PoC.sim_types.all; package sim_protected is -- Simulation Task and Status Management -- =========================================================================== type T_SIM_STATUS is protected -- Initializer and Finalizer procedure initialize; procedure finalize; -- Assertions procedure fail(Message : STRING := ""); procedure assertion(Condition : BOOLEAN; Message : STRING := ""); procedure writeMessage(Message : STRING); procedure writeReport; -- Process Management -- impure function registerProcess(Name : STRING; InstanceName : STRING) return T_SIM_PROCESS_ID; impure function registerProcess(Name : STRING) return T_SIM_PROCESS_ID; procedure deactivateProcess(procID : T_SIM_PROCESS_ID); -- Test Management impure function createTest(Name : STRING) return T_SIM_TEST_ID; -- Run Management procedure stopAllClocks; impure function isStopped return BOOLEAN; end protected; end package; package body sim_protected is -- Simulation process and Status Management -- =========================================================================== type T_SIM_STATUS is protected body -- status variable IsInitialized : BOOLEAN := FALSE; variable IsFinalized : BOOLEAN := FALSE; -- Internal state variable to log a failure condition for final reporting. -- Once de-asserted, this variable will never return to a value of true. variable Passed : BOOLEAN := TRUE; variable AssertCount : NATURAL := 0; variable FailedAssertCount : NATURAL := 0; -- Clock Management variable MainClockEnable : BOOLEAN := TRUE; -- Process Management variable ProcessCount : NATURAL := 0; variable ActiveProcessCount : NATURAL := 0; variable Processes : T_SIM_PROCESS_VECTOR(T_SIM_PROCESS_ID); -- Test Management variable TestCount : NATURAL := 0; variable Tests : T_SIM_TEST_VECTOR(T_SIM_TEST_ID); -- Initializer procedure initialize is begin IsInitialized := TRUE; end procedure; procedure finalize is begin if (IsFinalized = FALSE) then if (ActiveProcessCount = 0) then writeReport; IsFinalized := TRUE; end if; end if; end procedure; procedure fail(Message : STRING := "") is begin if (Message'length > 0) then report Message severity ERROR; end if; Passed := FALSE; end procedure; procedure assertion(condition : BOOLEAN; Message : STRING := "") is begin AssertCount := AssertCount + 1; if (condition = FALSE) then fail(Message); FailedAssertCount := FailedAssertCount + 1; end if; end procedure; procedure writeMessage(Message : STRING) is variable LineBuffer : LINE; begin write(LineBuffer, Message); writeline(output, LineBuffer); end procedure; procedure writeReport is variable LineBuffer : LINE; begin write(LineBuffer, (CR & STRING'("========================================"))); write(LineBuffer, (CR & STRING'("POC TESTBENCH REPORT"))); write(LineBuffer, (CR & STRING'("========================================"))); write(LineBuffer, (CR & STRING'("Assertions ") & INTEGER'image(AssertCount))); write(LineBuffer, (CR & STRING'(" failed ") & INTEGER'image(FailedAssertCount))); write(LineBuffer, (CR & STRING'("Processes ") & INTEGER'image(ProcessCount))); write(LineBuffer, (CR & STRING'(" active ") & INTEGER'image(ActiveProcessCount))); for i in 0 to ProcessCount - 1 loop if (Processes(i).Status = SIM_PROCESS_STATUS_ACTIVE) then write(LineBuffer, (CR & STRING'(" ") & str_trim(Processes(i).Name))); end if; end loop; write(LineBuffer, (CR & STRING'("Tests ") & INTEGER'image(TestCount))); for i in 0 to TestCount - 1 loop write(LineBuffer, (CR & STRING'(" ") & str_ralign(INTEGER'image(i), log10ceil(T_SIM_TEST_ID'high)) & ": " & str_trim(Tests(i).Name))); end loop; write(LineBuffer, (CR & STRING'("========================================"))); if (AssertCount = 0) then write(LineBuffer, (CR & STRING'("SIMULATION RESULT = NO ASSERTS"))); elsif (Passed = TRUE) then write(LineBuffer, (CR & STRING'("SIMULATION RESULT = PASSED"))); else write(LineBuffer, (CR & STRING'("SIMULATION RESULT = FAILED"))); end if; write(LineBuffer, (CR & STRING'("========================================"))); writeline(output, LineBuffer); end procedure; -- impure function registerProcess(Name : STRING; InstanceName : STRING) return T_SIM_PROCESS_ID is impure function registerProcess(Name : STRING) return T_SIM_PROCESS_ID is variable Proc : T_SIM_PROCESS; begin Proc.ID := ProcessCount; Proc.Name := resize(Name, T_SIM_PROCESS_NAME'length); -- Proc.InstanceName := resize(InstanceName, T_SIM_PROCESS_INSTNAME'length); Proc.Status := SIM_PROCESS_STATUS_ACTIVE; Processes(Proc.ID) := Proc; ProcessCount := ProcessCount + 1; ActiveProcessCount := ActiveProcessCount + 1; return Proc.ID; end function; procedure deactivateProcess(ProcID : T_SIM_PROCESS_ID) is variable hasActiveProcesses : BOOLEAN := FALSE; begin if (ProcID < ProcessCount) then if (Processes(ProcID).Status = SIM_PROCESS_STATUS_ACTIVE) then Processes(ProcID).Status := SIM_PROCESS_STATUS_ENDED; ActiveProcessCount := ActiveProcessCount - 1; end if; end if; if (ActiveProcessCount = 0) then stopAllClocks; end if; end procedure; impure function createTest(Name : STRING) return T_SIM_TEST_ID is variable Test : T_SIM_TEST; begin Test.ID := TestCount; Test.Name := resize(Name, T_SIM_TEST_NAME'length); Test.Status := SIM_TEST_STATUS_ACTIVE; Tests(Test.ID) := Test; TestCount := TestCount + 1; return Test.ID; end function; procedure stopAllClocks is begin MainClockEnable := FALSE; end procedure; impure function isStopped return BOOLEAN is begin return not MainClockEnable; end function; end protected body; end package body;
gpl-2.0
6afb2da6f0c329d52b067db33fe2ec16
0.597689
3.970262
false
true
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_dma_v7_1/hdl/src/vhdl/axi_dma_rst_module.vhd
3
24,259
-- (c) Copyright 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_dma_rst_module.vhd -- Description: This entity is the top level reset module entity for the -- AXI VDMA core. -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library unisim; use unisim.vcomponents.all; library axi_dma_v7_1_9; use axi_dma_v7_1_9.axi_dma_pkg.all; library lib_cdc_v1_0_2; ------------------------------------------------------------------------------- entity axi_dma_rst_module is generic( C_INCLUDE_MM2S : integer range 0 to 1 := 1; -- Include or exclude MM2S primary data path -- 0 = Exclude MM2S primary data path -- 1 = Include MM2S primary data path C_INCLUDE_S2MM : integer range 0 to 1 := 1; -- Include or exclude S2MM primary data path -- 0 = Exclude S2MM primary data path -- 1 = Include S2MM primary data path C_INCLUDE_SG : integer range 0 to 1 := 1; -- Include or Exclude the Scatter Gather Engine -- 0 = Exclude SG Engine - Enables Simple DMA Mode -- 1 = Include SG Engine - Enables Scatter Gather Mode C_SG_INCLUDE_STSCNTRL_STRM : integer range 0 to 1 := 1; -- Include or Exclude AXI Status and AXI Control Streams -- 0 = Exclude Status and Control Streams -- 1 = Include Status and Control Streams C_PRMRY_IS_ACLK_ASYNC : integer range 0 to 1 := 0; -- Primary MM2S/S2MM sync/async mode -- 0 = synchronous mode - all clocks are synchronous -- 1 = asynchronous mode - Primary data path channels (MM2S and S2MM) -- run asynchronous to AXI Lite, DMA Control, -- and SG. C_M_AXI_MM2S_ACLK_FREQ_HZ : integer := 100000000; -- Primary clock frequency in hertz C_M_AXI_S2MM_ACLK_FREQ_HZ : integer := 100000000; -- Primary clock frequency in hertz C_M_AXI_SG_ACLK_FREQ_HZ : integer := 100000000 -- Scatter Gather clock frequency in hertz ); port ( ----------------------------------------------------------------------- -- Clock Sources ----------------------------------------------------------------------- s_axi_lite_aclk : in std_logic ; m_axi_sg_aclk : in std_logic ; -- m_axi_mm2s_aclk : in std_logic ; -- m_axi_s2mm_aclk : in std_logic ; -- -- ----------------------------------------------------------------------- -- -- Hard Reset -- ----------------------------------------------------------------------- -- axi_resetn : in std_logic ; -- ----------------------------------------------------------------------- -- -- Soft Reset -- ----------------------------------------------------------------------- -- soft_reset : in std_logic ; -- soft_reset_clr : out std_logic := '0' ; -- -- ----------------------------------------------------------------------- -- -- MM2S Soft Reset Support -- ----------------------------------------------------------------------- -- mm2s_all_idle : in std_logic ; -- mm2s_stop : in std_logic ; -- mm2s_halt : out std_logic := '0' ; -- mm2s_halt_cmplt : in std_logic ; -- -- ----------------------------------------------------------------------- -- -- S2MM Soft Reset Support -- ----------------------------------------------------------------------- -- s2mm_all_idle : in std_logic ; -- s2mm_stop : in std_logic ; -- s2mm_halt : out std_logic := '0' ; -- s2mm_halt_cmplt : in std_logic ; -- -- ----------------------------------------------------------------------- -- -- MM2S Distributed Reset Out -- ----------------------------------------------------------------------- -- -- AXI DataMover Primary Reset (Raw) -- dm_mm2s_prmry_resetn : out std_logic := '1' ; -- -- AXI DataMover Secondary Reset (Raw) -- dm_mm2s_scndry_resetn : out std_logic := '1' ; -- AXI Stream Primary Reset Outputs -- mm2s_prmry_reset_out_n : out std_logic := '1' ; -- -- AXI Stream Control Reset Outputs -- mm2s_cntrl_reset_out_n : out std_logic := '1' ; -- -- AXI Secondary reset mm2s_scndry_resetn : out std_logic := '1' ; -- -- AXI Upsizer and Line Buffer -- mm2s_prmry_resetn : out std_logic := '1' ; -- -- -- ----------------------------------------------------------------------- -- -- S2MM Distributed Reset Out -- ----------------------------------------------------------------------- -- -- AXI DataMover Primary Reset (Raw) -- dm_s2mm_prmry_resetn : out std_logic := '1' ; -- -- AXI DataMover Secondary Reset (Raw) -- dm_s2mm_scndry_resetn : out std_logic := '1' ; -- AXI Stream Primary Reset Outputs -- s2mm_prmry_reset_out_n : out std_logic := '1' ; -- -- AXI Stream Control Reset Outputs -- s2mm_sts_reset_out_n : out std_logic := '1' ; -- -- AXI Secondary reset s2mm_scndry_resetn : out std_logic := '1' ; -- -- AXI Upsizer and Line Buffer -- s2mm_prmry_resetn : out std_logic := '1' ; -- ----------------------------------------------------------------------- -- -- Scatter Gather Distributed Reset Out ----------------------------------------------------------------------- -- -- AXI Scatter Gather Reset Out m_axi_sg_aresetn : out std_logic := '1' ; -- -- AXI Scatter Gather Datamover Reset Out dm_m_axi_sg_aresetn : out std_logic := '1' ; -- ----------------------------------------------------------------------- -- -- Hard Reset Out -- ----------------------------------------------------------------------- -- m_axi_sg_hrdresetn : out std_logic := '1' ; -- s_axi_lite_resetn : out std_logic := '1' -- ); Attribute KEEP : string; -- declaration Attribute EQUIVALENT_REGISTER_REMOVAL : string; -- declaration Attribute KEEP of s_axi_lite_resetn : signal is "TRUE"; Attribute KEEP of m_axi_sg_hrdresetn : signal is "TRUE"; Attribute EQUIVALENT_REGISTER_REMOVAL of s_axi_lite_resetn : signal is "no"; Attribute EQUIVALENT_REGISTER_REMOVAL of m_axi_sg_hrdresetn : signal is "no"; end axi_dma_rst_module; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_dma_rst_module is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- No Constants Declared ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- ATTRIBUTE async_reg : STRING; signal hrd_resetn_i_cdc_tig : std_logic := '1'; signal hrd_resetn_i_d1_cdc_tig : std_logic := '1'; --ATTRIBUTE async_reg OF hrd_resetn_i_cdc_tig : SIGNAL IS "true"; --ATTRIBUTE async_reg OF hrd_resetn_i_d1_cdc_tig : SIGNAL IS "true"; -- Soft reset support signal mm2s_soft_reset_clr : std_logic := '0'; signal s2mm_soft_reset_clr : std_logic := '0'; signal soft_reset_clr_i : std_logic := '0'; signal mm2s_soft_reset_done : std_logic := '0'; signal s2mm_soft_reset_done : std_logic := '0'; signal mm2s_scndry_resetn_i : std_logic := '0'; signal s2mm_scndry_resetn_i : std_logic := '0'; signal dm_mm2s_scndry_resetn_i : std_logic := '0'; signal dm_s2mm_scndry_resetn_i : std_logic := '0'; signal sg_hard_reset : std_logic := '0'; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin -- Register hard reset in REG_HRD_RST : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => axi_resetn, prmry_vect_in => (others => '0'), scndry_aclk => m_axi_sg_aclk, scndry_resetn => '0', scndry_out => sg_hard_reset, scndry_vect_out => open ); m_axi_sg_hrdresetn <= sg_hard_reset; --REG_HRD_RST : process(m_axi_sg_aclk) -- begin -- if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then -- hrd_resetn_i_cdc_tig <= axi_resetn; -- m_axi_sg_hrdresetn <= hrd_resetn_i_cdc_tig; -- end if; -- end process REG_HRD_RST; -- Regsiter hard reset out for axi lite interface REG_HRD_RST_OUT : entity lib_cdc_v1_0_2.cdc_sync generic map ( C_CDC_TYPE => 1, C_RESET_STATE => 0, C_SINGLE_BIT => 1, C_VECTOR_WIDTH => 32, C_MTBF_STAGES => MTBF_STAGES ) port map ( prmry_aclk => '0', prmry_resetn => '0', prmry_in => axi_resetn, prmry_vect_in => (others => '0'), scndry_aclk => s_axi_lite_aclk, scndry_resetn => '0', scndry_out => s_axi_lite_resetn, scndry_vect_out => open ); --REG_HRD_RST_OUT : process(s_axi_lite_aclk) -- begin -- if(s_axi_lite_aclk'EVENT and s_axi_lite_aclk = '1')then -- hrd_resetn_i_d1_cdc_tig <= hrd_resetn_i_cdc_tig; -- s_axi_lite_resetn <= hrd_resetn_i_d1_cdc_tig; -- end if; -- end process REG_HRD_RST_OUT; dm_mm2s_scndry_resetn <= dm_mm2s_scndry_resetn_i; dm_s2mm_scndry_resetn <= dm_s2mm_scndry_resetn_i; -- mm2s channel included therefore map secondary resets to -- from mm2s reset module to scatter gather interface (default) MAP_SG_FOR_BOTH : if C_INCLUDE_MM2S = 1 and C_INCLUDE_S2MM = 1 generate begin -- both must be low before sg reset is asserted. m_axi_sg_aresetn <= mm2s_scndry_resetn_i or s2mm_scndry_resetn_i; dm_m_axi_sg_aresetn <= dm_mm2s_scndry_resetn_i or dm_s2mm_scndry_resetn_i; end generate MAP_SG_FOR_BOTH; -- Only s2mm channel included therefore map secondary resets to -- from s2mm reset module to scatter gather interface MAP_SG_FOR_S2MM : if C_INCLUDE_MM2S = 0 and C_INCLUDE_S2MM = 1 generate begin m_axi_sg_aresetn <= s2mm_scndry_resetn_i; dm_m_axi_sg_aresetn <= dm_s2mm_scndry_resetn_i; end generate MAP_SG_FOR_S2MM; -- Only mm2s channel included therefore map secondary resets to -- from mm2s reset module to scatter gather interface MAP_SG_FOR_MM2S : if C_INCLUDE_MM2S = 1 and C_INCLUDE_S2MM = 0 generate begin m_axi_sg_aresetn <= mm2s_scndry_resetn_i; dm_m_axi_sg_aresetn <= dm_mm2s_scndry_resetn_i; end generate MAP_SG_FOR_MM2S; -- Invalid configuration for axi dma - simply here for completeness MAP_NO_SG : if C_INCLUDE_MM2S = 0 and C_INCLUDE_S2MM = 0 generate begin m_axi_sg_aresetn <= '1'; dm_m_axi_sg_aresetn <= '1'; end generate MAP_NO_SG; s2mm_scndry_resetn <= s2mm_scndry_resetn_i; mm2s_scndry_resetn <= mm2s_scndry_resetn_i; -- Generate MM2S reset signals GEN_RESET_FOR_MM2S : if C_INCLUDE_MM2S = 1 generate begin RESET_I : entity axi_dma_v7_1_9.axi_dma_reset generic map( C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_AXI_PRMRY_ACLK_FREQ_HZ => C_M_AXI_MM2S_ACLK_FREQ_HZ , C_AXI_SCNDRY_ACLK_FREQ_HZ => C_M_AXI_SG_ACLK_FREQ_HZ , C_SG_INCLUDE_STSCNTRL_STRM => C_SG_INCLUDE_STSCNTRL_STRM , C_INCLUDE_SG => C_INCLUDE_SG ) port map( -- Clock Sources m_axi_sg_aclk => m_axi_sg_aclk , axi_prmry_aclk => m_axi_mm2s_aclk , -- Hard Reset axi_resetn => sg_hard_reset , -- Soft Reset soft_reset => soft_reset , soft_reset_clr => mm2s_soft_reset_clr , soft_reset_done => soft_reset_clr_i , all_idle => mm2s_all_idle , stop => mm2s_stop , halt => mm2s_halt , halt_cmplt => mm2s_halt_cmplt , -- Secondary Reset scndry_resetn => mm2s_scndry_resetn_i , -- AXI Upsizer and Line Buffer prmry_resetn => mm2s_prmry_resetn , -- AXI DataMover Primary Reset (Raw) dm_prmry_resetn => dm_mm2s_prmry_resetn , -- AXI DataMover Secondary Reset (Raw) dm_scndry_resetn => dm_mm2s_scndry_resetn_i , -- AXI Stream Primary Reset Outputs prmry_reset_out_n => mm2s_prmry_reset_out_n , -- AXI Stream Alternate Reset Outputs altrnt_reset_out_n => mm2s_cntrl_reset_out_n ); -- Sample an hold mm2s soft reset done to use in -- combined reset done to DMACR MM2S_SOFT_RST_DONE : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(sg_hard_reset = '0' or soft_reset_clr_i = '1')then mm2s_soft_reset_done <= '0'; elsif(mm2s_soft_reset_clr = '1')then mm2s_soft_reset_done <= '1'; end if; end if; end process MM2S_SOFT_RST_DONE; end generate GEN_RESET_FOR_MM2S; -- No MM2S therefore tie off mm2s reset signals GEN_NO_RESET_FOR_MM2S : if C_INCLUDE_MM2S = 0 generate begin mm2s_prmry_reset_out_n <= '1'; mm2s_cntrl_reset_out_n <= '1'; dm_mm2s_scndry_resetn_i <= '1'; dm_mm2s_prmry_resetn <= '1'; mm2s_prmry_resetn <= '1'; mm2s_scndry_resetn_i <= '1'; mm2s_halt <= '0'; mm2s_soft_reset_clr <= '0'; mm2s_soft_reset_done <= '1'; end generate GEN_NO_RESET_FOR_MM2S; -- Generate S2MM reset signals GEN_RESET_FOR_S2MM : if C_INCLUDE_S2MM = 1 generate begin RESET_I : entity axi_dma_v7_1_9.axi_dma_reset generic map( C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_AXI_PRMRY_ACLK_FREQ_HZ => C_M_AXI_S2MM_ACLK_FREQ_HZ , C_AXI_SCNDRY_ACLK_FREQ_HZ => C_M_AXI_SG_ACLK_FREQ_HZ , C_SG_INCLUDE_STSCNTRL_STRM => C_SG_INCLUDE_STSCNTRL_STRM , C_INCLUDE_SG => C_INCLUDE_SG ) port map( -- Clock Sources m_axi_sg_aclk => m_axi_sg_aclk , axi_prmry_aclk => m_axi_s2mm_aclk , -- Hard Reset axi_resetn => sg_hard_reset , -- Soft Reset soft_reset => soft_reset , soft_reset_clr => s2mm_soft_reset_clr , soft_reset_done => soft_reset_clr_i , all_idle => s2mm_all_idle , stop => s2mm_stop , halt => s2mm_halt , halt_cmplt => s2mm_halt_cmplt , -- Secondary Reset scndry_resetn => s2mm_scndry_resetn_i , -- AXI Upsizer and Line Buffer prmry_resetn => s2mm_prmry_resetn , -- AXI DataMover Primary Reset (Raw) dm_prmry_resetn => dm_s2mm_prmry_resetn , -- AXI DataMover Secondary Reset (Raw) dm_scndry_resetn => dm_s2mm_scndry_resetn_i , -- AXI Stream Primary Reset Outputs prmry_reset_out_n => s2mm_prmry_reset_out_n , -- AXI Stream Alternate Reset Outputs altrnt_reset_out_n => s2mm_sts_reset_out_n ); -- Sample an hold s2mm soft reset done to use in -- combined reset done to DMACR S2MM_SOFT_RST_DONE : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(sg_hard_reset = '0' or soft_reset_clr_i = '1')then s2mm_soft_reset_done <= '0'; elsif(s2mm_soft_reset_clr = '1')then s2mm_soft_reset_done <= '1'; end if; end if; end process S2MM_SOFT_RST_DONE; end generate GEN_RESET_FOR_S2MM; -- No SsMM therefore tie off mm2s reset signals GEN_NO_RESET_FOR_S2MM : if C_INCLUDE_S2MM = 0 generate begin s2mm_prmry_reset_out_n <= '1'; dm_s2mm_scndry_resetn_i <= '1'; dm_s2mm_prmry_resetn <= '1'; s2mm_prmry_resetn <= '1'; s2mm_scndry_resetn_i <= '1'; s2mm_halt <= '0'; s2mm_soft_reset_clr <= '0'; s2mm_soft_reset_done <= '1'; end generate GEN_NO_RESET_FOR_S2MM; -- When both mm2s and s2mm are done then drive soft reset clear and -- also clear s_h registers above soft_reset_clr_i <= s2mm_soft_reset_done and mm2s_soft_reset_done; soft_reset_clr <= soft_reset_clr_i; end implementation;
gpl-3.0
f3051efdf74a180a1b944a495da53b64
0.421946
4.422789
false
false
false
false
stanford-ppl/spatial-lang
spatial/core/resources/chiselgen/template-level/fringeArria10/build/ip/ghrd_10as066n2/ghrd_10as066n2_ocm_0/ghrd_10as066n2_ocm_0_inst.vhd
1
1,408
component ghrd_10as066n2_ocm_0 is port ( clk : in std_logic := 'X'; -- clk reset : in std_logic := 'X'; -- reset reset_req : in std_logic := 'X'; -- reset_req address : in std_logic_vector(17 downto 0) := (others => 'X'); -- address clken : in std_logic := 'X'; -- clken chipselect : in std_logic := 'X'; -- chipselect write : in std_logic := 'X'; -- write readdata : out std_logic_vector(7 downto 0); -- readdata writedata : in std_logic_vector(7 downto 0) := (others => 'X') -- writedata ); end component ghrd_10as066n2_ocm_0; u0 : component ghrd_10as066n2_ocm_0 port map ( clk => CONNECTED_TO_clk, -- clk1.clk reset => CONNECTED_TO_reset, -- reset1.reset reset_req => CONNECTED_TO_reset_req, -- .reset_req address => CONNECTED_TO_address, -- s1.address clken => CONNECTED_TO_clken, -- .clken chipselect => CONNECTED_TO_chipselect, -- .chipselect write => CONNECTED_TO_write, -- .write readdata => CONNECTED_TO_readdata, -- .readdata writedata => CONNECTED_TO_writedata -- .writedata );
mit
10c0f0713794d14ea4714d8d5ac0c653
0.46946
3.528822
false
false
false
false
tgingold/ghdl
testsuite/synth/dff01/tb_dff02.vhdl
1
887
entity tb_dff02 is end tb_dff02; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_dff02 is signal clk : std_logic; signal rstn : std_logic; signal din : std_logic; signal dout : std_logic; begin dut: entity work.dff02 port map ( q => dout, d => din, clk => clk, rstn => rstn); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin rstn <= '0'; wait for 1 ns; assert dout = '0' severity failure; rstn <= '1'; din <= '1'; pulse; assert dout = '1' severity failure; din <= '0'; pulse; assert dout = '0' severity failure; din <= '1'; pulse; assert dout = '1' severity failure; rstn <= '0'; wait for 1 ns; assert dout = '0' severity failure; wait; end process; end behav;
gpl-2.0
f6a0d0514f84f0d1fffcc70a32e3f446
0.554679
3.372624
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado_HLS/image_contrast_adj/solution1/impl/vhdl/project.srcs/sources_1/ip/doHistStretch_ap_fmul_2_max_dsp_32/synth/doHistStretch_ap_fmul_2_max_dsp_32.vhd
1
12,800
-- (c) Copyright 1995-2016 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. -- -- DO NOT MODIFY THIS FILE. -- IP VLNV: xilinx.com:ip:floating_point:7.1 -- IP Revision: 2 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY floating_point_v7_1_2; USE floating_point_v7_1_2.floating_point_v7_1_2; ENTITY doHistStretch_ap_fmul_2_max_dsp_32 IS PORT ( aclk : IN STD_LOGIC; aclken : IN STD_LOGIC; s_axis_a_tvalid : IN STD_LOGIC; s_axis_a_tdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axis_b_tvalid : IN STD_LOGIC; s_axis_b_tdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); m_axis_result_tvalid : OUT STD_LOGIC; m_axis_result_tdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) ); END doHistStretch_ap_fmul_2_max_dsp_32; ARCHITECTURE doHistStretch_ap_fmul_2_max_dsp_32_arch OF doHistStretch_ap_fmul_2_max_dsp_32 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : STRING; ATTRIBUTE DowngradeIPIdentifiedWarnings OF doHistStretch_ap_fmul_2_max_dsp_32_arch: ARCHITECTURE IS "yes"; COMPONENT floating_point_v7_1_2 IS GENERIC ( C_XDEVICEFAMILY : STRING; C_HAS_ADD : INTEGER; C_HAS_SUBTRACT : INTEGER; C_HAS_MULTIPLY : INTEGER; C_HAS_DIVIDE : INTEGER; C_HAS_SQRT : INTEGER; C_HAS_COMPARE : INTEGER; C_HAS_FIX_TO_FLT : INTEGER; C_HAS_FLT_TO_FIX : INTEGER; C_HAS_FLT_TO_FLT : INTEGER; C_HAS_RECIP : INTEGER; C_HAS_RECIP_SQRT : INTEGER; C_HAS_ABSOLUTE : INTEGER; C_HAS_LOGARITHM : INTEGER; C_HAS_EXPONENTIAL : INTEGER; C_HAS_FMA : INTEGER; C_HAS_FMS : INTEGER; C_HAS_ACCUMULATOR_A : INTEGER; C_HAS_ACCUMULATOR_S : INTEGER; C_A_WIDTH : INTEGER; C_A_FRACTION_WIDTH : INTEGER; C_B_WIDTH : INTEGER; C_B_FRACTION_WIDTH : INTEGER; C_C_WIDTH : INTEGER; C_C_FRACTION_WIDTH : INTEGER; C_RESULT_WIDTH : INTEGER; C_RESULT_FRACTION_WIDTH : INTEGER; C_COMPARE_OPERATION : INTEGER; C_LATENCY : INTEGER; C_OPTIMIZATION : INTEGER; C_MULT_USAGE : INTEGER; C_BRAM_USAGE : INTEGER; C_RATE : INTEGER; C_ACCUM_INPUT_MSB : INTEGER; C_ACCUM_MSB : INTEGER; C_ACCUM_LSB : INTEGER; C_HAS_UNDERFLOW : INTEGER; C_HAS_OVERFLOW : INTEGER; C_HAS_INVALID_OP : INTEGER; C_HAS_DIVIDE_BY_ZERO : INTEGER; C_HAS_ACCUM_OVERFLOW : INTEGER; C_HAS_ACCUM_INPUT_OVERFLOW : INTEGER; C_HAS_ACLKEN : INTEGER; C_HAS_ARESETN : INTEGER; C_THROTTLE_SCHEME : INTEGER; C_HAS_A_TUSER : INTEGER; C_HAS_A_TLAST : INTEGER; C_HAS_B : INTEGER; C_HAS_B_TUSER : INTEGER; C_HAS_B_TLAST : INTEGER; C_HAS_C : INTEGER; C_HAS_C_TUSER : INTEGER; C_HAS_C_TLAST : INTEGER; C_HAS_OPERATION : INTEGER; C_HAS_OPERATION_TUSER : INTEGER; C_HAS_OPERATION_TLAST : INTEGER; C_HAS_RESULT_TUSER : INTEGER; C_HAS_RESULT_TLAST : INTEGER; C_TLAST_RESOLUTION : INTEGER; C_A_TDATA_WIDTH : INTEGER; C_A_TUSER_WIDTH : INTEGER; C_B_TDATA_WIDTH : INTEGER; C_B_TUSER_WIDTH : INTEGER; C_C_TDATA_WIDTH : INTEGER; C_C_TUSER_WIDTH : INTEGER; C_OPERATION_TDATA_WIDTH : INTEGER; C_OPERATION_TUSER_WIDTH : INTEGER; C_RESULT_TDATA_WIDTH : INTEGER; C_RESULT_TUSER_WIDTH : INTEGER; C_FIXED_DATA_UNSIGNED : INTEGER ); PORT ( aclk : IN STD_LOGIC; aclken : IN STD_LOGIC; aresetn : IN STD_LOGIC; s_axis_a_tvalid : IN STD_LOGIC; s_axis_a_tready : OUT STD_LOGIC; s_axis_a_tdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axis_a_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); s_axis_a_tlast : IN STD_LOGIC; s_axis_b_tvalid : IN STD_LOGIC; s_axis_b_tready : OUT STD_LOGIC; s_axis_b_tdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axis_b_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); s_axis_b_tlast : IN STD_LOGIC; s_axis_c_tvalid : IN STD_LOGIC; s_axis_c_tready : OUT STD_LOGIC; s_axis_c_tdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axis_c_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); s_axis_c_tlast : IN STD_LOGIC; s_axis_operation_tvalid : IN STD_LOGIC; s_axis_operation_tready : OUT STD_LOGIC; s_axis_operation_tdata : IN STD_LOGIC_VECTOR(7 DOWNTO 0); s_axis_operation_tuser : IN STD_LOGIC_VECTOR(0 DOWNTO 0); s_axis_operation_tlast : IN STD_LOGIC; m_axis_result_tvalid : OUT STD_LOGIC; m_axis_result_tready : IN STD_LOGIC; m_axis_result_tdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); m_axis_result_tuser : OUT STD_LOGIC_VECTOR(0 DOWNTO 0); m_axis_result_tlast : OUT STD_LOGIC ); END COMPONENT floating_point_v7_1_2; ATTRIBUTE X_CORE_INFO : STRING; ATTRIBUTE X_CORE_INFO OF doHistStretch_ap_fmul_2_max_dsp_32_arch: ARCHITECTURE IS "floating_point_v7_1_2,Vivado 2016.1"; ATTRIBUTE CHECK_LICENSE_TYPE : STRING; ATTRIBUTE CHECK_LICENSE_TYPE OF doHistStretch_ap_fmul_2_max_dsp_32_arch : ARCHITECTURE IS "doHistStretch_ap_fmul_2_max_dsp_32,floating_point_v7_1_2,{}"; ATTRIBUTE CORE_GENERATION_INFO : STRING; ATTRIBUTE CORE_GENERATION_INFO OF doHistStretch_ap_fmul_2_max_dsp_32_arch: ARCHITECTURE IS "doHistStretch_ap_fmul_2_max_dsp_32,floating_point_v7_1_2,{x_ipProduct=Vivado 2016.1,x_ipVendor=xilinx.com,x_ipLibrary=ip,x_ipName=floating_point,x_ipVersion=7.1,x_ipCoreRevision=2,x_ipLanguage=VHDL,x_ipSimLanguage=MIXED,C_XDEVICEFAMILY=zynq,C_HAS_ADD=0,C_HAS_SUBTRACT=0,C_HAS_MULTIPLY=1,C_HAS_DIVIDE=0,C_HAS_SQRT=0,C_HAS_COMPARE=0,C_HAS_FIX_TO_FLT=0,C_HAS_FLT_TO_FIX=0,C_HAS_FLT_TO_FLT=0,C_HAS_RECIP=0,C_HAS_RECIP_SQRT=0,C_HAS_ABSOLUTE=0,C_HAS_LOGARITHM=0,C_HAS_EXPONENTIAL=0,C_HAS_FMA=0,C_HAS_FMS=0," & "C_HAS_ACCUMULATOR_A=0,C_HAS_ACCUMULATOR_S=0,C_A_WIDTH=32,C_A_FRACTION_WIDTH=24,C_B_WIDTH=32,C_B_FRACTION_WIDTH=24,C_C_WIDTH=32,C_C_FRACTION_WIDTH=24,C_RESULT_WIDTH=32,C_RESULT_FRACTION_WIDTH=24,C_COMPARE_OPERATION=8,C_LATENCY=2,C_OPTIMIZATION=1,C_MULT_USAGE=3,C_BRAM_USAGE=0,C_RATE=1,C_ACCUM_INPUT_MSB=32,C_ACCUM_MSB=32,C_ACCUM_LSB=-31,C_HAS_UNDERFLOW=0,C_HAS_OVERFLOW=0,C_HAS_INVALID_OP=0,C_HAS_DIVIDE_BY_ZERO=0,C_HAS_ACCUM_OVERFLOW=0,C_HAS_ACCUM_INPUT_OVERFLOW=0,C_HAS_ACLKEN=1,C_HAS_ARESETN=0,C_TH" & "ROTTLE_SCHEME=3,C_HAS_A_TUSER=0,C_HAS_A_TLAST=0,C_HAS_B=1,C_HAS_B_TUSER=0,C_HAS_B_TLAST=0,C_HAS_C=0,C_HAS_C_TUSER=0,C_HAS_C_TLAST=0,C_HAS_OPERATION=0,C_HAS_OPERATION_TUSER=0,C_HAS_OPERATION_TLAST=0,C_HAS_RESULT_TUSER=0,C_HAS_RESULT_TLAST=0,C_TLAST_RESOLUTION=0,C_A_TDATA_WIDTH=32,C_A_TUSER_WIDTH=1,C_B_TDATA_WIDTH=32,C_B_TUSER_WIDTH=1,C_C_TDATA_WIDTH=32,C_C_TUSER_WIDTH=1,C_OPERATION_TDATA_WIDTH=8,C_OPERATION_TUSER_WIDTH=1,C_RESULT_TDATA_WIDTH=32,C_RESULT_TUSER_WIDTH=1,C_FIXED_DATA_UNSIGNED=0}"; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 aclk_intf CLK"; ATTRIBUTE X_INTERFACE_INFO OF aclken: SIGNAL IS "xilinx.com:signal:clockenable:1.0 aclken_intf CE"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_a_tvalid: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_A TVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_a_tdata: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_A TDATA"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_b_tvalid: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_B TVALID"; ATTRIBUTE X_INTERFACE_INFO OF s_axis_b_tdata: SIGNAL IS "xilinx.com:interface:axis:1.0 S_AXIS_B TDATA"; ATTRIBUTE X_INTERFACE_INFO OF m_axis_result_tvalid: SIGNAL IS "xilinx.com:interface:axis:1.0 M_AXIS_RESULT TVALID"; ATTRIBUTE X_INTERFACE_INFO OF m_axis_result_tdata: SIGNAL IS "xilinx.com:interface:axis:1.0 M_AXIS_RESULT TDATA"; BEGIN U0 : floating_point_v7_1_2 GENERIC MAP ( C_XDEVICEFAMILY => "zynq", C_HAS_ADD => 0, C_HAS_SUBTRACT => 0, C_HAS_MULTIPLY => 1, C_HAS_DIVIDE => 0, C_HAS_SQRT => 0, C_HAS_COMPARE => 0, C_HAS_FIX_TO_FLT => 0, C_HAS_FLT_TO_FIX => 0, C_HAS_FLT_TO_FLT => 0, C_HAS_RECIP => 0, C_HAS_RECIP_SQRT => 0, C_HAS_ABSOLUTE => 0, C_HAS_LOGARITHM => 0, C_HAS_EXPONENTIAL => 0, C_HAS_FMA => 0, C_HAS_FMS => 0, C_HAS_ACCUMULATOR_A => 0, C_HAS_ACCUMULATOR_S => 0, C_A_WIDTH => 32, C_A_FRACTION_WIDTH => 24, C_B_WIDTH => 32, C_B_FRACTION_WIDTH => 24, C_C_WIDTH => 32, C_C_FRACTION_WIDTH => 24, C_RESULT_WIDTH => 32, C_RESULT_FRACTION_WIDTH => 24, C_COMPARE_OPERATION => 8, C_LATENCY => 2, C_OPTIMIZATION => 1, C_MULT_USAGE => 3, C_BRAM_USAGE => 0, C_RATE => 1, C_ACCUM_INPUT_MSB => 32, C_ACCUM_MSB => 32, C_ACCUM_LSB => -31, C_HAS_UNDERFLOW => 0, C_HAS_OVERFLOW => 0, C_HAS_INVALID_OP => 0, C_HAS_DIVIDE_BY_ZERO => 0, C_HAS_ACCUM_OVERFLOW => 0, C_HAS_ACCUM_INPUT_OVERFLOW => 0, C_HAS_ACLKEN => 1, C_HAS_ARESETN => 0, C_THROTTLE_SCHEME => 3, C_HAS_A_TUSER => 0, C_HAS_A_TLAST => 0, C_HAS_B => 1, C_HAS_B_TUSER => 0, C_HAS_B_TLAST => 0, C_HAS_C => 0, C_HAS_C_TUSER => 0, C_HAS_C_TLAST => 0, C_HAS_OPERATION => 0, C_HAS_OPERATION_TUSER => 0, C_HAS_OPERATION_TLAST => 0, C_HAS_RESULT_TUSER => 0, C_HAS_RESULT_TLAST => 0, C_TLAST_RESOLUTION => 0, C_A_TDATA_WIDTH => 32, C_A_TUSER_WIDTH => 1, C_B_TDATA_WIDTH => 32, C_B_TUSER_WIDTH => 1, C_C_TDATA_WIDTH => 32, C_C_TUSER_WIDTH => 1, C_OPERATION_TDATA_WIDTH => 8, C_OPERATION_TUSER_WIDTH => 1, C_RESULT_TDATA_WIDTH => 32, C_RESULT_TUSER_WIDTH => 1, C_FIXED_DATA_UNSIGNED => 0 ) PORT MAP ( aclk => aclk, aclken => aclken, aresetn => '1', s_axis_a_tvalid => s_axis_a_tvalid, s_axis_a_tdata => s_axis_a_tdata, s_axis_a_tuser => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), s_axis_a_tlast => '0', s_axis_b_tvalid => s_axis_b_tvalid, s_axis_b_tdata => s_axis_b_tdata, s_axis_b_tuser => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), s_axis_b_tlast => '0', s_axis_c_tvalid => '0', s_axis_c_tdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axis_c_tuser => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), s_axis_c_tlast => '0', s_axis_operation_tvalid => '0', s_axis_operation_tdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 8)), s_axis_operation_tuser => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 1)), s_axis_operation_tlast => '0', m_axis_result_tvalid => m_axis_result_tvalid, m_axis_result_tready => '0', m_axis_result_tdata => m_axis_result_tdata ); END doHistStretch_ap_fmul_2_max_dsp_32_arch;
gpl-3.0
40afe76613518af35e8348cff6dd62ee
0.651797
3.023146
false
false
false
false
lfmunoz/vhdl
templates/sip_cmd/fifo_ctrl.vhd
2
6,579
------------------------------------------------------------------------------------- -- FILE NAME : fifo_ctrl.vhd -- AUTHOR : Luis -- COMPANY : -- UNITS : Entity - fifo_ctrl -- Architecture - Behavioral -- LANGUAGE : VHDL -- DATE : AUG 21, 2014 ------------------------------------------------------------------------------------- -- ------------------------------------------------------------------------------------- -- DESCRIPTION -- =========== -- -- -- -- TO-DO -- =========== -- 1. Change subtraction counting as a generic or constant -- -- -- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- -- LIBRARIES ------------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; -- IEEE --use ieee.numeric_std.all; -- non-IEEE use ieee.std_logic_unsigned.all; use ieee.std_logic_misc.all; use ieee.std_logic_arith.all; Library UNISIM; use UNISIM.vcomponents.all; ------------------------------------------------------------------------------------- -- ENTITY ------------------------------------------------------------------------------------- entity fifo_ctrl is port ( clk : in std_logic; rst : in std_logic; arm : in std_logic; disarm : in std_logic; adc0_en_reg : in std_logic; sw_trigger : in std_logic; trigger_sel_reg : in std_logic_vector(1 downto 0); fifo_valid : in std_logic; ext_trigger : in std_logic; nb_bursts_reg : in std_logic_vector(31 downto 0); burst_size_reg : in std_logic_vector(31 downto 0); fifo0_wr_en : out std_logic ); end fifo_ctrl; ------------------------------------------------------------------------------------- -- ARCHITECTURE ------------------------------------------------------------------------------------- architecture Behavioral of fifo_ctrl is ------------------------------------------------------------------------------------- -- CONSTANTS ------------------------------------------------------------------------------------- constant EXT_TRIGGER_DISABLE : std_logic_vector(1 downto 0) := "00"; constant EXT_TRIGGER_RISE : std_logic_vector(1 downto 0) := "01"; constant EXT_TRIGGER_FALL : std_logic_vector(1 downto 0) := "10"; constant EXT_TRIGGER_BOTH : std_logic_vector(1 downto 0) := "11"; ------------------------------------------------------------------------------------- -- SIGNALS ------------------------------------------------------------------------------------- signal armed : std_logic; signal trigger : std_logic; signal ext_trigger_prev0 : std_logic; signal ext_trigger_prev1 : std_logic; signal ext_trigger_re : std_logic; signal ext_trigger_fe : std_logic; signal fifo0_wr_en_sig : std_logic; signal unlim_bursts : std_logic; signal nb_bursts_cnt : std_logic_vector(31 downto 0); signal burst_size_cnt : std_logic_vector(31 downto 0); signal adc0_en : std_logic; --*********************************************************************************** begin --*********************************************************************************** process (rst, clk) begin if (rst = '1') then ext_trigger_prev0 <= '0'; ext_trigger_prev1 <= '0'; ext_trigger_re <= '0'; ext_trigger_fe <= '0'; trigger <= '0'; armed <= '0'; adc0_en <= '0'; unlim_bursts <= '0'; nb_bursts_cnt <= (others => '0'); burst_size_cnt <= (others => '0'); fifo0_wr_en_sig <= '0'; elsif (rising_edge(clk)) then ext_trigger_prev0 <= ext_trigger; ext_trigger_prev1 <= ext_trigger_prev0; -- Generate pulse on rising edge external trigger if (ext_trigger_prev0 = '1' and ext_trigger_prev1 = '0') then ext_trigger_re <= '1'; else ext_trigger_re <= '0'; end if; -- Generate pulse on falling edge external trigger if (ext_trigger_prev0 = '0' and ext_trigger_prev1 = '1') then ext_trigger_fe <= '1'; else ext_trigger_fe <= '0'; end if; -- Select the trigger source if (armed = '1' and sw_trigger = '1') then trigger <= '1'; elsif (armed = '1' and ext_trigger_re = '1' and (trigger_sel_reg = EXT_TRIGGER_RISE or trigger_sel_reg = EXT_TRIGGER_BOTH) ) then trigger <= '1'; elsif (armed = '1' and ext_trigger_fe = '1' and (trigger_sel_reg = EXT_TRIGGER_FALL or trigger_sel_reg = EXT_TRIGGER_BOTH) ) then trigger <= '1'; else trigger <= '0'; end if; -- Latch channel enable if (arm = '1' and armed = '0') then adc0_en <= adc0_en_reg; end if; if (arm = '1' and armed = '0') then armed <= '1'; elsif (disarm = '1' and armed = '1') then armed <= '0'; elsif (unlim_bursts = '0' and nb_bursts_cnt = 0 and burst_size_cnt = 0) then armed <= '0'; end if; -- No of burst set to 0 means unlimited amount of bustst if (armed = '0') then unlim_bursts <= not or_reduce(nb_bursts_reg); end if; -- When not (yet) armed copy the register into the counter if (armed = '0') then nb_bursts_cnt <= nb_bursts_reg; elsif (trigger = '1' and burst_size_cnt = 0 and nb_bursts_cnt /= 0) then nb_bursts_cnt <= nb_bursts_cnt - '1'; end if; -- Conversion start when the burst size counter is unequal to 0 -- Load the burst size counter on a trigger, when the previous burst is -- finished and one or more channels are selected. if (armed = '0') then burst_size_cnt <= (others => '0'); elsif (trigger = '1' and burst_size_cnt = 0 and (nb_bursts_cnt /= 0 or unlim_bursts = '1')) then burst_size_cnt <= burst_size_reg; -- Decrease the burst size counter every conversion elsif (burst_size_cnt /= 0 and fifo_valid = '1') then burst_size_cnt <= burst_size_cnt - 8; end if; if (trigger = '1' and adc0_en = '1' and burst_size_cnt = 0 and (nb_bursts_cnt /= 0 or unlim_bursts = '1')) then fifo0_wr_en_sig <= '1'; elsif (burst_size_cnt = 8 and fifo_valid = '1') then fifo0_wr_en_sig <= '0'; end if; fifo0_wr_en <= fifo0_wr_en_sig; end if; end process; --*********************************************************************************** end architecture Behavioral; --***********************************************************************************
mit
5619bdca56a59c6a21fa0954ca9bae70
0.44566
4.068646
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc1970.vhd
4
1,772
-- 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: tc1970.vhd,v 1.2 2001-10-26 16:29:44 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c07s02b01x00p02n02i01970ent IS END c07s02b01x00p02n02i01970ent; ARCHITECTURE c07s02b01x00p02n02i01970arch OF c07s02b01x00p02n02i01970ent IS BEGIN TESTING: PROCESS variable a : boolean := FALSE; variable b : boolean := TRUE; variable c : boolean; BEGIN c := a nor b; assert NOT(c=FALSE) report "***PASSED TEST: c07s02b01x00p02n02i01970" severity NOTE; assert ( c=FALSE ) report "***FAILED TEST: c07s02b01x00p02n02i01970 - Logical operation of 'NOR'." severity ERROR; wait; END PROCESS TESTING; END c07s02b01x00p02n02i01970arch;
gpl-2.0
736a1123cef6b2c471b9f4cf48b0546e
0.664786
3.676349
false
true
false
false
Darkin47/Zynq-TX-UTT
Vivado_HLS/image_contrast_adj/solution1/sim/vhdl/ip/mult_gen_v12_0_11/mult_gen_v12_0.vhd
9
10,054
`protect begin_protected `protect version = 1 `protect encrypt_agent = "XILINX" `protect encrypt_agent_info = "Xilinx Encryption Tool 2014" `protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64) `protect key_block ic+e2vwK5Q7PgjSgvwMH2WoojQ4BbTVuQzxkOMVjPI/VZ5NZbfo+pDZV2xAqhpQmyQ9GvI+HXb1j HmlK88vB0Q== `protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block EhYQ5ehP63YE16bz7Bs+Jp6XRtGGK+uBxpAwDXHwR28I2BtSgb9ncXucOpIeu0UTEMLqbvoLfbxU MKaMrYPMo8RM/a2HDSBr9m9kqrCswhqrsj7+l6YpDAYmcCTq9T3FOkfhQRKFn0OQ/XIIbTvvITnM Im9Df+3DnhnBsRIa6b8= `protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128) `protect key_block h0YJz7QAV8KNys9f0Mxlf+pNNU8LPo3hH7TmUMyrhw3lSO+kM5IGhIhrK6tA/vHS9HjpGQeWP4CV hUv0PJuDbFRDQozJGwYt7sEJSKD17mUe+oi8D93Qmbv3URq5Gi+VGUtURDK7m9vfm75L8tyy5ql9 qECsNvUIWukIEumtJEY= `protect key_keyowner = "Aldec", key_keyname= "ALDEC15_001", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block pP+6eQFqDiaeKP3BC0Vnjvzv+UaX8yu0QFcUAsHG6nA3D6UEozm0SxdJ2iFfFcGPTkGK1rJp3wQa XKLNY1k0r+8h6/HdEgYrEoLQxiu0rGTrMwFGkm5IpBA5qyUQJ9BOMA3RodmPZroFnpuOiQG9fXXi E9pTQFAqbQwJUIKn68iPFrjVm+q4qLqQgrHvjKnf6JEciMX/HO234NTOg6COPSv7Uyo3FXOOpRHp TCTyJBrP+6/0PD1dPLxzogieQ1fECqhCHlBWg5ARc7Wy8Nrvyugiw7tyWe9OCXkF34mphNHjHAfM kre/l/mYmZh4jzXcx586HHX8Gny5RYaZ4KoAiA== `protect key_keyowner = "ATRENTA", key_keyname= "ATR-SG-2015-RSA-3", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block DtRivEEQldRL8LC1umq+yZAExH6mDpzyWG1k5T3n0AafinwOAShYDeN3xJBVTROrx8yaZtcjOIVo RTz2YCioii4y47KGQkU7qOYGP1IL16aZBaLHN0ikiASZGuT2wIZ7vBOHDkXuyg7SHEzSut20MVdH yT522lI1hnAfDXEZagb5qrrQxGlsFJtLUxTUFbZ7CLxKt7IYJNSHgoLTaurt9KNyJHnk2Oa9efJx cG8KJwFEfS1eHTBu0rJX6eoLGEyPSJx4qXZ3eGjOwHDiGelueO/b4BZB7QA7g7zVJz86kqUZqX1s SpXZOqr7kFUwCnN2dJO5bhUtoF+y3GgfGerZaQ== `protect key_keyowner = "Xilinx", key_keyname= "xilinx_2015_12", key_method = "rsa" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256) `protect key_block pemFOX3XLyQdy4vtMYjiFXTZP+XlsBGKuE92WyWU4tr/zi/kdVNH1ODTNxNJ5DXwFjsQE3XaQKcO QVG3dkRqyxkufPvrynU460117JgXGW15a8rem6Dsd8qn7VgNRECRRwFEFLE3bFhFjG5aqlEDnd56 Jtv/dX2cI0okyfMCEOBuMBd48KhjQsDycf7KtJc5LpL06fv+nYIvBQGKfMIkl6F4N9MkpkCF18HN sm252Xem8SRCkTNQW6+o1yOVN45d9b+5a9+kx3Hc+5oEfCtymCxxbWIPnLnMAGhORy7lTFlrznDF KTRSVyP9INWg2r5KEz1jo7u/eNIyiLfueJeDjg== `protect data_method = "AES128-CBC" `protect encoding = (enctype = "BASE64", line_length = 76, bytes = 5312) `protect data_block +93ue+0K+V+pjfzqa5MG7PcsuqUtaSJlJ1C3g+5PmNsF0k+K0SWg9dc6HZ3SEW0oUBUAZuZ4NQMC pwKE7jI1z3e+v2BVU3pviQRu4Lz6ZpHq47DbmsjJdPNuAvCy1lXKhMAl5RUHAAHsTEnDAIcKmUIe zpCTr6bjbDtmeEybza0diDN9DQV9/JCh0uLlsyyFtykb1pM9XZDildiNJTRP8zqycJ5uYSLDBF39 21yy/chK+5M/3/tLMfmc+tB0LMwnHYAPCoq4kodMpfuNoMhoUiBRch8eOQ+VzntKQ7Z9lOthUbnd LmP/8OFkzFfeOTg44p0nQ4bYLfoPbMPrp9h4blR+tRklvt8gXwVxAET3VCDwre5pUCp9Y0skYyaJ F5tjc+frCA5szZBHY1dIhrEAdMFCErWNZzrKRaEmlMjff4Zc52Kk7TdmaH2oX+E5CBLfAorgZrSt UixYqC+TrDLFCih2Bq3/Ba4K+JqnfbE6C0fGdPfPkDFSanezeQf9vY3TLEEiDtwg8yL8qbZxFXo3 tW/ATQ1Miwn1NLtITQteDtpLohgBo/6S4oICSlW7KdZnruZR35QWSI5CoFlOBqO4yq+K2MADgpS/ 8+qPal9KpNccavBukh3kf4bxXkoFp5zLRIlL4DIMlvCO+WW1SAUjdQt/a9agUrdkNSeA+DWgoOft WeWypClsQXlPAxfzD/TavnizJ4RuSadVZDJA2hxpgBYYYcgt+rXmCnElSHQHnoRo26w1sLNtUtsA GXxG3C9aXZSEV6opM8YeXGrwZY7+HufHcjGzy9ti2NLlFOSuPGwYqvd/yJ8p63z7O2JOQkjg2M77 N39M6nTpt2WsycjvpTDrcQhSiK0j6t33hzRb8Pw5zJOgnzCPDQwqEysMuk8T5tsiWOkYC4Kb/ceN Rb/v/eEc0CcsZh6/QgQLz2U0hFBeXK00H/E+FWTnRrUTUbJxuIy9/6LWNwVDROGKJ1TI/YcQPLJc ND1ZwMm+EtA9/RZecsjy4CDictn4mtwjCoUF42TGiszYBTbHx/9Oi+MTujfsSVBzFnBEqXvrsXl1 fHme0y3mVR4bVZRMf+0AvjpRZ5va0zTH6UhYF+NHq8Dhe7b+XVxlG4XNFtwznlUOd4v2z1QLw8Nq VqAXC2ReB+eGewr1IdQSGO+2zJsyxdWSYQk1w7VLR/D3i+B3JaKqJAbkLtuOU9fKRWiac5Eu6uRx uhoWqjuEUDGOuqXjTEgJmsaoQKMCy9hDHZuSa33vcXAYEG2+p9GUxCNcqAD/UOK2od6HBlJoVw6a YqNkWukJVSWkzig3F0Crq//WA8Ts4UKkh7vh7J6iIDmfAOm6m/pvI7Np8NVE2UD+Ot8l3sVxeURn 0BgpUjUb0zEGsDiuNWaj4J/xOye3EzFHEaQTlZ4erF2usSFQkFq4yrOMddoKKkASRHneiCyaHGY3 Hw4/EsbC83Wb6L/sWu3TOi1e1DV7WHW99nkmh+Jsyaxk9yKy1CB9e15EHgL077WdGQh97gcFFenF 9h2dlNrm2cz+Yzr/HTQ9Hk0md/Vp4xnTZLcM2yf6yQCD51l+hS3TM6PFD7DKBoKLeU3ctcp3Psoy Fvh6q8EQAGW3YFXab0159QibO5/JiMC8hDwCA0Df2+2w1n14g0dldwsoSs9z2WpxQl4+juLxsGq6 uFKLG+oNJxaN+IaLSdgqJIwPA9YOZcI7jGlkGbuthz5rGBPj47zcGAdoC4OI783kvYDbSODLtneF yN1pLAJuWHe4cSJVfJGvxNgr9A2UCbM0GiCsjas91qJHj1JKPJWh3xECalex0S94B8UTDfkRGCfm 63E9LKoNb7Uwxg2U2CYeDkB65cN+ugPsGpPuxnV3Q2AOZOqCZDsFJHKDcy5lAU8APQBQjVExUb8T a4reAxSmUYvxBfSLKehWriM0ZdT1ONlUjAwOt7VFJuxbT74vYF9Vi/Mw7+vy9KZ0jJ29uWSRBrWo K1UqlmXMm6jvygRVfVHmN6Cz4H5jqvU02YBF17DEhy4gE6xmJrJOx9xCrfnqdF/2QZkJYuUx1o4g qfX/Fvv+PlcwcnZFeu1kNSyn5auxjjjcrtI6GRiRSE47vZBRCMTWxn7Um+yTduDYPhT3zrclKvXI +DdshLfKajag/ppQwykcswpcUCF3ZGhmzyFSI5WthzTG801M/wWmg2cGxWcFTw9jjo1Xr5cnc4GO 43IQMv9+qcReubLMVsttcjq0hR1k+wPSHu5rnqc73TpJxCI+SBBI5WCTv8W1WNeQzh6XflcwuzMd 9NGsu8WsSu6WpeWDiE8m282QNCzl+UwULYWuY1zUh3dNXiZr6qvTxKQjfXfGFFOA/z3uvllhDvP/ 8vEU5tEFH+1HTq+uSwlSib8Dtgob2lGF2JPSJDVWwAuYT2A6RknHgEXMO2WZFgwVDcJj2+qnCZvV 35IPGw6mFAJ2HnnKGFnoMUeoEuzoUVMIo3lPiKZYtWGgmunoD7f5C62wjzrGCop5tqMJS3OshEjW W8vmnngblDvHjNJ290dpmNUmnYZ87iMyrrECjBVd0F2D6vVuKdUNaK6mv6THC7GkE+umX4gNk8Qf SWqpYjEgSalFMbIbgwbo75MTFbrL1fLKH7ne6cyJWh80OXiXQ1D4cbSCvnDtQJQ5f/poD4paaZA0 SR5bBcUrDKalzBgh8LxyK0rkC2pI+0nFsEvRxsLwco89w0cBIDZKmT9Ek5GLD606jwe+zjrDIdxI z35WQr0WHKcUcSjcgsfGLjR/6YQx8umByifnBECcbTuZ9abgWyfXmUW0bB5MHjBBu8wXum/BwC1J 8kN6X9bNdcXlUkjuwnE+M2cJTpTPVf/V/vuMIUj8dsliqwYa27ksC5etzWjWdK0uw+xuBAFDt5kF nCwzj7Yyw89YzautEurk8mNi3f0OZbW6n10kGw/7OVvnWJIfB+8Gfq+YHWUOIMCtNhqVbPp0bEja gW9cKOrZsOznOR8k1HkC8pHlkq3iRRJTq+e5yuZD1iDmp8FELRaFibGmB8hA0WTbwb8GIbnMRVrH PGgUPho4Eyxa7nq1J+EYb8BI/+dxc4D2GdHH4t14XS9jI8sHnU6aorFlAREvSRzFKybQYS7Lupxh 8ed9YLuAyoLzh3tCWvG1o153Qhi4mi4gT5x6ZH3nO9PLWxX/9JVHlYSUUCfNO0oIVqHHk9KhpSS/ 35zjhUhfDl4Eh2cbIoFmfrZ0u4J8qO4M5ap0A1TC0ojdT4IITuykBlJ9zS2rjUAG5jP9yEWo9pHF qy0mhT73eI/NCyYhYDPiG97oD0Hx22KerLJtYfDtUvZ6AxMBE2mM4kh2abJRxM4xADi6y+n/McNc x0cDGUhAcLVbt6qujR+PKrbqiDnHU0nGzyRg9zLVZuzhEjhoX21PQTpBfkPIraOnQnUS54RC54GB RVmIuqZnOBSLG+kfUe86QJLfH55EiZFXMyWuurzGw3leEE3SScPh13PJZ/Tv9C0OqjDHxjc/HSXl lqhrdrinmgGuz3hYHyk2caEGRAAfXmoAmOFe20Wsuwfwb7q9YoHnfyu34Fek330xKmRa9jUGEUgX eyU6w67EkJH+IxbcUALMKx8cdXjVAdxfpc72g8UQzZmt8Jk+oPL0nna9RvzGYamwQaLULrEKoKgg trS3brHErC6I/Bg67DDaRmvrJEV9xFa2B/7jdHc9EIJAA9pbQEGlZ8+l0XJVVC+Z40LxWURgnEzW eo50E7je8Jf+ZXa6FldlB0BKShYQQIedYeAqC25OcY+IfFQ7TfDUgcUGQWRYRhtpFTQSwnUnMEIH qSXDNI1HOraveLjYfPYlRYubIs8q55ibymXfj0PtoRHrKvHmreaV+dh/WXfc7IEg5hqtnHDZcqEz WbHrjMHx+mW89bVolRAwoyNZvnHd0CcrtPb4kGau9w4NmuzAIXBf18kqATWPGsdFV8Gy3zFhj2mL zOn9aDDU4HFATr30MBEGdKE5DrsPbhMFE2InAi3n/OxNYZtvccPY2hrAGM/HmiByn/TDIvvEZIss 9xBBI2qhdgJSjjWHS4+aRUNeeXmbtKGU3k7CHYbi7oeqePWf/XLGfSlCU1DVZWna9+wbqQKMAFLe IFuU7eJVIczR09nGQsPKkN7zCDhOSQtZ+xekit0lHyZh15NOnb1n/6y2Bt0MF2NRy2WwWq76dBbu 5aYChbq0+ryAfVOTpnQGrdk6+tIc4Sa0++tOoM6QvfZfgdkwffrEHhealgTpftw/Rr39dPWmlyIP epqioMdLShBDEoXPcEGaTZz2K1NRLrwk6bcjk3aF3QGriX4Jzi2zUEcQbGbEvopuMVmL567+rgPP N55SZNtTUxHjJ1fGF44RNAB+1daXzrp0xk9CV4H/XDszNqOe2hwdL/4ywPAJJEErK7NeMhlRZm4+ 5or79YPIU4Zne2UWukwnBGy61IqJnYsdkJhqCdo9cvLj+hYG6g47XqobPcuJvyYa8clruBY8b5eo wAwg4jQ4YfRApjocn9hAkx9ia1pzuveliSOXBXcFXwW4aP+4xrZQFptPOj5QyXRG8kBDmYiR9jWH 2O75XC4AAp5G6kkJAH5cMH/oPuyfiiEysua1+/rjHfMd0ep2LsO7iZp1aSvzaJTvHepE5RUHUFWI z2QCD+6i7jejV3Np2F23OGMLYLSaPVkQjbFDd3h2vU9IB9fZPYmX1FeDg4yd31nxg9Wjb824O+nr A+52xW6dVufVnJpzlUF+RPgp9zJaWLjsZ/BPWO+Knrj/l61T3cCGNY91iOHZMG/4wYeYfXOKahjT qUwETSQIQZKxCU5x9E5EnJHSeICnI+77bIuzEXg5SvIPewawTviodW0GsgXxNrbIEN1bpjSR5w7e XA2zQsAdNIPEmRmZrizFuZJ2aZ5qLqyPwQ3+u0+Q1J/z9puHMeUON2knHjFXlT12jfz8C6mHwpQu oJU5GM7fu2M1yNRfBu24PFoO4x9T7KfWOdX+IBk3ykJHVSRNlOe/aPc8GwZGdZ+8/1nAbUqZznu3 Pw2docIu5c1D4qAj/NYgO020RWcgLu5HDAfPUT0YG2ZaRg2rmURibh0Y0aN5UOjIc/X0/Wse/m5K urbEJrXSr04ZIAKxit1LTIeH34tXtPaLkTid0VuBwvJBGUVsCaIzT4GtuFso3QN+095SQeWbkzD+ j1TDMCcqhXmXJlyjWRwYYITAWzGD9AaGiZA9BKTJikb0S7xFZNX8x6dWMP6T3vlcphSOdenYa5uy tVijVIQXiAjm5AwBYLMGSVk77KzBeZoer3NOi3bmtO+6izgmDAhqkOziIG1tXcieYYSQ7zD6jXaa bcxqb2JtQC3KJRbge8ChDPB6Q43rcAGWZo21Vy+wCxFJwV/jdahXsTZq1ODPgoMcidBHVgD19mWc BANwdfSM18JaKL5e3RQEqffLA6I3cTu2RXThNWdS98WY6/fQyAID3Noi84wzNylzBb8vBhvsoQ1s olPXbYvr2JeOqD5XOTsq5lQrughsEPUalMWkGGZGJg1RIwI51N/Nu8mFxM+hc7qYzAqPWNrne/qL SogeCOjady4QlaDBrT3TB9Ow2nyxGRRFQB3+KGTl56FouuiCS81kKWViXHeG0kjgGEk34FRriWgN HXEEWJLl09jSaxjT4+/gCfjF5pvl0cp0ZOdD3X1WJoO8xSeQbONahzKUyuMxjCqP/1io+xiCCLok ptoGWAXmcQIPQ2fzPJQ/zcsK4aYc0VLlnpL0qgpeH0KiMLL18awNCvhOc1c57X8ZQL4v/MnNiSnf dxZsLEeVVaJu++27bXa8y3b5gEhcR4HqXcGtr+lSGNAgLCaqvWctX++8t2Jn0QFd+5u6ODOO69X/ 9rxXMSfIWOFXucTZGeYN96imW79sLMjZXhpbUXt7pJYWbTC+cgW+wP3ZAjnUrN/AyYysDiqx8IaY Hvb68eC70CGWz+Nvy/yF0LVkeChdMcLoNjUN+FimdZzh3PL2sMQGVAesq7RX/+g+m8e2y1aVV+uM DvrvDxu//rAJt00uIDX0KyKQuesk2Kystx7nIIhGzzW8kYf5ZId86sUjZIE1ieUR4l6RIeKJ4gm5 BW5Bamm6Y0Hy0oiCxNL4/9JXlffCpdjpODYmXMPWATy7SN8EUwgfrEseTShp7g+7Nl++Nh8iVDPj ui36qtcF7+Is5Xej0qxrX5xo0LTHPSK6Zma+xewpiBTKCw44iGsxDn+3bIlr9pR1HJpFs5IH6cU2 qMDBLdnCylaX/fzDiHOg5FErmyFh9Pru3E4gwy5QEqSqreEoNDzYrOcjVVu1T3gX9i8ODF8cFitB lzRA+KTHqNCil9iN3JbQ5y+xtNJcD8m77gMOpR+IMX6WTxlJcDye9iYKZ6EmA8bpTo2+FTW73vmw JiCCBi7xIIJON1jgSpPnvLaG8yxyp/v1wopmmBAsldglfDcBeBTUF837kS29An1v4u3+bnqoeEfg DA656FJveNNyWn5GXnj3dcxircOYaxOEf7BgEyE89w4wBCQXfkQOcPow6FWI5Xrg5umTv3ODzcFW KFLbVw49c0cbAnH1kz5MBhDxDIE+aBrjUGv6z4erEXoWn1tIciENMyRA/7WtxA1tTplxI38c9l/K 3+aRTwuYxFMlvEhKr6ndqvqn/o/MY9mM03ZcuAYcek0pegIHupoaowf4toVkBKcvipiD4S7q7Fvf JmFT4sy9fzXzdPhtAM7uYQxjOs+tT+bNTq+8bbXf3XFnOPmS/7woHvaySwf+A+v5iRnW0gNrwM/L HF10Xh+NGl/FLLsd1PyyY0YQwQWVpYFYAqkfqXibmZsHutV1zd8vSURSXjcyOIOlanhPc4M9iViU lHye3oJHoNZQZi2b5Thpb9OAxuQEOO1wi2fKirahqoM6Ymo6a+r8pN1+h2JiN4HKwod4kmjsV98s eQQ/YJS/EM84AJr8qoACoJChc7iXtXDzRTV7l6Vat1XIDdLme517RroB5fuoaX8JUBmrUoPodq6/ iUZddqISDdr8A1yHhzH6m4rojdh03TRmk9BxtaIICC5SDwFPvUDScPC/NKHu7EFfhBnH0CEBu37Q GYyhN7/7GJe/oPM= `protect end_protected
gpl-3.0
8d62f9398305cf5fee5415ed85cece9c
0.918341
1.933462
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_lite_ipif_v3_0/hdl/src/vhdl/address_decoder.vhd
8
22,452
------------------------------------------------------------------- -- (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: address_decoder.vhd -- Version: v2.0 -- Description: Address decoder utilizing unconstrained arrays for Base -- Address specification and ce number. ------------------------------------------------------------------------------- -- 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 08/09/2010 -- -- - updated the core with optimziation. Closed CR 574507 -- - combined the CE generation logic to further optimize the code. -- ^^^^^^ -- ~~~~~~ -- 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.numeric_std.all; --library proc_common_base_v5_0; --use proc_common_base_v5_0.proc_common_pkg.clog2; --use proc_common_base_v5_0.pselect_f; --use proc_common_base_v5_0.ipif_pkg.all; library axi_lite_ipif_v3_0_3; use axi_lite_ipif_v3_0_3.ipif_pkg.all; ------------------------------------------------------------------------------- -- Definition of Generics ------------------------------------------------------------------------------- -- C_BUS_AWIDTH -- Address bus width -- C_S_AXI_MIN_SIZE -- Minimum address range of the IP -- 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 ------------------------------------------------------------------------------- -- Bus_clk -- Clock -- Bus_rst -- Reset -- Address_In_Erly -- Adddress in -- Address_Valid_Erly -- Address is valid -- Bus_RNW -- Read or write registered -- Bus_RNW_Erly -- Read or Write -- CS_CE_ld_enable -- chip select and chip enable registered -- Clear_CS_CE_Reg -- Clear_CS_CE_Reg clear -- RW_CE_ld_enable -- Read or Write Chip Enable -- CS_for_gaps -- CS generation for the gaps between address ranges -- CS_Out -- Chip select -- RdCE_Out -- Read Chip enable -- WrCE_Out -- Write chip enable ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Entity Declaration ------------------------------------------------------------------------------- entity address_decoder is generic ( C_BUS_AWIDTH : integer := 32; C_S_AXI_MIN_SIZE : std_logic_vector(0 to 31) := X"000001FF"; C_ARD_ADDR_RANGE_ARRAY: SLV64_ARRAY_TYPE := ( X"0000_0000_1000_0000", -- IP user0 base address X"0000_0000_1000_01FF", -- IP user0 high address X"0000_0000_1000_0200", -- IP user1 base address X"0000_0000_1000_02FF" -- IP user1 high address ); C_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := ( 8, -- User0 CE Number 1 -- User1 CE Number ); C_FAMILY : string := "virtex6" ); port ( Bus_clk : in std_logic; Bus_rst : in std_logic; -- PLB Interface signals Address_In_Erly : in std_logic_vector(0 to C_BUS_AWIDTH-1); Address_Valid_Erly : in std_logic; Bus_RNW : in std_logic; Bus_RNW_Erly : in std_logic; -- Registering control signals CS_CE_ld_enable : in std_logic; Clear_CS_CE_Reg : in std_logic; RW_CE_ld_enable : in std_logic; CS_for_gaps : out std_logic; -- Decode output signals CS_Out : out std_logic_vector (0 to ((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2)-1); RdCE_Out : out std_logic_vector (0 to calc_num_ce(C_ARD_NUM_CE_ARRAY)-1); WrCE_Out : out std_logic_vector (0 to calc_num_ce(C_ARD_NUM_CE_ARRAY)-1) ); end entity address_decoder; ------------------------------------------------------------------------------- -- Architecture section ------------------------------------------------------------------------------- architecture IMP of address_decoder is ---------------------------------------------------------------------------------- -- below attributes are added to reduce the synth warnings in Vivado tool attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; ---------------------------------------------------------------------------------- -- local type declarations ---------------------------------------------------- type decode_bit_array_type is Array(natural range 0 to ( (C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2)-1) of integer; type short_addr_array_type is Array(natural range 0 to C_ARD_ADDR_RANGE_ARRAY'LENGTH-1) of std_logic_vector(0 to C_BUS_AWIDTH-1); ------------------------------------------------------------------------------- -- Function Declarations ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- This function converts a 64 bit address range array to a AWIDTH bit -- address range array. ------------------------------------------------------------------------------- function slv64_2_slv_awidth(slv64_addr_array : SLV64_ARRAY_TYPE; awidth : integer) return short_addr_array_type is variable temp_addr : std_logic_vector(0 to 63); variable slv_array : short_addr_array_type; begin for array_index in 0 to slv64_addr_array'length-1 loop temp_addr := slv64_addr_array(array_index); slv_array(array_index) := temp_addr((64-awidth) to 63); end loop; return(slv_array); end function slv64_2_slv_awidth; ------------------------------------------------------------------------------- --Function Addr_bits --function to convert an address range (base address and an upper address) --into the number of upper address bits needed for decoding a device --select signal. will handle slices and big or little endian ------------------------------------------------------------------------------- function Addr_Bits (x,y : std_logic_vector(0 to C_BUS_AWIDTH-1)) return integer is variable addr_nor : std_logic_vector(0 to C_BUS_AWIDTH-1); begin addr_nor := x xor y; for i in 0 to C_BUS_AWIDTH-1 loop if addr_nor(i)='1' then return i; end if; end loop; --coverage off return(C_BUS_AWIDTH); --coverage on end function Addr_Bits; ------------------------------------------------------------------------------- --Function Get_Addr_Bits --function calculates the array which has the decode bits for the each address --range. ------------------------------------------------------------------------------- function Get_Addr_Bits (baseaddrs : short_addr_array_type) return decode_bit_array_type is variable num_bits : decode_bit_array_type; begin for i in 0 to ((baseaddrs'length)/2)-1 loop num_bits(i) := Addr_Bits (baseaddrs(i*2), baseaddrs(i*2+1)); end loop; return(num_bits); end function Get_Addr_Bits; ------------------------------------------------------------------------------- -- NEEDED_ADDR_BITS -- -- Function Description: -- This function calculates the number of address bits required -- to support the CE generation logic. This is determined by -- multiplying the number of CEs for an address space by the -- data width of the address space (in bytes). Each address -- space entry is processed and the biggest of the spaces is -- used to set the number of address bits required to be latched -- and used for CE decoding. A minimum value of 1 is returned by -- this function. -- ------------------------------------------------------------------------------- function needed_addr_bits (ce_array : INTEGER_ARRAY_TYPE) return integer is constant NUM_CE_ENTRIES : integer := CE_ARRAY'length; variable biggest : integer := 2; variable req_ce_addr_size : integer := 0; variable num_addr_bits : integer := 0; begin for i in 0 to NUM_CE_ENTRIES-1 loop req_ce_addr_size := ce_array(i) * 4; if (req_ce_addr_size > biggest) Then biggest := req_ce_addr_size; end if; end loop; num_addr_bits := clog2(biggest); return(num_addr_bits); end function NEEDED_ADDR_BITS; ----------------------------------------------------------------------------- -- Function calc_high_address -- -- This function is used to calculate the high address of the each address -- range ----------------------------------------------------------------------------- function calc_high_address (high_address : short_addr_array_type; index : integer) return std_logic_vector is variable calc_high_addr : std_logic_vector(0 to C_BUS_AWIDTH-1); begin If (index = (C_ARD_ADDR_RANGE_ARRAY'length/2-1)) Then calc_high_addr := C_S_AXI_MIN_SIZE(32-C_BUS_AWIDTH to 31); else calc_high_addr := high_address(index*2+2); end if; return(calc_high_addr); end function calc_high_address; ---------------------------------------------------------------------------- -- Constant Declarations ------------------------------------------------------------------------------- constant ARD_ADDR_RANGE_ARRAY : short_addr_array_type := slv64_2_slv_awidth(C_ARD_ADDR_RANGE_ARRAY, C_BUS_AWIDTH); constant NUM_BASE_ADDRS : integer := (C_ARD_ADDR_RANGE_ARRAY'length)/2; constant DECODE_BITS : decode_bit_array_type := Get_Addr_Bits(ARD_ADDR_RANGE_ARRAY); constant NUM_CE_SIGNALS : integer := calc_num_ce(C_ARD_NUM_CE_ARRAY); constant NUM_S_H_ADDR_BITS : integer := needed_addr_bits(C_ARD_NUM_CE_ARRAY); ------------------------------------------------------------------------------- -- Signal Declarations ------------------------------------------------------------------------------- signal pselect_hit_i : std_logic_vector (0 to ((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2)-1); signal cs_out_i : std_logic_vector (0 to ((C_ARD_ADDR_RANGE_ARRAY'LENGTH)/2)-1); signal ce_expnd_i : std_logic_vector(0 to NUM_CE_SIGNALS-1); signal rdce_out_i : std_logic_vector(0 to NUM_CE_SIGNALS-1); signal wrce_out_i : std_logic_vector(0 to NUM_CE_SIGNALS-1); signal ce_out_i : std_logic_vector(0 to NUM_CE_SIGNALS-1); -- signal cs_ce_clr : std_logic; signal addr_out_s_h : std_logic_vector(0 to NUM_S_H_ADDR_BITS-1); signal Bus_RNW_reg : std_logic; ------------------------------------------------------------------------------- -- Begin architecture ------------------------------------------------------------------------------- begin -- architecture IMP -- Register clears cs_ce_clr <= not Bus_rst or Clear_CS_CE_Reg; addr_out_s_h <= Address_In_Erly(C_BUS_AWIDTH-NUM_S_H_ADDR_BITS to C_BUS_AWIDTH-1); ------------------------------------------------------------------------------- -- MEM_DECODE_GEN: Universal Address Decode Block ------------------------------------------------------------------------------- MEM_DECODE_GEN: for bar_index in 0 to NUM_BASE_ADDRS-1 generate --------------- constant CE_INDEX_START : integer := calc_start_ce_index(C_ARD_NUM_CE_ARRAY,bar_index); constant CE_ADDR_SIZE : Integer range 0 to 15 := clog2(C_ARD_NUM_CE_ARRAY(bar_index)); constant OFFSET : integer := 2; constant BASE_ADDR_x : std_logic_vector(0 to C_BUS_AWIDTH-1) := ARD_ADDR_RANGE_ARRAY(bar_index*2+1); constant HIGH_ADDR_X : std_logic_vector(0 to C_BUS_AWIDTH-1) := calc_high_address(ARD_ADDR_RANGE_ARRAY,bar_index); --constant DECODE_BITS_0 : integer:= DECODE_BITS(0); --------- begin --------- -- GEN_FOR_MULTI_CS: Below logic generates the CS for decoded address -- ----------------- GEN_FOR_MULTI_CS : if C_ARD_ADDR_RANGE_ARRAY'length > 2 generate -- Instantiate the basic Base Address Decoders MEM_SELECT_I: entity axi_lite_ipif_v3_0_3.pselect_f generic map ( C_AB => DECODE_BITS(bar_index), C_AW => C_BUS_AWIDTH, C_BAR => ARD_ADDR_RANGE_ARRAY(bar_index*2), C_FAMILY => C_FAMILY ) port map ( A => Address_In_Erly, -- [in] AValid => Address_Valid_Erly, -- [in] CS => pselect_hit_i(bar_index) -- [out] ); end generate GEN_FOR_MULTI_CS; -- GEN_FOR_ONE_CS: below logic decodes the CS for single address range -- --------------- GEN_FOR_ONE_CS : if C_ARD_ADDR_RANGE_ARRAY'length = 2 generate pselect_hit_i(bar_index) <= Address_Valid_Erly; end generate GEN_FOR_ONE_CS; -- Instantate backend registers for the Chip Selects BKEND_CS_REG : process(Bus_Clk) begin if(Bus_Clk'EVENT and Bus_Clk = '1')then if(Bus_Rst='0' or Clear_CS_CE_Reg = '1')then cs_out_i(bar_index) <= '0'; elsif(CS_CE_ld_enable='1')then cs_out_i(bar_index) <= pselect_hit_i(bar_index); end if; end if; end process BKEND_CS_REG; ------------------------------------------------------------------------- -- PER_CE_GEN: Now expand the individual CEs for each base address. ------------------------------------------------------------------------- PER_CE_GEN: for j in 0 to C_ARD_NUM_CE_ARRAY(bar_index) - 1 generate ----------- begin ----------- ---------------------------------------------------------------------- -- CE decoders for multiple CE's ---------------------------------------------------------------------- MULTIPLE_CES_THIS_CS_GEN : if CE_ADDR_SIZE > 0 generate constant BAR : std_logic_vector(0 to CE_ADDR_SIZE-1) := std_logic_vector(to_unsigned(j,CE_ADDR_SIZE)); begin CE_I : entity axi_lite_ipif_v3_0_3.pselect_f generic map ( C_AB => CE_ADDR_SIZE , C_AW => CE_ADDR_SIZE , C_BAR => BAR , C_FAMILY => C_FAMILY ) port map ( A => addr_out_s_h (NUM_S_H_ADDR_BITS-OFFSET-CE_ADDR_SIZE to NUM_S_H_ADDR_BITS - OFFSET - 1) , AValid => pselect_hit_i(bar_index) , CS => ce_expnd_i(CE_INDEX_START+j) ); end generate MULTIPLE_CES_THIS_CS_GEN; -------------------------------------- ---------------------------------------------------------------------- -- SINGLE_CE_THIS_CS_GEN: CE decoders for single CE ---------------------------------------------------------------------- SINGLE_CE_THIS_CS_GEN : if CE_ADDR_SIZE = 0 generate ce_expnd_i(CE_INDEX_START+j) <= pselect_hit_i(bar_index); end generate; ------------- end generate PER_CE_GEN; ------------------------ end generate MEM_DECODE_GEN; -- RNW_REG_P: Register the incoming RNW signal at the time of registering the -- address. This is need to generate the CE's separately. RNW_REG_P:process(Bus_Clk) begin if(Bus_Clk'EVENT and Bus_Clk = '1')then if(RW_CE_ld_enable='1')then Bus_RNW_reg <= Bus_RNW_Erly; end if; end if; end process RNW_REG_P; --------------------------------------------------------------------------- -- GEN_BKEND_CE_REGISTERS -- This ForGen implements the backend registering for -- the CE, RdCE, and WrCE output buses. --------------------------------------------------------------------------- GEN_BKEND_CE_REGISTERS : for ce_index in 0 to NUM_CE_SIGNALS-1 generate signal rdce_expnd_i : std_logic_vector(0 to NUM_CE_SIGNALS-1); signal wrce_expnd_i : std_logic_vector(0 to NUM_CE_SIGNALS-1); ------ begin ------ BKEND_RDCE_REG : process(Bus_Clk) begin if(Bus_Clk'EVENT and Bus_Clk = '1')then if(cs_ce_clr='1')then ce_out_i(ce_index) <= '0'; elsif(RW_CE_ld_enable='1')then ce_out_i(ce_index) <= ce_expnd_i(ce_index); end if; end if; end process BKEND_RDCE_REG; rdce_out_i(ce_index) <= ce_out_i(ce_index) and Bus_RNW_reg; wrce_out_i(ce_index) <= ce_out_i(ce_index) and not Bus_RNW_reg; ------------------------------- end generate GEN_BKEND_CE_REGISTERS; ------------------------------------------------------------------------------- CS_for_gaps <= '0'; -- Removed the GAP adecoder logic --------------------------------- CS_Out <= cs_out_i ; RdCE_Out <= rdce_out_i ; WrCE_Out <= wrce_out_i ; end architecture IMP;
gpl-3.0
3db830fc7dc1eefb76698f9633478579
0.466284
4.483227
false
false
false
false
tgingold/ghdl
testsuite/gna/bug040/quantbuff.vhd
2
1,402
library ieee; use ieee.std_logic_1164.all; library ieee; use ieee.numeric_std.all; entity quantbuff is port ( wa0_data : in std_logic_vector(31 downto 0); wa0_addr : in std_logic_vector(5 downto 0); clk : in std_logic; ra0_addr : in std_logic_vector(5 downto 0); ra0_data : out std_logic_vector(31 downto 0); wa0_en : in std_logic ); end quantbuff; architecture augh of quantbuff is -- Embedded RAM type ram_type is array (0 to 63) of std_logic_vector(31 downto 0); signal ram : ram_type := (others => (others => '0')); -- Little utility functions to make VHDL syntactically correct -- with the syntax to_integer(unsigned(vector)) when 'vector' is a std_logic. -- This happens when accessing arrays with <= 2 cells, for example. function to_integer(B: std_logic) return integer is variable V: std_logic_vector(0 to 0); begin V(0) := B; return to_integer(unsigned(V)); end; function to_integer(V: std_logic_vector) return integer is begin return to_integer(unsigned(V)); end; begin -- Sequential process -- It handles the Writes process (clk) begin if rising_edge(clk) then -- Write to the RAM -- Note: there should be only one port. if wa0_en = '1' then ram( to_integer(wa0_addr) ) <= wa0_data; end if; end if; end process; -- The Read side (the outputs) ra0_data <= ram( to_integer(ra0_addr) ); end architecture;
gpl-2.0
2725120e0cc6a9c5a62b12eabaf9f864
0.674037
2.914761
false
false
false
false
lfmunoz/vhdl
ip_blocks/sip_router_async_s1d2_x4_b/src/sip_router_async_s1d2_x4_b_stellar_regs.vhd
1
10,569
-------------------------------------------------------------------------------- -- file name : sip_router_async_s1d2_x4_b_regs.vhd -- -- author : e. barhorst -- -- company : 4dsp -- -- item : number -- -- units : entity -sip_router_async_s1d2_x4_b_regs -- arch_itecture - arch_sip_router_async_s1d2_x4_b_regs -- -- language : vhdl -- -------------------------------------------------------------------------------- -- description -- =========== -- -- -- notes: -------------------------------------------------------------------------------- -- -- disclaimer: limited warranty and disclaimer. these designs are -- provided to you as is. 4dsp specifically disclaims any -- implied warranties of merchantability, non-infringement, or -- fitness for a particular purpose. 4dsp does not warrant that -- the functions contained in these designs will meet your -- requirements, or that the operation of these designs will be -- uninterrupted or error free, or that defects in the designs -- will be corrected. furthermore, 4dsp does not warrant or -- make any representations regarding use or the results of the -- use of the designs in terms of correctness, accuracy, -- reliability, or otherwise. -- -- limitation of liability. in no event will 4dsp or its -- licensors be liable for any loss of data, lost profits, cost -- or procurement of substitute goods or services, or for any -- special, incidental, consequential, or indirect damages -- arising from the use or operation of the designs or -- accompanying documentation, however caused and on any theory -- of liability. this limitation will apply even if 4dsp -- has been advised of the possibility of such damage. this -- limitation shall apply not-withstanding the failure of the -- essential purpose of any limited remedies herein. -- -- from -- ver pcb mod date changes -- === ======= ======== ======= -- -- 0.0 0 19-01-2009 new version -- ---------------------------------------------- -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- specify libraries. -------------------------------------------------------------------------------- library ieee ; use ieee.std_logic_unsigned.all ; use ieee.std_logic_misc.all ; use ieee.std_logic_arith.all ; use ieee.std_logic_1164.all ; -------------------------------------------------------------------------------- -- entity declaration -------------------------------------------------------------------------------- entity sip_router_async_s1d2_x4_b_regs is generic ( start_addr :std_logic_vector(27 downto 0):=x"0000000"; stop_addr :std_logic_vector(27 downto 0):=x"0000001" ); port ( reset :in std_logic; --command if clk_cmd :in std_logic; --cmd_in and cmd_out are synchronous to this clock; out_cmd :out std_logic_vector(63 downto 0); out_cmd_val :out std_logic; in_cmd :in std_logic_vector(63 downto 0); in_cmd_val :in std_logic; --register interface clk_reg :in std_logic; reg0000 :out std_logic_vector(31 downto 0); reg0001 :out std_logic_vector(31 downto 0) ); end entity sip_router_async_s1d2_x4_b_regs ; -------------------------------------------------------------------------------- -- arch_itecture declaration -------------------------------------------------------------------------------- architecture arch_sip_router_async_s1d2_x4_b_regs of sip_router_async_s1d2_x4_b_regs is ----------------------------------------------------------------------------------- --constant declarations ----------------------------------------------------------------------------------- --register addresses constant addr_mbx_in :std_logic_vector(27 downto 0) :=x"0000000"; --register address for the lsb of the start addr constant addr_mbx_out :std_logic_vector(27 downto 0) :=x"0000001"; --register address for the lsb of the start addr --ctrl type std2d_32b is array(natural range<>) of std_logic_vector(31 downto 0); constant nb_regs :integer := 2; ----------------------------------------------------------------------------------- --signal declarations ----------------------------------------------------------------------------------- signal registers :std2d_32b(nb_regs-1 downto 0); signal out_reg :std_logic_vector(31 downto 0); signal out_reg_val :std_logic; signal out_reg_addr :std_logic_vector(27 downto 0); signal in_reg :std_logic_vector(31 downto 0); signal in_reg_val :std_logic; signal in_reg_req :std_logic; signal in_reg_addr :std_logic_vector(27 downto 0); signal local_reset : std_logic_vector(2 downto 0); signal out_mailbox_data_sig :std_logic_vector(31 downto 0); ----------------------------------------------------------------------------------- --component declarations ----------------------------------------------------------------------------------- component sip_router_async_s1d2_x4_b_stellar_cmd generic ( start_addr :std_logic_vector(27 downto 0):=x"0000000"; stop_addr :std_logic_vector(27 downto 0):=x"0000010" ); port ( reset :in std_logic; --command if clk_cmd :in std_logic; --cmd_in and cmd_out are synchronous to this clock; out_cmd :out std_logic_vector(63 downto 0); out_cmd_val :out std_logic; in_cmd :in std_logic_vector(63 downto 0); in_cmd_val :in std_logic; --register interface clk_reg :in std_logic; --register interface is synchronous to this clock out_reg :out std_logic_vector(31 downto 0);--caries the out register data out_reg_val :out std_logic; --the out_reg has valid data (pulse) out_reg_addr :out std_logic_vector(27 downto 0);--out register address in_reg :in std_logic_vector(31 downto 0);--requested register data is placed on this bus in_reg_val :in std_logic; --pulse to indicate requested register is valid in_reg_req :out std_logic; --pulse to request data in_reg_addr :out std_logic_vector(27 downto 0); --requested address --mailbox interface mbx_out_reg :out std_logic_vector(31 downto 0);--value of the mailbox to send mbx_out_val :out std_logic; mbx_in_reg :in std_logic_vector(31 downto 0);--value of the mailbox to send mbx_in_val :in std_logic ); end component; component pulse2pulse port ( in_clk :in std_logic; out_clk :in std_logic; rst :in std_logic; pulsein :in std_logic; inbusy :out std_logic; pulseout :out std_logic ); end component; begin ----------------------------------------------------------------------------------- --component instantiations ----------------------------------------------------------------------------------- i_sip_router_async_s1d2_x4_b_stellar_cmd: sip_router_async_s1d2_x4_b_stellar_cmd generic map ( start_addr =>start_addr, stop_addr =>stop_addr ) port map ( reset =>reset, --command if clk_cmd =>clk_cmd, out_cmd =>out_cmd, out_cmd_val =>out_cmd_val, in_cmd =>in_cmd, in_cmd_val =>in_cmd_val, --register interface clk_reg =>clk_reg, out_reg =>out_reg, out_reg_val =>out_reg_val, out_reg_addr =>out_reg_addr, in_reg =>in_reg, in_reg_val =>in_reg_val, in_reg_req =>in_reg_req, in_reg_addr =>in_reg_addr, mbx_out_reg =>out_mailbox_data_sig, mbx_out_val =>open, mbx_in_reg =>(others=>'0'), mbx_in_val =>'0' ); ----------------------------------------------------------------------------------- --synchronous processes ----------------------------------------------------------------------------------- in_reg_proc: process(clk_reg) begin -- Local reset if reset = '1' then local_reset <= (others => '1'); elsif rising_edge(clk_reg) then local_reset <= local_reset(1 downto 0) & '0'; end if; if(clk_reg'event and clk_reg='1') then if local_reset(2) = '1' then for i in 0 to nb_regs-1 loop registers(i) <= (others => '0'); end loop; else for i in 0 to nb_regs-1 loop if (out_reg_val = '1' and out_reg_addr = i) then registers(i) <= out_reg; end if; end loop; --acknoledge the requested register in_reg_val <= in_reg_req; end if; end if; end process; ----------------------------------------------------------------------------------- --asynchronous processes ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- --asynchronous mapping ----------------------------------------------------------------------------------- --map the requested register register in_reg <= registers(conv_integer(in_reg_addr)); reg0000 <=registers(conv_integer(0)); reg0001 <=registers(conv_integer(1)); end architecture arch_sip_router_async_s1d2_x4_b_regs ; -- of sip_router_async_s1d2_x4_b_regs
mit
67785b5c1180d34f3c9562dabacbd6fd
0.438168
4.573345
false
false
false
false
tgingold/ghdl
testsuite/gna/issue542/wrapper.vhd
1
785
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity wrapper is port( clk : in std_logic; reset : in std_logic; write : in std_logic; ack : out std_logic ); end wrapper; architecture a of wrapper is -- compiling with std=93 produces an error here component write is port( clk : in std_logic; reset : in std_logic; write : in std_logic; ack : out std_logic ); end component; begin --dut : entity work.write(a) -- compilation works with this type of instanciation/declaration, std=08 and component declaration on line 17 commented dut: component write port map( clk => clk, reset => reset, write => write, --compiling with std=08 produces a error here ack => ack ); end architecture;
gpl-2.0
85f310124ffa53fe47f09f4dc105af9f
0.661146
3.257261
false
false
false
false
tgingold/ghdl
testsuite/synth/string01/string01.vhdl
1
541
library ieee; use ieee.std_logic_1164.all; entity driver is generic (val : string); port (o : out std_logic); end driver; architecture behav of driver is begin drv1: if val = "one" generate o <= '1'; end generate; drv0: if val = "zero" generate o <= '0'; end generate; end behav; library ieee; use ieee.std_logic_1164.all; entity string01 is port (o : out std_logic); end string01; architecture behav of string01 is begin e : entity work.driver generic map (val => "one") port map (o => o); end behav;
gpl-2.0
cf47ccc49b35bcc46e74d7a2dc5f1073
0.656192
3.127168
false
false
false
false
nickg/nvc
test/regress/array6.vhd
1
666
entity array6 is end entity; architecture test of array6 is type int_vec2 is array (natural range <>) of integer_vector; constant a : int_vec2(1 to 3)(1 to 2) := ( (1, 2), (3, 4), (5, 6) ); begin main: process is variable v : a'subtype := a; begin assert a(1)(1) = 1; assert a(3)(2) = 6; wait for 1 ns; assert v(1)(1) = 1; assert v(3)(2) = 6; assert v = a; v(1)(2) := 99; assert v /= a; assert v(1) = (1, 99); v(2) := (55, 666); assert v(2)(2) = 666; assert v(2 to 3) = ((55, 666), (5, 6)); wait; end process; end architecture;
gpl-3.0
be5dc96baf0986f03a7f8364eb4f1126
0.46997
2.946903
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc1075.vhd
4
2,265
-- 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: tc1075.vhd,v 1.2 2001-10-26 16:29:38 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c06s04b00x00p03n02i01075ent IS END c06s04b00x00p03n02i01075ent; ARCHITECTURE c06s04b00x00p03n02i01075arch OF c06s04b00x00p03n02i01075ent IS BEGIN TESTING: PROCESS type CSTRING is array (CHARACTER range <>) of CHARACTER; constant C1 : CSTRING('A' to 'H') := "BCDEFGHA"; constant C2 : CSTRING('A' to 'H') := "CDEFGHAB"; constant C3 : CSTRING('A' to 'H') := "DEFGHABC"; variable V1 : CHARACTER; variable V2 : CHARACTER; variable V3 : CHARACTER; BEGIN V1 := C1('A'); -- A -> B assert V1 = 'B'; V2 := C2(C1('A')); -- A -> B -> D assert V2 = 'D'; V3 := C3(C2(C1('A'))); -- A -> B -> H assert V3 = 'G'; wait for 5 ns; assert NOT( V1 = 'B' and V2 = 'D' and V3 = 'G' ) report "***PASSED TEST: c06s04b00x00p03n02i01075" severity NOTE; assert ( V1 = 'B' and V2 = 'D' and V3 = 'G' ) report "***FAILED TEST: c06s04b00x00p03n02i01075 - The expresion for index name check test failed." severity ERROR; wait; END PROCESS TESTING; END c06s04b00x00p03n02i01075arch;
gpl-2.0
f94a441d940e980716f1534130ddd8d7
0.619868
3.365527
false
true
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_sg_v4_1/hdl/src/vhdl/axi_sg_fifo.vhd
7
24,380
-- ************************************************************************* -- -- (c) Copyright 2010-2011 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_sg_fifo.vhd -- Version: initial -- Description: -- This file is a wrapper file for the Synchronous FIFO used by the DataMover. -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; library lib_pkg_v1_0_2; use lib_pkg_v1_0_2.lib_pkg.all; use lib_pkg_v1_0_2.lib_pkg.clog2; library lib_srl_fifo_v1_0_2; use lib_srl_fifo_v1_0_2.srl_fifo_f; library axi_sg_v4_1_2; use axi_sg_v4_1_2.axi_sg_sfifo_autord; use axi_sg_v4_1_2.axi_sg_afifo_autord; ------------------------------------------------------------------------------- entity axi_sg_fifo is generic ( C_DWIDTH : integer := 32 ; -- Bit width of the FIFO C_DEPTH : integer := 4 ; -- Depth of the fifo in fifo width words C_IS_ASYNC : Integer range 0 to 1 := 0 ; -- 0 = Syncronous FIFO -- 1 = Asynchronous (2 clock) FIFO C_PRIM_TYPE : Integer range 0 to 2 := 2 ; -- 0 = Register -- 1 = Block Memory -- 2 = SRL C_FAMILY : String := "virtex7" -- Specifies the Target FPGA device family ); port ( -- Write Clock and reset ----------------- fifo_wr_reset : In std_logic; -- fifo_wr_clk : In std_logic; -- ------------------------------------------ -- Write Side ------------------------------------------------------ fifo_wr_tvalid : In std_logic; -- fifo_wr_tready : Out std_logic; -- fifo_wr_tdata : In std_logic_vector(C_DWIDTH-1 downto 0); -- fifo_wr_full : Out std_logic; -- -------------------------------------------------------------------- -- Read Clock and reset ----------------------------------------------- fifo_async_rd_reset : In std_logic; -- only used if C_IS_ASYNC = 1 -- fifo_async_rd_clk : In std_logic; -- only used if C_IS_ASYNC = 1 -- ----------------------------------------------------------------------- -- Read Side -------------------------------------------------------- fifo_rd_tvalid : Out std_logic; -- fifo_rd_tready : In std_logic; -- fifo_rd_tdata : Out std_logic_vector(C_DWIDTH-1 downto 0); -- fifo_rd_empty : Out std_logic -- --------------------------------------------------------------------- ); end entity axi_sg_fifo; ----------------------------------------------------------------------------- -- Architecture section ----------------------------------------------------------------------------- architecture imp of axi_sg_fifo is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of imp : architecture is "yes"; -- function Declarations ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_prim_type -- -- Function Description: -- Sorts out the FIFO Primitive type selection based on fifo -- depth and original primitive choice. -- ------------------------------------------------------------------- -- coverage off function funct_get_prim_type (depth : integer; input_prim_type : integer) return integer is Variable temp_prim_type : Integer := 0; begin If (depth > 64) Then temp_prim_type := 1; -- use BRAM Elsif (depth <= 64 and input_prim_type = 0) Then temp_prim_type := 0; -- use regiaters else temp_prim_type := 1; -- use BRAM End if; Return (temp_prim_type); end function funct_get_prim_type; -- coverage on -- Signal declarations Signal sig_init_reg : std_logic := '0'; Signal sig_init_reg2 : std_logic := '0'; Signal sig_init_done : std_logic := '0'; signal sig_inhibit_rdy_n : std_logic := '0'; ----------------------------------------------------------------------------- -- Begin architecture ----------------------------------------------------------------------------- begin ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_INIT_REG -- -- Process Description: -- Registers the reset signal input. -- ------------------------------------------------------------- IMP_INIT_REG : process (fifo_wr_clk) begin if (fifo_wr_clk'event and fifo_wr_clk = '1') then if (fifo_wr_reset = '1') then sig_init_reg <= '1'; sig_init_reg2 <= '1'; else sig_init_reg <= '0'; sig_init_reg2 <= sig_init_reg; end if; end if; end process IMP_INIT_REG; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_INIT_DONE_REG -- -- Process Description: -- Create a 1 clock wide init done pulse. -- ------------------------------------------------------------- IMP_INIT_DONE_REG : process (fifo_wr_clk) begin if (fifo_wr_clk'event and fifo_wr_clk = '1') then if (fifo_wr_reset = '1' or sig_init_done = '1') then sig_init_done <= '0'; Elsif (sig_init_reg = '1' and sig_init_reg2 = '1') Then sig_init_done <= '1'; else null; -- hold current state end if; end if; end process IMP_INIT_DONE_REG; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_RDY_INHIBIT_REG -- -- Process Description: -- Implements a ready inhibit flop. -- ------------------------------------------------------------- IMP_RDY_INHIBIT_REG : process (fifo_wr_clk) begin if (fifo_wr_clk'event and fifo_wr_clk = '1') then if (fifo_wr_reset = '1') then sig_inhibit_rdy_n <= '0'; Elsif (sig_init_done = '1') Then sig_inhibit_rdy_n <= '1'; else null; -- hold current state end if; end if; end process IMP_RDY_INHIBIT_REG; ------------------------------------------------------------ -- If Generate -- -- Label: USE_SINGLE_REG -- -- If Generate Description: -- Implements a 1 deep register FIFO (synchronous mode only) -- -- ------------------------------------------------------------ USE_SINGLE_REG : if (C_IS_ASYNC = 0 and C_DEPTH <= 1) generate -- Local Constants -- local signals signal sig_data_in : std_logic_vector(C_DWIDTH-1 downto 0) := (others => '0'); signal sig_regfifo_dout_reg : std_logic_vector(C_DWIDTH-1 downto 0) := (others => '0'); signal sig_regfifo_full_reg : std_logic := '0'; signal sig_regfifo_empty_reg : std_logic := '0'; signal sig_push_regfifo : std_logic := '0'; signal sig_pop_regfifo : std_logic := '0'; begin -- Internal signals -- Write signals fifo_wr_tready <= sig_regfifo_empty_reg; fifo_wr_full <= sig_regfifo_full_reg ; sig_push_regfifo <= fifo_wr_tvalid and sig_regfifo_empty_reg; sig_data_in <= fifo_wr_tdata ; -- Read signals fifo_rd_tdata <= sig_regfifo_dout_reg ; fifo_rd_tvalid <= sig_regfifo_full_reg ; fifo_rd_empty <= sig_regfifo_empty_reg; sig_pop_regfifo <= sig_regfifo_full_reg and fifo_rd_tready; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_REG_FIFO -- -- Process Description: -- This process implements the data and full flag for the -- register fifo. -- ------------------------------------------------------------- IMP_REG_FIFO : process (fifo_wr_clk) begin if (fifo_wr_clk'event and fifo_wr_clk = '1') then if (fifo_wr_reset = '1' or sig_pop_regfifo = '1') then sig_regfifo_full_reg <= '0'; elsif (sig_push_regfifo = '1') then sig_regfifo_full_reg <= '1'; else null; -- don't change state end if; end if; end process IMP_REG_FIFO; IMP_REG_FIFO1 : process (fifo_wr_clk) begin if (fifo_wr_clk'event and fifo_wr_clk = '1') then if (fifo_wr_reset = '1') then sig_regfifo_dout_reg <= (others => '0'); elsif (sig_push_regfifo = '1') then sig_regfifo_dout_reg <= sig_data_in; else null; -- don't change state end if; end if; end process IMP_REG_FIFO1; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_REG_EMPTY_FLOP -- -- Process Description: -- This process implements the empty flag for the -- register fifo. -- ------------------------------------------------------------- IMP_REG_EMPTY_FLOP : process (fifo_wr_clk) begin if (fifo_wr_clk'event and fifo_wr_clk = '1') then if (fifo_wr_reset = '1') then sig_regfifo_empty_reg <= '0'; -- since this is used for the ready (invertd) -- it can't be asserted during reset elsif (sig_pop_regfifo = '1' or sig_init_done = '1') then sig_regfifo_empty_reg <= '1'; elsif (sig_push_regfifo = '1') then sig_regfifo_empty_reg <= '0'; else null; -- don't change state end if; end if; end process IMP_REG_EMPTY_FLOP; end generate USE_SINGLE_REG; ------------------------------------------------------------ -- If Generate -- -- Label: USE_SRL_FIFO -- -- If Generate Description: -- Generates a fifo implementation usinf SRL based FIFOa -- -- ------------------------------------------------------------ USE_SRL_FIFO : if (C_IS_ASYNC = 0 and C_DEPTH <= 64 and C_DEPTH > 1 and C_PRIM_TYPE = 2 ) generate -- Local Constants Constant LOGIC_LOW : std_logic := '0'; Constant NEED_ALMOST_EMPTY : Integer := 0; Constant NEED_ALMOST_FULL : Integer := 0; -- local signals signal sig_wr_full : std_logic := '0'; signal sig_wr_fifo : std_logic := '0'; signal sig_wr_ready : std_logic := '0'; signal sig_rd_fifo : std_logic := '0'; signal sig_rd_empty : std_logic := '0'; signal sig_rd_valid : std_logic := '0'; signal sig_fifo_rd_data : std_logic_vector(C_DWIDTH-1 downto 0) := (others => '0'); signal sig_fifo_wr_data : std_logic_vector(C_DWIDTH-1 downto 0) := (others => '0'); begin -- Write side signals fifo_wr_tready <= sig_wr_ready; fifo_wr_full <= sig_wr_full; sig_wr_ready <= not(sig_wr_full) and sig_inhibit_rdy_n; sig_wr_fifo <= fifo_wr_tvalid and sig_wr_ready; sig_fifo_wr_data <= fifo_wr_tdata; -- Read Side Signals fifo_rd_tvalid <= sig_rd_valid; sig_rd_valid <= not(sig_rd_empty); fifo_rd_tdata <= sig_fifo_rd_data ; fifo_rd_empty <= not(sig_rd_valid); sig_rd_fifo <= sig_rd_valid and fifo_rd_tready; ------------------------------------------------------------ -- Instance: I_SYNC_FIFO -- -- Description: -- Implement the synchronous FIFO using SRL FIFO elements -- ------------------------------------------------------------ I_SYNC_FIFO : entity lib_srl_fifo_v1_0_2.srl_fifo_f generic map ( C_DWIDTH => C_DWIDTH , C_DEPTH => C_DEPTH , C_FAMILY => C_FAMILY ) port map ( Clk => fifo_wr_clk , Reset => fifo_wr_reset , FIFO_Write => sig_wr_fifo , Data_In => sig_fifo_wr_data , FIFO_Read => sig_rd_fifo , Data_Out => sig_fifo_rd_data , FIFO_Empty => sig_rd_empty , FIFO_Full => sig_wr_full , Addr => open ); end generate USE_SRL_FIFO; ------------------------------------------------------------ -- If Generate -- -- Label: USE_SYNC_FIFO -- -- If Generate Description: -- Instantiates a synchronous FIFO design for use in the -- synchronous operating mode. -- ------------------------------------------------------------ USE_SYNC_FIFO : if (C_IS_ASYNC = 0 and (C_DEPTH > 64 or (C_DEPTH > 1 and C_PRIM_TYPE < 2 ))) generate -- Local Constants Constant LOGIC_LOW : std_logic := '0'; Constant NEED_ALMOST_EMPTY : Integer := 0; Constant NEED_ALMOST_FULL : Integer := 0; Constant DATA_CNT_WIDTH : Integer := clog2(C_DEPTH)+1; Constant PRIM_TYPE : Integer := funct_get_prim_type(C_DEPTH, C_PRIM_TYPE); -- local signals signal sig_wr_full : std_logic := '0'; signal sig_wr_fifo : std_logic := '0'; signal sig_wr_ready : std_logic := '0'; signal sig_rd_fifo : std_logic := '0'; signal sig_rd_valid : std_logic := '0'; signal sig_fifo_rd_data : std_logic_vector(C_DWIDTH-1 downto 0) := (others => '0'); signal sig_fifo_wr_data : std_logic_vector(C_DWIDTH-1 downto 0) := (others => '0'); begin -- Write side signals fifo_wr_tready <= sig_wr_ready; fifo_wr_full <= sig_wr_full; sig_wr_ready <= not(sig_wr_full) and sig_inhibit_rdy_n; sig_wr_fifo <= fifo_wr_tvalid and sig_wr_ready; sig_fifo_wr_data <= fifo_wr_tdata; -- Read Side Signals fifo_rd_tvalid <= sig_rd_valid; fifo_rd_tdata <= sig_fifo_rd_data ; fifo_rd_empty <= not(sig_rd_valid); sig_rd_fifo <= sig_rd_valid and fifo_rd_tready; ------------------------------------------------------------ -- Instance: I_SYNC_FIFO -- -- Description: -- Implement the synchronous FIFO -- ------------------------------------------------------------ I_SYNC_FIFO : entity axi_sg_v4_1_2.axi_sg_sfifo_autord generic map ( C_DWIDTH => C_DWIDTH , C_DEPTH => C_DEPTH , C_DATA_CNT_WIDTH => DATA_CNT_WIDTH , C_NEED_ALMOST_EMPTY => NEED_ALMOST_EMPTY , C_NEED_ALMOST_FULL => NEED_ALMOST_FULL , C_USE_BLKMEM => PRIM_TYPE , C_FAMILY => C_FAMILY ) port map ( -- Inputs SFIFO_Sinit => fifo_wr_reset , SFIFO_Clk => fifo_wr_clk , SFIFO_Wr_en => sig_wr_fifo , SFIFO_Din => fifo_wr_tdata , SFIFO_Rd_en => sig_rd_fifo , SFIFO_Clr_Rd_Data_Valid => LOGIC_LOW , -- Outputs SFIFO_DValid => sig_rd_valid , SFIFO_Dout => sig_fifo_rd_data , SFIFO_Full => sig_wr_full , SFIFO_Empty => open , SFIFO_Almost_full => open , SFIFO_Almost_empty => open , SFIFO_Rd_count => open , SFIFO_Rd_count_minus1 => open , SFIFO_Wr_count => open , SFIFO_Rd_ack => open ); end generate USE_SYNC_FIFO; ------------------------------------------------------------ -- If Generate -- -- Label: USE_ASYNC_FIFO -- -- If Generate Description: -- Instantiates an asynchronous FIFO design for use in the -- asynchronous operating mode. -- ------------------------------------------------------------ USE_ASYNC_FIFO : if (C_IS_ASYNC = 1) generate -- Local Constants Constant LOGIC_LOW : std_logic := '0'; Constant CNT_WIDTH : Integer := clog2(C_DEPTH); -- local signals signal sig_async_wr_full : std_logic := '0'; signal sig_async_wr_fifo : std_logic := '0'; signal sig_async_wr_ready : std_logic := '0'; signal sig_async_rd_fifo : std_logic := '0'; signal sig_async_rd_valid : std_logic := '0'; signal sig_afifo_rd_data : std_logic_vector(C_DWIDTH-1 downto 0); signal sig_afifo_wr_data : std_logic_vector(C_DWIDTH-1 downto 0); signal sig_fifo_ainit : std_logic := '0'; Signal sig_init_reg : std_logic := '0'; begin sig_fifo_ainit <= fifo_async_rd_reset or fifo_wr_reset; -- Write side signals fifo_wr_tready <= sig_async_wr_ready; fifo_wr_full <= sig_async_wr_full; sig_async_wr_ready <= not(sig_async_wr_full) and sig_inhibit_rdy_n; sig_async_wr_fifo <= fifo_wr_tvalid and sig_async_wr_ready; sig_afifo_wr_data <= fifo_wr_tdata; -- Read Side Signals fifo_rd_tvalid <= sig_async_rd_valid; fifo_rd_tdata <= sig_afifo_rd_data ; fifo_rd_empty <= not(sig_async_rd_valid); sig_async_rd_fifo <= sig_async_rd_valid and fifo_rd_tready; ------------------------------------------------------------ -- Instance: I_ASYNC_FIFO -- -- Description: -- Implement the asynchronous FIFO -- ------------------------------------------------------------ I_ASYNC_FIFO : entity axi_sg_v4_1_2.axi_sg_afifo_autord generic map ( C_DWIDTH => C_DWIDTH , C_DEPTH => C_DEPTH , C_CNT_WIDTH => CNT_WIDTH , C_USE_BLKMEM => C_PRIM_TYPE , C_FAMILY => C_FAMILY ) port map ( -- Inputs AFIFO_Ainit => sig_fifo_ainit , AFIFO_Wr_clk => fifo_wr_clk , AFIFO_Wr_en => sig_async_wr_fifo , AFIFO_Din => sig_afifo_wr_data , AFIFO_Rd_clk => fifo_async_rd_clk , AFIFO_Rd_en => sig_async_rd_fifo , AFIFO_Clr_Rd_Data_Valid => LOGIC_LOW , -- Outputs AFIFO_DValid => sig_async_rd_valid, AFIFO_Dout => sig_afifo_rd_data , AFIFO_Full => sig_async_wr_full , AFIFO_Empty => open , AFIFO_Almost_full => open , AFIFO_Almost_empty => open , AFIFO_Wr_count => open , AFIFO_Rd_count => open , AFIFO_Corr_Rd_count => open , AFIFO_Corr_Rd_count_minus1 => open , AFIFO_Rd_ack => open ); end generate USE_ASYNC_FIFO; end imp;
gpl-3.0
8cf4c43072a5c43e2943ed0fe3dd6012
0.420221
4.435146
false
false
false
false
tgingold/ghdl
libraries/ieee2008/fixed_generic_pkg-body.vhdl
1
216,296
-- ----------------------------------------------------------------- -- -- Copyright 2019 IEEE P1076 WG Authors -- -- See the LICENSE file distributed with this work for copyright and -- licensing information and the AUTHORS file. -- -- This file to you under the Apache License, Version 2.0 (the "License"). -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -- implied. See the License for the specific language governing -- permissions and limitations under the License. -- -- Title : Fixed-point package (Generic package body) -- : -- Library : This package shall be compiled into a library -- : symbolically named IEEE. -- : -- Developers: Accellera VHDL-TC and IEEE P1076 Working Group -- : -- Purpose : This packages defines basic binary fixed point arithmetic -- : arithmetic functions -- : -- Note : This package may be modified to include additional data -- : required by tools, but it must in no way change the -- : external interfaces or simulation behavior of the -- : description. It is permissible to add comments and/or -- : attributes to the package declarations, but not to change -- : or delete any original lines of the package declaration. -- : The package body may be changed only in accordance with -- : the terms of Clause 16 of this standard. -- : -- -------------------------------------------------------------------- -- $Revision: 1220 $ -- $Date: 2008-04-10 17:16:09 +0930 (Thu, 10 Apr 2008) $ -- -------------------------------------------------------------------- library IEEE; use IEEE.MATH_REAL.all; package body fixed_generic_pkg is -- Author David Bishop ([email protected]) -- Other contributers: Jim Lewis, Yannick Grugni, Ryan W. Hilton -- null array constants constant NAUF : UNRESOLVED_ufixed (0 downto 1) := (others => '0'); constant NASF : UNRESOLVED_sfixed (0 downto 1) := (others => '0'); constant NSLV : STD_ULOGIC_VECTOR (0 downto 1) := (others => '0'); -- This differed constant will tell you if the package body is synthesizable -- or implemented as real numbers, set to "true" if synthesizable. constant fixedsynth_or_real : BOOLEAN := true; -- Special version of "minimum" to do some boundary checking without errors function mins (l, r : INTEGER) return INTEGER is begin -- function mins if (l = INTEGER'low or r = INTEGER'low) then return 0; -- error condition, silent end if; return minimum (l, r); end function mins; -- Special version of "minimum" to do some boundary checking with errors function mine (l, r : INTEGER) return INTEGER is begin -- function mine if (l = INTEGER'low or r = INTEGER'low) then report fixed_generic_pkg'instance_name & " Unbounded number passed, was a literal used?" severity error; return 0; end if; return minimum (l, r); end function mine; -- The following functions are used only internally. Every function -- calls "cleanvec" either directly or indirectly. -- purpose: Fixes "downto" problem and resolves meta states function cleanvec ( arg : UNRESOLVED_sfixed) -- input return UNRESOLVED_sfixed is begin -- function cleanvec assert not (arg'ascending and (arg'low /= INTEGER'low)) report fixed_generic_pkg'instance_name & " Vector passed using a ""to"" range, expected is ""downto""" severity error; return arg; end function cleanvec; -- purpose: Fixes "downto" problem and resolves meta states function cleanvec ( arg : UNRESOLVED_ufixed) -- input return UNRESOLVED_ufixed is begin -- function cleanvec assert not (arg'ascending and (arg'low /= INTEGER'low)) report fixed_generic_pkg'instance_name & " Vector passed using a ""to"" range, expected is ""downto""" severity error; return arg; end function cleanvec; -- Type convert a "unsigned" into a "ufixed", used internally function to_fixed ( arg : UNRESOLVED_UNSIGNED; -- shifted vector constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (left_index downto right_index); begin -- function to_fixed result := UNRESOLVED_ufixed(arg); return result; end function to_fixed; -- Type convert a "signed" into an "sfixed", used internally function to_fixed ( arg : UNRESOLVED_SIGNED; -- shifted vector constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (left_index downto right_index); begin -- function to_fixed result := UNRESOLVED_sfixed(arg); return result; end function to_fixed; -- Type convert a "ufixed" into an "unsigned", used internally function to_uns ( arg : UNRESOLVED_ufixed) -- fp vector return UNRESOLVED_UNSIGNED is subtype t is UNRESOLVED_UNSIGNED(arg'high - arg'low downto 0); variable slv : t; begin -- function to_uns slv := t(arg); return slv; end function to_uns; -- Type convert an "sfixed" into a "signed", used internally function to_s ( arg : UNRESOLVED_sfixed) -- fp vector return UNRESOLVED_SIGNED is subtype t is UNRESOLVED_SIGNED(arg'high - arg'low downto 0); variable slv : t; begin -- function to_s slv := t(arg); return slv; end function to_s; -- adds 1 to the LSB of the number procedure round_up (arg : in UNRESOLVED_ufixed; result : out UNRESOLVED_ufixed; overflowx : out BOOLEAN) is variable arguns, resuns : UNRESOLVED_UNSIGNED (arg'high-arg'low+1 downto 0) := (others => '0'); begin -- round_up arguns (arguns'high-1 downto 0) := to_uns (arg); resuns := arguns + 1; result := to_fixed(resuns(arg'high-arg'low downto 0), arg'high, arg'low); overflowx := (resuns(resuns'high) = '1'); end procedure round_up; -- adds 1 to the LSB of the number procedure round_up (arg : in UNRESOLVED_sfixed; result : out UNRESOLVED_sfixed; overflowx : out BOOLEAN) is variable args, ress : UNRESOLVED_SIGNED (arg'high-arg'low+1 downto 0); begin -- round_up args (args'high-1 downto 0) := to_s (arg); args(args'high) := arg(arg'high); -- sign extend ress := args + 1; result := to_fixed(ress (ress'high-1 downto 0), arg'high, arg'low); overflowx := ((arg(arg'high) /= ress(ress'high-1)) and (or (STD_ULOGIC_VECTOR(ress)) /= '0')); end procedure round_up; -- Rounding - Performs a "round_nearest" (IEEE 754) which rounds up -- when the remainder is > 0.5. If the remainder IS 0.5 then if the -- bottom bit is a "1" it is rounded, otherwise it remains the same. function round_fixed (arg : UNRESOLVED_ufixed; remainder : UNRESOLVED_ufixed; overflow_style : fixed_overflow_style_type := fixed_overflow_style) return UNRESOLVED_ufixed is variable rounds : BOOLEAN; variable round_overflow : BOOLEAN; variable result : UNRESOLVED_ufixed (arg'range); begin rounds := false; if (remainder'length > 1) then if (remainder (remainder'high) = '1') then rounds := (arg(arg'low) = '1') or (or (to_sulv(remainder(remainder'high-1 downto remainder'low))) = '1'); end if; else rounds := (arg(arg'low) = '1') and (remainder (remainder'high) = '1'); end if; if rounds then round_up(arg => arg, result => result, overflowx => round_overflow); else result := arg; end if; if (overflow_style = fixed_saturate) and round_overflow then result := saturate (result'high, result'low); end if; return result; end function round_fixed; -- Rounding case statement function round_fixed (arg : UNRESOLVED_sfixed; remainder : UNRESOLVED_sfixed; overflow_style : fixed_overflow_style_type := fixed_overflow_style) return UNRESOLVED_sfixed is variable rounds : BOOLEAN; variable round_overflow : BOOLEAN; variable result : UNRESOLVED_sfixed (arg'range); begin rounds := false; if (remainder'length > 1) then if (remainder (remainder'high) = '1') then rounds := (arg(arg'low) = '1') or (or (to_sulv(remainder(remainder'high-1 downto remainder'low))) = '1'); end if; else rounds := (arg(arg'low) = '1') and (remainder (remainder'high) = '1'); end if; if rounds then round_up(arg => arg, result => result, overflowx => round_overflow); else result := arg; end if; if round_overflow then if (overflow_style = fixed_saturate) then if arg(arg'high) = '0' then result := saturate (result'high, result'low); else result := not saturate (result'high, result'low); end if; -- Sign bit not fixed when wrapping end if; end if; return result; end function round_fixed; -- converts an sfixed into a ufixed. The output is the same length as the -- input, because abs("1000") = "1000" = 8. function to_ufixed ( arg : UNRESOLVED_sfixed) return UNRESOLVED_ufixed is constant left_index : INTEGER := arg'high; constant right_index : INTEGER := mine(arg'low, arg'low); variable xarg : UNRESOLVED_sfixed(left_index+1 downto right_index); variable result : UNRESOLVED_ufixed(left_index downto right_index); begin if arg'length < 1 then return NAUF; end if; xarg := abs(arg); result := UNRESOLVED_ufixed (xarg (left_index downto right_index)); return result; end function to_ufixed; ----------------------------------------------------------------------------- -- Visible functions ----------------------------------------------------------------------------- -- Conversion functions. These are needed for synthesis where typically -- the only input and output type is a std_logic_vector. function to_sulv ( arg : UNRESOLVED_ufixed) -- fixed point vector return STD_ULOGIC_VECTOR is variable intermediate_result : UNRESOLVED_ufixed(arg'length-1 downto 0); begin if arg'length < 1 then return NSLV; end if; intermediate_result := arg; return STD_ULOGIC_VECTOR (intermediate_result); end function to_sulv; function to_sulv ( arg : UNRESOLVED_sfixed) -- fixed point vector return STD_ULOGIC_VECTOR is variable intermediate_result : UNRESOLVED_sfixed(arg'length-1 downto 0); begin if arg'length < 1 then return NSLV; end if; intermediate_result := arg; return STD_ULOGIC_VECTOR (intermediate_result); end function to_sulv; function to_slv ( arg : UNRESOLVED_ufixed) -- fixed point vector return STD_LOGIC_VECTOR is begin return to_sulv(arg); end function to_slv; function to_slv ( arg : UNRESOLVED_sfixed) -- fixed point vector return STD_LOGIC_VECTOR is begin return to_sulv(arg); end function to_slv; function to_ufixed ( arg : STD_ULOGIC_VECTOR; -- shifted vector constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (left_index downto right_index); begin if (arg'length < 1 or right_index > left_index) then return NAUF; end if; if (arg'length /= result'length) then report fixed_generic_pkg'instance_name & "TO_UFIXED(SLV) " & "Vector lengths do not match. Input length is " & INTEGER'image(arg'length) & " and output will be " & INTEGER'image(result'length) & " wide." severity error; return NAUF; else result := to_fixed (arg => UNRESOLVED_UNSIGNED(arg), left_index => left_index, right_index => right_index); return result; end if; end function to_ufixed; function to_sfixed ( arg : STD_ULOGIC_VECTOR; -- shifted vector constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (left_index downto right_index); begin if (arg'length < 1 or right_index > left_index) then return NASF; end if; if (arg'length /= result'length) then report fixed_generic_pkg'instance_name & "TO_SFIXED(SLV) " & "Vector lengths do not match. Input length is " & INTEGER'image(arg'length) & " and output will be " & INTEGER'image(result'length) & " wide." severity error; return NASF; else result := to_fixed (arg => UNRESOLVED_SIGNED(arg), left_index => left_index, right_index => right_index); return result; end if; end function to_sfixed; -- Two's complement number, Grows the vector by 1 bit. -- because "abs (1000.000) = 01000.000" or abs(-16) = 16. function "abs" ( arg : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is constant left_index : INTEGER := arg'high; constant right_index : INTEGER := mine(arg'low, arg'low); variable ressns : UNRESOLVED_SIGNED (arg'length downto 0); variable result : UNRESOLVED_sfixed (left_index+1 downto right_index); begin if (arg'length < 1 or result'length < 1) then return NASF; end if; ressns (arg'length-1 downto 0) := to_s (cleanvec (arg)); ressns (arg'length) := ressns (arg'length-1); -- expand sign bit result := to_fixed (abs(ressns), left_index+1, right_index); return result; end function "abs"; -- also grows the vector by 1 bit. function "-" ( arg : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is constant left_index : INTEGER := arg'high+1; constant right_index : INTEGER := mine(arg'low, arg'low); variable ressns : UNRESOLVED_SIGNED (arg'length downto 0); variable result : UNRESOLVED_sfixed (left_index downto right_index); begin if (arg'length < 1 or result'length < 1) then return NASF; end if; ressns (arg'length-1 downto 0) := to_s (cleanvec(arg)); ressns (arg'length) := ressns (arg'length-1); -- expand sign bit result := to_fixed (-ressns, left_index, right_index); return result; end function "-"; -- Addition function "+" ( l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) + ufixed(c downto d) = return UNRESOLVED_ufixed -- ufixed(max(a,c)+1 downto min(b,d)) is constant left_index : INTEGER := maximum(l'high, r'high)+1; constant right_index : INTEGER := mine(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable result : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (left_index-right_index downto 0); variable result_slv : UNRESOLVED_UNSIGNED (left_index-right_index downto 0); begin if (l'length < 1 or r'length < 1 or result'length < 1) then return NAUF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); result_slv := lslv + rslv; result := to_fixed(result_slv, left_index, right_index); return result; end function "+"; function "+" ( l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) + sfixed(c downto d) = return UNRESOLVED_sfixed -- sfixed(max(a,c)+1 downto min(b,d)) is constant left_index : INTEGER := maximum(l'high, r'high)+1; constant right_index : INTEGER := mine(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable result : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (left_index-right_index downto 0); variable result_slv : UNRESOLVED_SIGNED (left_index-right_index downto 0); begin if (l'length < 1 or r'length < 1 or result'length < 1) then return NASF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); result_slv := lslv + rslv; result := to_fixed(result_slv, left_index, right_index); return result; end function "+"; -- Subtraction function "-" ( l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) - ufixed(c downto d) = return UNRESOLVED_ufixed -- ufixed(max(a,c)+1 downto min(b,d)) is constant left_index : INTEGER := maximum(l'high, r'high)+1; constant right_index : INTEGER := mine(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable result : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (left_index-right_index downto 0); variable result_slv : UNRESOLVED_UNSIGNED (left_index-right_index downto 0); begin if (l'length < 1 or r'length < 1 or result'length < 1) then return NAUF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); result_slv := lslv - rslv; result := to_fixed(result_slv, left_index, right_index); return result; end function "-"; function "-" ( l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) - sfixed(c downto d) = return UNRESOLVED_sfixed -- sfixed(max(a,c)+1 downto min(b,d)) is constant left_index : INTEGER := maximum(l'high, r'high)+1; constant right_index : INTEGER := mine(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable result : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (left_index-right_index downto 0); variable result_slv : UNRESOLVED_SIGNED (left_index-right_index downto 0); begin if (l'length < 1 or r'length < 1 or result'length < 1) then return NASF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); result_slv := lslv - rslv; result := to_fixed(result_slv, left_index, right_index); return result; end function "-"; function "*" ( l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) * ufixed(c downto d) = return UNRESOLVED_ufixed -- ufixed(a+c+1 downto b+d) is variable lslv : UNRESOLVED_UNSIGNED (l'length-1 downto 0); variable rslv : UNRESOLVED_UNSIGNED (r'length-1 downto 0); variable result_slv : UNRESOLVED_UNSIGNED (r'length+l'length-1 downto 0); variable result : UNRESOLVED_ufixed (l'high + r'high+1 downto mine(l'low, l'low) + mine(r'low, r'low)); begin if (l'length < 1 or r'length < 1 or result'length /= result_slv'length) then return NAUF; end if; lslv := to_uns (cleanvec(l)); rslv := to_uns (cleanvec(r)); result_slv := lslv * rslv; result := to_fixed (result_slv, result'high, result'low); return result; end function "*"; function "*" ( l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) * sfixed(c downto d) = return UNRESOLVED_sfixed -- sfixed(a+c+1 downto b+d) is variable lslv : UNRESOLVED_SIGNED (l'length-1 downto 0); variable rslv : UNRESOLVED_SIGNED (r'length-1 downto 0); variable result_slv : UNRESOLVED_SIGNED (r'length+l'length-1 downto 0); variable result : UNRESOLVED_sfixed (l'high + r'high+1 downto mine(l'low, l'low) + mine(r'low, r'low)); begin if (l'length < 1 or r'length < 1 or result'length /= result_slv'length) then return NASF; end if; lslv := to_s (cleanvec(l)); rslv := to_s (cleanvec(r)); result_slv := lslv * rslv; result := to_fixed (result_slv, result'high, result'low); return result; end function "*"; function "/" ( l, r : UNRESOLVED_ufixed) -- ufixed(a downto b) / ufixed(c downto d) = return UNRESOLVED_ufixed is -- ufixed(a-d downto b-c-1) begin return divide (l, r); end function "/"; function "/" ( l, r : UNRESOLVED_sfixed) -- sfixed(a downto b) / sfixed(c downto d) = return UNRESOLVED_sfixed is -- sfixed(a-d+1 downto b-c) begin return divide (l, r); end function "/"; -- This version of divide gives the user more control -- ufixed(a downto b) / ufixed(c downto d) = ufixed(a-d downto b-c-1) function divide ( l, r : UNRESOLVED_ufixed; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (l'high - mine(r'low, r'low) downto mine (l'low, l'low) - r'high -1); variable dresult : UNRESOLVED_ufixed (result'high downto result'low -guard_bits); variable lresize : UNRESOLVED_ufixed (l'high downto l'high - dresult'length+1); variable lslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); variable rslv : UNRESOLVED_UNSIGNED (r'length-1 downto 0); variable result_slv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1 or mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then return NAUF; end if; lresize := resize (arg => l, left_index => lresize'high, right_index => lresize'low, overflow_style => fixed_wrap, -- vector only grows round_style => fixed_truncate); lslv := to_uns (cleanvec (lresize)); rslv := to_uns (cleanvec (r)); if (rslv = 0) then report fixed_generic_pkg'instance_name & "DIVIDE(ufixed) Division by zero" severity error; result := saturate (result'high, result'low); -- saturate else result_slv := lslv / rslv; dresult := to_fixed (result_slv, dresult'high, dresult'low); result := resize (arg => dresult, left_index => result'high, right_index => result'low, overflow_style => fixed_wrap, -- overflow impossible round_style => round_style); end if; return result; end function divide; -- sfixed(a downto b) / sfixed(c downto d) = sfixed(a-d+1 downto b-c) function divide ( l, r : UNRESOLVED_sfixed; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (l'high - mine(r'low, r'low) + 1 downto mine (l'low, l'low) - r'high); variable dresult : UNRESOLVED_sfixed (result'high downto result'low-guard_bits); variable lresize : UNRESOLVED_sfixed (l'high+1 downto l'high+1 -dresult'length+1); variable lslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); variable rslv : UNRESOLVED_SIGNED (r'length-1 downto 0); variable result_slv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1 or mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then return NASF; end if; lresize := resize (arg => l, left_index => lresize'high, right_index => lresize'low, overflow_style => fixed_wrap, -- vector only grows round_style => fixed_truncate); lslv := to_s (cleanvec (lresize)); rslv := to_s (cleanvec (r)); if (rslv = 0) then report fixed_generic_pkg'instance_name & "DIVIDE(sfixed) Division by zero" severity error; result := saturate (result'high, result'low); else result_slv := lslv / rslv; dresult := to_fixed (result_slv, dresult'high, dresult'low); result := resize (arg => dresult, left_index => result'high, right_index => result'low, overflow_style => fixed_wrap, -- overflow impossible round_style => round_style); end if; return result; end function divide; -- 1 / ufixed(a downto b) = ufixed(-b downto -a-1) function reciprocal ( arg : UNRESOLVED_ufixed; -- fixed point input constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_ufixed is constant one : UNRESOLVED_ufixed (0 downto 0) := "1"; begin return divide (l => one, r => arg, round_style => round_style, guard_bits => guard_bits); end function reciprocal; -- 1 / sfixed(a downto b) = sfixed(-b+1 downto -a) function reciprocal ( arg : UNRESOLVED_sfixed; -- fixed point input constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_sfixed is constant one : UNRESOLVED_sfixed (1 downto 0) := "01"; -- extra bit. variable resultx : UNRESOLVED_sfixed (-mine(arg'low, arg'low)+2 downto -arg'high); begin if (arg'length < 1 or resultx'length < 1) then return NASF; else resultx := divide (l => one, r => arg, round_style => round_style, guard_bits => guard_bits); return resultx (resultx'high-1 downto resultx'low); -- remove extra bit end if; end function reciprocal; -- ufixed (a downto b) rem ufixed (c downto d) -- = ufixed (min(a,c) downto min(b,d)) function "rem" ( l, r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return remainder (l, r); end function "rem"; -- remainder -- sfixed (a downto b) rem sfixed (c downto d) -- = sfixed (min(a,c) downto min(b,d)) function "rem" ( l, r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return remainder (l, r); end function "rem"; -- ufixed (a downto b) rem ufixed (c downto d) -- = ufixed (min(a,c) downto min(b,d)) function remainder ( l, r : UNRESOLVED_ufixed; -- fixed point input constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (minimum(l'high, r'high) downto mine(l'low, r'low)); constant rlow : integer := mins(r'low, r'low); variable lresize : UNRESOLVED_ufixed (maximum(l'high, r'low) downto rlow-guard_bits); variable rresize : UNRESOLVED_ufixed (r'high downto rlow-guard_bits); variable dresult : UNRESOLVED_ufixed (rresize'range); variable lslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); variable rslv : UNRESOLVED_UNSIGNED (rresize'length-1 downto 0); variable result_slv : UNRESOLVED_UNSIGNED (rslv'range); begin if (l'length < 1 or r'length < 1 or mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then return NAUF; end if; lresize := resize (arg => l, left_index => lresize'high, right_index => lresize'low, overflow_style => fixed_wrap, -- vector only grows round_style => fixed_truncate); lslv := to_uns (lresize); rresize := resize (arg => r, left_index => rresize'high, right_index => rresize'low, overflow_style => fixed_wrap, -- vector only grows round_style => fixed_truncate); rslv := to_uns (rresize); if (rslv = 0) then report fixed_generic_pkg'instance_name & "remainder(ufixed) Division by zero" severity error; result := saturate (result'high, result'low); -- saturate else if (r'low <= l'high) then result_slv := lslv rem rslv; dresult := to_fixed (result_slv, dresult'high, dresult'low); result := resize (arg => dresult, left_index => result'high, right_index => result'low, overflow_style => fixed_wrap, -- can't overflow round_style => round_style); end if; if l'low < r'low then result(mins(r'low-1, l'high) downto l'low) := cleanvec(l(mins(r'low-1, l'high) downto l'low)); end if; end if; return result; end function remainder; -- remainder -- sfixed (a downto b) rem sfixed (c downto d) -- = sfixed (min(a,c) downto min(b,d)) function remainder ( l, r : UNRESOLVED_sfixed; -- fixed point input constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_sfixed is variable l_abs : UNRESOLVED_ufixed (l'range); variable r_abs : UNRESOLVED_ufixed (r'range); variable result : UNRESOLVED_sfixed (minimum(r'high, l'high) downto mine(r'low, l'low)); variable neg_result : UNRESOLVED_sfixed (minimum(r'high, l'high)+1 downto mins(r'low, l'low)); begin if (l'length < 1 or r'length < 1 or mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then return NASF; end if; l_abs := to_ufixed (l); r_abs := to_ufixed (r); result := UNRESOLVED_sfixed (remainder ( l => l_abs, r => r_abs, round_style => round_style)); neg_result := -result; if l(l'high) = '1' then result := neg_result(result'range); end if; return result; end function remainder; -- modulo -- ufixed (a downto b) mod ufixed (c downto d) -- = ufixed (min(a,c) downto min(b, d)) function "mod" ( l, r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return modulo (l, r); end function "mod"; -- sfixed (a downto b) mod sfixed (c downto d) -- = sfixed (c downto min(b, d)) function "mod" ( l, r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return modulo(l, r); end function "mod"; -- modulo -- ufixed (a downto b) mod ufixed (c downto d) -- = ufixed (min(a,c) downto min(b, d)) function modulo ( l, r : UNRESOLVED_ufixed; -- fixed point input constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_ufixed is begin return remainder(l => l, r => r, round_style => round_style, guard_bits => guard_bits); end function modulo; -- sfixed (a downto b) mod sfixed (c downto d) -- = sfixed (c downto min(b, d)) function modulo ( l, r : UNRESOLVED_sfixed; -- fixed point input constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) return UNRESOLVED_sfixed is variable l_abs : UNRESOLVED_ufixed (l'range); variable r_abs : UNRESOLVED_ufixed (r'range); variable result : UNRESOLVED_sfixed (r'high downto mine(r'low, l'low)); variable dresult : UNRESOLVED_sfixed (minimum(r'high, l'high)+1 downto mins(r'low, l'low)); variable dresult_not_zero : BOOLEAN; begin if (l'length < 1 or r'length < 1 or mins(r'low, r'low) /= r'low or mins(l'low, l'low) /= l'low) then return NASF; end if; l_abs := to_ufixed (l); r_abs := to_ufixed (r); dresult := "0" & UNRESOLVED_sfixed(remainder (l => l_abs, r => r_abs, round_style => round_style)); if (to_s(dresult) = 0) then dresult_not_zero := false; else dresult_not_zero := true; end if; if to_x01(l(l'high)) = '1' and to_x01(r(r'high)) = '0' and dresult_not_zero then result := resize (arg => r - dresult, left_index => result'high, right_index => result'low, overflow_style => overflow_style, round_style => round_style); elsif to_x01(l(l'high)) = '1' and to_x01(r(r'high)) = '1' then result := resize (arg => -dresult, left_index => result'high, right_index => result'low, overflow_style => overflow_style, round_style => round_style); elsif to_x01(l(l'high)) = '0' and to_x01(r(r'high)) = '1' and dresult_not_zero then result := resize (arg => dresult + r, left_index => result'high, right_index => result'low, overflow_style => overflow_style, round_style => round_style); else result := resize (arg => dresult, left_index => result'high, right_index => result'low, overflow_style => overflow_style, round_style => round_style); end if; return result; end function modulo; -- Procedure for those who need an "accumulator" function procedure add_carry ( L, R : in UNRESOLVED_ufixed; c_in : in STD_ULOGIC; result : out UNRESOLVED_ufixed; c_out : out STD_ULOGIC) is constant left_index : INTEGER := maximum(L'high, R'high)+1; constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (left_index-right_index downto 0); variable result_slv : UNRESOLVED_UNSIGNED (left_index-right_index downto 0); variable cx : UNRESOLVED_UNSIGNED (0 downto 0); -- Carry in begin if (L'length < 1 or R'length < 1) then result := NAUF; c_out := '0'; else cx (0) := c_in; lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); result_slv := lslv + rslv + cx; c_out := result_slv(left_index); result := to_fixed(result_slv (left_index-right_index-1 downto 0), left_index-1, right_index); end if; end procedure add_carry; procedure add_carry ( L, R : in UNRESOLVED_sfixed; c_in : in STD_ULOGIC; result : out UNRESOLVED_sfixed; c_out : out STD_ULOGIC) is constant left_index : INTEGER := maximum(L'high, R'high)+1; constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (left_index-right_index downto 0); variable result_slv : UNRESOLVED_SIGNED (left_index-right_index downto 0); variable cx : UNRESOLVED_SIGNED (1 downto 0); -- Carry in begin if (L'length < 1 or R'length < 1) then result := NASF; c_out := '0'; else cx (1) := '0'; cx (0) := c_in; lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); result_slv := lslv + rslv + cx; c_out := result_slv(left_index); result := to_fixed(result_slv (left_index-right_index-1 downto 0), left_index-1, right_index); end if; end procedure add_carry; -- Scales the result by a power of 2. Width of input = width of output with -- the decimal point moved. function scalb (y : UNRESOLVED_ufixed; N : INTEGER) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (y'high+N downto y'low+N); begin if y'length < 1 then return NAUF; else result := y; return result; end if; end function scalb; function scalb (y : UNRESOLVED_ufixed; N : UNRESOLVED_SIGNED) return UNRESOLVED_ufixed is begin return scalb (y => y, N => to_integer(N)); end function scalb; function scalb (y : UNRESOLVED_sfixed; N : INTEGER) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (y'high+N downto y'low+N); begin if y'length < 1 then return NASF; else result := y; return result; end if; end function scalb; function scalb (y : UNRESOLVED_sfixed; N : UNRESOLVED_SIGNED) return UNRESOLVED_sfixed is begin return scalb (y => y, N => to_integer(N)); end function scalb; function Is_Negative (arg : UNRESOLVED_sfixed) return BOOLEAN is begin if to_X01(arg(arg'high)) = '1' then return true; else return false; end if; end function Is_Negative; function find_rightmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC) return INTEGER is begin for_loop : for i in arg'reverse_range loop if arg(i) ?= y then return i; end if; end loop; return arg'high+1; -- return out of bounds 'high end function find_rightmost; function find_leftmost (arg : UNRESOLVED_ufixed; y : STD_ULOGIC) return INTEGER is begin for_loop : for i in arg'range loop if arg(i) ?= y then return i; end if; end loop; return arg'low-1; -- return out of bounds 'low end function find_leftmost; function find_rightmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC) return INTEGER is begin for_loop : for i in arg'reverse_range loop if arg(i) ?= y then return i; end if; end loop; return arg'high+1; -- return out of bounds 'high end function find_rightmost; function find_leftmost (arg : UNRESOLVED_sfixed; y : STD_ULOGIC) return INTEGER is begin for_loop : for i in arg'range loop if arg(i) ?= y then return i; end if; end loop; return arg'low-1; -- return out of bounds 'low end function find_leftmost; function "sll" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER) return UNRESOLVED_ufixed is variable argslv : UNRESOLVED_UNSIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_ufixed (ARG'range); begin argslv := to_uns (ARG); argslv := argslv sll COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "sll"; function "srl" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER) return UNRESOLVED_ufixed is variable argslv : UNRESOLVED_UNSIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_ufixed (ARG'range); begin argslv := to_uns (ARG); argslv := argslv srl COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "srl"; function "rol" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER) return UNRESOLVED_ufixed is variable argslv : UNRESOLVED_UNSIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_ufixed (ARG'range); begin argslv := to_uns (ARG); argslv := argslv rol COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "rol"; function "ror" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER) return UNRESOLVED_ufixed is variable argslv : UNRESOLVED_UNSIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_ufixed (ARG'range); begin argslv := to_uns (ARG); argslv := argslv ror COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "ror"; function "sla" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER) return UNRESOLVED_ufixed is variable argslv : UNRESOLVED_UNSIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_ufixed (ARG'range); begin argslv := to_uns (ARG); -- Arithmetic shift on an unsigned is a logical shift argslv := argslv sll COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "sla"; function "sra" (ARG : UNRESOLVED_ufixed; COUNT : INTEGER) return UNRESOLVED_ufixed is variable argslv : UNRESOLVED_UNSIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_ufixed (ARG'range); begin argslv := to_uns (ARG); -- Arithmetic shift on an unsigned is a logical shift argslv := argslv srl COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "sra"; function "sll" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER) return UNRESOLVED_sfixed is variable argslv : UNRESOLVED_SIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_sfixed (ARG'range); begin argslv := to_s (ARG); argslv := argslv sll COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "sll"; function "srl" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER) return UNRESOLVED_sfixed is variable argslv : UNRESOLVED_SIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_sfixed (ARG'range); begin argslv := to_s (ARG); argslv := argslv srl COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "srl"; function "rol" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER) return UNRESOLVED_sfixed is variable argslv : UNRESOLVED_SIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_sfixed (ARG'range); begin argslv := to_s (ARG); argslv := argslv rol COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "rol"; function "ror" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER) return UNRESOLVED_sfixed is variable argslv : UNRESOLVED_SIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_sfixed (ARG'range); begin argslv := to_s (ARG); argslv := argslv ror COUNT; result := to_fixed (argslv, result'high, result'low); return result; end function "ror"; function "sla" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER) return UNRESOLVED_sfixed is variable argslv : UNRESOLVED_SIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_sfixed (ARG'range); begin argslv := to_s (ARG); if COUNT > 0 then -- Arithmetic shift left on a 2's complement number is a logic shift argslv := argslv sll COUNT; else argslv := argslv sra -COUNT; end if; result := to_fixed (argslv, result'high, result'low); return result; end function "sla"; function "sra" (ARG : UNRESOLVED_sfixed; COUNT : INTEGER) return UNRESOLVED_sfixed is variable argslv : UNRESOLVED_SIGNED (ARG'length-1 downto 0); variable result : UNRESOLVED_sfixed (ARG'range); begin argslv := to_s (ARG); if COUNT > 0 then argslv := argslv sra COUNT; else -- Arithmetic shift left on a 2's complement number is a logic shift argslv := argslv sll -COUNT; end if; result := to_fixed (argslv, result'high, result'low); return result; end function "sra"; -- Because some people want the older functions. function SHIFT_LEFT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL) return UNRESOLVED_ufixed is begin if (ARG'length < 1) then return NAUF; end if; return ARG sla COUNT; end function SHIFT_LEFT; function SHIFT_RIGHT (ARG : UNRESOLVED_ufixed; COUNT : NATURAL) return UNRESOLVED_ufixed is begin if (ARG'length < 1) then return NAUF; end if; return ARG sra COUNT; end function SHIFT_RIGHT; function SHIFT_LEFT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL) return UNRESOLVED_sfixed is begin if (ARG'length < 1) then return NASF; end if; return ARG sla COUNT; end function SHIFT_LEFT; function SHIFT_RIGHT (ARG : UNRESOLVED_sfixed; COUNT : NATURAL) return UNRESOLVED_sfixed is begin if (ARG'length < 1) then return NASF; end if; return ARG sra COUNT; end function SHIFT_RIGHT; ---------------------------------------------------------------------------- -- logical functions ---------------------------------------------------------------------------- function "not" (L : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin RESULT := not to_sulv(L); return to_ufixed(RESULT, L'high, L'low); end function "not"; function "and" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) and to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """and"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_ufixed(RESULT, L'high, L'low); end function "and"; function "or" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) or to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """or"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_ufixed(RESULT, L'high, L'low); end function "or"; function "nand" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) nand to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """nand"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_ufixed(RESULT, L'high, L'low); end function "nand"; function "nor" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) nor to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """nor"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_ufixed(RESULT, L'high, L'low); end function "nor"; function "xor" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) xor to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """xor"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_ufixed(RESULT, L'high, L'low); end function "xor"; function "xnor" (L, R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) xnor to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """xnor"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_ufixed(RESULT, L'high, L'low); end function "xnor"; function "not" (L : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin RESULT := not to_sulv(L); return to_sfixed(RESULT, L'high, L'low); end function "not"; function "and" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) and to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """and"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_sfixed(RESULT, L'high, L'low); end function "and"; function "or" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) or to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """or"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_sfixed(RESULT, L'high, L'low); end function "or"; function "nand" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) nand to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """nand"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_sfixed(RESULT, L'high, L'low); end function "nand"; function "nor" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) nor to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """nor"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_sfixed(RESULT, L'high, L'low); end function "nor"; function "xor" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) xor to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """xor"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_sfixed(RESULT, L'high, L'low); end function "xor"; function "xnor" (L, R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable RESULT : STD_ULOGIC_VECTOR(L'length-1 downto 0); -- force downto begin if (L'high = R'high and L'low = R'low) then RESULT := to_sulv(L) xnor to_sulv(R); else assert no_warning report fixed_generic_pkg'instance_name & """xnor"": Range error L'RANGE /= R'RANGE" severity warning; RESULT := (others => 'X'); end if; return to_sfixed(RESULT, L'high, L'low); end function "xnor"; -- Vector and std_ulogic functions, same as functions in numeric_std function "and" (L : STD_ULOGIC; R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (R'range); begin for i in result'range loop result(i) := L and R(i); end loop; return result; end function "and"; function "and" (L : UNRESOLVED_ufixed; R : STD_ULOGIC) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (L'range); begin for i in result'range loop result(i) := L(i) and R; end loop; return result; end function "and"; function "or" (L : STD_ULOGIC; R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (R'range); begin for i in result'range loop result(i) := L or R(i); end loop; return result; end function "or"; function "or" (L : UNRESOLVED_ufixed; R : STD_ULOGIC) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (L'range); begin for i in result'range loop result(i) := L(i) or R; end loop; return result; end function "or"; function "nand" (L : STD_ULOGIC; R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (R'range); begin for i in result'range loop result(i) := L nand R(i); end loop; return result; end function "nand"; function "nand" (L : UNRESOLVED_ufixed; R : STD_ULOGIC) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (L'range); begin for i in result'range loop result(i) := L(i) nand R; end loop; return result; end function "nand"; function "nor" (L : STD_ULOGIC; R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (R'range); begin for i in result'range loop result(i) := L nor R(i); end loop; return result; end function "nor"; function "nor" (L : UNRESOLVED_ufixed; R : STD_ULOGIC) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (L'range); begin for i in result'range loop result(i) := L(i) nor R; end loop; return result; end function "nor"; function "xor" (L : STD_ULOGIC; R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (R'range); begin for i in result'range loop result(i) := L xor R(i); end loop; return result; end function "xor"; function "xor" (L : UNRESOLVED_ufixed; R : STD_ULOGIC) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (L'range); begin for i in result'range loop result(i) := L(i) xor R; end loop; return result; end function "xor"; function "xnor" (L : STD_ULOGIC; R : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (R'range); begin for i in result'range loop result(i) := L xnor R(i); end loop; return result; end function "xnor"; function "xnor" (L : UNRESOLVED_ufixed; R : STD_ULOGIC) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (L'range); begin for i in result'range loop result(i) := L(i) xnor R; end loop; return result; end function "xnor"; function "and" (L : STD_ULOGIC; R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (R'range); begin for i in result'range loop result(i) := L and R(i); end loop; return result; end function "and"; function "and" (L : UNRESOLVED_sfixed; R : STD_ULOGIC) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (L'range); begin for i in result'range loop result(i) := L(i) and R; end loop; return result; end function "and"; function "or" (L : STD_ULOGIC; R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (R'range); begin for i in result'range loop result(i) := L or R(i); end loop; return result; end function "or"; function "or" (L : UNRESOLVED_sfixed; R : STD_ULOGIC) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (L'range); begin for i in result'range loop result(i) := L(i) or R; end loop; return result; end function "or"; function "nand" (L : STD_ULOGIC; R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (R'range); begin for i in result'range loop result(i) := L nand R(i); end loop; return result; end function "nand"; function "nand" (L : UNRESOLVED_sfixed; R : STD_ULOGIC) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (L'range); begin for i in result'range loop result(i) := L(i) nand R; end loop; return result; end function "nand"; function "nor" (L : STD_ULOGIC; R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (R'range); begin for i in result'range loop result(i) := L nor R(i); end loop; return result; end function "nor"; function "nor" (L : UNRESOLVED_sfixed; R : STD_ULOGIC) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (L'range); begin for i in result'range loop result(i) := L(i) nor R; end loop; return result; end function "nor"; function "xor" (L : STD_ULOGIC; R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (R'range); begin for i in result'range loop result(i) := L xor R(i); end loop; return result; end function "xor"; function "xor" (L : UNRESOLVED_sfixed; R : STD_ULOGIC) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (L'range); begin for i in result'range loop result(i) := L(i) xor R; end loop; return result; end function "xor"; function "xnor" (L : STD_ULOGIC; R : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (R'range); begin for i in result'range loop result(i) := L xnor R(i); end loop; return result; end function "xnor"; function "xnor" (L : UNRESOLVED_sfixed; R : STD_ULOGIC) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (L'range); begin for i in result'range loop result(i) := L(i) xnor R; end loop; return result; end function "xnor"; -- Reduction operators function "and" (l : UNRESOLVED_ufixed) return STD_ULOGIC is begin return and to_sulv(l); end function "and"; function "nand" (l : UNRESOLVED_ufixed) return STD_ULOGIC is begin return nand to_sulv(l); end function "nand"; function "or" (l : UNRESOLVED_ufixed) return STD_ULOGIC is begin return or to_sulv(l); end function "or"; function "nor" (l : UNRESOLVED_ufixed) return STD_ULOGIC is begin return nor to_sulv(l); end function "nor"; function "xor" (l : UNRESOLVED_ufixed) return STD_ULOGIC is begin return xor to_sulv(l); end function "xor"; function "xnor" (l : UNRESOLVED_ufixed) return STD_ULOGIC is begin return xnor to_sulv(l); end function "xnor"; function "and" (l : UNRESOLVED_sfixed) return STD_ULOGIC is begin return and to_sulv(l); end function "and"; function "nand" (l : UNRESOLVED_sfixed) return STD_ULOGIC is begin return nand to_sulv(l); end function "nand"; function "or" (l : UNRESOLVED_sfixed) return STD_ULOGIC is begin return or to_sulv(l); end function "or"; function "nor" (l : UNRESOLVED_sfixed) return STD_ULOGIC is begin return nor to_sulv(l); end function "nor"; function "xor" (l : UNRESOLVED_sfixed) return STD_ULOGIC is begin return xor to_sulv(l); end function "xor"; function "xnor" (l : UNRESOLVED_sfixed) return STD_ULOGIC is begin return xnor to_sulv(l); end function "xnor"; -- End reduction operators function "?=" (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin -- ?= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv ?= rslv; end if; end function "?="; function "?/=" (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin -- ?/= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?/="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv ?/= rslv; end if; end function "?/="; function "?>" (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin -- ?> if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?>"": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv ?> rslv; end if; end function "?>"; function "?>=" (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin -- ?>= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?>="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv ?>= rslv; end if; end function "?>="; function "?<" (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin -- ?< if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?<"": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv ?< rslv; end if; end function "?<"; function "?<=" (L, R : UNRESOLVED_ufixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin -- ?<= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?<="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv ?<= rslv; end if; end function "?<="; function "?=" (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin -- ?= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv ?= rslv; end if; end function "?="; function "?/=" (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin -- ?/= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?/="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv ?/= rslv; end if; end function "?/="; function "?>" (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin -- ?> if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?>"": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv ?> rslv; end if; end function "?>"; function "?>=" (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin -- ?>= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?>="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv ?>= rslv; end if; end function "?>="; function "?<" (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin -- ?< if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?<"": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv ?< rslv; end if; end function "?<"; function "?<=" (L, R : UNRESOLVED_sfixed) return STD_ULOGIC is constant left_index : INTEGER := maximum(L'high, R'high); constant right_index : INTEGER := mins(L'low, R'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin -- ?<= if ((L'length < 1) or (R'length < 1)) then assert no_warning report fixed_generic_pkg'instance_name & """?<="": null detected, returning X" severity warning; return 'X'; else lresize := resize (L, left_index, right_index); rresize := resize (R, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv ?<= rslv; end if; end function "?<="; -- Match function, similar to "std_match" from numeric_std function std_match (L, R : UNRESOLVED_ufixed) return BOOLEAN is begin if (L'high = R'high and L'low = R'low) then return std_match(to_sulv(L), to_sulv(R)); else assert no_warning report fixed_generic_pkg'instance_name & "STD_MATCH: L'RANGE /= R'RANGE, returning FALSE" severity warning; return false; end if; end function std_match; function std_match (L, R : UNRESOLVED_sfixed) return BOOLEAN is begin if (L'high = R'high and L'low = R'low) then return std_match(to_sulv(L), to_sulv(R)); else assert no_warning report fixed_generic_pkg'instance_name & "STD_MATCH: L'RANGE /= R'RANGE, returning FALSE" severity warning; return false; end if; end function std_match; -- compare functions function "=" ( l, r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """="": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """="": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv = rslv; end function "="; function "=" ( l, r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """="": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """="": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv = rslv; end function "="; function "/=" ( l, r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """/="": null argument detected, returning TRUE" severity warning; return true; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """/="": metavalue detected, returning TRUE" severity warning; return true; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv /= rslv; end function "/="; function "/=" ( l, r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """/="": null argument detected, returning TRUE" severity warning; return true; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """/="": metavalue detected, returning TRUE" severity warning; return true; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv /= rslv; end function "/="; function ">" ( l, r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """>"": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """>"": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv > rslv; end function ">"; function ">" ( l, r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """>"": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """>"": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv > rslv; end function ">"; function "<" ( l, r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """<"": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """<"": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv < rslv; end function "<"; function "<" ( l, r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """<"": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """<"": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv < rslv; end function "<"; function ">=" ( l, r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """>="": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """>="": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv >= rslv; end function ">="; function ">=" ( l, r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """>="": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """>="": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv >= rslv; end function ">="; function "<=" ( l, r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """<="": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """<="": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_uns (lresize); rslv := to_uns (rresize); return lslv <= rslv; end function "<="; function "<=" ( l, r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); variable lslv, rslv : UNRESOLVED_SIGNED (lresize'length-1 downto 0); begin if (l'length < 1 or r'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & """<="": null argument detected, returning FALSE" severity warning; return false; elsif (Is_X(l) or Is_X(r)) then assert no_warning report fixed_generic_pkg'instance_name & """<="": metavalue detected, returning FALSE" severity warning; return false; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); lslv := to_s (lresize); rslv := to_s (rresize); return lslv <= rslv; end function "<="; -- overloads of the default maximum and minimum functions function maximum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); begin if (l'length < 1 or r'length < 1) then return NAUF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); return to_fixed(maximum(to_uns(lresize), to_uns(rresize)), left_index, right_index); end function maximum; function maximum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); begin if (l'length < 1 or r'length < 1) then return NASF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); return to_fixed(maximum(to_s(lresize), to_s(rresize)), left_index, right_index); end function maximum; function minimum (l, r : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_ufixed (left_index downto right_index); begin if (l'length < 1 or r'length < 1) then return NAUF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); return to_fixed(minimum(to_uns(lresize), to_uns(rresize)), left_index, right_index); end function minimum; function minimum (l, r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is constant left_index : INTEGER := maximum(l'high, r'high); constant right_index : INTEGER := mins(l'low, r'low); variable lresize, rresize : UNRESOLVED_sfixed (left_index downto right_index); begin if (l'length < 1 or r'length < 1) then return NASF; end if; lresize := resize (l, left_index, right_index); rresize := resize (r, left_index, right_index); return to_fixed(minimum(to_s(lresize), to_s(rresize)), left_index, right_index); end function minimum; function to_ufixed ( arg : NATURAL; -- integer constant left_index : INTEGER; -- left index (high index) constant right_index : INTEGER := 0; -- right index constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_ufixed is constant fw : INTEGER := mins (right_index, right_index); -- catch literals variable result : UNRESOLVED_ufixed (left_index downto fw); variable sresult : UNRESOLVED_ufixed (left_index downto 0) := (others => '0'); -- integer portion variable argx : NATURAL; -- internal version of arg begin if (result'length < 1) then return NAUF; end if; if arg /= 0 then argx := arg; for I in 0 to sresult'left loop if (argx mod 2) = 0 then sresult(I) := '0'; else sresult(I) := '1'; end if; argx := argx/2; end loop; if argx /= 0 then assert no_warning report fixed_generic_pkg'instance_name & "TO_UFIXED(NATURAL): vector truncated" severity warning; if overflow_style = fixed_saturate then return saturate (left_index, right_index); end if; end if; result := resize (arg => sresult, left_index => left_index, right_index => right_index, round_style => round_style, overflow_style => overflow_style); else result := (others => '0'); end if; return result; end function to_ufixed; function to_sfixed ( arg : INTEGER; -- integer constant left_index : INTEGER; -- left index (high index) constant right_index : INTEGER := 0; -- right index constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_sfixed is constant fw : INTEGER := mins (right_index, right_index); -- catch literals variable result : UNRESOLVED_sfixed (left_index downto fw); variable sresult : UNRESOLVED_sfixed (left_index downto 0) := (others => '0'); -- integer portion variable argx : INTEGER; -- internal version of arg variable sign : STD_ULOGIC; -- sign of input begin if (result'length < 1) then -- null range return NASF; end if; if arg /= 0 then if (arg < 0) then sign := '1'; argx := -(arg + 1); else sign := '0'; argx := arg; end if; for I in 0 to sresult'left loop if (argx mod 2) = 0 then sresult(I) := sign; else sresult(I) := not sign; end if; argx := argx/2; end loop; if argx /= 0 or left_index < 0 or sign /= sresult(sresult'left) then assert no_warning report fixed_generic_pkg'instance_name & "TO_SFIXED(INTEGER): vector truncated" severity warning; if overflow_style = fixed_saturate then -- saturate if arg < 0 then result := not saturate (result'high, result'low); -- underflow else result := saturate (result'high, result'low); -- overflow end if; return result; end if; end if; result := resize (arg => sresult, left_index => left_index, right_index => right_index, round_style => round_style, overflow_style => overflow_style); else result := (others => '0'); end if; return result; end function to_sfixed; function to_ufixed ( arg : REAL; -- real constant left_index : INTEGER; -- left index (high index) constant right_index : INTEGER; -- right index constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits return UNRESOLVED_ufixed is constant fw : INTEGER := mins (right_index, right_index); -- catch literals variable result : UNRESOLVED_ufixed (left_index downto fw) := (others => '0'); variable Xresult : UNRESOLVED_ufixed (left_index downto fw-guard_bits) := (others => '0'); variable presult : REAL; begin -- If negative or null range, return. if (left_index < fw) then return NAUF; end if; if (arg < 0.0) then report fixed_generic_pkg'instance_name & "TO_UFIXED: Negative argument passed " & REAL'image(arg) severity error; return result; end if; presult := arg; if presult >= (2.0**(left_index+1)) then assert no_warning report fixed_generic_pkg'instance_name & "TO_UFIXED(REAL): vector truncated" severity warning; if overflow_style = fixed_wrap then presult := presult mod (2.0**(left_index+1)); -- wrap else return saturate (result'high, result'low); end if; end if; for i in Xresult'range loop if presult >= 2.0**i then Xresult(i) := '1'; presult := presult - 2.0**i; else Xresult(i) := '0'; end if; end loop; if guard_bits > 0 and round_style = fixed_round then result := round_fixed (arg => Xresult (left_index downto right_index), remainder => Xresult (right_index-1 downto right_index-guard_bits), overflow_style => overflow_style); else result := Xresult (result'range); end if; return result; end function to_ufixed; function to_sfixed ( arg : REAL; -- real constant left_index : INTEGER; -- left index (high index) constant right_index : INTEGER; -- right index constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits return UNRESOLVED_sfixed is constant fw : INTEGER := mins (right_index, right_index); -- catch literals variable result : UNRESOLVED_sfixed (left_index downto fw) := (others => '0'); variable Xresult : UNRESOLVED_sfixed (left_index+1 downto fw-guard_bits) := (others => '0'); variable presult : REAL; begin if (left_index < fw) then -- null range return NASF; end if; if (arg >= (2.0**left_index) or arg < -(2.0**left_index)) then assert no_warning report fixed_generic_pkg'instance_name & "TO_SFIXED(REAL): vector truncated" severity warning; if overflow_style = fixed_saturate then if arg < 0.0 then -- saturate result := not saturate (result'high, result'low); -- underflow else result := saturate (result'high, result'low); -- overflow end if; return result; else presult := abs(arg) mod (2.0**(left_index+1)); -- wrap end if; else presult := abs(arg); end if; for i in Xresult'range loop if presult >= 2.0**i then Xresult(i) := '1'; presult := presult - 2.0**i; else Xresult(i) := '0'; end if; end loop; if arg < 0.0 then Xresult := to_fixed(-to_s(Xresult), Xresult'high, Xresult'low); end if; if guard_bits > 0 and round_style = fixed_round then result := round_fixed (arg => Xresult (left_index downto right_index), remainder => Xresult (right_index-1 downto right_index-guard_bits), overflow_style => overflow_style); else result := Xresult (result'range); end if; return result; end function to_sfixed; function to_ufixed ( arg : UNRESOLVED_UNSIGNED; -- unsigned constant left_index : INTEGER; -- left index (high index) constant right_index : INTEGER := 0; -- right index constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_ufixed is constant ARG_LEFT : INTEGER := arg'length-1; alias XARG : UNRESOLVED_UNSIGNED(ARG_LEFT downto 0) is arg; variable result : UNRESOLVED_ufixed (left_index downto right_index); begin if arg'length < 1 or (left_index < right_index) then return NAUF; end if; result := resize (arg => UNRESOLVED_ufixed (XARG), left_index => left_index, right_index => right_index, round_style => round_style, overflow_style => overflow_style); return result; end function to_ufixed; -- converted version function to_ufixed ( arg : UNRESOLVED_UNSIGNED) -- unsigned return UNRESOLVED_ufixed is constant ARG_LEFT : INTEGER := arg'length-1; alias XARG : UNRESOLVED_UNSIGNED(ARG_LEFT downto 0) is arg; begin if arg'length < 1 then return NAUF; end if; return UNRESOLVED_ufixed(XARG); end function to_ufixed; function to_sfixed ( arg : UNRESOLVED_SIGNED; -- signed constant left_index : INTEGER; -- left index (high index) constant right_index : INTEGER := 0; -- right index constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_sfixed is constant ARG_LEFT : INTEGER := arg'length-1; alias XARG : UNRESOLVED_SIGNED(ARG_LEFT downto 0) is arg; variable result : UNRESOLVED_sfixed (left_index downto right_index); begin if arg'length < 1 or (left_index < right_index) then return NASF; end if; result := resize (arg => UNRESOLVED_sfixed (XARG), left_index => left_index, right_index => right_index, round_style => round_style, overflow_style => overflow_style); return result; end function to_sfixed; -- converted version function to_sfixed ( arg : UNRESOLVED_SIGNED) -- signed return UNRESOLVED_sfixed is constant ARG_LEFT : INTEGER := arg'length-1; alias XARG : UNRESOLVED_SIGNED(ARG_LEFT downto 0) is arg; begin if arg'length < 1 then return NASF; end if; return UNRESOLVED_sfixed(XARG); end function to_sfixed; function to_sfixed (arg : UNRESOLVED_ufixed) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (arg'high+1 downto arg'low); begin if arg'length < 1 then return NASF; end if; result (arg'high downto arg'low) := UNRESOLVED_sfixed(cleanvec(arg)); result (arg'high+1) := '0'; return result; end function to_sfixed; -- Because of the fairly complicated sizing rules in the fixed point -- packages these functions are provided to compute the result ranges -- Example: -- signal uf1 : ufixed (3 downto -3); -- signal uf2 : ufixed (4 downto -2); -- signal uf1multuf2 : ufixed (ufixed_high (3, -3, '*', 4, -2) downto -- ufixed_low (3, -3, '*', 4, -2)); -- uf1multuf2 <= uf1 * uf2; -- Valid characters: '+', '-', '*', '/', 'r' or 'R' (rem), 'm' or 'M' (mod), -- '1' (reciprocal), 'A', 'a' (abs), 'N', 'n' (-sfixed) function ufixed_high (left_index, right_index : INTEGER; operation : CHARACTER := 'X'; left_index2, right_index2 : INTEGER := 0) return INTEGER is begin case operation is when '+'| '-' => return maximum (left_index, left_index2) + 1; when '*' => return left_index + left_index2 + 1; when '/' => return left_index - right_index2; when '1' => return -right_index; -- reciprocal when 'R'|'r' => return mins (left_index, left_index2); -- "rem" when 'M'|'m' => return mins (left_index, left_index2); -- "mod" when others => return left_index; -- For abs and default end case; end function ufixed_high; function ufixed_low (left_index, right_index : INTEGER; operation : CHARACTER := 'X'; left_index2, right_index2 : INTEGER := 0) return INTEGER is begin case operation is when '+'| '-' => return mins (right_index, right_index2); when '*' => return right_index + right_index2; when '/' => return right_index - left_index2 - 1; when '1' => return -left_index - 1; -- reciprocal when 'R'|'r' => return mins (right_index, right_index2); -- "rem" when 'M'|'m' => return mins (right_index, right_index2); -- "mod" when others => return right_index; -- for abs and default end case; end function ufixed_low; function sfixed_high (left_index, right_index : INTEGER; operation : CHARACTER := 'X'; left_index2, right_index2 : INTEGER := 0) return INTEGER is begin case operation is when '+'| '-' => return maximum (left_index, left_index2) + 1; when '*' => return left_index + left_index2 + 1; when '/' => return left_index - right_index2 + 1; when '1' => return -right_index + 1; -- reciprocal when 'R'|'r' => return mins (left_index, left_index2); -- "rem" when 'M'|'m' => return left_index2; -- "mod" when 'A'|'a' => return left_index + 1; -- "abs" when 'N'|'n' => return left_index + 1; -- -sfixed when others => return left_index; end case; end function sfixed_high; function sfixed_low (left_index, right_index : INTEGER; operation : CHARACTER := 'X'; left_index2, right_index2 : INTEGER := 0) return INTEGER is begin case operation is when '+'| '-' => return mins (right_index, right_index2); when '*' => return right_index + right_index2; when '/' => return right_index - left_index2; when '1' => return -left_index; -- reciprocal when 'R'|'r' => return mins (right_index, right_index2); -- "rem" when 'M'|'m' => return mins (right_index, right_index2); -- "mod" when others => return right_index; -- default for abs, neg and default end case; end function sfixed_low; -- Same as above, but using the "size_res" input only for their ranges: -- signal uf1multuf2 : ufixed (ufixed_high (uf1, '*', uf2) downto -- ufixed_low (uf1, '*', uf2)); -- uf1multuf2 <= uf1 * uf2; function ufixed_high (size_res : UNRESOLVED_ufixed; operation : CHARACTER := 'X'; size_res2 : UNRESOLVED_ufixed) return INTEGER is begin return ufixed_high (left_index => size_res'high, right_index => size_res'low, operation => operation, left_index2 => size_res2'high, right_index2 => size_res2'low); end function ufixed_high; function ufixed_low (size_res : UNRESOLVED_ufixed; operation : CHARACTER := 'X'; size_res2 : UNRESOLVED_ufixed) return INTEGER is begin return ufixed_low (left_index => size_res'high, right_index => size_res'low, operation => operation, left_index2 => size_res2'high, right_index2 => size_res2'low); end function ufixed_low; function sfixed_high (size_res : UNRESOLVED_sfixed; operation : CHARACTER := 'X'; size_res2 : UNRESOLVED_sfixed) return INTEGER is begin return sfixed_high (left_index => size_res'high, right_index => size_res'low, operation => operation, left_index2 => size_res2'high, right_index2 => size_res2'low); end function sfixed_high; function sfixed_low (size_res : UNRESOLVED_sfixed; operation : CHARACTER := 'X'; size_res2 : UNRESOLVED_sfixed) return INTEGER is begin return sfixed_low (left_index => size_res'high, right_index => size_res'low, operation => operation, left_index2 => size_res2'high, right_index2 => size_res2'low); end function sfixed_low; -- purpose: returns a saturated number function saturate ( constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed is constant sat : UNRESOLVED_ufixed (left_index downto right_index) := (others => '1'); begin return sat; end function saturate; -- purpose: returns a saturated number function saturate ( constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed is variable sat : UNRESOLVED_sfixed (left_index downto right_index) := (others => '1'); begin -- saturate positive, to saturate negative, just do "not saturate()" sat (left_index) := '0'; return sat; end function saturate; function saturate ( size_res : UNRESOLVED_ufixed) -- only the size of this is used return UNRESOLVED_ufixed is begin return saturate (size_res'high, size_res'low); end function saturate; function saturate ( size_res : UNRESOLVED_sfixed) -- only the size of this is used return UNRESOLVED_sfixed is begin return saturate (size_res'high, size_res'low); end function saturate; -- As a concession to those who use a graphical DSP environment, -- these functions take parameters in those tools format and create -- fixed point numbers. These functions are designed to convert from -- a std_logic_vector to the VHDL fixed point format using the conventions -- of these packages. In a pure VHDL environment you should use the -- "to_ufixed" and "to_sfixed" routines. -- Unsigned fixed point function to_UFix ( arg : STD_ULOGIC_VECTOR; width : NATURAL; -- width of vector fraction : NATURAL) -- width of fraction return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (width-fraction-1 downto -fraction); begin if (arg'length /= result'length) then report fixed_generic_pkg'instance_name & "TO_UFIX (STD_ULOGIC_VECTOR) " & "Vector lengths do not match. Input length is " & INTEGER'image(arg'length) & " and output will be " & INTEGER'image(result'length) & " wide." severity error; return NAUF; else result := to_ufixed (arg, result'high, result'low); return result; end if; end function to_UFix; -- signed fixed point function to_SFix ( arg : STD_ULOGIC_VECTOR; width : NATURAL; -- width of vector fraction : NATURAL) -- width of fraction return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (width-fraction-1 downto -fraction); begin if (arg'length /= result'length) then report fixed_generic_pkg'instance_name & "TO_SFIX (STD_ULOGIC_VECTOR) " & "Vector lengths do not match. Input length is " & INTEGER'image(arg'length) & " and output will be " & INTEGER'image(result'length) & " wide." severity error; return NASF; else result := to_sfixed (arg, result'high, result'low); return result; end if; end function to_SFix; -- finding the bounds of a number. These functions can be used like this: -- signal xxx : ufixed (7 downto -3); -- -- Which is the same as "ufixed (UFix_high (11,3) downto UFix_low(11,3))" -- signal yyy : ufixed (UFix_high (11, 3, "+", 11, 3) -- downto UFix_low(11, 3, "+", 11, 3)); -- Where "11" is the width of xxx (xxx'length), -- and 3 is the lower bound (abs (xxx'low)) -- In a pure VHDL environment use "ufixed_high" and "ufixed_low" function ufix_high ( width, fraction : NATURAL; operation : CHARACTER := 'X'; width2, fraction2 : NATURAL := 0) return INTEGER is begin return ufixed_high (left_index => width - 1 - fraction, right_index => -fraction, operation => operation, left_index2 => width2 - 1 - fraction2, right_index2 => -fraction2); end function ufix_high; function ufix_low ( width, fraction : NATURAL; operation : CHARACTER := 'X'; width2, fraction2 : NATURAL := 0) return INTEGER is begin return ufixed_low (left_index => width - 1 - fraction, right_index => -fraction, operation => operation, left_index2 => width2 - 1 - fraction2, right_index2 => -fraction2); end function ufix_low; function sfix_high ( width, fraction : NATURAL; operation : CHARACTER := 'X'; width2, fraction2 : NATURAL := 0) return INTEGER is begin return sfixed_high (left_index => width - fraction, right_index => -fraction, operation => operation, left_index2 => width2 - fraction2, right_index2 => -fraction2); end function sfix_high; function sfix_low ( width, fraction : NATURAL; operation : CHARACTER := 'X'; width2, fraction2 : NATURAL := 0) return INTEGER is begin return sfixed_low (left_index => width - fraction, right_index => -fraction, operation => operation, left_index2 => width2 - fraction2, right_index2 => -fraction2); end function sfix_low; function to_unsigned ( arg : UNRESOLVED_ufixed; -- ufixed point input constant size : NATURAL; -- length of output constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_UNSIGNED is begin return to_uns(resize (arg => arg, left_index => size-1, right_index => 0, round_style => round_style, overflow_style => overflow_style)); end function to_unsigned; function to_unsigned ( arg : UNRESOLVED_ufixed; -- ufixed point input size_res : UNRESOLVED_UNSIGNED; -- length of output constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_UNSIGNED is begin return to_unsigned (arg => arg, size => size_res'length, round_style => round_style, overflow_style => overflow_style); end function to_unsigned; function to_signed ( arg : UNRESOLVED_sfixed; -- sfixed point input constant size : NATURAL; -- length of output constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_SIGNED is begin return to_s(resize (arg => arg, left_index => size-1, right_index => 0, round_style => round_style, overflow_style => overflow_style)); end function to_signed; function to_signed ( arg : UNRESOLVED_sfixed; -- sfixed point input size_res : UNRESOLVED_SIGNED; -- used for length of output constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_SIGNED is begin return to_signed (arg => arg, size => size_res'length, round_style => round_style, overflow_style => overflow_style); end function to_signed; function to_real ( arg : UNRESOLVED_ufixed) -- ufixed point input return REAL is constant left_index : INTEGER := arg'high; constant right_index : INTEGER := arg'low; variable result : REAL; -- result variable arg_int : UNRESOLVED_ufixed (left_index downto right_index); begin if (arg'length < 1) then return 0.0; end if; arg_int := To_X01(cleanvec(arg)); if (Is_X(arg_int)) then assert no_warning report fixed_generic_pkg'instance_name & "TO_REAL (ufixed): metavalue detected, returning 0.0" severity warning; return 0.0; end if; result := 0.0; for i in arg_int'range loop if (arg_int(i) = '1') then result := result + (2.0**i); end if; end loop; return result; end function to_real; function to_real ( arg : UNRESOLVED_sfixed) -- ufixed point input return REAL is constant left_index : INTEGER := arg'high; constant right_index : INTEGER := arg'low; variable result : REAL; -- result variable arg_int : UNRESOLVED_sfixed (left_index downto right_index); -- unsigned version of argument variable arg_uns : UNRESOLVED_ufixed (left_index downto right_index); -- absolute of argument begin if (arg'length < 1) then return 0.0; end if; arg_int := to_X01(cleanvec(arg)); if (Is_X(arg_int)) then assert no_warning report fixed_generic_pkg'instance_name & "TO_REAL (sfixed): metavalue detected, returning 0.0" severity warning; return 0.0; end if; arg_uns := to_ufixed (arg_int); result := to_real (arg_uns); if (arg_int(arg_int'high) = '1') then result := -result; end if; return result; end function to_real; function to_integer ( arg : UNRESOLVED_ufixed; -- fixed point input constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return NATURAL is constant left_index : INTEGER := arg'high; variable arg_uns : UNRESOLVED_UNSIGNED (left_index+1 downto 0) := (others => '0'); begin if (arg'length < 1) then return 0; end if; if (Is_X (arg)) then assert no_warning report fixed_generic_pkg'instance_name & "TO_INTEGER (ufixed): metavalue detected, returning 0" severity warning; return 0; end if; if (left_index < -1) then return 0; end if; arg_uns := to_uns(resize (arg => arg, left_index => arg_uns'high, right_index => 0, round_style => round_style, overflow_style => overflow_style)); return to_integer (arg_uns); end function to_integer; function to_integer ( arg : UNRESOLVED_sfixed; -- fixed point input constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return INTEGER is constant left_index : INTEGER := arg'high; variable arg_s : UNRESOLVED_SIGNED (left_index+1 downto 0); begin if (arg'length < 1) then return 0; end if; if (Is_X (arg)) then assert no_warning report fixed_generic_pkg'instance_name & "TO_INTEGER (sfixed): metavalue detected, returning 0" severity warning; return 0; end if; if (left_index < -1) then return 0; end if; arg_s := to_s(resize (arg => arg, left_index => arg_s'high, right_index => 0, round_style => round_style, overflow_style => overflow_style)); return to_integer (arg_s); end function to_integer; function to_01 ( s : UNRESOLVED_ufixed; -- ufixed point input constant XMAP : STD_ULOGIC := '0') -- Map x to return UNRESOLVED_ufixed is begin if (s'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & "TO_01(ufixed): null detected, returning NULL" severity warning; return NAUF; end if; return to_fixed (to_01(to_uns(s), XMAP), s'high, s'low); end function to_01; function to_01 ( s : UNRESOLVED_sfixed; -- sfixed point input constant XMAP : STD_ULOGIC := '0') -- Map x to return UNRESOLVED_sfixed is begin if (s'length < 1) then assert no_warning report fixed_generic_pkg'instance_name & "TO_01(sfixed): null detected, returning NULL" severity warning; return NASF; end if; return to_fixed (to_01(to_s(s), XMAP), s'high, s'low); end function to_01; function Is_X ( arg : UNRESOLVED_ufixed) return BOOLEAN is variable argslv : STD_ULOGIC_VECTOR (arg'length-1 downto 0); -- slv begin argslv := to_sulv(arg); return Is_X (argslv); end function Is_X; function Is_X ( arg : UNRESOLVED_sfixed) return BOOLEAN is variable argslv : STD_ULOGIC_VECTOR (arg'length-1 downto 0); -- slv begin argslv := to_sulv(arg); return Is_X (argslv); end function Is_X; function To_X01 ( arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is begin return to_ufixed (To_X01(to_sulv(arg)), arg'high, arg'low); end function To_X01; function to_X01 ( arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return to_sfixed (To_X01(to_sulv(arg)), arg'high, arg'low); end function to_X01; function To_X01Z ( arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is begin return to_ufixed (To_X01Z(to_sulv(arg)), arg'high, arg'low); end function To_X01Z; function to_X01Z ( arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return to_sfixed (To_X01Z(to_sulv(arg)), arg'high, arg'low); end function to_X01Z; function To_UX01 ( arg : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is begin return to_ufixed (To_UX01(to_sulv(arg)), arg'high, arg'low); end function To_UX01; function to_UX01 ( arg : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return to_sfixed (To_UX01(to_sulv(arg)), arg'high, arg'low); end function to_UX01; function resize ( arg : UNRESOLVED_ufixed; -- input constant left_index : INTEGER; -- integer portion constant right_index : INTEGER; -- size of fraction constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_ufixed is constant arghigh : INTEGER := maximum (arg'high, arg'low); constant arglow : INTEGER := mine (arg'high, arg'low); variable invec : UNRESOLVED_ufixed (arghigh downto arglow); variable result : UNRESOLVED_ufixed(left_index downto right_index) := (others => '0'); variable needs_rounding : BOOLEAN := false; begin -- resize if (arg'length < 1) or (result'length < 1) then return NAUF; elsif (invec'length < 1) then return result; -- string literal value else invec := cleanvec(arg); if (right_index > arghigh) then -- return top zeros needs_rounding := (round_style = fixed_round) and (right_index = arghigh+1); elsif (left_index < arglow) then -- return overflow if (overflow_style = fixed_saturate) and (or(to_sulv(invec)) = '1') then result := saturate (result'high, result'low); -- saturate end if; elsif (arghigh > left_index) then -- wrap or saturate? if (overflow_style = fixed_saturate and or (to_sulv(invec(arghigh downto left_index+1))) = '1') then result := saturate (result'high, result'low); -- saturate else if (arglow >= right_index) then result (left_index downto arglow) := invec(left_index downto arglow); else result (left_index downto right_index) := invec (left_index downto right_index); needs_rounding := (round_style = fixed_round); -- round end if; end if; else -- arghigh <= integer width if (arglow >= right_index) then result (arghigh downto arglow) := invec; else result (arghigh downto right_index) := invec (arghigh downto right_index); needs_rounding := (round_style = fixed_round); -- round end if; end if; -- Round result if needs_rounding then result := round_fixed (arg => result, remainder => invec (right_index-1 downto arglow), overflow_style => overflow_style); end if; return result; end if; end function resize; function resize ( arg : UNRESOLVED_sfixed; -- input constant left_index : INTEGER; -- integer portion constant right_index : INTEGER; -- size of fraction constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_sfixed is constant arghigh : INTEGER := maximum (arg'high, arg'low); constant arglow : INTEGER := mine (arg'high, arg'low); variable invec : UNRESOLVED_sfixed (arghigh downto arglow); variable result : UNRESOLVED_sfixed(left_index downto right_index) := (others => '0'); variable reduced : STD_ULOGIC; variable needs_rounding : BOOLEAN := false; -- rounding begin -- resize if (arg'length < 1) or (result'length < 1) then return NASF; elsif (invec'length < 1) then return result; -- string literal value else invec := cleanvec(arg); if (right_index > arghigh) then -- return top zeros if (arg'low /= INTEGER'low) then -- check for a literal result := (others => arg(arghigh)); -- sign extend end if; needs_rounding := (round_style = fixed_round) and (right_index = arghigh+1); elsif (left_index < arglow) then -- return overflow if (overflow_style = fixed_saturate) then reduced := or (to_sulv(invec)); if (reduced = '1') then if (invec(arghigh) = '0') then -- saturate POSITIVE result := saturate (result'high, result'low); else -- saturate negative result := not saturate (result'high, result'low); end if; -- else return 0 (input was 0) end if; -- else return 0 (wrap) end if; elsif (arghigh > left_index) then if (invec(arghigh) = '0') then reduced := or (to_sulv(invec(arghigh-1 downto left_index))); if overflow_style = fixed_saturate and reduced = '1' then -- saturate positive result := saturate (result'high, result'low); else if (right_index > arglow) then result := invec (left_index downto right_index); needs_rounding := (round_style = fixed_round); else result (left_index downto arglow) := invec (left_index downto arglow); end if; end if; else reduced := and (to_sulv(invec(arghigh-1 downto left_index))); if overflow_style = fixed_saturate and reduced = '0' then result := not saturate (result'high, result'low); else if (right_index > arglow) then result := invec (left_index downto right_index); needs_rounding := (round_style = fixed_round); else result (left_index downto arglow) := invec (left_index downto arglow); end if; end if; end if; else -- arghigh <= integer width if (arglow >= right_index) then result (arghigh downto arglow) := invec; else result (arghigh downto right_index) := invec (arghigh downto right_index); needs_rounding := (round_style = fixed_round); -- round end if; if (left_index > arghigh) then -- sign extend result(left_index downto arghigh+1) := (others => invec(arghigh)); end if; end if; -- Round result if (needs_rounding) then result := round_fixed (arg => result, remainder => invec (right_index-1 downto arglow), overflow_style => overflow_style); end if; return result; end if; end function resize; -- size_res functions -- These functions compute the size from a passed variable named "size_res" -- The only part of this variable used it it's size, it is never passed -- to a lower level routine. function to_ufixed ( arg : STD_ULOGIC_VECTOR; -- shifted vector size_res : UNRESOLVED_ufixed) -- for size only return UNRESOLVED_ufixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_ufixed (size_res'left downto fw); begin if (result'length < 1 or arg'length < 1) then return NAUF; else result := to_ufixed (arg => arg, left_index => size_res'high, right_index => size_res'low); return result; end if; end function to_ufixed; function to_sfixed ( arg : STD_ULOGIC_VECTOR; -- shifted vector size_res : UNRESOLVED_sfixed) -- for size only return UNRESOLVED_sfixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_sfixed (size_res'left downto fw); begin if (result'length < 1 or arg'length < 1) then return NASF; else result := to_sfixed (arg => arg, left_index => size_res'high, right_index => size_res'low); return result; end if; end function to_sfixed; function to_ufixed ( arg : NATURAL; -- integer size_res : UNRESOLVED_ufixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_ufixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_ufixed (size_res'left downto fw); begin if (result'length < 1) then return NAUF; else result := to_ufixed (arg => arg, left_index => size_res'high, right_index => size_res'low, round_style => round_style, overflow_style => overflow_style); return result; end if; end function to_ufixed; function to_sfixed ( arg : INTEGER; -- integer size_res : UNRESOLVED_sfixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_sfixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_sfixed (size_res'left downto fw); begin if (result'length < 1) then return NASF; else result := to_sfixed (arg => arg, left_index => size_res'high, right_index => size_res'low, round_style => round_style, overflow_style => overflow_style); return result; end if; end function to_sfixed; function to_ufixed ( arg : REAL; -- real size_res : UNRESOLVED_ufixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits return UNRESOLVED_ufixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_ufixed (size_res'left downto fw); begin if (result'length < 1) then return NAUF; else result := to_ufixed (arg => arg, left_index => size_res'high, right_index => size_res'low, guard_bits => guard_bits, round_style => round_style, overflow_style => overflow_style); return result; end if; end function to_ufixed; function to_sfixed ( arg : REAL; -- real size_res : UNRESOLVED_sfixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style; constant guard_bits : NATURAL := fixed_guard_bits) -- # of guard bits return UNRESOLVED_sfixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_sfixed (size_res'left downto fw); begin if (result'length < 1) then return NASF; else result := to_sfixed (arg => arg, left_index => size_res'high, right_index => size_res'low, guard_bits => guard_bits, round_style => round_style, overflow_style => overflow_style); return result; end if; end function to_sfixed; function to_ufixed ( arg : UNRESOLVED_UNSIGNED; -- unsigned size_res : UNRESOLVED_ufixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_ufixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_ufixed (size_res'left downto fw); begin if (result'length < 1 or arg'length < 1) then return NAUF; else result := to_ufixed (arg => arg, left_index => size_res'high, right_index => size_res'low, round_style => round_style, overflow_style => overflow_style); return result; end if; end function to_ufixed; function to_sfixed ( arg : UNRESOLVED_SIGNED; -- signed size_res : UNRESOLVED_sfixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_sfixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_sfixed (size_res'left downto fw); begin if (result'length < 1 or arg'length < 1) then return NASF; else result := to_sfixed (arg => arg, left_index => size_res'high, right_index => size_res'low, round_style => round_style, overflow_style => overflow_style); return result; end if; end function to_sfixed; function resize ( arg : UNRESOLVED_ufixed; -- input size_res : UNRESOLVED_ufixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_ufixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_ufixed (size_res'high downto fw); begin if (result'length < 1 or arg'length < 1) then return NAUF; else result := resize (arg => arg, left_index => size_res'high, right_index => size_res'low, round_style => round_style, overflow_style => overflow_style); return result; end if; end function resize; function resize ( arg : UNRESOLVED_sfixed; -- input size_res : UNRESOLVED_sfixed; -- for size only constant overflow_style : fixed_overflow_style_type := fixed_overflow_style; constant round_style : fixed_round_style_type := fixed_round_style) return UNRESOLVED_sfixed is constant fw : INTEGER := mine (size_res'low, size_res'low); -- catch literals variable result : UNRESOLVED_sfixed (size_res'high downto fw); begin if (result'length < 1 or arg'length < 1) then return NASF; else result := resize (arg => arg, left_index => size_res'high, right_index => size_res'low, round_style => round_style, overflow_style => overflow_style); return result; end if; end function resize; -- Overloaded math functions for real function "+" ( l : UNRESOLVED_ufixed; -- fixed point input r : REAL) return UNRESOLVED_ufixed is begin return (l + to_ufixed (r, l'high, l'low)); end function "+"; function "+" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, r'low) + r); end function "+"; function "+" ( l : UNRESOLVED_sfixed; -- fixed point input r : REAL) return UNRESOLVED_sfixed is begin return (l + to_sfixed (r, l'high, l'low)); end function "+"; function "+" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, r'low) + r); end function "+"; function "-" ( l : UNRESOLVED_ufixed; -- fixed point input r : REAL) return UNRESOLVED_ufixed is begin return (l - to_ufixed (r, l'high, l'low)); end function "-"; function "-" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, r'low) - r); end function "-"; function "-" ( l : UNRESOLVED_sfixed; -- fixed point input r : REAL) return UNRESOLVED_sfixed is begin return (l - to_sfixed (r, l'high, l'low)); end function "-"; function "-" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, r'low) - r); end function "-"; function "*" ( l : UNRESOLVED_ufixed; -- fixed point input r : REAL) return UNRESOLVED_ufixed is begin return (l * to_ufixed (r, l'high, l'low)); end function "*"; function "*" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, r'low) * r); end function "*"; function "*" ( l : UNRESOLVED_sfixed; -- fixed point input r : REAL) return UNRESOLVED_sfixed is begin return (l * to_sfixed (r, l'high, l'low)); end function "*"; function "*" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, r'low) * r); end function "*"; function "/" ( l : UNRESOLVED_ufixed; -- fixed point input r : REAL) return UNRESOLVED_ufixed is begin return (l / to_ufixed (r, l'high, l'low)); end function "/"; function "/" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, r'low) / r); end function "/"; function "/" ( l : UNRESOLVED_sfixed; -- fixed point input r : REAL) return UNRESOLVED_sfixed is begin return (l / to_sfixed (r, l'high, l'low)); end function "/"; function "/" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, r'low) / r); end function "/"; function "rem" ( l : UNRESOLVED_ufixed; -- fixed point input r : REAL) return UNRESOLVED_ufixed is begin return (l rem to_ufixed (r, l'high, l'low)); end function "rem"; function "rem" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, r'low) rem r); end function "rem"; function "rem" ( l : UNRESOLVED_sfixed; -- fixed point input r : REAL) return UNRESOLVED_sfixed is begin return (l rem to_sfixed (r, l'high, l'low)); end function "rem"; function "rem" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, r'low) rem r); end function "rem"; function "mod" ( l : UNRESOLVED_ufixed; -- fixed point input r : REAL) return UNRESOLVED_ufixed is begin return (l mod to_ufixed (r, l'high, l'low)); end function "mod"; function "mod" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, r'low) mod r); end function "mod"; function "mod" ( l : UNRESOLVED_sfixed; -- fixed point input r : REAL) return UNRESOLVED_sfixed is begin return (l mod to_sfixed (r, l'high, l'low)); end function "mod"; function "mod" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, r'low) mod r); end function "mod"; -- Overloaded math functions for integers function "+" ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return (l + to_ufixed (r, l'high, 0)); end function "+"; function "+" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, 0) + r); end function "+"; function "+" ( l : UNRESOLVED_sfixed; -- fixed point input r : INTEGER) return UNRESOLVED_sfixed is begin return (l + to_sfixed (r, l'high, 0)); end function "+"; function "+" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, 0) + r); end function "+"; -- Overloaded functions function "-" ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return (l - to_ufixed (r, l'high, 0)); end function "-"; function "-" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, 0) - r); end function "-"; function "-" ( l : UNRESOLVED_sfixed; -- fixed point input r : INTEGER) return UNRESOLVED_sfixed is begin return (l - to_sfixed (r, l'high, 0)); end function "-"; function "-" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, 0) - r); end function "-"; -- Overloaded functions function "*" ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return (l * to_ufixed (r, l'high, 0)); end function "*"; function "*" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, 0) * r); end function "*"; function "*" ( l : UNRESOLVED_sfixed; -- fixed point input r : INTEGER) return UNRESOLVED_sfixed is begin return (l * to_sfixed (r, l'high, 0)); end function "*"; function "*" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, 0) * r); end function "*"; -- Overloaded functions function "/" ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return (l / to_ufixed (r, l'high, 0)); end function "/"; function "/" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, 0) / r); end function "/"; function "/" ( l : UNRESOLVED_sfixed; -- fixed point input r : INTEGER) return UNRESOLVED_sfixed is begin return (l / to_sfixed (r, l'high, 0)); end function "/"; function "/" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, 0) / r); end function "/"; function "rem" ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return (l rem to_ufixed (r, l'high, 0)); end function "rem"; function "rem" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, 0) rem r); end function "rem"; function "rem" ( l : UNRESOLVED_sfixed; -- fixed point input r : INTEGER) return UNRESOLVED_sfixed is begin return (l rem to_sfixed (r, l'high, 0)); end function "rem"; function "rem" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, 0) rem r); end function "rem"; function "mod" ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return (l mod to_ufixed (r, l'high, 0)); end function "mod"; function "mod" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return (to_ufixed (l, r'high, 0) mod r); end function "mod"; function "mod" ( l : UNRESOLVED_sfixed; -- fixed point input r : INTEGER) return UNRESOLVED_sfixed is begin return (l mod to_sfixed (r, l'high, 0)); end function "mod"; function "mod" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return UNRESOLVED_sfixed is begin return (to_sfixed (l, r'high, 0) mod r); end function "mod"; -- overloaded ufixed compare functions with integer function "=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return BOOLEAN is begin return (l = to_ufixed (r, l'high, l'low)); end function "="; function "/=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return BOOLEAN is begin return (l /= to_ufixed (r, l'high, l'low)); end function "/="; function ">=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return BOOLEAN is begin return (l >= to_ufixed (r, l'high, l'low)); end function ">="; function "<=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return BOOLEAN is begin return (l <= to_ufixed (r, l'high, l'low)); end function "<="; function ">" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return BOOLEAN is begin return (l > to_ufixed (r, l'high, l'low)); end function ">"; function "<" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return BOOLEAN is begin return (l < to_ufixed (r, l'high, l'low)); end function "<"; function "?=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return STD_ULOGIC is begin return (l ?= to_ufixed (r, l'high, l'low)); end function "?="; function "?/=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return STD_ULOGIC is begin return (l ?/= to_ufixed (r, l'high, l'low)); end function "?/="; function "?>=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return STD_ULOGIC is begin return (l ?>= to_ufixed (r, l'high, l'low)); end function "?>="; function "?<=" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return STD_ULOGIC is begin return (l ?<= to_ufixed (r, l'high, l'low)); end function "?<="; function "?>" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return STD_ULOGIC is begin return (l ?> to_ufixed (r, l'high, l'low)); end function "?>"; function "?<" ( l : UNRESOLVED_ufixed; r : NATURAL) -- fixed point input return STD_ULOGIC is begin return (l ?< to_ufixed (r, l'high, l'low)); end function "?<"; function maximum ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return maximum (l, to_ufixed (r, l'high, l'low)); end function maximum; function minimum ( l : UNRESOLVED_ufixed; -- fixed point input r : NATURAL) return UNRESOLVED_ufixed is begin return minimum (l, to_ufixed (r, l'high, l'low)); end function minimum; -- NATURAL to ufixed function "=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) = r); end function "="; function "/=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) /= r); end function "/="; function ">=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) >= r); end function ">="; function "<=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) <= r); end function "<="; function ">" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) > r); end function ">"; function "<" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) < r); end function "<"; function "?=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?= r); end function "?="; function "?/=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?/= r); end function "?/="; function "?>=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?>= r); end function "?>="; function "?<=" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?<= r); end function "?<="; function "?>" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?> r); end function "?>"; function "?<" ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?< r); end function "?<"; function maximum ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return maximum (to_ufixed (l, r'high, r'low), r); end function maximum; function minimum ( l : NATURAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return minimum (to_ufixed (l, r'high, r'low), r); end function minimum; -- overloaded ufixed compare functions with real function "=" ( l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN is begin return (l = to_ufixed (r, l'high, l'low)); end function "="; function "/=" ( l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN is begin return (l /= to_ufixed (r, l'high, l'low)); end function "/="; function ">=" ( l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN is begin return (l >= to_ufixed (r, l'high, l'low)); end function ">="; function "<=" ( l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN is begin return (l <= to_ufixed (r, l'high, l'low)); end function "<="; function ">" ( l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN is begin return (l > to_ufixed (r, l'high, l'low)); end function ">"; function "<" ( l : UNRESOLVED_ufixed; r : REAL) return BOOLEAN is begin return (l < to_ufixed (r, l'high, l'low)); end function "<"; function "?=" ( l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC is begin return (l ?= to_ufixed (r, l'high, l'low)); end function "?="; function "?/=" ( l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC is begin return (l ?/= to_ufixed (r, l'high, l'low)); end function "?/="; function "?>=" ( l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC is begin return (l ?>= to_ufixed (r, l'high, l'low)); end function "?>="; function "?<=" ( l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC is begin return (l ?<= to_ufixed (r, l'high, l'low)); end function "?<="; function "?>" ( l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC is begin return (l ?> to_ufixed (r, l'high, l'low)); end function "?>"; function "?<" ( l : UNRESOLVED_ufixed; r : REAL) return STD_ULOGIC is begin return (l ?< to_ufixed (r, l'high, l'low)); end function "?<"; function maximum ( l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed is begin return maximum (l, to_ufixed (r, l'high, l'low)); end function maximum; function minimum ( l : UNRESOLVED_ufixed; r : REAL) return UNRESOLVED_ufixed is begin return minimum (l, to_ufixed (r, l'high, l'low)); end function minimum; -- real and ufixed function "=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) = r); end function "="; function "/=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) /= r); end function "/="; function ">=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) >= r); end function ">="; function "<=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) <= r); end function "<="; function ">" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) > r); end function ">"; function "<" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return BOOLEAN is begin return (to_ufixed (l, r'high, r'low) < r); end function "<"; function "?=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?= r); end function "?="; function "?/=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?/= r); end function "?/="; function "?>=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?>= r); end function "?>="; function "?<=" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?<= r); end function "?<="; function "?>" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?> r); end function "?>"; function "?<" ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return STD_ULOGIC is begin return (to_ufixed (l, r'high, r'low) ?< r); end function "?<"; function maximum ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return maximum (to_ufixed (l, r'high, r'low), r); end function maximum; function minimum ( l : REAL; r : UNRESOLVED_ufixed) -- fixed point input return UNRESOLVED_ufixed is begin return minimum (to_ufixed (l, r'high, r'low), r); end function minimum; -- overloaded sfixed compare functions with integer function "=" ( l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN is begin return (l = to_sfixed (r, l'high, l'low)); end function "="; function "/=" ( l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN is begin return (l /= to_sfixed (r, l'high, l'low)); end function "/="; function ">=" ( l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN is begin return (l >= to_sfixed (r, l'high, l'low)); end function ">="; function "<=" ( l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN is begin return (l <= to_sfixed (r, l'high, l'low)); end function "<="; function ">" ( l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN is begin return (l > to_sfixed (r, l'high, l'low)); end function ">"; function "<" ( l : UNRESOLVED_sfixed; r : INTEGER) return BOOLEAN is begin return (l < to_sfixed (r, l'high, l'low)); end function "<"; function "?=" ( l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC is begin return (l ?= to_sfixed (r, l'high, l'low)); end function "?="; function "?/=" ( l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC is begin return (l ?/= to_sfixed (r, l'high, l'low)); end function "?/="; function "?>=" ( l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC is begin return (l ?>= to_sfixed (r, l'high, l'low)); end function "?>="; function "?<=" ( l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC is begin return (l ?<= to_sfixed (r, l'high, l'low)); end function "?<="; function "?>" ( l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC is begin return (l ?> to_sfixed (r, l'high, l'low)); end function "?>"; function "?<" ( l : UNRESOLVED_sfixed; r : INTEGER) return STD_ULOGIC is begin return (l ?< to_sfixed (r, l'high, l'low)); end function "?<"; function maximum ( l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed is begin return maximum (l, to_sfixed (r, l'high, l'low)); end function maximum; function minimum ( l : UNRESOLVED_sfixed; r : INTEGER) return UNRESOLVED_sfixed is begin return minimum (l, to_sfixed (r, l'high, l'low)); end function minimum; -- integer and sfixed function "=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) = r); end function "="; function "/=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) /= r); end function "/="; function ">=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) >= r); end function ">="; function "<=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) <= r); end function "<="; function ">" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) > r); end function ">"; function "<" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) < r); end function "<"; function "?=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?= r); end function "?="; function "?/=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?/= r); end function "?/="; function "?>=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?>= r); end function "?>="; function "?<=" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?<= r); end function "?<="; function "?>" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?> r); end function "?>"; function "?<" ( l : INTEGER; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?< r); end function "?<"; function maximum ( l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return maximum (to_sfixed (l, r'high, r'low), r); end function maximum; function minimum ( l : INTEGER; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return minimum (to_sfixed (l, r'high, r'low), r); end function minimum; -- overloaded sfixed compare functions with real function "=" ( l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN is begin return (l = to_sfixed (r, l'high, l'low)); end function "="; function "/=" ( l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN is begin return (l /= to_sfixed (r, l'high, l'low)); end function "/="; function ">=" ( l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN is begin return (l >= to_sfixed (r, l'high, l'low)); end function ">="; function "<=" ( l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN is begin return (l <= to_sfixed (r, l'high, l'low)); end function "<="; function ">" ( l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN is begin return (l > to_sfixed (r, l'high, l'low)); end function ">"; function "<" ( l : UNRESOLVED_sfixed; r : REAL) return BOOLEAN is begin return (l < to_sfixed (r, l'high, l'low)); end function "<"; function "?=" ( l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC is begin return (l ?= to_sfixed (r, l'high, l'low)); end function "?="; function "?/=" ( l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC is begin return (l ?/= to_sfixed (r, l'high, l'low)); end function "?/="; function "?>=" ( l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC is begin return (l ?>= to_sfixed (r, l'high, l'low)); end function "?>="; function "?<=" ( l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC is begin return (l ?<= to_sfixed (r, l'high, l'low)); end function "?<="; function "?>" ( l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC is begin return (l ?> to_sfixed (r, l'high, l'low)); end function "?>"; function "?<" ( l : UNRESOLVED_sfixed; r : REAL) return STD_ULOGIC is begin return (l ?< to_sfixed (r, l'high, l'low)); end function "?<"; function maximum ( l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed is begin return maximum (l, to_sfixed (r, l'high, l'low)); end function maximum; function minimum ( l : UNRESOLVED_sfixed; r : REAL) return UNRESOLVED_sfixed is begin return minimum (l, to_sfixed (r, l'high, l'low)); end function minimum; -- REAL and sfixed function "=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) = r); end function "="; function "/=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) /= r); end function "/="; function ">=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) >= r); end function ">="; function "<=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) <= r); end function "<="; function ">" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) > r); end function ">"; function "<" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return BOOLEAN is begin return (to_sfixed (l, r'high, r'low) < r); end function "<"; function "?=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?= r); end function "?="; function "?/=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?/= r); end function "?/="; function "?>=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?>= r); end function "?>="; function "?<=" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?<= r); end function "?<="; function "?>" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?> r); end function "?>"; function "?<" ( l : REAL; r : UNRESOLVED_sfixed) -- fixed point input return STD_ULOGIC is begin return (to_sfixed (l, r'high, r'low) ?< r); end function "?<"; function maximum ( l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return maximum (to_sfixed (l, r'high, r'low), r); end function maximum; function minimum ( l : REAL; r : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return minimum (to_sfixed (l, r'high, r'low), r); end function minimum; -- copied from std_logic_textio type MVL9plus is ('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-', error); type char_indexed_by_MVL9 is array (STD_ULOGIC) of CHARACTER; type MVL9_indexed_by_char is array (CHARACTER) of STD_ULOGIC; type MVL9plus_indexed_by_char is array (CHARACTER) of MVL9plus; constant MVL9_to_char : char_indexed_by_MVL9 := "UX01ZWLH-"; constant char_to_MVL9 : MVL9_indexed_by_char := ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z', 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => 'U'); constant char_to_MVL9plus : MVL9plus_indexed_by_char := ('U' => 'U', 'X' => 'X', '0' => '0', '1' => '1', 'Z' => 'Z', 'W' => 'W', 'L' => 'L', 'H' => 'H', '-' => '-', others => error); constant NBSP : CHARACTER := CHARACTER'val(160); -- space character constant NUS : STRING(2 to 1) := (others => ' '); -- purpose: Skips white space procedure skip_whitespace ( L : inout LINE) is variable c : CHARACTER; variable left : positive; begin while L /= null and L.all'length /= 0 loop left := L.all'left; c := L.all(left); if (c = ' ' or c = NBSP or c = HT) then read (L, c); else exit; end if; end loop; end procedure skip_whitespace; -- purpose: writes fixed point into a line procedure write ( L : inout LINE; -- input line VALUE : in UNRESOLVED_ufixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is variable s : STRING(1 to VALUE'length +1) := (others => ' '); variable sindx : INTEGER; begin -- function write Example: 0011.1100 sindx := 1; for i in VALUE'high downto VALUE'low loop if i = -1 then s(sindx) := '.'; sindx := sindx + 1; end if; s(sindx) := MVL9_to_char(STD_ULOGIC(VALUE(i))); sindx := sindx + 1; end loop; write(L, s, JUSTIFIED, FIELD); end procedure write; -- purpose: writes fixed point into a line procedure write ( L : inout LINE; -- input line VALUE : in UNRESOLVED_sfixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is variable s : STRING(1 to VALUE'length +1); variable sindx : INTEGER; begin -- function write Example: 0011.1100 sindx := 1; for i in VALUE'high downto VALUE'low loop if i = -1 then s(sindx) := '.'; sindx := sindx + 1; end if; s(sindx) := MVL9_to_char(STD_ULOGIC(VALUE(i))); sindx := sindx + 1; end loop; write(L, s, JUSTIFIED, FIELD); end procedure write; procedure READ(L : inout LINE; VALUE : out UNRESOLVED_ufixed) is -- Possible data: 00000.0000000 -- 000000000000 variable c : CHARACTER; variable readOk : BOOLEAN; variable i : INTEGER; -- index variable variable mv : ufixed (VALUE'range); variable lastu : BOOLEAN := false; -- last character was an "_" variable founddot : BOOLEAN := false; -- found a "." begin -- READ VALUE := (VALUE'range => 'U'); skip_whitespace (L); if VALUE'length > 0 then -- non Null input string read (L, c, readOk); i := VALUE'high; while i >= VALUE'low loop if readOk = false then -- Bail out if there was a bad read report fixed_generic_pkg'instance_name & "READ(ufixed) " & "End of string encountered" severity error; return; elsif c = '_' then if i = VALUE'high then report fixed_generic_pkg'instance_name & "READ(ufixed) " & "String begins with an ""_""" severity error; return; elsif lastu then report fixed_generic_pkg'instance_name & "READ(ufixed) " & "Two underscores detected in input string ""__""" severity error; return; else lastu := true; end if; elsif c = '.' then -- binary point if founddot then report fixed_generic_pkg'instance_name & "READ(ufixed) " & "Two binary points found in input string" severity error; return; elsif i /= -1 then -- Seperator in the wrong spot report fixed_generic_pkg'instance_name & "READ(ufixed) " & "Decimal point does not match number format " severity error; return; end if; founddot := true; lastu := false; elsif c = ' ' or c = NBSP or c = HT then -- reading done. report fixed_generic_pkg'instance_name & "READ(ufixed) " & "Short read, Space encounted in input string" severity error; return; elsif char_to_MVL9plus(c) = error then report fixed_generic_pkg'instance_name & "READ(ufixed) " & "Character '" & c & "' read, expected STD_ULOGIC literal." severity error; return; else mv(i) := char_to_MVL9(c); i := i - 1; if i < mv'low then VALUE := mv; return; end if; lastu := false; end if; read(L, c, readOk); end loop; end if; end procedure READ; procedure READ(L : inout LINE; VALUE : out UNRESOLVED_ufixed; GOOD : out BOOLEAN) is -- Possible data: 00000.0000000 -- 000000000000 variable c : CHARACTER; variable readOk : BOOLEAN; variable mv : ufixed (VALUE'range); variable i : INTEGER; -- index variable variable lastu : BOOLEAN := false; -- last character was an "_" variable founddot : BOOLEAN := false; -- found a "." begin -- READ VALUE := (VALUE'range => 'U'); skip_whitespace (L); if VALUE'length > 0 then read (L, c, readOk); i := VALUE'high; GOOD := false; while i >= VALUE'low loop if not readOk then -- Bail out if there was a bad read return; elsif c = '_' then if i = VALUE'high then -- Begins with an "_" return; elsif lastu then -- "__" detected return; else lastu := true; end if; elsif c = '.' then -- binary point if founddot then return; elsif i /= -1 then -- Seperator in the wrong spot return; end if; founddot := true; lastu := false; elsif (char_to_MVL9plus(c) = error) then -- Illegal character/short read return; else mv(i) := char_to_MVL9(c); i := i - 1; if i < mv'low then -- reading done GOOD := true; VALUE := mv; return; end if; lastu := false; end if; read(L, c, readOk); end loop; else GOOD := true; -- read into a null array end if; end procedure READ; procedure READ(L : inout LINE; VALUE : out UNRESOLVED_sfixed) is variable c : CHARACTER; variable readOk : BOOLEAN; variable i : INTEGER; -- index variable variable mv : sfixed (VALUE'range); variable lastu : BOOLEAN := false; -- last character was an "_" variable founddot : BOOLEAN := false; -- found a "." begin -- READ VALUE := (VALUE'range => 'U'); skip_whitespace (L); if VALUE'length > 0 then -- non Null input string read (L, c, readOk); i := VALUE'high; while i >= VALUE'low loop if readOk = false then -- Bail out if there was a bad read report fixed_generic_pkg'instance_name & "READ(sfixed) " & "End of string encountered" severity error; return; elsif c = '_' then if i = VALUE'high then report fixed_generic_pkg'instance_name & "READ(sfixed) " & "String begins with an ""_""" severity error; return; elsif lastu then report fixed_generic_pkg'instance_name & "READ(sfixed) " & "Two underscores detected in input string ""__""" severity error; return; else lastu := true; end if; elsif c = '.' then -- binary point if founddot then report fixed_generic_pkg'instance_name & "READ(sfixed) " & "Two binary points found in input string" severity error; return; elsif i /= -1 then -- Seperator in the wrong spot report fixed_generic_pkg'instance_name & "READ(sfixed) " & "Decimal point does not match number format " severity error; return; end if; founddot := true; lastu := false; elsif c = ' ' or c = NBSP or c = HT then -- reading done. report fixed_generic_pkg'instance_name & "READ(sfixed) " & "Short read, Space encounted in input string" severity error; return; elsif char_to_MVL9plus(c) = error then report fixed_generic_pkg'instance_name & "READ(sfixed) " & "Character '" & c & "' read, expected STD_ULOGIC literal." severity error; return; else mv(i) := char_to_MVL9(c); i := i - 1; if i < mv'low then VALUE := mv; return; end if; lastu := false; end if; read(L, c, readOk); end loop; end if; end procedure READ; procedure READ(L : inout LINE; VALUE : out UNRESOLVED_sfixed; GOOD : out BOOLEAN) is variable value_ufixed : UNRESOLVED_ufixed (VALUE'range); begin -- READ READ (L => L, VALUE => value_ufixed, GOOD => GOOD); VALUE := UNRESOLVED_sfixed (value_ufixed); end procedure READ; -- octal read and write procedure owrite ( L : inout LINE; -- input line VALUE : in UNRESOLVED_ufixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is begin -- Example 03.30 write (L => L, VALUE => TO_OSTRING (VALUE), JUSTIFIED => JUSTIFIED, FIELD => FIELD); end procedure owrite; procedure owrite ( L : inout LINE; -- input line VALUE : in UNRESOLVED_sfixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is begin -- Example 03.30 write (L => L, VALUE => TO_OSTRING (VALUE), JUSTIFIED => JUSTIFIED, FIELD => FIELD); end procedure owrite; -- Note that for Octal and Hex read, you can not start with a ".", -- the read is for numbers formatted "A.BC". These routines go to -- the nearest bounds, so "F.E" will fit into an sfixed (2 downto -3). procedure Char2TriBits (C : CHARACTER; RESULT : out STD_ULOGIC_VECTOR(2 downto 0); GOOD : out BOOLEAN; ISSUE_ERROR : in BOOLEAN) is begin case C is when '0' => RESULT := o"0"; GOOD := true; when '1' => RESULT := o"1"; GOOD := true; when '2' => RESULT := o"2"; GOOD := true; when '3' => RESULT := o"3"; GOOD := true; when '4' => RESULT := o"4"; GOOD := true; when '5' => RESULT := o"5"; GOOD := true; when '6' => RESULT := o"6"; GOOD := true; when '7' => RESULT := o"7"; GOOD := true; when 'Z' => RESULT := "ZZZ"; GOOD := true; when 'X' => RESULT := "XXX"; GOOD := true; when others => assert not ISSUE_ERROR report fixed_generic_pkg'instance_name & "OREAD Error: Read a '" & C & "', expected an Octal character (0-7)." severity error; RESULT := "UUU"; GOOD := false; end case; end procedure Char2TriBits; -- purpose: Routines common to the OREAD routines procedure OREAD_common ( L : inout LINE; slv : out STD_ULOGIC_VECTOR; igood : out BOOLEAN; idex : out INTEGER; constant bpoint : in INTEGER; -- binary point constant message : in BOOLEAN; constant smath : in BOOLEAN) is -- purpose: error message routine procedure errmes ( constant mess : in STRING) is -- error message begin if message then if smath then report fixed_generic_pkg'instance_name & "OREAD(sfixed) " & mess severity error; else report fixed_generic_pkg'instance_name & "OREAD(ufixed) " & mess severity error; end if; end if; end procedure errmes; variable xgood : BOOLEAN; variable nybble : STD_ULOGIC_VECTOR (2 downto 0); -- 3 bits variable c : CHARACTER; variable i : INTEGER; variable lastu : BOOLEAN := false; -- last character was an "_" variable founddot : BOOLEAN := false; -- found a dot. begin skip_whitespace (L); if slv'length > 0 then i := slv'high; read (L, c, xgood); while i > 0 loop if xgood = false then errmes ("Error: end of string encountered"); exit; elsif c = '_' then if i = slv'length then errmes ("Error: String begins with an ""_"""); xgood := false; exit; elsif lastu then errmes ("Error: Two underscores detected in input string ""__"""); xgood := false; exit; else lastu := true; end if; elsif (c = '.') then if (i + 1 /= bpoint) then errmes ("encountered ""."" at wrong index"); xgood := false; exit; elsif i = slv'length then errmes ("encounted a ""."" at the beginning of the line"); xgood := false; exit; elsif founddot then errmes ("Two ""."" encounted in input string"); xgood := false; exit; end if; founddot := true; lastu := false; else Char2TriBits(c, nybble, xgood, message); if not xgood then exit; end if; slv (i downto i-2) := nybble; i := i - 3; lastu := false; end if; if i > 0 then read (L, c, xgood); end if; end loop; idex := i; igood := xgood; else igood := true; -- read into a null array idex := -1; end if; end procedure OREAD_common; -- Note that for Octal and Hex read, you can not start with a ".", -- the read is for numbers formatted "A.BC". These routines go to -- the nearest bounds, so "F.E" will fit into an sfixed (2 downto -3). procedure OREAD (L : inout LINE; VALUE : out UNRESOLVED_ufixed) is constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_ufixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); OREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => true, smath => false); if igood then -- We did not get another error if not ((i = -1) and -- We read everything, and high bits 0 (or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then report fixed_generic_pkg'instance_name & "OREAD(ufixed): Vector truncated." severity error; else if (or (slv(VALUE'low-lbv-1 downto 0)) = '1') then assert no_warning report fixed_generic_pkg'instance_name & "OREAD(ufixed): Vector truncated" severity warning; end if; valuex := to_ufixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); end if; end if; end procedure OREAD; procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed; GOOD : out BOOLEAN) is constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_ufixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); OREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => false, smath => false); if (igood and -- We did not get another error (i = -1) and -- We read everything, and high bits 0 (or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then valuex := to_ufixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); GOOD := true; else GOOD := false; end if; end procedure OREAD; procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed) is constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_sfixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); OREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => true, smath => true); if igood then -- We did not get another error if not ((i = -1) and -- We read everything ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or (slv(VALUE'high-lbv) = '1' and and (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then report fixed_generic_pkg'instance_name & "OREAD(sfixed): Vector truncated." severity error; else if (or (slv(VALUE'low-lbv-1 downto 0)) = '1') then assert no_warning report fixed_generic_pkg'instance_name & "OREAD(sfixed): Vector truncated" severity warning; end if; valuex := to_sfixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); end if; end if; end procedure OREAD; procedure OREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed; GOOD : out BOOLEAN) is constant hbv : INTEGER := (((maximum(3, (VALUE'high+1))+2)/3)*3)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-2)/3)*3; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_sfixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); OREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => false, smath => true); if (igood -- We did not get another error and (i = -1) -- We read everything and ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or (slv(VALUE'high-lbv) = '1' and and (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then valuex := to_sfixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); GOOD := true; else GOOD := false; end if; end procedure OREAD; -- hex read and write procedure hwrite ( L : inout LINE; -- input line VALUE : in UNRESOLVED_ufixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is begin -- Example 03.30 write (L => L, VALUE => TO_HSTRING (VALUE), JUSTIFIED => JUSTIFIED, FIELD => FIELD); end procedure hwrite; -- purpose: writes fixed point into a line procedure hwrite ( L : inout LINE; -- input line VALUE : in UNRESOLVED_sfixed; -- fixed point input JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0) is begin -- Example 03.30 write (L => L, VALUE => TO_HSTRING (VALUE), JUSTIFIED => JUSTIFIED, FIELD => FIELD); end procedure hwrite; -- Hex Read and Write procedures for STD_ULOGIC_VECTOR. -- Modified from the original to be more forgiving. procedure Char2QuadBits (C : CHARACTER; RESULT : out STD_ULOGIC_VECTOR(3 downto 0); GOOD : out BOOLEAN; ISSUE_ERROR : in BOOLEAN) is begin case C is when '0' => RESULT := x"0"; GOOD := true; when '1' => RESULT := x"1"; GOOD := true; when '2' => RESULT := x"2"; GOOD := true; when '3' => RESULT := x"3"; GOOD := true; when '4' => RESULT := x"4"; GOOD := true; when '5' => RESULT := x"5"; GOOD := true; when '6' => RESULT := x"6"; GOOD := true; when '7' => RESULT := x"7"; GOOD := true; when '8' => RESULT := x"8"; GOOD := true; when '9' => RESULT := x"9"; GOOD := true; when 'A' | 'a' => RESULT := x"A"; GOOD := true; when 'B' | 'b' => RESULT := x"B"; GOOD := true; when 'C' | 'c' => RESULT := x"C"; GOOD := true; when 'D' | 'd' => RESULT := x"D"; GOOD := true; when 'E' | 'e' => RESULT := x"E"; GOOD := true; when 'F' | 'f' => RESULT := x"F"; GOOD := true; when 'Z' => RESULT := "ZZZZ"; GOOD := true; when 'X' => RESULT := "XXXX"; GOOD := true; when others => assert not ISSUE_ERROR report fixed_generic_pkg'instance_name & "HREAD Error: Read a '" & C & "', expected a Hex character (0-F)." severity error; RESULT := "UUUU"; GOOD := false; end case; end procedure Char2QuadBits; -- purpose: Routines common to the HREAD routines procedure HREAD_common ( L : inout LINE; slv : out STD_ULOGIC_VECTOR; igood : out BOOLEAN; idex : out INTEGER; constant bpoint : in INTEGER; -- binary point constant message : in BOOLEAN; constant smath : in BOOLEAN) is -- purpose: error message routine procedure errmes ( constant mess : in STRING) is -- error message begin if message then if smath then report fixed_generic_pkg'instance_name & "HREAD(sfixed) " & mess severity error; else report fixed_generic_pkg'instance_name & "HREAD(ufixed) " & mess severity error; end if; end if; end procedure errmes; variable xgood : BOOLEAN; variable nybble : STD_ULOGIC_VECTOR (3 downto 0); -- 4 bits variable c : CHARACTER; variable i : INTEGER; variable lastu : BOOLEAN := false; -- last character was an "_" variable founddot : BOOLEAN := false; -- found a dot. begin skip_whitespace (L); if slv'length > 0 then i := slv'high; read (L, c, xgood); while i > 0 loop if xgood = false then errmes ("Error: end of string encountered"); exit; elsif c = '_' then if i = slv'length then errmes ("Error: String begins with an ""_"""); xgood := false; exit; elsif lastu then errmes ("Error: Two underscores detected in input string ""__"""); xgood := false; exit; else lastu := true; end if; elsif (c = '.') then if (i + 1 /= bpoint) then errmes ("encountered ""."" at wrong index"); xgood := false; exit; elsif i = slv'length then errmes ("encounted a ""."" at the beginning of the line"); xgood := false; exit; elsif founddot then errmes ("Two ""."" encounted in input string"); xgood := false; exit; end if; founddot := true; lastu := false; else Char2QuadBits(c, nybble, xgood, message); if not xgood then exit; end if; slv (i downto i-3) := nybble; i := i - 4; lastu := false; end if; if i > 0 then read (L, c, xgood); end if; end loop; idex := i; igood := xgood; else idex := -1; igood := true; -- read null string end if; end procedure HREAD_common; procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed) is constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_ufixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); HREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => true, smath => false); if igood then if not ((i = -1) and -- We read everything, and high bits 0 (or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then report fixed_generic_pkg'instance_name & "HREAD(ufixed): Vector truncated." severity error; else if (or (slv(VALUE'low-lbv-1 downto 0)) = '1') then assert no_warning report fixed_generic_pkg'instance_name & "HREAD(ufixed): Vector truncated" severity warning; end if; valuex := to_ufixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); end if; end if; end procedure HREAD; procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_ufixed; GOOD : out BOOLEAN) is constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_ufixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); HREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => false, smath => false); if (igood and -- We did not get another error (i = -1) and -- We read everything, and high bits 0 (or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0')) then valuex := to_ufixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); GOOD := true; else GOOD := false; end if; end procedure HREAD; procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed) is constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_sfixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); HREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => true, smath => true); if igood then -- We did not get another error if not ((i = -1) -- We read everything and ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or (slv(VALUE'high-lbv) = '1' and and (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then report fixed_generic_pkg'instance_name & "HREAD(sfixed): Vector truncated." severity error; else if (or (slv(VALUE'low-lbv-1 downto 0)) = '1') then assert no_warning report fixed_generic_pkg'instance_name & "HREAD(sfixed): Vector truncated" severity warning; end if; valuex := to_sfixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); end if; end if; end procedure HREAD; procedure HREAD(L : inout LINE; VALUE : out UNRESOLVED_sfixed; GOOD : out BOOLEAN) is constant hbv : INTEGER := (((maximum(4, (VALUE'high+1))+3)/4)*4)-1; constant lbv : INTEGER := ((mine(0, VALUE'low)-3)/4)*4; variable slv : STD_ULOGIC_VECTOR (hbv-lbv downto 0); -- high bits variable valuex : UNRESOLVED_sfixed (hbv downto lbv); variable igood : BOOLEAN; variable i : INTEGER; begin VALUE := (VALUE'range => 'U'); HREAD_common ( L => L, slv => slv, igood => igood, idex => i, bpoint => -lbv, message => false, smath => true); if (igood and -- We did not get another error (i = -1) and -- We read everything ((slv(VALUE'high-lbv) = '0' and -- sign bits = extra bits or (slv(hbv-lbv downto VALUE'high+1-lbv)) = '0') or (slv(VALUE'high-lbv) = '1' and and (slv(hbv-lbv downto VALUE'high+1-lbv)) = '1'))) then valuex := to_sfixed (slv, hbv, lbv); VALUE := valuex (VALUE'range); GOOD := true; else GOOD := false; end if; end procedure HREAD; -- TO_STRING functions. Useful in "report" statements. -- Example: report "result was " & TO_STRING(result); function TO_STRING (value : UNRESOLVED_ufixed) return STRING is variable s : STRING(1 to value'length +1) := (others => ' '); variable subval : UNRESOLVED_ufixed (value'high downto -1); variable sindx : INTEGER; begin if value'length < 1 then return NUS; else if value'high < 0 then if value(value'high) = 'Z' then return TO_STRING (resize (sfixed(value), 0, value'low)); else return TO_STRING (resize (value, 0, value'low)); end if; elsif value'low >= 0 then if Is_X (value(value'low)) then subval := (others => value(value'low)); subval (value'range) := value; return TO_STRING(subval); else return TO_STRING (resize (value, value'high, -1)); end if; else sindx := 1; for i in value'high downto value'low loop if i = -1 then s(sindx) := '.'; sindx := sindx + 1; end if; s(sindx) := MVL9_to_char(STD_ULOGIC(value(i))); sindx := sindx + 1; end loop; return s; end if; end if; end function TO_STRING; function TO_STRING (value : UNRESOLVED_sfixed) return STRING is variable s : STRING(1 to value'length + 1) := (others => ' '); variable subval : UNRESOLVED_sfixed (value'high downto -1); variable sindx : INTEGER; begin if value'length < 1 then return NUS; else if value'high < 0 then return TO_STRING (resize (value, 0, value'low)); elsif value'low >= 0 then if Is_X (value(value'low)) then subval := (others => value(value'low)); subval (value'range) := value; return TO_STRING(subval); else return TO_STRING (resize (value, value'high, -1)); end if; else sindx := 1; for i in value'high downto value'low loop if i = -1 then s(sindx) := '.'; sindx := sindx + 1; end if; s(sindx) := MVL9_to_char(STD_ULOGIC(value(i))); sindx := sindx + 1; end loop; return s; end if; end if; end function TO_STRING; function TO_OSTRING (value : UNRESOLVED_ufixed) return STRING is constant lne : INTEGER := (-value'low+2)/3; variable subval : UNRESOLVED_ufixed (value'high downto -3); variable lpad : STD_ULOGIC_VECTOR (0 to (lne*3 + value'low) -1); variable slv : STD_ULOGIC_VECTOR (value'length-1 downto 0); begin if value'length < 1 then return NUS; else if value'high < 0 then if value(value'high) = 'Z' then return TO_OSTRING (resize (sfixed(value), 2, value'low)); else return TO_OSTRING (resize (value, 2, value'low)); end if; elsif value'low >= 0 then if Is_X (value(value'low)) then subval := (others => value(value'low)); subval (value'range) := value; return TO_OSTRING(subval); else return TO_OSTRING (resize (value, value'high, -3)); end if; else slv := to_sulv (value); if Is_X (value (value'low)) then lpad := (others => value (value'low)); else lpad := (others => '0'); end if; return TO_OSTRING(slv(slv'high downto slv'high-value'high)) & "." & TO_OSTRING(slv(slv'high-value'high-1 downto 0) & lpad); end if; end if; end function TO_OSTRING; function TO_HSTRING (value : UNRESOLVED_ufixed) return STRING is constant lne : INTEGER := (-value'low+3)/4; variable subval : UNRESOLVED_ufixed (value'high downto -4); variable lpad : STD_ULOGIC_VECTOR (0 to (lne*4 + value'low) -1); variable slv : STD_ULOGIC_VECTOR (value'length-1 downto 0); begin if value'length < 1 then return NUS; else if value'high < 0 then if value(value'high) = 'Z' then return TO_HSTRING (resize (sfixed(value), 3, value'low)); else return TO_HSTRING (resize (value, 3, value'low)); end if; elsif value'low >= 0 then if Is_X (value(value'low)) then subval := (others => value(value'low)); subval (value'range) := value; return TO_HSTRING(subval); else return TO_HSTRING (resize (value, value'high, -4)); end if; else slv := to_sulv (value); if Is_X (value (value'low)) then lpad := (others => value(value'low)); else lpad := (others => '0'); end if; return TO_HSTRING(slv(slv'high downto slv'high-value'high)) & "." & TO_HSTRING(slv(slv'high-value'high-1 downto 0)&lpad); end if; end if; end function TO_HSTRING; function TO_OSTRING (value : UNRESOLVED_sfixed) return STRING is constant ne : INTEGER := ((value'high+1)+2)/3; variable pad : STD_ULOGIC_VECTOR(0 to (ne*3 - (value'high+1)) - 1); constant lne : INTEGER := (-value'low+2)/3; variable subval : UNRESOLVED_sfixed (value'high downto -3); variable lpad : STD_ULOGIC_VECTOR (0 to (lne*3 + value'low) -1); variable slv : STD_ULOGIC_VECTOR (value'high - value'low downto 0); begin if value'length < 1 then return NUS; else if value'high < 0 then return TO_OSTRING (resize (value, 2, value'low)); elsif value'low >= 0 then if Is_X (value(value'low)) then subval := (others => value(value'low)); subval (value'range) := value; return TO_OSTRING(subval); else return TO_OSTRING (resize (value, value'high, -3)); end if; else pad := (others => value(value'high)); slv := to_sulv (value); if Is_X (value (value'low)) then lpad := (others => value(value'low)); else lpad := (others => '0'); end if; return TO_OSTRING(pad & slv(slv'high downto slv'high-value'high)) & "." & TO_OSTRING(slv(slv'high-value'high-1 downto 0) & lpad); end if; end if; end function TO_OSTRING; function TO_HSTRING (value : UNRESOLVED_sfixed) return STRING is constant ne : INTEGER := ((value'high+1)+3)/4; variable pad : STD_ULOGIC_VECTOR(0 to (ne*4 - (value'high+1)) - 1); constant lne : INTEGER := (-value'low+3)/4; variable subval : UNRESOLVED_sfixed (value'high downto -4); variable lpad : STD_ULOGIC_VECTOR (0 to (lne*4 + value'low) -1); variable slv : STD_ULOGIC_VECTOR (value'length-1 downto 0); begin if value'length < 1 then return NUS; else if value'high < 0 then return TO_HSTRING (resize (value, 3, value'low)); elsif value'low >= 0 then if Is_X (value(value'low)) then subval := (others => value(value'low)); subval (value'range) := value; return TO_HSTRING(subval); else return TO_HSTRING (resize (value, value'high, -4)); end if; else slv := to_sulv (value); pad := (others => value(value'high)); if Is_X (value (value'low)) then lpad := (others => value(value'low)); else lpad := (others => '0'); end if; return TO_HSTRING(pad & slv(slv'high downto slv'high-value'high)) & "." & TO_HSTRING(slv(slv'high-value'high-1 downto 0) & lpad); end if; end if; end function TO_HSTRING; -- From string functions allow you to convert a string into a fixed -- point number. Example: -- signal uf1 : ufixed (3 downto -3); -- uf1 <= from_string ("0110.100", uf1'high, uf1'low); -- 6.5 -- The "." is optional in this syntax, however it exist and is -- in the wrong location an error is produced. Overflow will -- result in saturation. function from_string ( bstring : STRING; -- binary string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (left_index downto right_index); variable L : LINE; variable good : BOOLEAN; begin L := new STRING'(bstring); READ (L, result, good); deallocate (L); assert (good) report fixed_generic_pkg'instance_name & "from_string: Bad string "& bstring severity error; return result; end function from_string; -- Octal and hex conversions work as follows: -- uf1 <= from_hstring ("6.8", 3, -3); -- 6.5 (bottom zeros dropped) -- uf1 <= from_ostring ("06.4", 3, -3); -- 6.5 (top zeros dropped) function from_ostring ( ostring : STRING; -- Octal string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (left_index downto right_index); variable L : LINE; variable good : BOOLEAN; begin L := new STRING'(ostring); OREAD (L, result, good); deallocate (L); assert (good) report fixed_generic_pkg'instance_name & "from_ostring: Bad string "& ostring severity error; return result; end function from_ostring; function from_hstring ( hstring : STRING; -- hex string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_ufixed is variable result : UNRESOLVED_ufixed (left_index downto right_index); variable L : LINE; variable good : BOOLEAN; begin L := new STRING'(hstring); HREAD (L, result, good); deallocate (L); assert (good) report fixed_generic_pkg'instance_name & "from_hstring: Bad string "& hstring severity error; return result; end function from_hstring; function from_string ( bstring : STRING; -- binary string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (left_index downto right_index); variable L : LINE; variable good : BOOLEAN; begin L := new STRING'(bstring); READ (L, result, good); deallocate (L); assert (good) report fixed_generic_pkg'instance_name & "from_string: Bad string "& bstring severity error; return result; end function from_string; function from_ostring ( ostring : STRING; -- Octal string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (left_index downto right_index); variable L : LINE; variable good : BOOLEAN; begin L := new STRING'(ostring); OREAD (L, result, good); deallocate (L); assert (good) report fixed_generic_pkg'instance_name & "from_ostring: Bad string "& ostring severity error; return result; end function from_ostring; function from_hstring ( hstring : STRING; -- hex string constant left_index : INTEGER; constant right_index : INTEGER) return UNRESOLVED_sfixed is variable result : UNRESOLVED_sfixed (left_index downto right_index); variable L : LINE; variable good : BOOLEAN; begin L := new STRING'(hstring); HREAD (L, result, good); deallocate (L); assert (good) report fixed_generic_pkg'instance_name & "from_hstring: Bad string "& hstring severity error; return result; end function from_hstring; -- Same as above, "size_res" is used for it's range only. function from_string ( bstring : STRING; -- binary string size_res : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is begin return from_string (bstring, size_res'high, size_res'low); end function from_string; function from_ostring ( ostring : STRING; -- Octal string size_res : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is begin return from_ostring (ostring, size_res'high, size_res'low); end function from_ostring; function from_hstring ( hstring : STRING; -- hex string size_res : UNRESOLVED_ufixed) return UNRESOLVED_ufixed is begin return from_hstring(hstring, size_res'high, size_res'low); end function from_hstring; function from_string ( bstring : STRING; -- binary string size_res : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return from_string (bstring, size_res'high, size_res'low); end function from_string; function from_ostring ( ostring : STRING; -- Octal string size_res : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return from_ostring (ostring, size_res'high, size_res'low); end function from_ostring; function from_hstring ( hstring : STRING; -- hex string size_res : UNRESOLVED_sfixed) return UNRESOLVED_sfixed is begin return from_hstring (hstring, size_res'high, size_res'low); end function from_hstring; -- Direct conversion functions. Example: -- signal uf1 : ufixed (3 downto -3); -- uf1 <= from_string ("0110.100"); -- 6.5 -- In this case the "." is not optional, and the size of -- the output must match exactly. -- purpose: Calculate the string boundaries procedure calculate_string_boundry ( arg : in STRING; -- input string left_index : out INTEGER; -- left right_index : out INTEGER) is -- right -- examples "10001.111" would return +4, -3 -- "07X.44" would return +2, -2 (then the octal routine would multiply) -- "A_B_._C" would return +1, -1 (then the hex routine would multiply) alias xarg : STRING (arg'length downto 1) is arg; -- make it downto range variable l, r : INTEGER; -- internal indexes variable founddot : BOOLEAN := false; begin if arg'length > 0 then l := xarg'high - 1; r := 0; for i in xarg'range loop if xarg(i) = '_' then if r = 0 then l := l - 1; else r := r + 1; end if; elsif xarg(i) = ' ' or xarg(i) = NBSP or xarg(i) = HT then report fixed_generic_pkg'instance_name & "Found a space in the input STRING " & xarg severity error; elsif xarg(i) = '.' then if founddot then report fixed_generic_pkg'instance_name & "Found two binary points in input string " & xarg severity error; else l := l - i; r := -i + 1; founddot := true; end if; end if; end loop; left_index := l; right_index := r; else left_index := 0; right_index := 0; end if; end procedure calculate_string_boundry; -- Direct conversion functions. Example: -- signal uf1 : ufixed (3 downto -3); -- uf1 <= from_string ("0110.100"); -- 6.5 -- In this case the "." is not optional, and the size of -- the output must match exactly. function from_string ( bstring : STRING) -- binary string return UNRESOLVED_ufixed is variable left_index, right_index : INTEGER; begin calculate_string_boundry (bstring, left_index, right_index); return from_string (bstring, left_index, right_index); end function from_string; -- Direct octal and hex conversion functions. In this case -- the string lengths must match. Example: -- signal sf1 := sfixed (5 downto -3); -- sf1 <= from_ostring ("71.4") -- -6.5 function from_ostring ( ostring : STRING) -- Octal string return UNRESOLVED_ufixed is variable left_index, right_index : INTEGER; begin calculate_string_boundry (ostring, left_index, right_index); return from_ostring (ostring, ((left_index+1)*3)-1, right_index*3); end function from_ostring; function from_hstring ( hstring : STRING) -- hex string return UNRESOLVED_ufixed is variable left_index, right_index : INTEGER; begin calculate_string_boundry (hstring, left_index, right_index); return from_hstring (hstring, ((left_index+1)*4)-1, right_index*4); end function from_hstring; function from_string ( bstring : STRING) -- binary string return UNRESOLVED_sfixed is variable left_index, right_index : INTEGER; begin calculate_string_boundry (bstring, left_index, right_index); return from_string (bstring, left_index, right_index); end function from_string; function from_ostring ( ostring : STRING) -- Octal string return UNRESOLVED_sfixed is variable left_index, right_index : INTEGER; begin calculate_string_boundry (ostring, left_index, right_index); return from_ostring (ostring, ((left_index+1)*3)-1, right_index*3); end function from_ostring; function from_hstring ( hstring : STRING) -- hex string return UNRESOLVED_sfixed is variable left_index, right_index : INTEGER; begin calculate_string_boundry (hstring, left_index, right_index); return from_hstring (hstring, ((left_index+1)*4)-1, right_index*4); end function from_hstring; end package body fixed_generic_pkg;
gpl-2.0
8b6317eb97255ebe972cf19e96f2200c
0.563358
3.978882
false
false
false
false
nickg/nvc
test/regress/record17.vhd
1
557
entity record17 is end entity; architecture test of record17 is type rec is record x : boolean; y : natural; z : real; end record; type rec_3x3 is array (1 to 3, 1 to 3) of rec; signal s : rec_3x3; begin p1: process is begin assert s(2, 2).z = real'left; s(2, 2).y <= 123; wait for 1 ns; assert s(2, 2) = (false, 123, real'left); s(3, 3) <= (true, 456, 1.0); wait for 1 ns; assert s(3, 3).x = true; wait; end process; end architecture;
gpl-3.0
d39bd3be06855bfc28ecabfed49a964e
0.51526
3.129213
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_datamover_v5_1/hdl/src/vhdl/axi_datamover.vhd
3
74,551
------------------------------------------------------------------------------- -- axi_datamover.vhd ------------------------------------------------------------------------------- -- -- ************************************************************************* -- -- (c) Copyright 2010-2011 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_datamover.vhd -- -- Description: -- Top level VHDL wrapper for the AXI DataMover -- -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library axi_datamover_v5_1_10; use axi_datamover_v5_1_10.axi_datamover_mm2s_omit_wrap ; use axi_datamover_v5_1_10.axi_datamover_mm2s_full_wrap ; use axi_datamover_v5_1_10.axi_datamover_mm2s_basic_wrap; use axi_datamover_v5_1_10.axi_datamover_s2mm_omit_wrap ; use axi_datamover_v5_1_10.axi_datamover_s2mm_full_wrap ; use axi_datamover_v5_1_10.axi_datamover_s2mm_basic_wrap; ------------------------------------------------------------------------------- entity axi_datamover is generic ( C_INCLUDE_MM2S : Integer range 0 to 2 := 2; -- Specifies the type of MM2S function to include -- 0 = Omit MM2S functionality -- 1 = Full MM2S Functionality -- 2 = Basic MM2S functionality C_M_AXI_MM2S_ARID : Integer range 0 to 255 := 0; -- Specifies the constant value to output on -- the ARID output port C_M_AXI_MM2S_ID_WIDTH : Integer range 1 to 8 := 4; -- Specifies the width of the MM2S ID port C_M_AXI_MM2S_ADDR_WIDTH : Integer range 32 to 64 := 32; -- Specifies the width of the MMap Read Address Channel -- Address bus C_M_AXI_MM2S_DATA_WIDTH : Integer range 32 to 1024 := 32; -- Specifies the width of the MMap Read Data Channel -- data bus C_M_AXIS_MM2S_TDATA_WIDTH : Integer range 8 to 1024 := 32; -- Specifies the width of the MM2S Master Stream Data -- Channel data bus C_INCLUDE_MM2S_STSFIFO : Integer range 0 to 1 := 1; -- Specifies if a Status FIFO is to be implemented -- 0 = Omit MM2S Status FIFO -- 1 = Include MM2S Status FIFO C_MM2S_STSCMD_FIFO_DEPTH : Integer range 1 to 16 := 4; -- Specifies the depth of the MM2S Command FIFO and the -- optional Status FIFO -- Valid values are 1,4,8,16 C_MM2S_STSCMD_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the Status and Command interfaces need to -- be asynchronous to the primary data path clocking -- 0 = Use same clocking as data path -- 1 = Use special Status/Command clock for the interfaces C_INCLUDE_MM2S_DRE : Integer range 0 to 1 := 1; -- Specifies if DRE is to be included in the MM2S function -- 0 = Omit DRE -- 1 = Include DRE C_MM2S_BURST_SIZE : Integer range 2 to 256 := 16; -- Specifies the max number of databeats to use for MMap -- burst transfers by the MM2S function C_MM2S_BTT_USED : Integer range 8 to 23 := 16; -- Specifies the number of bits used from the BTT field -- of the input Command Word of the MM2S Command Interface C_MM2S_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 3; -- This parameter specifies the depth of the MM2S internal -- child command queues in the Read Address Controller and -- the Read Data Controller. Increasing this value will -- allow more Read Addresses to be issued to the AXI4 Read -- Address Channel before receipt of the associated read -- data on the Read Data Channel. C_MM2S_INCLUDE_SF : Integer range 0 to 1 := 1 ; -- This parameter specifies the inclusion/omission of the -- MM2S (Read) Store and Forward function -- 0 = Omit MM2S Store and Forward -- 1 = Include MM2S Store and Forward C_INCLUDE_S2MM : Integer range 0 to 4 := 2; -- Specifies the type of S2MM function to include -- 0 = Omit S2MM functionality -- 1 = Full S2MM Functionality -- 2 = Basic S2MM functionality C_M_AXI_S2MM_AWID : Integer range 0 to 255 := 1; -- Specifies the constant value to output on -- the ARID output port C_M_AXI_S2MM_ID_WIDTH : Integer range 1 to 8 := 4; -- Specifies the width of the S2MM ID port C_M_AXI_S2MM_ADDR_WIDTH : Integer range 32 to 64 := 32; -- Specifies the width of the MMap Read Address Channel -- Address bus C_M_AXI_S2MM_DATA_WIDTH : Integer range 32 to 1024 := 32; -- Specifies the width of the MMap Read Data Channel -- data bus C_S_AXIS_S2MM_TDATA_WIDTH : Integer range 8 to 1024 := 32; -- Specifies the width of the S2MM Master Stream Data -- Channel data bus C_INCLUDE_S2MM_STSFIFO : Integer range 0 to 1 := 1; -- Specifies if a Status FIFO is to be implemented -- 0 = Omit S2MM Status FIFO -- 1 = Include S2MM Status FIFO C_S2MM_STSCMD_FIFO_DEPTH : Integer range 1 to 16 := 4; -- Specifies the depth of the S2MM Command FIFO and the -- optional Status FIFO -- Valid values are 1,4,8,16 C_S2MM_STSCMD_IS_ASYNC : Integer range 0 to 1 := 0; -- Specifies if the Status and Command interfaces need to -- be asynchronous to the primary data path clocking -- 0 = Use same clocking as data path -- 1 = Use special Status/Command clock for the interfaces C_INCLUDE_S2MM_DRE : Integer range 0 to 1 := 1; -- Specifies if DRE is to be included in the S2MM function -- 0 = Omit DRE -- 1 = Include DRE C_S2MM_BURST_SIZE : Integer range 2 to 256 := 16; -- Specifies the max number of databeats to use for MMap -- burst transfers by the S2MM function C_S2MM_BTT_USED : Integer range 8 to 23 := 16; -- Specifies the number of bits used from the BTT field -- of the input Command Word of the S2MM Command Interface C_S2MM_SUPPORT_INDET_BTT : Integer range 0 to 1 := 0; -- Specifies if support for indeterminate packet lengths -- are to be received on the input Stream interface -- 0 = Omit support (User MUST transfer the exact number of -- bytes on the Stream interface as specified in the BTT -- field of the Corresponding DataMover Command) -- 1 = Include support for indeterminate packet lengths -- This causes FIFOs to be added and "Store and Forward" -- behavior of the S2MM function C_S2MM_ADDR_PIPE_DEPTH : Integer range 1 to 30 := 3; -- This parameter specifies the depth of the S2MM internal -- address pipeline queues in the Write Address Controller -- and the Write Data Controller. Increasing this value will -- allow more Write Addresses to be issued to the AXI4 Write -- Address Channel before transmission of the associated -- write data on the Write Data Channel. C_S2MM_INCLUDE_SF : Integer range 0 to 1 := 1 ; -- This parameter specifies the inclusion/omission of the -- S2MM (Write) Store and Forward function -- 0 = Omit S2MM Store and Forward -- 1 = Include S2MM Store and Forward C_ENABLE_CACHE_USER : integer range 0 to 1 := 0; C_ENABLE_SKID_BUF : string := "11111"; C_ENABLE_MM2S_TKEEP : integer range 0 to 1 := 1; C_ENABLE_S2MM_TKEEP : integer range 0 to 1 := 1; C_ENABLE_S2MM_ADV_SIG : integer range 0 to 1 := 0; C_ENABLE_MM2S_ADV_SIG : integer range 0 to 1 := 0; C_MICRO_DMA : integer range 0 to 1 := 0; C_CMD_WIDTH : integer range 72 to 112 := 72; C_FAMILY : String := "virtex7" -- Specifies the target FPGA family type ); port ( -- MM2S Primary Clock input ---------------------------------- m_axi_mm2s_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- MM2S Primary Reset input -- m_axi_mm2s_aresetn : in std_logic; -- -- Reset used for the internal master logic -- -------------------------------------------------------------- -- MM2S Halt request input control -------------------- mm2s_halt : in std_logic; -- -- Active high soft shutdown request -- -- -- MM2S Halt Complete status flag -- mm2s_halt_cmplt : Out std_logic; -- -- Active high soft shutdown complete status -- ------------------------------------------------------- -- Error discrete output ------------------------- mm2s_err : Out std_logic; -- -- Composite Error indication -- -------------------------------------------------- -- Memory Map to Stream Command FIFO and Status FIFO I/O --------- m_axis_mm2s_cmdsts_aclk : in std_logic; -- -- Secondary Clock input for async CMD/Status interface -- -- m_axis_mm2s_cmdsts_aresetn : in std_logic; -- -- Secondary Reset input for async CMD/Status interface -- ------------------------------------------------------------------ -- User Command Interface Ports (AXI Stream) ------------------------------------------------- s_axis_mm2s_cmd_tvalid : in std_logic; -- s_axis_mm2s_cmd_tready : out std_logic; -- s_axis_mm2s_cmd_tdata : in std_logic_vector(C_CMD_WIDTH-1 downto 0); -- ---------------------------------------------------------------------------------------------- -- User Status Interface Ports (AXI Stream) ------------------------ m_axis_mm2s_sts_tvalid : out std_logic; -- m_axis_mm2s_sts_tready : in std_logic; -- m_axis_mm2s_sts_tdata : out std_logic_vector(7 downto 0); -- m_axis_mm2s_sts_tkeep : out std_logic_vector(0 downto 0); -- m_axis_mm2s_sts_tlast : out std_logic; -- -------------------------------------------------------------------- -- Address Posting contols ----------------------- mm2s_allow_addr_req : in std_logic; -- mm2s_addr_req_posted : out std_logic; -- mm2s_rd_xfer_cmplt : out std_logic; -- -------------------------------------------------- -- MM2S AXI Address Channel I/O -------------------------------------------------- m_axi_mm2s_arid : out std_logic_vector(C_M_AXI_MM2S_ID_WIDTH-1 downto 0); -- -- AXI Address Channel ID output -- -- m_axi_mm2s_araddr : out std_logic_vector(C_M_AXI_MM2S_ADDR_WIDTH-1 downto 0); -- -- AXI Address Channel Address output -- -- m_axi_mm2s_arlen : out std_logic_vector(7 downto 0); -- -- AXI Address Channel LEN output -- -- Sized to support 256 data beat bursts -- -- m_axi_mm2s_arsize : out std_logic_vector(2 downto 0); -- -- AXI Address Channel SIZE output -- -- m_axi_mm2s_arburst : out std_logic_vector(1 downto 0); -- -- AXI Address Channel BURST output -- -- m_axi_mm2s_arprot : out std_logic_vector(2 downto 0); -- -- AXI Address Channel PROT output -- -- m_axi_mm2s_arcache : out std_logic_vector(3 downto 0); -- -- AXI Address Channel CACHE output -- m_axi_mm2s_aruser : out std_logic_vector(3 downto 0); -- -- AXI Address Channel USER output -- -- m_axi_mm2s_arvalid : out std_logic; -- -- AXI Address Channel VALID output -- -- m_axi_mm2s_arready : in std_logic; -- -- AXI Address Channel READY input -- ----------------------------------------------------------------------------------- -- Currently unsupported AXI Address Channel output signals ------- -- m_axi_mm2s_alock : out std_logic_vector(2 downto 0); -- -- m_axi_mm2s_acache : out std_logic_vector(4 downto 0); -- -- m_axi_mm2s_aqos : out std_logic_vector(3 downto 0); -- -- m_axi_mm2s_aregion : out std_logic_vector(3 downto 0); -- ------------------------------------------------------------------- -- MM2S AXI MMap Read Data Channel I/O ------------------------------------------------ m_axi_mm2s_rdata : In std_logic_vector(C_M_AXI_MM2S_DATA_WIDTH-1 downto 0); -- m_axi_mm2s_rresp : In std_logic_vector(1 downto 0); -- m_axi_mm2s_rlast : In std_logic; -- m_axi_mm2s_rvalid : In std_logic; -- m_axi_mm2s_rready : Out std_logic; -- ---------------------------------------------------------------------------------------- -- MM2S AXI Master Stream Channel I/O ------------------------------------------------------- m_axis_mm2s_tdata : Out std_logic_vector(C_M_AXIS_MM2S_TDATA_WIDTH-1 downto 0); -- m_axis_mm2s_tkeep : Out std_logic_vector((C_M_AXIS_MM2S_TDATA_WIDTH/8)-1 downto 0); -- m_axis_mm2s_tlast : Out std_logic; -- m_axis_mm2s_tvalid : Out std_logic; -- m_axis_mm2s_tready : In std_logic; -- ---------------------------------------------------------------------------------------------- -- Testing Support I/O -------------------------------------------------------- mm2s_dbg_sel : in std_logic_vector( 3 downto 0); -- mm2s_dbg_data : out std_logic_vector(31 downto 0) ; -- ------------------------------------------------------------------------------- -- S2MM Primary Clock input --------------------------------- m_axi_s2mm_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- S2MM Primary Reset input -- m_axi_s2mm_aresetn : in std_logic; -- -- Reset used for the internal master logic -- ------------------------------------------------------------- -- S2MM Halt request input control ------------------ s2mm_halt : in std_logic; -- -- Active high soft shutdown request -- -- -- S2MM Halt Complete status flag -- s2mm_halt_cmplt : out std_logic; -- -- Active high soft shutdown complete status -- ----------------------------------------------------- -- S2MM Error discrete output ------------------ s2mm_err : Out std_logic; -- -- Composite Error indication -- ------------------------------------------------ -- Memory Map to Stream Command FIFO and Status FIFO I/O ----------------- m_axis_s2mm_cmdsts_awclk : in std_logic; -- -- Secondary Clock input for async CMD/Status interface -- -- m_axis_s2mm_cmdsts_aresetn : in std_logic; -- -- Secondary Reset input for async CMD/Status interface -- -------------------------------------------------------------------------- -- User Command Interface Ports (AXI Stream) -------------------------------------------------- s_axis_s2mm_cmd_tvalid : in std_logic; -- s_axis_s2mm_cmd_tready : out std_logic; -- s_axis_s2mm_cmd_tdata : in std_logic_vector(C_CMD_WIDTH-1 downto 0); -- ----------------------------------------------------------------------------------------------- -- User Status Interface Ports (AXI Stream) ----------------------------------------------------------- m_axis_s2mm_sts_tvalid : out std_logic; -- m_axis_s2mm_sts_tready : in std_logic; -- m_axis_s2mm_sts_tdata : out std_logic_vector(((C_S2MM_SUPPORT_INDET_BTT*24)+8)-1 downto 0); -- m_axis_s2mm_sts_tkeep : out std_logic_vector((((C_S2MM_SUPPORT_INDET_BTT*24)+8)/8)-1 downto 0); -- m_axis_s2mm_sts_tlast : out std_logic; -- ------------------------------------------------------------------------------------------------------- -- Address posting controls ----------------------------------------- s2mm_allow_addr_req : in std_logic; -- s2mm_addr_req_posted : out std_logic; -- s2mm_wr_xfer_cmplt : out std_logic; -- s2mm_ld_nxt_len : out std_logic; -- s2mm_wr_len : out std_logic_vector(7 downto 0); -- --------------------------------------------------------------------- -- S2MM AXI Address Channel I/O ---------------------------------------------------- m_axi_s2mm_awid : out std_logic_vector(C_M_AXI_S2MM_ID_WIDTH-1 downto 0); -- -- AXI Address Channel ID output -- -- m_axi_s2mm_awaddr : out std_logic_vector(C_M_AXI_S2MM_ADDR_WIDTH-1 downto 0); -- -- AXI Address Channel Address output -- -- m_axi_s2mm_awlen : out std_logic_vector(7 downto 0); -- -- AXI Address Channel LEN output -- -- Sized to support 256 data beat bursts -- -- m_axi_s2mm_awsize : out std_logic_vector(2 downto 0); -- -- AXI Address Channel SIZE output -- -- m_axi_s2mm_awburst : out std_logic_vector(1 downto 0); -- -- AXI Address Channel BURST output -- -- m_axi_s2mm_awprot : out std_logic_vector(2 downto 0); -- -- AXI Address Channel PROT output -- -- m_axi_s2mm_awcache : out std_logic_vector(3 downto 0); -- -- AXI Address Channel CACHE output -- m_axi_s2mm_awuser : out std_logic_vector(3 downto 0); -- -- AXI Address Channel USER output -- -- m_axi_s2mm_awvalid : out std_logic; -- -- AXI Address Channel VALID output -- -- m_axi_s2mm_awready : in std_logic; -- -- AXI Address Channel READY input -- ------------------------------------------------------------------------------------- -- Currently unsupported AXI Address Channel output signals ------- -- m_axi_s2mm__awlock : out std_logic_vector(2 downto 0); -- -- m_axi_s2mm__awcache : out std_logic_vector(4 downto 0); -- -- m_axi_s2mm__awqos : out std_logic_vector(3 downto 0); -- -- m_axi_s2mm__awregion : out std_logic_vector(3 downto 0); -- ------------------------------------------------------------------- -- S2MM AXI MMap Write Data Channel I/O -------------------------------------------------- m_axi_s2mm_wdata : Out std_logic_vector(C_M_AXI_S2MM_DATA_WIDTH-1 downto 0); -- m_axi_s2mm_wstrb : Out std_logic_vector((C_M_AXI_S2MM_DATA_WIDTH/8)-1 downto 0); -- m_axi_s2mm_wlast : Out std_logic; -- m_axi_s2mm_wvalid : Out std_logic; -- m_axi_s2mm_wready : In std_logic; -- ------------------------------------------------------------------------------------------- -- S2MM AXI MMap Write response Channel I/O ------------------------- m_axi_s2mm_bresp : In std_logic_vector(1 downto 0); -- m_axi_s2mm_bvalid : In std_logic; -- m_axi_s2mm_bready : Out std_logic; -- ---------------------------------------------------------------------- -- S2MM AXI Slave Stream Channel I/O ------------------------------------------------------- s_axis_s2mm_tdata : In std_logic_vector(C_S_AXIS_S2MM_TDATA_WIDTH-1 downto 0); -- s_axis_s2mm_tkeep : In std_logic_vector((C_S_AXIS_S2MM_TDATA_WIDTH/8)-1 downto 0); -- s_axis_s2mm_tlast : In std_logic; -- s_axis_s2mm_tvalid : In std_logic; -- s_axis_s2mm_tready : Out std_logic; -- --------------------------------------------------------------------------------------------- -- Testing Support I/O ------------------------------------------------ s2mm_dbg_sel : in std_logic_vector( 3 downto 0); -- s2mm_dbg_data : out std_logic_vector(31 downto 0) -- ------------------------------------------------------------------------ ); end entity axi_datamover; architecture implementation of axi_datamover is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; -- Function Declarations ------------------------------------------------------------------- -- Function -- -- Function Name: funct_clip_brst_len -- -- Function Description: -- This function is used to limit the parameterized max burst -- databeats when the tranfer data width is 256 bits or greater. -- This is required to keep from crossing the 4K byte xfer -- boundary required by AXI. This process is further complicated -- by the inclusion/omission of upsizers or downsizers in the -- data path. -- ------------------------------------------------------------------- function funct_clip_brst_len (param_burst_beats : integer; mmap_transfer_bit_width : integer; stream_transfer_bit_width : integer; down_up_sizers_enabled : integer) return integer is constant FCONST_SIZERS_ENABLED : boolean := (down_up_sizers_enabled > 0); Variable fvar_max_burst_dbeats : Integer; begin if (FCONST_SIZERS_ENABLED) then -- use MMap dwidth for calc If (mmap_transfer_bit_width <= 128) Then -- allowed fvar_max_burst_dbeats := param_burst_beats; Elsif (mmap_transfer_bit_width <= 256) Then If (param_burst_beats <= 128) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 128; End if; Elsif (mmap_transfer_bit_width <= 512) Then If (param_burst_beats <= 64) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 64; End if; Else -- 1024 bit mmap width case If (param_burst_beats <= 32) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 32; End if; End if; else -- use stream dwidth for calc If (stream_transfer_bit_width <= 128) Then -- allowed fvar_max_burst_dbeats := param_burst_beats; Elsif (stream_transfer_bit_width <= 256) Then If (param_burst_beats <= 128) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 128; End if; Elsif (stream_transfer_bit_width <= 512) Then If (param_burst_beats <= 64) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 64; End if; Else -- 1024 bit stream width case If (param_burst_beats <= 32) Then fvar_max_burst_dbeats := param_burst_beats; Else fvar_max_burst_dbeats := 32; End if; End if; end if; Return (fvar_max_burst_dbeats); end function funct_clip_brst_len; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_fix_depth_16 -- -- Function Description: -- This function is used to fix the Command and Status FIFO depths to -- 16 entries when Async clocking mode is enabled. This is required -- due to the way the async_fifo_fg.vhd design in proc_common is -- implemented. ------------------------------------------------------------------- function funct_fix_depth_16 (async_clocking_mode : integer; requested_depth : integer) return integer is Variable fvar_depth_2_use : Integer; begin If (async_clocking_mode = 1) Then -- async mode so fix at 16 fvar_depth_2_use := 16; Elsif (requested_depth > 16) Then -- limit at 16 fvar_depth_2_use := 16; Else -- use requested depth fvar_depth_2_use := requested_depth; End if; Return (fvar_depth_2_use); end function funct_fix_depth_16; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_min_btt_width -- -- Function Description: -- This function calculates the minimum required value -- for the used width of the command BTT field. -- ------------------------------------------------------------------- function funct_get_min_btt_width (max_burst_beats : integer; bytes_per_beat : integer ) return integer is Variable var_min_btt_needed : Integer; Variable var_max_bytes_per_burst : Integer; begin var_max_bytes_per_burst := max_burst_beats*bytes_per_beat; if (var_max_bytes_per_burst <= 16) then var_min_btt_needed := 5; elsif (var_max_bytes_per_burst <= 32) then var_min_btt_needed := 6; elsif (var_max_bytes_per_burst <= 64) then var_min_btt_needed := 7; elsif (var_max_bytes_per_burst <= 128) then var_min_btt_needed := 8; elsif (var_max_bytes_per_burst <= 256) then var_min_btt_needed := 9; elsif (var_max_bytes_per_burst <= 512) then var_min_btt_needed := 10; elsif (var_max_bytes_per_burst <= 1024) then var_min_btt_needed := 11; elsif (var_max_bytes_per_burst <= 2048) then var_min_btt_needed := 12; elsif (var_max_bytes_per_burst <= 4096) then var_min_btt_needed := 13; else -- 8K byte range var_min_btt_needed := 14; end if; Return (var_min_btt_needed); end function funct_get_min_btt_width; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_xfer_bytes_per_dbeat -- -- Function Description: -- Calculates the nuber of bytes that will transfered per databeat -- on the AXI4 MMap Bus. -- ------------------------------------------------------------------- function funct_get_xfer_bytes_per_dbeat (mmap_transfer_bit_width : integer; stream_transfer_bit_width : integer; down_up_sizers_enabled : integer) return integer is Variable temp_bytes_per_dbeat : Integer := 4; begin if (down_up_sizers_enabled > 0) then -- down/up sizers are in use, use full mmap dwidth temp_bytes_per_dbeat := mmap_transfer_bit_width/8; else -- No down/up sizers so use Stream data width temp_bytes_per_dbeat := stream_transfer_bit_width/8; end if; Return (temp_bytes_per_dbeat); end function funct_get_xfer_bytes_per_dbeat; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_fix_btt_used -- -- Function Description: -- THis function makes sure the BTT width used is at least the -- minimum needed. -- ------------------------------------------------------------------- function funct_fix_btt_used (requested_btt_width : integer; min_btt_width : integer) return integer is Variable var_corrected_btt_width : Integer; begin If (requested_btt_width < min_btt_width) Then var_corrected_btt_width := min_btt_width; else var_corrected_btt_width := requested_btt_width; End if; Return (var_corrected_btt_width); end function funct_fix_btt_used; function funct_fix_addr (in_addr_width : integer) return integer is Variable new_addr_width : Integer; begin If (in_addr_width <= 32) Then new_addr_width := 32; elsif (in_addr_width > 32 and in_addr_width <= 40) Then new_addr_width := 40; elsif (in_addr_width > 40 and in_addr_width <= 48) Then new_addr_width := 48; elsif (in_addr_width > 48 and in_addr_width <= 56) Then new_addr_width := 56; else new_addr_width := 64; End if; Return (new_addr_width); end function funct_fix_addr; ------------------------------------------------------------------- -- Constant Declarations ------------------------------------------------------------------- Constant MM2S_TAG_WIDTH : integer := 4; Constant S2MM_TAG_WIDTH : integer := 4; Constant MM2S_DOWNSIZER_ENABLED : integer := C_MM2S_INCLUDE_SF; Constant S2MM_UPSIZER_ENABLED : integer := C_S2MM_INCLUDE_SF + C_S2MM_SUPPORT_INDET_BTT; Constant MM2S_MAX_BURST_BEATS : integer := funct_clip_brst_len(C_MM2S_BURST_SIZE, C_M_AXI_MM2S_DATA_WIDTH, C_M_AXIS_MM2S_TDATA_WIDTH, MM2S_DOWNSIZER_ENABLED); Constant S2MM_MAX_BURST_BEATS : integer := funct_clip_brst_len(C_S2MM_BURST_SIZE, C_M_AXI_S2MM_DATA_WIDTH, C_S_AXIS_S2MM_TDATA_WIDTH, S2MM_UPSIZER_ENABLED); Constant MM2S_CMDSTS_FIFO_DEPTH : integer := funct_fix_depth_16(C_MM2S_STSCMD_IS_ASYNC, C_MM2S_STSCMD_FIFO_DEPTH); Constant S2MM_CMDSTS_FIFO_DEPTH : integer := funct_fix_depth_16(C_S2MM_STSCMD_IS_ASYNC, C_S2MM_STSCMD_FIFO_DEPTH); Constant MM2S_BYTES_PER_BEAT : integer := funct_get_xfer_bytes_per_dbeat(C_M_AXI_MM2S_DATA_WIDTH, C_M_AXIS_MM2S_TDATA_WIDTH, MM2S_DOWNSIZER_ENABLED); Constant MM2S_MIN_BTT_NEEDED : integer := funct_get_min_btt_width(MM2S_MAX_BURST_BEATS, MM2S_BYTES_PER_BEAT); Constant MM2S_CORRECTED_BTT_USED : integer := funct_fix_btt_used(C_MM2S_BTT_USED, MM2S_MIN_BTT_NEEDED); Constant S2MM_BYTES_PER_BEAT : integer := funct_get_xfer_bytes_per_dbeat(C_M_AXI_S2MM_DATA_WIDTH, C_S_AXIS_S2MM_TDATA_WIDTH, S2MM_UPSIZER_ENABLED); Constant S2MM_MIN_BTT_NEEDED : integer := funct_get_min_btt_width(S2MM_MAX_BURST_BEATS, S2MM_BYTES_PER_BEAT); Constant S2MM_CORRECTED_BTT_USED : integer := funct_fix_btt_used(C_S2MM_BTT_USED, S2MM_MIN_BTT_NEEDED); constant C_M_AXI_MM2S_ADDR_WIDTH_int : integer := funct_fix_addr(C_M_AXI_MM2S_ADDR_WIDTH); constant C_M_AXI_S2MM_ADDR_WIDTH_int : integer := funct_fix_addr(C_M_AXI_S2MM_ADDR_WIDTH); -- Signals signal sig_mm2s_tstrb : std_logic_vector((C_M_AXIS_MM2S_TDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_mm2s_sts_tstrb : std_logic_vector(0 downto 0) := (others => '0'); signal sig_s2mm_tstrb : std_logic_vector((C_S_AXIS_S2MM_TDATA_WIDTH/8)-1 downto 0) := (others => '0'); signal sig_s2mm_sts_tstrb : std_logic_vector((((C_S2MM_SUPPORT_INDET_BTT*24)+8)/8)-1 downto 0) := (others => '0'); signal m_axi_mm2s_araddr_int : std_logic_vector (C_M_AXI_MM2S_ADDR_WIDTH_int-1 downto 0) ; signal m_axi_s2mm_awaddr_int : std_logic_vector (C_M_AXI_S2MM_ADDR_WIDTH_int-1 downto 0) ; begin --(architecture implementation) ------------------------------------------------------------- -- Conversion to tkeep for external stream connnections ------------------------------------------------------------- -- MM2S Status Stream Output m_axis_mm2s_sts_tkeep <= sig_mm2s_sts_tstrb ; GEN_MM2S_TKEEP_ENABLE1 : if C_ENABLE_MM2S_TKEEP = 1 generate begin -- MM2S Stream Output m_axis_mm2s_tkeep <= sig_mm2s_tstrb ; end generate GEN_MM2S_TKEEP_ENABLE1; GEN_MM2S_TKEEP_DISABLE1 : if C_ENABLE_MM2S_TKEEP = 0 generate begin m_axis_mm2s_tkeep <= (others => '1'); end generate GEN_MM2S_TKEEP_DISABLE1; GEN_S2MM_TKEEP_ENABLE1 : if C_ENABLE_S2MM_TKEEP = 1 generate begin -- S2MM Stream Input sig_s2mm_tstrb <= s_axis_s2mm_tkeep ; end generate GEN_S2MM_TKEEP_ENABLE1; GEN_S2MM_TKEEP_DISABLE1 : if C_ENABLE_S2MM_TKEEP = 0 generate begin sig_s2mm_tstrb <= (others => '1'); end generate GEN_S2MM_TKEEP_DISABLE1; -- S2MM Status Stream Output m_axis_s2mm_sts_tkeep <= sig_s2mm_sts_tstrb ; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_MM2S_OMIT -- -- If Generate Description: -- Instantiate the MM2S OMIT Wrapper -- -- ------------------------------------------------------------ GEN_MM2S_OMIT : if (C_INCLUDE_MM2S = 0) generate begin ------------------------------------------------------------ -- Instance: I_MM2S_OMIT_WRAPPER -- -- Description: -- Read omit Wrapper Instance -- ------------------------------------------------------------ I_MM2S_OMIT_WRAPPER : entity axi_datamover_v5_1_10.axi_datamover_mm2s_omit_wrap generic map ( C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_MM2S_ARID => C_M_AXI_MM2S_ARID , C_MM2S_ID_WIDTH => C_M_AXI_MM2S_ID_WIDTH , C_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH_int , C_MM2S_MDATA_WIDTH => C_M_AXI_MM2S_DATA_WIDTH , C_MM2S_SDATA_WIDTH => C_M_AXIS_MM2S_TDATA_WIDTH , C_INCLUDE_MM2S_STSFIFO => C_INCLUDE_MM2S_STSFIFO , C_MM2S_STSCMD_FIFO_DEPTH => MM2S_CMDSTS_FIFO_DEPTH , C_MM2S_STSCMD_IS_ASYNC => C_MM2S_STSCMD_IS_ASYNC , C_INCLUDE_MM2S_DRE => C_INCLUDE_MM2S_DRE , C_MM2S_BURST_SIZE => MM2S_MAX_BURST_BEATS , C_MM2S_BTT_USED => MM2S_CORRECTED_BTT_USED , C_MM2S_ADDR_PIPE_DEPTH => C_MM2S_ADDR_PIPE_DEPTH , C_TAG_WIDTH => MM2S_TAG_WIDTH , C_ENABLE_CACHE_USER => C_ENABLE_CACHE_USER , C_FAMILY => C_FAMILY ) port map ( mm2s_aclk => m_axi_mm2s_aclk , mm2s_aresetn => m_axi_mm2s_aresetn , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , mm2s_err => mm2s_err , mm2s_cmdsts_awclk => m_axis_mm2s_cmdsts_aclk , mm2s_cmdsts_aresetn => m_axis_mm2s_cmdsts_aresetn , mm2s_cmd_wvalid => s_axis_mm2s_cmd_tvalid , mm2s_cmd_wready => s_axis_mm2s_cmd_tready , mm2s_cmd_wdata => s_axis_mm2s_cmd_tdata , mm2s_sts_wvalid => m_axis_mm2s_sts_tvalid , mm2s_sts_wready => m_axis_mm2s_sts_tready , mm2s_sts_wdata => m_axis_mm2s_sts_tdata , mm2s_sts_wstrb => sig_mm2s_sts_tstrb , mm2s_sts_wlast => m_axis_mm2s_sts_tlast , mm2s_allow_addr_req => mm2s_allow_addr_req , mm2s_addr_req_posted => mm2s_addr_req_posted , mm2s_rd_xfer_cmplt => mm2s_rd_xfer_cmplt , mm2s_arid => m_axi_mm2s_arid , mm2s_araddr => m_axi_mm2s_araddr_int , mm2s_arlen => m_axi_mm2s_arlen , mm2s_arsize => m_axi_mm2s_arsize , mm2s_arburst => m_axi_mm2s_arburst , mm2s_arprot => m_axi_mm2s_arprot , mm2s_arcache => m_axi_mm2s_arcache , mm2s_aruser => m_axi_mm2s_aruser , mm2s_arvalid => m_axi_mm2s_arvalid , mm2s_arready => m_axi_mm2s_arready , mm2s_rdata => m_axi_mm2s_rdata , mm2s_rresp => m_axi_mm2s_rresp , mm2s_rlast => m_axi_mm2s_rlast , mm2s_rvalid => m_axi_mm2s_rvalid , mm2s_rready => m_axi_mm2s_rready , mm2s_strm_wdata => m_axis_mm2s_tdata , mm2s_strm_wstrb => sig_mm2s_tstrb , mm2s_strm_wlast => m_axis_mm2s_tlast , mm2s_strm_wvalid => m_axis_mm2s_tvalid , mm2s_strm_wready => m_axis_mm2s_tready , mm2s_dbg_sel => mm2s_dbg_sel , mm2s_dbg_data => mm2s_dbg_data ); end generate GEN_MM2S_OMIT; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_MM2S_FULL -- -- If Generate Description: -- Instantiate the MM2S Full Wrapper -- -- ------------------------------------------------------------ GEN_MM2S_FULL : if (C_INCLUDE_MM2S = 1) generate begin ------------------------------------------------------------ -- Instance: I_MM2S_FULL_WRAPPER -- -- Description: -- Read Full Wrapper Instance -- ------------------------------------------------------------ I_MM2S_FULL_WRAPPER : entity axi_datamover_v5_1_10.axi_datamover_mm2s_full_wrap generic map ( C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_MM2S_ARID => C_M_AXI_MM2S_ARID , C_MM2S_ID_WIDTH => C_M_AXI_MM2S_ID_WIDTH , C_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH_int , C_MM2S_MDATA_WIDTH => C_M_AXI_MM2S_DATA_WIDTH , C_MM2S_SDATA_WIDTH => C_M_AXIS_MM2S_TDATA_WIDTH , C_INCLUDE_MM2S_STSFIFO => C_INCLUDE_MM2S_STSFIFO , C_MM2S_STSCMD_FIFO_DEPTH => MM2S_CMDSTS_FIFO_DEPTH , C_MM2S_STSCMD_IS_ASYNC => C_MM2S_STSCMD_IS_ASYNC , C_INCLUDE_MM2S_DRE => C_INCLUDE_MM2S_DRE , C_MM2S_BURST_SIZE => MM2S_MAX_BURST_BEATS , C_MM2S_BTT_USED => MM2S_CORRECTED_BTT_USED , C_MM2S_ADDR_PIPE_DEPTH => C_MM2S_ADDR_PIPE_DEPTH , C_TAG_WIDTH => MM2S_TAG_WIDTH , C_INCLUDE_MM2S_GP_SF => C_MM2S_INCLUDE_SF , C_ENABLE_CACHE_USER => C_ENABLE_CACHE_USER , C_ENABLE_MM2S_TKEEP => C_ENABLE_MM2S_TKEEP , C_ENABLE_SKID_BUF => C_ENABLE_SKID_BUF , C_FAMILY => C_FAMILY ) port map ( mm2s_aclk => m_axi_mm2s_aclk , mm2s_aresetn => m_axi_mm2s_aresetn , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , mm2s_err => mm2s_err , mm2s_cmdsts_awclk => m_axis_mm2s_cmdsts_aclk , mm2s_cmdsts_aresetn => m_axis_mm2s_cmdsts_aresetn , mm2s_cmd_wvalid => s_axis_mm2s_cmd_tvalid , mm2s_cmd_wready => s_axis_mm2s_cmd_tready , mm2s_cmd_wdata => s_axis_mm2s_cmd_tdata , mm2s_sts_wvalid => m_axis_mm2s_sts_tvalid , mm2s_sts_wready => m_axis_mm2s_sts_tready , mm2s_sts_wdata => m_axis_mm2s_sts_tdata , mm2s_sts_wstrb => sig_mm2s_sts_tstrb , mm2s_sts_wlast => m_axis_mm2s_sts_tlast , mm2s_allow_addr_req => mm2s_allow_addr_req , mm2s_addr_req_posted => mm2s_addr_req_posted , mm2s_rd_xfer_cmplt => mm2s_rd_xfer_cmplt , mm2s_arid => m_axi_mm2s_arid , mm2s_araddr => m_axi_mm2s_araddr_int , mm2s_arlen => m_axi_mm2s_arlen , mm2s_arsize => m_axi_mm2s_arsize , mm2s_arburst => m_axi_mm2s_arburst , mm2s_arprot => m_axi_mm2s_arprot , mm2s_arcache => m_axi_mm2s_arcache , mm2s_aruser => m_axi_mm2s_aruser , mm2s_arvalid => m_axi_mm2s_arvalid , mm2s_arready => m_axi_mm2s_arready , mm2s_rdata => m_axi_mm2s_rdata , mm2s_rresp => m_axi_mm2s_rresp , mm2s_rlast => m_axi_mm2s_rlast , mm2s_rvalid => m_axi_mm2s_rvalid , mm2s_rready => m_axi_mm2s_rready , mm2s_strm_wdata => m_axis_mm2s_tdata , mm2s_strm_wstrb => sig_mm2s_tstrb , mm2s_strm_wlast => m_axis_mm2s_tlast , mm2s_strm_wvalid => m_axis_mm2s_tvalid , mm2s_strm_wready => m_axis_mm2s_tready , mm2s_dbg_sel => mm2s_dbg_sel , mm2s_dbg_data => mm2s_dbg_data ); end generate GEN_MM2S_FULL; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_MM2S_BASIC -- -- If Generate Description: -- Instantiate the MM2S Basic Wrapper -- -- ------------------------------------------------------------ GEN_MM2S_BASIC : if (C_INCLUDE_MM2S = 2) generate begin ------------------------------------------------------------ -- Instance: I_MM2S_BASIC_WRAPPER -- -- Description: -- Read Basic Wrapper Instance -- ------------------------------------------------------------ I_MM2S_BASIC_WRAPPER : entity axi_datamover_v5_1_10.axi_datamover_mm2s_basic_wrap generic map ( C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_MM2S_ARID => C_M_AXI_MM2S_ARID , C_MM2S_ID_WIDTH => C_M_AXI_MM2S_ID_WIDTH , C_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH_int , C_MM2S_MDATA_WIDTH => C_M_AXI_MM2S_DATA_WIDTH , C_MM2S_SDATA_WIDTH => C_M_AXIS_MM2S_TDATA_WIDTH , C_INCLUDE_MM2S_STSFIFO => C_INCLUDE_MM2S_STSFIFO , C_MM2S_STSCMD_FIFO_DEPTH => MM2S_CMDSTS_FIFO_DEPTH , C_MM2S_STSCMD_IS_ASYNC => C_MM2S_STSCMD_IS_ASYNC , C_INCLUDE_MM2S_DRE => C_INCLUDE_MM2S_DRE , C_MM2S_BURST_SIZE => MM2S_MAX_BURST_BEATS , C_MM2S_BTT_USED => MM2S_CORRECTED_BTT_USED , C_MM2S_ADDR_PIPE_DEPTH => C_MM2S_ADDR_PIPE_DEPTH , C_TAG_WIDTH => MM2S_TAG_WIDTH , C_ENABLE_CACHE_USER => C_ENABLE_CACHE_USER , C_ENABLE_SKID_BUF => C_ENABLE_SKID_BUF , C_MICRO_DMA => C_MICRO_DMA , C_FAMILY => C_FAMILY ) port map ( mm2s_aclk => m_axi_mm2s_aclk , mm2s_aresetn => m_axi_mm2s_aresetn , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , mm2s_err => mm2s_err , mm2s_cmdsts_awclk => m_axis_mm2s_cmdsts_aclk , mm2s_cmdsts_aresetn => m_axis_mm2s_cmdsts_aresetn , mm2s_cmd_wvalid => s_axis_mm2s_cmd_tvalid , mm2s_cmd_wready => s_axis_mm2s_cmd_tready , mm2s_cmd_wdata => s_axis_mm2s_cmd_tdata , mm2s_sts_wvalid => m_axis_mm2s_sts_tvalid , mm2s_sts_wready => m_axis_mm2s_sts_tready , mm2s_sts_wdata => m_axis_mm2s_sts_tdata , mm2s_sts_wstrb => sig_mm2s_sts_tstrb , mm2s_sts_wlast => m_axis_mm2s_sts_tlast , mm2s_allow_addr_req => mm2s_allow_addr_req , mm2s_addr_req_posted => mm2s_addr_req_posted , mm2s_rd_xfer_cmplt => mm2s_rd_xfer_cmplt , mm2s_arid => m_axi_mm2s_arid , mm2s_araddr => m_axi_mm2s_araddr_int , mm2s_arlen => m_axi_mm2s_arlen , mm2s_arsize => m_axi_mm2s_arsize , mm2s_arburst => m_axi_mm2s_arburst , mm2s_arprot => m_axi_mm2s_arprot , mm2s_arcache => m_axi_mm2s_arcache , mm2s_aruser => m_axi_mm2s_aruser , mm2s_arvalid => m_axi_mm2s_arvalid , mm2s_arready => m_axi_mm2s_arready , mm2s_rdata => m_axi_mm2s_rdata , mm2s_rresp => m_axi_mm2s_rresp , mm2s_rlast => m_axi_mm2s_rlast , mm2s_rvalid => m_axi_mm2s_rvalid , mm2s_rready => m_axi_mm2s_rready , mm2s_strm_wdata => m_axis_mm2s_tdata , mm2s_strm_wstrb => sig_mm2s_tstrb , mm2s_strm_wlast => m_axis_mm2s_tlast , mm2s_strm_wvalid => m_axis_mm2s_tvalid , mm2s_strm_wready => m_axis_mm2s_tready , mm2s_dbg_sel => mm2s_dbg_sel , mm2s_dbg_data => mm2s_dbg_data ); end generate GEN_MM2S_BASIC; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_S2MM_OMIT -- -- If Generate Description: -- Instantiate the S2MM OMIT Wrapper -- -- ------------------------------------------------------------ GEN_S2MM_OMIT : if (C_INCLUDE_S2MM = 0) generate begin ------------------------------------------------------------ -- Instance: I_S2MM_OMIT_WRAPPER -- -- Description: -- Write Omit Wrapper Instance -- ------------------------------------------------------------ I_S2MM_OMIT_WRAPPER : entity axi_datamover_v5_1_10.axi_datamover_s2mm_omit_wrap generic map ( C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_S2MM_AWID => C_M_AXI_S2MM_AWID , C_S2MM_ID_WIDTH => C_M_AXI_S2MM_ID_WIDTH , C_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH_int , C_S2MM_MDATA_WIDTH => C_M_AXI_S2MM_DATA_WIDTH , C_S2MM_SDATA_WIDTH => C_S_AXIS_S2MM_TDATA_WIDTH , C_INCLUDE_S2MM_STSFIFO => C_INCLUDE_S2MM_STSFIFO , C_S2MM_STSCMD_FIFO_DEPTH => S2MM_CMDSTS_FIFO_DEPTH , C_S2MM_STSCMD_IS_ASYNC => C_S2MM_STSCMD_IS_ASYNC , C_INCLUDE_S2MM_DRE => C_INCLUDE_S2MM_DRE , C_S2MM_BURST_SIZE => S2MM_MAX_BURST_BEATS , C_S2MM_SUPPORT_INDET_BTT => C_S2MM_SUPPORT_INDET_BTT , C_S2MM_ADDR_PIPE_DEPTH => C_S2MM_ADDR_PIPE_DEPTH , C_TAG_WIDTH => S2MM_TAG_WIDTH , C_ENABLE_CACHE_USER => C_ENABLE_CACHE_USER , C_FAMILY => C_FAMILY ) port map ( s2mm_aclk => m_axi_s2mm_aclk , s2mm_aresetn => m_axi_s2mm_aresetn , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , s2mm_err => s2mm_err , s2mm_cmdsts_awclk => m_axis_s2mm_cmdsts_awclk , s2mm_cmdsts_aresetn => m_axis_s2mm_cmdsts_aresetn , s2mm_cmd_wvalid => s_axis_s2mm_cmd_tvalid , s2mm_cmd_wready => s_axis_s2mm_cmd_tready , s2mm_cmd_wdata => s_axis_s2mm_cmd_tdata , s2mm_sts_wvalid => m_axis_s2mm_sts_tvalid , s2mm_sts_wready => m_axis_s2mm_sts_tready , s2mm_sts_wdata => m_axis_s2mm_sts_tdata , s2mm_sts_wstrb => sig_s2mm_sts_tstrb , s2mm_sts_wlast => m_axis_s2mm_sts_tlast , s2mm_allow_addr_req => s2mm_allow_addr_req , s2mm_addr_req_posted => s2mm_addr_req_posted , s2mm_wr_xfer_cmplt => s2mm_wr_xfer_cmplt , s2mm_ld_nxt_len => s2mm_ld_nxt_len , s2mm_wr_len => s2mm_wr_len , s2mm_awid => m_axi_s2mm_awid , s2mm_awaddr => m_axi_s2mm_awaddr_int , s2mm_awlen => m_axi_s2mm_awlen , s2mm_awsize => m_axi_s2mm_awsize , s2mm_awburst => m_axi_s2mm_awburst , s2mm_awprot => m_axi_s2mm_awprot , s2mm_awcache => m_axi_s2mm_awcache , s2mm_awuser => m_axi_s2mm_awuser , s2mm_awvalid => m_axi_s2mm_awvalid , s2mm_awready => m_axi_s2mm_awready , s2mm_wdata => m_axi_s2mm_wdata , s2mm_wstrb => m_axi_s2mm_wstrb , s2mm_wlast => m_axi_s2mm_wlast , s2mm_wvalid => m_axi_s2mm_wvalid , s2mm_wready => m_axi_s2mm_wready , s2mm_bresp => m_axi_s2mm_bresp , s2mm_bvalid => m_axi_s2mm_bvalid , s2mm_bready => m_axi_s2mm_bready , s2mm_strm_wdata => s_axis_s2mm_tdata , s2mm_strm_wstrb => sig_s2mm_tstrb , s2mm_strm_wlast => s_axis_s2mm_tlast , s2mm_strm_wvalid => s_axis_s2mm_tvalid , s2mm_strm_wready => s_axis_s2mm_tready , s2mm_dbg_sel => s2mm_dbg_sel , s2mm_dbg_data => s2mm_dbg_data ); end generate GEN_S2MM_OMIT; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_S2MM_FULL -- -- If Generate Description: -- Instantiate the S2MM FULL Wrapper -- -- ------------------------------------------------------------ GEN_S2MM_FULL : if (C_INCLUDE_S2MM = 1) generate begin ------------------------------------------------------------ -- Instance: I_S2MM_FULL_WRAPPER -- -- Description: -- Write Full Wrapper Instance -- ------------------------------------------------------------ I_S2MM_FULL_WRAPPER : entity axi_datamover_v5_1_10.axi_datamover_s2mm_full_wrap generic map ( C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_S2MM_AWID => C_M_AXI_S2MM_AWID , C_S2MM_ID_WIDTH => C_M_AXI_S2MM_ID_WIDTH , C_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH_int , C_S2MM_MDATA_WIDTH => C_M_AXI_S2MM_DATA_WIDTH , C_S2MM_SDATA_WIDTH => C_S_AXIS_S2MM_TDATA_WIDTH , C_INCLUDE_S2MM_STSFIFO => C_INCLUDE_S2MM_STSFIFO , C_S2MM_STSCMD_FIFO_DEPTH => S2MM_CMDSTS_FIFO_DEPTH , C_S2MM_STSCMD_IS_ASYNC => C_S2MM_STSCMD_IS_ASYNC , C_INCLUDE_S2MM_DRE => C_INCLUDE_S2MM_DRE , C_S2MM_BURST_SIZE => S2MM_MAX_BURST_BEATS , C_S2MM_BTT_USED => S2MM_CORRECTED_BTT_USED , C_S2MM_SUPPORT_INDET_BTT => C_S2MM_SUPPORT_INDET_BTT , C_S2MM_ADDR_PIPE_DEPTH => C_S2MM_ADDR_PIPE_DEPTH , C_TAG_WIDTH => S2MM_TAG_WIDTH , C_INCLUDE_S2MM_GP_SF => C_S2MM_INCLUDE_SF , C_ENABLE_CACHE_USER => C_ENABLE_CACHE_USER , C_ENABLE_S2MM_TKEEP => C_ENABLE_S2MM_TKEEP , C_ENABLE_SKID_BUF => C_ENABLE_SKID_BUF , C_FAMILY => C_FAMILY ) port map ( s2mm_aclk => m_axi_s2mm_aclk , s2mm_aresetn => m_axi_s2mm_aresetn , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , s2mm_err => s2mm_err , s2mm_cmdsts_awclk => m_axis_s2mm_cmdsts_awclk , s2mm_cmdsts_aresetn => m_axis_s2mm_cmdsts_aresetn , s2mm_cmd_wvalid => s_axis_s2mm_cmd_tvalid , s2mm_cmd_wready => s_axis_s2mm_cmd_tready , s2mm_cmd_wdata => s_axis_s2mm_cmd_tdata , s2mm_sts_wvalid => m_axis_s2mm_sts_tvalid , s2mm_sts_wready => m_axis_s2mm_sts_tready , s2mm_sts_wdata => m_axis_s2mm_sts_tdata , s2mm_sts_wstrb => sig_s2mm_sts_tstrb , s2mm_sts_wlast => m_axis_s2mm_sts_tlast , s2mm_allow_addr_req => s2mm_allow_addr_req , s2mm_addr_req_posted => s2mm_addr_req_posted , s2mm_wr_xfer_cmplt => s2mm_wr_xfer_cmplt , s2mm_ld_nxt_len => s2mm_ld_nxt_len , s2mm_wr_len => s2mm_wr_len , s2mm_awid => m_axi_s2mm_awid , s2mm_awaddr => m_axi_s2mm_awaddr_int , s2mm_awlen => m_axi_s2mm_awlen , s2mm_awsize => m_axi_s2mm_awsize , s2mm_awburst => m_axi_s2mm_awburst , s2mm_awprot => m_axi_s2mm_awprot , s2mm_awcache => m_axi_s2mm_awcache , s2mm_awuser => m_axi_s2mm_awuser , s2mm_awvalid => m_axi_s2mm_awvalid , s2mm_awready => m_axi_s2mm_awready , s2mm_wdata => m_axi_s2mm_wdata , s2mm_wstrb => m_axi_s2mm_wstrb , s2mm_wlast => m_axi_s2mm_wlast , s2mm_wvalid => m_axi_s2mm_wvalid , s2mm_wready => m_axi_s2mm_wready , s2mm_bresp => m_axi_s2mm_bresp , s2mm_bvalid => m_axi_s2mm_bvalid , s2mm_bready => m_axi_s2mm_bready , s2mm_strm_wdata => s_axis_s2mm_tdata , s2mm_strm_wstrb => sig_s2mm_tstrb , s2mm_strm_wlast => s_axis_s2mm_tlast , s2mm_strm_wvalid => s_axis_s2mm_tvalid , s2mm_strm_wready => s_axis_s2mm_tready , s2mm_dbg_sel => s2mm_dbg_sel , s2mm_dbg_data => s2mm_dbg_data ); end generate GEN_S2MM_FULL; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_S2MM_BASIC -- -- If Generate Description: -- Instantiate the S2MM Basic Wrapper -- -- ------------------------------------------------------------ GEN_S2MM_BASIC : if (C_INCLUDE_S2MM = 2) generate begin ------------------------------------------------------------ -- Instance: I_S2MM_BASIC_WRAPPER -- -- Description: -- Write Basic Wrapper Instance -- ------------------------------------------------------------ I_S2MM_BASIC_WRAPPER : entity axi_datamover_v5_1_10.axi_datamover_s2mm_basic_wrap generic map ( C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_S2MM_AWID => C_M_AXI_S2MM_AWID , C_S2MM_ID_WIDTH => C_M_AXI_S2MM_ID_WIDTH , C_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH_int , C_S2MM_MDATA_WIDTH => C_M_AXI_S2MM_DATA_WIDTH , C_S2MM_SDATA_WIDTH => C_S_AXIS_S2MM_TDATA_WIDTH , C_INCLUDE_S2MM_STSFIFO => C_INCLUDE_S2MM_STSFIFO , C_S2MM_STSCMD_FIFO_DEPTH => S2MM_CMDSTS_FIFO_DEPTH , C_S2MM_STSCMD_IS_ASYNC => C_S2MM_STSCMD_IS_ASYNC , C_INCLUDE_S2MM_DRE => C_INCLUDE_S2MM_DRE , C_S2MM_BURST_SIZE => S2MM_MAX_BURST_BEATS , C_S2MM_ADDR_PIPE_DEPTH => C_S2MM_ADDR_PIPE_DEPTH , C_TAG_WIDTH => S2MM_TAG_WIDTH , C_ENABLE_CACHE_USER => C_ENABLE_CACHE_USER , C_ENABLE_SKID_BUF => C_ENABLE_SKID_BUF , C_MICRO_DMA => C_MICRO_DMA , C_FAMILY => C_FAMILY ) port map ( s2mm_aclk => m_axi_s2mm_aclk , s2mm_aresetn => m_axi_s2mm_aresetn , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , s2mm_err => s2mm_err , s2mm_cmdsts_awclk => m_axis_s2mm_cmdsts_awclk , s2mm_cmdsts_aresetn => m_axis_s2mm_cmdsts_aresetn , s2mm_cmd_wvalid => s_axis_s2mm_cmd_tvalid , s2mm_cmd_wready => s_axis_s2mm_cmd_tready , s2mm_cmd_wdata => s_axis_s2mm_cmd_tdata , s2mm_sts_wvalid => m_axis_s2mm_sts_tvalid , s2mm_sts_wready => m_axis_s2mm_sts_tready , s2mm_sts_wdata => m_axis_s2mm_sts_tdata , s2mm_sts_wstrb => sig_s2mm_sts_tstrb , s2mm_sts_wlast => m_axis_s2mm_sts_tlast , s2mm_allow_addr_req => s2mm_allow_addr_req , s2mm_addr_req_posted => s2mm_addr_req_posted , s2mm_wr_xfer_cmplt => s2mm_wr_xfer_cmplt , s2mm_ld_nxt_len => s2mm_ld_nxt_len , s2mm_wr_len => s2mm_wr_len , s2mm_awid => m_axi_s2mm_awid , s2mm_awaddr => m_axi_s2mm_awaddr_int , s2mm_awlen => m_axi_s2mm_awlen , s2mm_awsize => m_axi_s2mm_awsize , s2mm_awburst => m_axi_s2mm_awburst , s2mm_awprot => m_axi_s2mm_awprot , s2mm_awcache => m_axi_s2mm_awcache , s2mm_awuser => m_axi_s2mm_awuser , s2mm_awvalid => m_axi_s2mm_awvalid , s2mm_awready => m_axi_s2mm_awready , s2mm_wdata => m_axi_s2mm_wdata , s2mm_wstrb => m_axi_s2mm_wstrb , s2mm_wlast => m_axi_s2mm_wlast , s2mm_wvalid => m_axi_s2mm_wvalid , s2mm_wready => m_axi_s2mm_wready , s2mm_bresp => m_axi_s2mm_bresp , s2mm_bvalid => m_axi_s2mm_bvalid , s2mm_bready => m_axi_s2mm_bready , s2mm_strm_wdata => s_axis_s2mm_tdata , s2mm_strm_wstrb => sig_s2mm_tstrb , s2mm_strm_wlast => s_axis_s2mm_tlast , s2mm_strm_wvalid => s_axis_s2mm_tvalid , s2mm_strm_wready => s_axis_s2mm_tready , s2mm_dbg_sel => s2mm_dbg_sel , s2mm_dbg_data => s2mm_dbg_data ); end generate GEN_S2MM_BASIC; m_axi_mm2s_araddr <= m_axi_mm2s_araddr_int (C_M_AXI_MM2S_ADDR_WIDTH-1 downto 0); m_axi_s2mm_awaddr <= m_axi_s2mm_awaddr_int (C_M_AXI_S2MM_ADDR_WIDTH-1 downto 0); end implementation;
gpl-3.0
451464d22b28999b4851e49e5b00bea5
0.402892
4.165791
false
false
false
false
nickg/nvc
test/lower/assign1.vhd
1
459
entity assign1 is end entity; architecture test of assign1 is begin p1: process is variable x : integer := 64; variable y : integer := -4; begin wait for 4 ns; assert x = 64; assert y = -4; x := y * 2; assert x = -8; x := 5; y := 7; assert x = 5; assert y = 7; wait for 1 ns; assert x + y = 12; wait; end process; end architecture;
gpl-3.0
8d3f38b6054eefe1db3ec06b52559b6c
0.466231
3.672
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_datamover_v5_1/hdl/src/vhdl/axi_datamover_wr_status_cntl.vhd
3
57,653
------------------------------------------------------------------------------- -- axi_datamover_wr_status_cntl.vhd ------------------------------------------------------------------------------- -- -- ************************************************************************* -- -- (c) Copyright 2010-2011 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_datamover_wr_status_cntl.vhd -- -- Description: -- This file implements the DataMover Master Write Status Controller. -- -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library axi_datamover_v5_1_10; use axi_datamover_v5_1_10.axi_datamover_fifo; ------------------------------------------------------------------------------- entity axi_datamover_wr_status_cntl is generic ( C_ENABLE_INDET_BTT : Integer range 0 to 1 := 0; -- Specifies if the Indeterminate BTT Module is enabled -- for use (outside of this module) C_SF_BYTES_RCVD_WIDTH : Integer range 1 to 23 := 1; -- Sets the width of the data2wsc_bytes_rcvd port used for -- relaying the actual number of bytes received when Idet BTT is -- enabled (C_ENABLE_INDET_BTT = 1) C_STS_FIFO_DEPTH : Integer range 1 to 32 := 8; -- Specifies the depth of the internal status queue fifo C_STS_WIDTH : Integer range 8 to 32 := 8; -- sets the width of the Status ports C_TAG_WIDTH : Integer range 1 to 8 := 4; -- Sets the width of the Tag field in the Status reply C_FAMILY : String := "virtex7" -- Specifies the target FPGA device family ); port ( -- Clock and Reset inputs ------------------------------------------ -- primary_aclk : in std_logic; -- -- Primary synchronization clock for the Master side -- -- interface and internal logic. It is also used -- -- for the User interface synchronization when -- -- C_STSCMD_IS_ASYNC = 0. -- -- -- Reset input -- mmap_reset : in std_logic; -- -- Reset used for the internal master logic -- -------------------------------------------------------------------- -- Soft Shutdown Control interface -------------------------------- -- rst2wsc_stop_request : in std_logic; -- -- Active high soft stop request to modules -- -- wsc2rst_stop_cmplt : Out std_logic; -- -- Active high indication that the Write status Controller -- -- has completed any pending transfers committed by the -- -- Address Controller after a stop has been requested by -- -- the Reset module. -- -- addr2wsc_addr_posted : In std_logic ; -- -- Indication from the Address Channel Controller to the -- -- write Status Controller that an address has been posted -- -- to the AXI Address Channel -- -------------------------------------------------------------------- -- Write Response Channel Interface ------------------------------- -- s2mm_bresp : In std_logic_vector(1 downto 0); -- -- The Write response value -- -- s2mm_bvalid : In std_logic ; -- -- Indication from the Write Response Channel that a new -- -- write status input is valid -- -- s2mm_bready : out std_logic ; -- -- Indication to the Write Response Channel that the -- -- Status module is ready for a new status input -- -------------------------------------------------------------------- -- Command Calculator Interface ------------------------------------- -- calc2wsc_calc_error : in std_logic ; -- -- Indication from the Command Calculator that a calculation -- -- error has occured. -- --------------------------------------------------------------------- -- Address Controller Status ---------------------------------------- -- addr2wsc_calc_error : In std_logic ; -- -- Indication from the Address Channel Controller that it -- -- has encountered a calculation error from the command -- -- Calculator -- -- addr2wsc_fifo_empty : In std_logic ; -- -- Indication from the Address Controller FIFO that it -- -- is empty (no commands pending) -- --------------------------------------------------------------------- -- Data Controller Status --------------------------------------------------------- -- data2wsc_tag : In std_logic_vector(C_TAG_WIDTH-1 downto 0); -- -- The command tag -- -- data2wsc_calc_error : In std_logic ; -- -- Indication from the Data Channel Controller FIFO that it -- -- has encountered a Calculation error in the command pipe -- -- data2wsc_last_error : In std_logic ; -- -- Indication from the Write Data Channel Controller that a -- -- premature TLAST assertion was encountered on the incoming -- -- Stream Channel -- -- data2wsc_cmd_cmplt : In std_logic ; -- -- Indication from the Data Channel Controller that the -- -- corresponding status is the final status for a parent -- -- command fetched from the command FIFO -- -- data2wsc_valid : In std_logic ; -- -- Indication from the Data Channel Controller FIFO that it -- -- has a new tag/error status to transfer -- -- wsc2data_ready : out std_logic ; -- -- Indication to the Data Channel Controller FIFO that the -- -- Status module is ready for a new tag/error status input -- -- -- data2wsc_eop : In std_logic; -- -- Input from the Write Data Controller indicating that the -- -- associated command status also corresponds to a End of Packet -- -- marker for the input Stream. This is only used when Store and -- -- Forward is enabled in the S2MM. -- -- data2wsc_bytes_rcvd : In std_logic_vector(C_SF_BYTES_RCVD_WIDTH-1 downto 0); -- -- Input from the Write Data Controller indicating the actual -- -- number of bytes received from the Stream input for the -- -- corresponding command status. This is only used when Store and -- -- Forward is enabled in the S2MM. -- ------------------------------------------------------------------------------------ -- Command/Status Interface -------------------------------------------------------- -- wsc2stat_status : Out std_logic_vector(C_STS_WIDTH-1 downto 0); -- -- Read Status value collected during a Read Data transfer -- -- Output to the Command/Status Module -- -- stat2wsc_status_ready : In std_logic; -- -- Input from the Command/Status Module indicating that the -- -- Status Reg/FIFO is Full and cannot accept more staus writes -- -- wsc2stat_status_valid : Out std_logic ; -- -- Control Signal to Write the Status value to the Status -- -- Reg/FIFO -- ------------------------------------------------------------------------------------ -- Address and Data Controller Pipe halt -------------------------------- -- wsc2mstr_halt_pipe : Out std_logic -- -- Indication to Halt the Data and Address Command pipeline due -- -- to the Status pipe getting full at some point -- ------------------------------------------------------------------------- ); end entity axi_datamover_wr_status_cntl; architecture implementation of axi_datamover_wr_status_cntl is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------- -- Function -- -- Function Name: funct_set_cnt_width -- -- Function Description: -- Sets a count width based on a fifo depth. A depth of 4 or less -- is a special case which requires a minimum count width of 3 bits. -- ------------------------------------------------------------------- function funct_set_cnt_width (fifo_depth : integer) return integer is Variable temp_cnt_width : Integer := 4; begin if (fifo_depth <= 4) then temp_cnt_width := 3; elsif (fifo_depth <= 8) then temp_cnt_width := 4; elsif (fifo_depth <= 16) then temp_cnt_width := 5; elsif (fifo_depth <= 32) then temp_cnt_width := 6; else -- fifo depth <= 64 temp_cnt_width := 7; end if; Return (temp_cnt_width); end function funct_set_cnt_width; -- Constant Declarations -------------------------------------------- Constant OKAY : std_logic_vector(1 downto 0) := "00"; Constant EXOKAY : std_logic_vector(1 downto 0) := "01"; Constant SLVERR : std_logic_vector(1 downto 0) := "10"; Constant DECERR : std_logic_vector(1 downto 0) := "11"; Constant STAT_RSVD : std_logic_vector(3 downto 0) := "0000"; Constant TAG_WIDTH : integer := C_TAG_WIDTH; Constant STAT_REG_TAG_WIDTH : integer := 4; Constant SYNC_FIFO_SELECT : integer := 0; Constant SRL_FIFO_TYPE : integer := 2; Constant DCNTL_SFIFO_DEPTH : integer := C_STS_FIFO_DEPTH; Constant DCNTL_STATCNT_WIDTH : integer := funct_set_cnt_width(C_STS_FIFO_DEPTH);-- bits Constant DCNTL_HALT_THRES : unsigned(DCNTL_STATCNT_WIDTH-1 downto 0) := TO_UNSIGNED(DCNTL_SFIFO_DEPTH-2,DCNTL_STATCNT_WIDTH); Constant DCNTL_STATCNT_ZERO : unsigned(DCNTL_STATCNT_WIDTH-1 downto 0) := (others => '0'); Constant DCNTL_STATCNT_MAX : unsigned(DCNTL_STATCNT_WIDTH-1 downto 0) := TO_UNSIGNED(DCNTL_SFIFO_DEPTH,DCNTL_STATCNT_WIDTH); Constant DCNTL_STATCNT_ONE : unsigned(DCNTL_STATCNT_WIDTH-1 downto 0) := TO_UNSIGNED(1, DCNTL_STATCNT_WIDTH); Constant WRESP_WIDTH : integer := 2; Constant WRESP_SFIFO_WIDTH : integer := WRESP_WIDTH; Constant WRESP_SFIFO_DEPTH : integer := DCNTL_SFIFO_DEPTH; Constant ADDR_POSTED_CNTR_WIDTH : integer := funct_set_cnt_width(C_STS_FIFO_DEPTH);-- bits Constant ADDR_POSTED_ZERO : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := (others => '0'); Constant ADDR_POSTED_ONE : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := TO_UNSIGNED(1, ADDR_POSTED_CNTR_WIDTH); Constant ADDR_POSTED_MAX : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := (others => '1'); -- Signal Declarations -------------------------------------------- signal sig_valid_status_rdy : std_logic := '0'; signal sig_decerr : std_logic := '0'; signal sig_slverr : std_logic := '0'; signal sig_coelsc_okay_reg : std_logic := '0'; signal sig_coelsc_interr_reg : std_logic := '0'; signal sig_coelsc_decerr_reg : std_logic := '0'; signal sig_coelsc_slverr_reg : std_logic := '0'; signal sig_coelsc_tag_reg : std_logic_vector(TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_pop_coelsc_reg : std_logic := '0'; signal sig_push_coelsc_reg : std_logic := '0'; signal sig_coelsc_reg_empty : std_logic := '0'; signal sig_coelsc_reg_full : std_logic := '0'; signal sig_tag2status : std_logic_vector(TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_data_tag_reg : std_logic_vector(TAG_WIDTH-1 downto 0) := (others => '0'); signal sig_data_err_reg : std_logic := '0'; signal sig_data_last_err_reg : std_logic := '0'; signal sig_data_cmd_cmplt_reg : std_logic := '0'; signal sig_bresp_reg : std_logic_vector(1 downto 0) := (others => '0'); signal sig_push_status : std_logic := '0'; Signal sig_status_push_ok : std_logic := '0'; signal sig_status_valid : std_logic := '0'; signal sig_wsc2data_ready : std_logic := '0'; signal sig_s2mm_bready : std_logic := '0'; signal sig_wresp_sfifo_in : std_logic_vector(WRESP_SFIFO_WIDTH-1 downto 0) := (others => '0'); signal sig_wresp_sfifo_out : std_logic_vector(WRESP_SFIFO_WIDTH-1 downto 0) := (others => '0'); signal sig_wresp_sfifo_wr_valid : std_logic := '0'; signal sig_wresp_sfifo_wr_ready : std_logic := '0'; signal sig_wresp_sfifo_wr_full : std_logic := '0'; signal sig_wresp_sfifo_rd_valid : std_logic := '0'; signal sig_wresp_sfifo_rd_ready : std_logic := '0'; signal sig_wresp_sfifo_rd_empty : std_logic := '0'; signal sig_halt_reg : std_logic := '0'; signal sig_halt_reg_dly1 : std_logic := '0'; signal sig_halt_reg_dly2 : std_logic := '0'; signal sig_halt_reg_dly3 : std_logic := '0'; signal sig_addr_posted_cntr : unsigned(ADDR_POSTED_CNTR_WIDTH-1 downto 0) := (others => '0'); signal sig_addr_posted_cntr_eq_0 : std_logic := '0'; signal sig_addr_posted_cntr_eq_1 : std_logic := '0'; signal sig_addr_posted_cntr_max : std_logic := '0'; signal sig_decr_addr_posted_cntr : std_logic := '0'; signal sig_incr_addr_posted_cntr : std_logic := '0'; signal sig_no_posted_cmds : std_logic := '0'; signal sig_addr_posted : std_logic := '0'; signal sig_all_cmds_done : std_logic := '0'; signal sig_wsc2stat_status : std_logic_vector(C_STS_WIDTH-1 downto 0) := (others => '0'); signal sig_dcntl_sfifo_wr_valid : std_logic := '0'; signal sig_dcntl_sfifo_wr_ready : std_logic := '0'; signal sig_dcntl_sfifo_wr_full : std_logic := '0'; signal sig_dcntl_sfifo_rd_valid : std_logic := '0'; signal sig_dcntl_sfifo_rd_ready : std_logic := '0'; signal sig_dcntl_sfifo_rd_empty : std_logic := '0'; signal sig_wdc_statcnt : unsigned(DCNTL_STATCNT_WIDTH-1 downto 0) := (others => '0'); signal sig_incr_statcnt : std_logic := '0'; signal sig_decr_statcnt : std_logic := '0'; signal sig_statcnt_eq_max : std_logic := '0'; signal sig_statcnt_eq_0 : std_logic := '0'; signal sig_statcnt_gt_eq_thres : std_logic := '0'; signal sig_wdc_status_going_full : std_logic := '0'; begin --(architecture implementation) -- Assign the ready output to the AXI Write Response Channel s2mm_bready <= sig_s2mm_bready or sig_halt_reg; -- force bready if a Halt is requested -- Assign the ready output to the Data Controller status interface wsc2data_ready <= sig_wsc2data_ready; -- Assign the status valid output control to the Status FIFO wsc2stat_status_valid <= sig_status_valid ; -- Formulate the status output value to the Status FIFO wsc2stat_status <= sig_wsc2stat_status; -- Formulate the status write request signal sig_status_valid <= sig_push_status; -- Indicate the desire to push a coelesced status word -- to the Status FIFO sig_push_status <= sig_coelsc_reg_full; -- Detect that a push of a new status word is completing sig_status_push_ok <= sig_status_valid and stat2wsc_status_ready; sig_pop_coelsc_reg <= sig_status_push_ok; -- Signal a halt to the execution pipe if new status -- is valid but the Status FIFO is not accepting it or -- the WDC Status FIFO is going full wsc2mstr_halt_pipe <= (sig_status_valid and not(stat2wsc_status_ready)) or sig_wdc_status_going_full; -- Monitor the Status capture registers to detect a -- qualified Status set and push to the coelescing register -- when available to do so sig_push_coelsc_reg <= sig_valid_status_rdy and sig_coelsc_reg_empty; -- pre CR616212 sig_valid_status_rdy <= (sig_wresp_sfifo_rd_valid and -- pre CR616212 sig_dcntl_sfifo_rd_valid) or -- pre CR616212 (sig_data_err_reg and -- pre CR616212 sig_dcntl_sfifo_rd_valid); sig_valid_status_rdy <= (sig_wresp_sfifo_rd_valid and sig_dcntl_sfifo_rd_valid) or (sig_data_err_reg and sig_dcntl_sfifo_rd_valid) or -- or Added for CR616212 (sig_data_last_err_reg and -- Added for CR616212 sig_dcntl_sfifo_rd_valid); -- Added for CR616212 -- Decode the AXI MMap Read Respose sig_decerr <= '1' When sig_bresp_reg = DECERR Else '0'; sig_slverr <= '1' When sig_bresp_reg = SLVERR Else '0'; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_TAG_LE_STAT -- -- If Generate Description: -- Populates the TAG bits into the availble Status bits when -- the TAG width is less than or equal to the available number -- of bits in the Status word. -- ------------------------------------------------------------ GEN_TAG_LE_STAT : if (TAG_WIDTH <= STAT_REG_TAG_WIDTH) generate -- local signals signal lsig_temp_tag_small : std_logic_vector(STAT_REG_TAG_WIDTH-1 downto 0) := (others => '0'); begin sig_tag2status <= lsig_temp_tag_small; ------------------------------------------------------------- -- Combinational Process -- -- Label: POPULATE_SMALL_TAG -- -- Process Description: -- -- ------------------------------------------------------------- POPULATE_SMALL_TAG : process (sig_coelsc_tag_reg) begin -- Set default value lsig_temp_tag_small <= (others => '0'); -- Now overload actual TAG bits lsig_temp_tag_small(TAG_WIDTH-1 downto 0) <= sig_coelsc_tag_reg; end process POPULATE_SMALL_TAG; end generate GEN_TAG_LE_STAT; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_TAG_GT_STAT -- -- If Generate Description: -- Populates the TAG bits into the availble Status bits when -- the TAG width is greater than the available number of -- bits in the Status word. The upper bits of the TAG are -- clipped off (discarded). -- ------------------------------------------------------------ GEN_TAG_GT_STAT : if (TAG_WIDTH > STAT_REG_TAG_WIDTH) generate -- local signals signal lsig_temp_tag_big : std_logic_vector(STAT_REG_TAG_WIDTH-1 downto 0) := (others => '0'); begin sig_tag2status <= lsig_temp_tag_big; ------------------------------------------------------------- -- Combinational Process -- -- Label: POPULATE_BIG_TAG -- -- Process Description: -- -- ------------------------------------------------------------- POPULATE_SMALL_TAG : process (sig_coelsc_tag_reg) begin -- Set default value lsig_temp_tag_big <= (others => '0'); -- Now overload actual TAG bits lsig_temp_tag_big <= sig_coelsc_tag_reg(STAT_REG_TAG_WIDTH-1 downto 0); end process POPULATE_SMALL_TAG; end generate GEN_TAG_GT_STAT; ------------------------------------------------------------------------- -- Write Response Channel input FIFO and logic -- BRESP is the only fifo data sig_wresp_sfifo_in <= s2mm_bresp; -- The fifo output is already in the right format sig_bresp_reg <= sig_wresp_sfifo_out; -- Write Side assignments sig_wresp_sfifo_wr_valid <= s2mm_bvalid; sig_s2mm_bready <= sig_wresp_sfifo_wr_ready; -- read Side ready assignment sig_wresp_sfifo_rd_ready <= sig_push_coelsc_reg; ------------------------------------------------------------ -- Instance: I_WRESP_STATUS_FIFO -- -- Description: -- Instance for the AXI Write Response FIFO -- ------------------------------------------------------------ I_WRESP_STATUS_FIFO : entity axi_datamover_v5_1_10.axi_datamover_fifo generic map ( C_DWIDTH => WRESP_SFIFO_WIDTH , C_DEPTH => WRESP_SFIFO_DEPTH , C_IS_ASYNC => SYNC_FIFO_SELECT , C_PRIM_TYPE => SRL_FIFO_TYPE , C_FAMILY => C_FAMILY ) port map ( -- Write Clock and reset fifo_wr_reset => mmap_reset , fifo_wr_clk => primary_aclk , -- Write Side fifo_wr_tvalid => sig_wresp_sfifo_wr_valid , fifo_wr_tready => sig_wresp_sfifo_wr_ready , fifo_wr_tdata => sig_wresp_sfifo_in , fifo_wr_full => sig_wresp_sfifo_wr_full , -- Read Clock and reset (not used in Sync mode) fifo_async_rd_reset => mmap_reset , fifo_async_rd_clk => primary_aclk , -- Read Side fifo_rd_tvalid => sig_wresp_sfifo_rd_valid , fifo_rd_tready => sig_wresp_sfifo_rd_ready , fifo_rd_tdata => sig_wresp_sfifo_out , fifo_rd_empty => sig_wresp_sfifo_rd_empty ); -------- Write Data Controller Status FIFO Going Full Logic ------------- sig_incr_statcnt <= sig_dcntl_sfifo_wr_valid and sig_dcntl_sfifo_wr_ready; sig_decr_statcnt <= sig_dcntl_sfifo_rd_valid and sig_dcntl_sfifo_rd_ready; sig_statcnt_eq_max <= '1' when (sig_wdc_statcnt = DCNTL_STATCNT_MAX) Else '0'; sig_statcnt_eq_0 <= '1' when (sig_wdc_statcnt = DCNTL_STATCNT_ZERO) Else '0'; sig_statcnt_gt_eq_thres <= '1' when (sig_wdc_statcnt >= DCNTL_HALT_THRES) Else '0'; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_WDC_GOING_FULL_FLOP -- -- Process Description: -- Implements a flop for the WDC Status FIFO going full flag. -- ------------------------------------------------------------- IMP_WDC_GOING_FULL_FLOP : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1') then sig_wdc_status_going_full <= '0'; else sig_wdc_status_going_full <= sig_statcnt_gt_eq_thres; end if; end if; end process IMP_WDC_GOING_FULL_FLOP; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_DCNTL_FIFO_CNTR -- -- Process Description: -- Implements a simple counter keeping track of the number -- of entries in the WDC Status FIFO. If the Status FIFO gets -- too full, the S2MM Data Pipe has to be halted. -- ------------------------------------------------------------- IMP_DCNTL_FIFO_CNTR : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1') then sig_wdc_statcnt <= (others => '0'); elsif (sig_incr_statcnt = '1' and sig_decr_statcnt = '0' and sig_statcnt_eq_max = '0') then sig_wdc_statcnt <= sig_wdc_statcnt + DCNTL_STATCNT_ONE; elsif (sig_incr_statcnt = '0' and sig_decr_statcnt = '1' and sig_statcnt_eq_0 = '0') then sig_wdc_statcnt <= sig_wdc_statcnt - DCNTL_STATCNT_ONE; else null; -- Hold current count value end if; end if; end process IMP_DCNTL_FIFO_CNTR; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_OMIT_INDET_BTT -- -- If Generate Description: -- Implements the logic needed when Indeterminate BTT is -- not enabled in the S2MM function. -- ------------------------------------------------------------ GEN_OMIT_INDET_BTT : if (C_ENABLE_INDET_BTT = 0) generate -- Local Constants Constant DCNTL_SFIFO_WIDTH : integer := STAT_REG_TAG_WIDTH+3; Constant DCNTL_SFIFO_CMD_CMPLT_INDEX : integer := 0; Constant DCNTL_SFIFO_TLAST_ERR_INDEX : integer := 1; Constant DCNTL_SFIFO_CALC_ERR_INDEX : integer := 2; Constant DCNTL_SFIFO_TAG_INDEX : integer := DCNTL_SFIFO_CALC_ERR_INDEX+1; -- local signals signal sig_dcntl_sfifo_in : std_logic_vector(DCNTL_SFIFO_WIDTH-1 downto 0) := (others => '0'); signal sig_dcntl_sfifo_out : std_logic_vector(DCNTL_SFIFO_WIDTH-1 downto 0) := (others => '0'); begin sig_wsc2stat_status <= sig_coelsc_okay_reg & sig_coelsc_slverr_reg & sig_coelsc_decerr_reg & sig_coelsc_interr_reg & sig_tag2status; ----------------------------------------------------------------------------- -- Data Controller Status FIFO and Logic -- Concatonate Input bits to build Dcntl fifo data word sig_dcntl_sfifo_in <= data2wsc_tag & -- bit 3 to tag Width+2 data2wsc_calc_error & -- bit 2 data2wsc_last_error & -- bit 1 data2wsc_cmd_cmplt ; -- bit 0 -- Rip the DCntl fifo outputs back to constituant pieces sig_data_tag_reg <= sig_dcntl_sfifo_out((DCNTL_SFIFO_TAG_INDEX+STAT_REG_TAG_WIDTH)-1 downto DCNTL_SFIFO_TAG_INDEX); sig_data_err_reg <= sig_dcntl_sfifo_out(DCNTL_SFIFO_CALC_ERR_INDEX) ; sig_data_last_err_reg <= sig_dcntl_sfifo_out(DCNTL_SFIFO_TLAST_ERR_INDEX); sig_data_cmd_cmplt_reg <= sig_dcntl_sfifo_out(DCNTL_SFIFO_CMD_CMPLT_INDEX); -- Data Control Valid/Ready assignments sig_dcntl_sfifo_wr_valid <= data2wsc_valid ; sig_wsc2data_ready <= sig_dcntl_sfifo_wr_ready; -- read side ready assignment sig_dcntl_sfifo_rd_ready <= sig_push_coelsc_reg; ------------------------------------------------------------ -- Instance: I_DATA_CNTL_STATUS_FIFO -- -- Description: -- Instance for the Command Qualifier FIFO -- ------------------------------------------------------------ I_DATA_CNTL_STATUS_FIFO : entity axi_datamover_v5_1_10.axi_datamover_fifo generic map ( C_DWIDTH => DCNTL_SFIFO_WIDTH , C_DEPTH => DCNTL_SFIFO_DEPTH , C_IS_ASYNC => SYNC_FIFO_SELECT , C_PRIM_TYPE => SRL_FIFO_TYPE , C_FAMILY => C_FAMILY ) port map ( -- Write Clock and reset fifo_wr_reset => mmap_reset , fifo_wr_clk => primary_aclk , -- Write Side fifo_wr_tvalid => sig_dcntl_sfifo_wr_valid , fifo_wr_tready => sig_dcntl_sfifo_wr_ready , fifo_wr_tdata => sig_dcntl_sfifo_in , fifo_wr_full => sig_dcntl_sfifo_wr_full , -- Read Clock and reset (not used in Sync mode) fifo_async_rd_reset => mmap_reset , fifo_async_rd_clk => primary_aclk , -- Read Side fifo_rd_tvalid => sig_dcntl_sfifo_rd_valid , fifo_rd_tready => sig_dcntl_sfifo_rd_ready , fifo_rd_tdata => sig_dcntl_sfifo_out , fifo_rd_empty => sig_dcntl_sfifo_rd_empty ); ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: STATUS_COELESC_REG -- -- Process Description: -- Implement error status coelescing register. -- Once a bit is set it will remain set until the overall -- status is written to the Status FIFO. -- Tag bits are just registered at each valid dbeat. -- ------------------------------------------------------------- STATUS_COELESC_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1' or sig_pop_coelsc_reg = '1') then sig_coelsc_tag_reg <= (others => '0'); sig_coelsc_interr_reg <= '0'; sig_coelsc_decerr_reg <= '0'; sig_coelsc_slverr_reg <= '0'; sig_coelsc_okay_reg <= '1'; -- set back to default of "OKAY" sig_coelsc_reg_full <= '0'; sig_coelsc_reg_empty <= '1'; Elsif (sig_push_coelsc_reg = '1') Then sig_coelsc_tag_reg <= sig_data_tag_reg; sig_coelsc_interr_reg <= sig_data_err_reg or sig_data_last_err_reg or sig_coelsc_interr_reg; sig_coelsc_decerr_reg <= not(sig_data_err_reg) and (sig_decerr or sig_coelsc_decerr_reg); sig_coelsc_slverr_reg <= not(sig_data_err_reg) and (sig_slverr or sig_coelsc_slverr_reg); sig_coelsc_okay_reg <= not(sig_decerr or sig_coelsc_decerr_reg or sig_slverr or sig_coelsc_slverr_reg or sig_data_err_reg or sig_data_last_err_reg or sig_coelsc_interr_reg ); sig_coelsc_reg_full <= sig_data_cmd_cmplt_reg; sig_coelsc_reg_empty <= not(sig_data_cmd_cmplt_reg); else null; -- hold current state end if; end if; end process STATUS_COELESC_REG; end generate GEN_OMIT_INDET_BTT; ------------------------------------------------------------ -- If Generate -- -- Label: GEN_ENABLE_INDET_BTT -- -- If Generate Description: -- Implements the logic needed when Indeterminate BTT is -- enabled in the S2MM function. Primary difference is the -- addition to the reported status of the End of Packet -- marker (EOP) and the received byte count for the parent -- command. -- ------------------------------------------------------------ GEN_ENABLE_INDET_BTT : if (C_ENABLE_INDET_BTT = 1) generate -- Local Constants Constant SF_DCNTL_SFIFO_WIDTH : integer := TAG_WIDTH + C_SF_BYTES_RCVD_WIDTH + 3; Constant SF_SFIFO_LS_TAG_INDEX : integer := 0; Constant SF_SFIFO_MS_TAG_INDEX : integer := SF_SFIFO_LS_TAG_INDEX + (TAG_WIDTH-1); Constant SF_SFIFO_CALC_ERR_INDEX : integer := SF_SFIFO_MS_TAG_INDEX+1; Constant SF_SFIFO_CMD_CMPLT_INDEX : integer := SF_SFIFO_CALC_ERR_INDEX+1; Constant SF_SFIFO_LS_BYTES_RCVD_INDEX : integer := SF_SFIFO_CMD_CMPLT_INDEX+1; Constant SF_SFIFO_MS_BYTES_RCVD_INDEX : integer := SF_SFIFO_LS_BYTES_RCVD_INDEX+ (C_SF_BYTES_RCVD_WIDTH-1); Constant SF_SFIFO_EOP_INDEX : integer := SF_SFIFO_MS_BYTES_RCVD_INDEX+1; Constant BYTES_RCVD_FIELD_WIDTH : integer := 23; -- local signals signal sig_dcntl_sfifo_in : std_logic_vector(SF_DCNTL_SFIFO_WIDTH-1 downto 0) := (others => '0'); signal sig_dcntl_sfifo_out : std_logic_vector(SF_DCNTL_SFIFO_WIDTH-1 downto 0) := (others => '0'); signal sig_data_bytes_rcvd : std_logic_vector(C_SF_BYTES_RCVD_WIDTH-1 downto 0) := (others => '0'); signal sig_data_eop : std_logic := '0'; signal sig_coelsc_bytes_rcvd : std_logic_vector(C_SF_BYTES_RCVD_WIDTH-1 downto 0) := (others => '0'); signal sig_coelsc_eop : std_logic := '0'; signal sig_coelsc_bytes_rcvd_pad : std_logic_vector(BYTES_RCVD_FIELD_WIDTH-1 downto 0) := (others => '0'); begin sig_wsc2stat_status <= sig_coelsc_eop & sig_coelsc_bytes_rcvd_pad & sig_coelsc_okay_reg & sig_coelsc_slverr_reg & sig_coelsc_decerr_reg & sig_coelsc_interr_reg & sig_tag2status; ----------------------------------------------------------------------------- -- Data Controller Status FIFO and Logic -- Concatonate Input bits to build Dcntl fifo input data word sig_dcntl_sfifo_in <= data2wsc_eop & -- ms bit data2wsc_bytes_rcvd & -- bit 7 to C_SF_BYTES_RCVD_WIDTH+7 data2wsc_cmd_cmplt & -- bit 6 data2wsc_calc_error & -- bit 4 data2wsc_tag; -- bits 0 to 3 -- Rip the DCntl fifo outputs back to constituant pieces sig_data_eop <= sig_dcntl_sfifo_out(SF_SFIFO_EOP_INDEX); sig_data_bytes_rcvd <= sig_dcntl_sfifo_out(SF_SFIFO_MS_BYTES_RCVD_INDEX downto SF_SFIFO_LS_BYTES_RCVD_INDEX); sig_data_cmd_cmplt_reg <= sig_dcntl_sfifo_out(SF_SFIFO_CMD_CMPLT_INDEX); sig_data_err_reg <= sig_dcntl_sfifo_out(SF_SFIFO_CALC_ERR_INDEX); sig_data_tag_reg <= sig_dcntl_sfifo_out(SF_SFIFO_MS_TAG_INDEX downto SF_SFIFO_LS_TAG_INDEX) ; -- Data Control Valid/Ready assignments sig_dcntl_sfifo_wr_valid <= data2wsc_valid ; sig_wsc2data_ready <= sig_dcntl_sfifo_wr_ready; -- read side ready assignment sig_dcntl_sfifo_rd_ready <= sig_push_coelsc_reg; ------------------------------------------------------------ -- Instance: I_SF_DATA_CNTL_STATUS_FIFO -- -- Description: -- Instance for the Command Qualifier FIFO when Store and -- Forward is included. -- ------------------------------------------------------------ I_SF_DATA_CNTL_STATUS_FIFO : entity axi_datamover_v5_1_10.axi_datamover_fifo generic map ( C_DWIDTH => SF_DCNTL_SFIFO_WIDTH , C_DEPTH => DCNTL_SFIFO_DEPTH , C_IS_ASYNC => SYNC_FIFO_SELECT , C_PRIM_TYPE => SRL_FIFO_TYPE , C_FAMILY => C_FAMILY ) port map ( -- Write Clock and reset fifo_wr_reset => mmap_reset , fifo_wr_clk => primary_aclk , -- Write Side fifo_wr_tvalid => sig_dcntl_sfifo_wr_valid , fifo_wr_tready => sig_dcntl_sfifo_wr_ready , fifo_wr_tdata => sig_dcntl_sfifo_in , fifo_wr_full => sig_dcntl_sfifo_wr_full , -- Read Clock and reset (not used in Sync mode) fifo_async_rd_reset => mmap_reset , fifo_async_rd_clk => primary_aclk , -- Read Side fifo_rd_tvalid => sig_dcntl_sfifo_rd_valid , fifo_rd_tready => sig_dcntl_sfifo_rd_ready , fifo_rd_tdata => sig_dcntl_sfifo_out , fifo_rd_empty => sig_dcntl_sfifo_rd_empty ); ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: SF_STATUS_COELESC_REG -- -- Process Description: -- Implement error status coelescing register. -- Once a bit is set it will remain set until the overall -- status is written to the Status FIFO. -- Tag bits are just registered at each valid dbeat. -- ------------------------------------------------------------- SF_STATUS_COELESC_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1' or sig_pop_coelsc_reg = '1') then sig_coelsc_tag_reg <= (others => '0'); sig_coelsc_interr_reg <= '0'; sig_coelsc_decerr_reg <= '0'; sig_coelsc_slverr_reg <= '0'; sig_coelsc_okay_reg <= '1'; -- set back to default of "OKAY" sig_coelsc_bytes_rcvd <= (others => '0'); sig_coelsc_eop <= '0'; sig_coelsc_reg_full <= '0'; sig_coelsc_reg_empty <= '1'; Elsif (sig_push_coelsc_reg = '1') Then sig_coelsc_tag_reg <= sig_data_tag_reg; sig_coelsc_interr_reg <= sig_data_err_reg or sig_coelsc_interr_reg; sig_coelsc_decerr_reg <= not(sig_data_err_reg) and (sig_decerr or sig_coelsc_decerr_reg); sig_coelsc_slverr_reg <= not(sig_data_err_reg) and (sig_slverr or sig_coelsc_slverr_reg); sig_coelsc_okay_reg <= not(sig_decerr or sig_coelsc_decerr_reg or sig_slverr or sig_coelsc_slverr_reg or sig_data_err_reg or sig_coelsc_interr_reg ); sig_coelsc_bytes_rcvd <= sig_data_bytes_rcvd; sig_coelsc_eop <= sig_data_eop; sig_coelsc_reg_full <= sig_data_cmd_cmplt_reg; sig_coelsc_reg_empty <= not(sig_data_cmd_cmplt_reg); else null; -- hold current state end if; end if; end process SF_STATUS_COELESC_REG; ------------------------------------------------------------ -- If Generate -- -- Label: SF_GEN_PAD_BYTES_RCVD -- -- If Generate Description: -- Pad the bytes received value with zeros to fill in the -- status field width. -- -- ------------------------------------------------------------ SF_GEN_PAD_BYTES_RCVD : if (C_SF_BYTES_RCVD_WIDTH < BYTES_RCVD_FIELD_WIDTH) generate begin sig_coelsc_bytes_rcvd_pad(BYTES_RCVD_FIELD_WIDTH-1 downto C_SF_BYTES_RCVD_WIDTH) <= (others => '0'); sig_coelsc_bytes_rcvd_pad(C_SF_BYTES_RCVD_WIDTH-1 downto 0) <= sig_coelsc_bytes_rcvd; end generate SF_GEN_PAD_BYTES_RCVD; ------------------------------------------------------------ -- If Generate -- -- Label: SF_GEN_NO_PAD_BYTES_RCVD -- -- If Generate Description: -- No padding required for the bytes received value. -- -- ------------------------------------------------------------ SF_GEN_NO_PAD_BYTES_RCVD : if (C_SF_BYTES_RCVD_WIDTH = BYTES_RCVD_FIELD_WIDTH) generate begin sig_coelsc_bytes_rcvd_pad <= sig_coelsc_bytes_rcvd; -- no pad required end generate SF_GEN_NO_PAD_BYTES_RCVD; end generate GEN_ENABLE_INDET_BTT; ------- Soft Shutdown Logic ------------------------------- -- Address Posted Counter Logic ---------------------t----------------- -- Supports soft shutdown by tracking when all commited Write -- transfers to the AXI Bus have had corresponding Write Status -- Reponses Received. sig_addr_posted <= addr2wsc_addr_posted ; sig_incr_addr_posted_cntr <= sig_addr_posted ; sig_decr_addr_posted_cntr <= sig_s2mm_bready and s2mm_bvalid ; sig_addr_posted_cntr_eq_0 <= '1' when (sig_addr_posted_cntr = ADDR_POSTED_ZERO) Else '0'; sig_addr_posted_cntr_eq_1 <= '1' when (sig_addr_posted_cntr = ADDR_POSTED_ONE) Else '0'; sig_addr_posted_cntr_max <= '1' when (sig_addr_posted_cntr = ADDR_POSTED_MAX) Else '0'; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_ADDR_POSTED_FIFO_CNTR -- -- Process Description: -- This process implements a counter for the tracking -- if an Address has been posted on the AXI address channel. -- The counter is used to track flushing operations where all -- transfers committed on the AXI Address Channel have to -- be completed before a halt can occur. ------------------------------------------------------------- IMP_ADDR_POSTED_FIFO_CNTR : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1') then sig_addr_posted_cntr <= ADDR_POSTED_ZERO; elsif (sig_incr_addr_posted_cntr = '1' and sig_decr_addr_posted_cntr = '0' and sig_addr_posted_cntr_max = '0') then sig_addr_posted_cntr <= sig_addr_posted_cntr + ADDR_POSTED_ONE ; elsif (sig_incr_addr_posted_cntr = '0' and sig_decr_addr_posted_cntr = '1' and sig_addr_posted_cntr_eq_0 = '0') then sig_addr_posted_cntr <= sig_addr_posted_cntr - ADDR_POSTED_ONE ; else null; -- don't change state end if; end if; end process IMP_ADDR_POSTED_FIFO_CNTR; wsc2rst_stop_cmplt <= sig_all_cmds_done; sig_no_posted_cmds <= (sig_addr_posted_cntr_eq_0 and not(addr2wsc_calc_error)) or (sig_addr_posted_cntr_eq_1 and addr2wsc_calc_error); sig_all_cmds_done <= sig_no_posted_cmds and sig_halt_reg_dly3; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_HALT_REQ_REG -- -- Process Description: -- Implements the flop for capturing the Halt request from -- the Reset module. -- ------------------------------------------------------------- IMP_HALT_REQ_REG : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1') then sig_halt_reg <= '0'; elsif (rst2wsc_stop_request = '1') then sig_halt_reg <= '1'; else null; -- Hold current State end if; end if; end process IMP_HALT_REQ_REG; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: IMP_HALT_REQ_REG_DLY -- -- Process Description: -- Implements the flops for delaying the halt request by 3 -- clocks to allow the Address Controller to halt before the -- Data Contoller can safely indicate it has exhausted all -- transfers committed to the AXI Address Channel by the Address -- Controller. -- ------------------------------------------------------------- IMP_HALT_REQ_REG_DLY : process (primary_aclk) begin if (primary_aclk'event and primary_aclk = '1') then if (mmap_reset = '1') then sig_halt_reg_dly1 <= '0'; sig_halt_reg_dly2 <= '0'; sig_halt_reg_dly3 <= '0'; else sig_halt_reg_dly1 <= sig_halt_reg; sig_halt_reg_dly2 <= sig_halt_reg_dly1; sig_halt_reg_dly3 <= sig_halt_reg_dly2; end if; end if; end process IMP_HALT_REQ_REG_DLY; end implementation;
gpl-3.0
9bb6b7a2b0b5052785a1c689eb447060
0.411514
5.111988
false
false
false
false
tgingold/ghdl
testsuite/synth/var01/tb_var01c.vhdl
1
984
entity tb_var01c is end tb_var01c; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_var01c is signal clk : std_logic; signal mask : std_logic_vector (1 downto 0); signal val : std_logic_vector (1 downto 0); signal res : std_logic_vector (3 downto 0); begin dut: entity work.var01c port map ( clk => clk, mask => mask, val => val, res => res); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin mask <= "11"; val <= b"01"; pulse; assert res = b"01_01" report "res=" & to_bstring (res) severity failure; mask <= "10"; val <= b"11"; pulse; assert res = b"11_01" severity failure; mask <= "00"; val <= b"00"; pulse; assert res = b"11_01" severity failure; mask <= "01"; val <= b"10"; pulse; assert res = b"11_10" severity failure; wait; end process; end behav;
gpl-2.0
2c121b56037f1f8a33cdaa36b64ce9d4
0.561992
3.22623
false
false
false
false
nickg/nvc
test/regress/protected7.vhd
1
1,358
package pack is type id_alloc_t is protected impure function next_id return integer; end protected; type rec_t is record id : integer; end record; impure function get_next_rec return rec_t; end package; package body pack is type id_alloc_t is protected body variable counter : integer := 0; impure function next_id return integer is begin counter := counter + 1; return counter; end function; end protected body; shared variable id_alloc : id_alloc_t; impure function get_next_rec return rec_t is begin return (id => id_alloc.next_id); end function; end package body; ------------------------------------------------------------------------------- use work.pack.all; entity sub is generic ( r1, r2 : rec_t ); end entity; architecture test of sub is begin p1: process is begin assert r1.id = 1; assert r2.id = 2; wait; end process; end architecture; ------------------------------------------------------------------------------- use work.pack.all; entity protected7 is end entity; architecture test of protected7 is constant cr1 : rec_t := get_next_rec; constant cr2 : rec_t := get_next_rec; begin u: entity work.sub generic map ( cr1, cr2 ); end architecture;
gpl-3.0
3b0ccd1f4100d27ab97badbdba8929cb
0.553756
4.12766
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado_HLS/convolution_2D/solution1/syn/vhdl/doImgProc_lineBuff_val_0.vhd
4
4,157
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2016.1 -- Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved. -- -- ============================================================== -- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity doImgProc_lineBuff_val_0_ram is generic( mem_type : string := "block"; dwidth : integer := 8; awidth : integer := 9; mem_size : integer := 512 ); port ( addr0 : in std_logic_vector(awidth-1 downto 0); ce0 : in std_logic; d0 : in std_logic_vector(dwidth-1 downto 0); we0 : in std_logic; q0 : out std_logic_vector(dwidth-1 downto 0); addr1 : in std_logic_vector(awidth-1 downto 0); ce1 : in std_logic; q1 : out std_logic_vector(dwidth-1 downto 0); clk : in std_logic ); end entity; architecture rtl of doImgProc_lineBuff_val_0_ram is signal addr0_tmp : std_logic_vector(awidth-1 downto 0); signal addr1_tmp : std_logic_vector(awidth-1 downto 0); type mem_array is array (0 to mem_size-1) of std_logic_vector (dwidth-1 downto 0); shared variable ram : mem_array; attribute syn_ramstyle : string; attribute syn_ramstyle of ram : variable is "block_ram"; attribute ram_style : string; attribute ram_style of ram : variable is mem_type; attribute EQUIVALENT_REGISTER_REMOVAL : string; begin memory_access_guard_0: process (addr0) begin addr0_tmp <= addr0; --synthesis translate_off if (CONV_INTEGER(addr0) > mem_size-1) then addr0_tmp <= (others => '0'); else addr0_tmp <= addr0; end if; --synthesis translate_on end process; p_memory_access_0: process (clk) begin if (clk'event and clk = '1') then if (ce0 = '1') then if (we0 = '1') then ram(CONV_INTEGER(addr0_tmp)) := d0; end if; q0 <= ram(CONV_INTEGER(addr0_tmp)); end if; end if; end process; memory_access_guard_1: process (addr1) begin addr1_tmp <= addr1; --synthesis translate_off if (CONV_INTEGER(addr1) > mem_size-1) then addr1_tmp <= (others => '0'); else addr1_tmp <= addr1; end if; --synthesis translate_on end process; p_memory_access_1: process (clk) begin if (clk'event and clk = '1') then if (ce1 = '1') then q1 <= ram(CONV_INTEGER(addr1_tmp)); end if; end if; end process; end rtl; Library IEEE; use IEEE.std_logic_1164.all; entity doImgProc_lineBuff_val_0 is generic ( DataWidth : INTEGER := 8; AddressRange : INTEGER := 512; AddressWidth : INTEGER := 9); port ( reset : IN STD_LOGIC; clk : IN STD_LOGIC; address0 : IN STD_LOGIC_VECTOR(AddressWidth - 1 DOWNTO 0); ce0 : IN STD_LOGIC; we0 : IN STD_LOGIC; d0 : IN STD_LOGIC_VECTOR(DataWidth - 1 DOWNTO 0); q0 : OUT STD_LOGIC_VECTOR(DataWidth - 1 DOWNTO 0); address1 : IN STD_LOGIC_VECTOR(AddressWidth - 1 DOWNTO 0); ce1 : IN STD_LOGIC; q1 : OUT STD_LOGIC_VECTOR(DataWidth - 1 DOWNTO 0)); end entity; architecture arch of doImgProc_lineBuff_val_0 is component doImgProc_lineBuff_val_0_ram is port ( clk : IN STD_LOGIC; addr0 : IN STD_LOGIC_VECTOR; ce0 : IN STD_LOGIC; d0 : IN STD_LOGIC_VECTOR; we0 : IN STD_LOGIC; q0 : OUT STD_LOGIC_VECTOR; addr1 : IN STD_LOGIC_VECTOR; ce1 : IN STD_LOGIC; q1 : OUT STD_LOGIC_VECTOR); end component; begin doImgProc_lineBuff_val_0_ram_U : component doImgProc_lineBuff_val_0_ram port map ( clk => clk, addr0 => address0, ce0 => ce0, d0 => d0, we0 => we0, q0 => q0, addr1 => address1, ce1 => ce1, q1 => q1); end architecture;
gpl-3.0
db89b0ba3a31c6a97616cc965b64c3c4
0.54727
3.505059
false
false
false
false
nickg/nvc
test/regress/record14.vhd
1
1,624
entity sub is generic ( N : natural ); end entity; architecture test of sub is type rec is record x : natural; y : bit_vector(1 to N); z : natural; end record; type rec2 is record x : natural; y : rec; z : natural; end record; function func (q : bit_vector) return natural is type rec3 is record x : natural; y : bit_vector(1 to q'length); z : natural; end record; variable r : rec3; begin r := ( 1, q, q'length ); r.y(1) := '1'; for i in r.y'range loop if i = 1 then assert r.y(i) = '1'; else assert r.y(i) = '0'; end if; end loop; return r.z; end function; signal s : rec; signal s2 : rec2; begin p1: process is variable r : rec; begin assert r = (0, (1 to N => '0'), 0); r.y(1) := '1'; assert r.y = (1 => '1', 2 to 4 => '0'); assert func(r.y) = N; assert s = (0, (1 to N => '0'), 0); s.y(1) <= '1'; wait for 1 ns; assert s.y = (1 => '1', 2 to 4 => '0'); assert s2 = (0, (0, (1 to N => '0'), 0), 0); s2.y.y(1) <= '1'; wait for 1 ns; assert s2.y.y = (1 => '1', 2 to 4 => '0'); wait; end process; end architecture; ------------------------------------------------------------------------------- entity record14 is end entity; architecture test of record14 is begin sub_i: entity work.sub generic map ( 4 ); end architecture;
gpl-3.0
ba553f0e013e04485185e7055edfd58b
0.425493
3.418947
false
false
false
false
tgingold/ghdl
testsuite/synth/synth34/tb_repro_sgn.vhdl
1
641
entity tb_repro_sgn is end tb_repro_sgn; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; architecture behav of tb_repro_sgn is signal clk : std_logic; signal a : signed(7 downto 0); signal b : signed(7 downto 0); begin dut: entity work.repro_sgn port map ( clk => clk, a => a, b => b); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin a <= x"ab"; pulse; assert b = x"ab" severity failure; a <= x"12"; pulse; assert b = x"12" severity failure; wait; end process; end behav;
gpl-2.0
dc797797603bf128919165c12d72e1e0
0.586583
3.189055
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc2110.vhd
4
2,277
-- 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: tc2110.vhd,v 1.2 2001-10-26 16:29:45 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c07s02b04x00p20n01i02110ent IS END c07s02b04x00p20n01i02110ent; ARCHITECTURE c07s02b04x00p20n01i02110arch OF c07s02b04x00p20n01i02110ent IS TYPE time_v is array (integer range <>) of time; SUBTYPE time_8 is time_v (1 to 8); SUBTYPE time_4 is time_v (1 to 4); BEGIN TESTING : PROCESS variable result : time_4; variable l_operand : time_4 := ( 78 ns , 23 ns , 78 ns , 23 ns ); variable r_operand : time_4 := ( 23 ns , 23 ns , 78 ns , 78 ns ); alias l_alias : time_v (1 to 2) is l_operand (2 to 3); alias r_alias : time_v (1 to 2) is r_operand (3 to 4); BEGIN result := l_alias & r_alias; wait for 20 ns; assert NOT((result = ( 23 ns, 78 ns, 78 ns, 78 ns )) and (result(1) = 23 ns)) report "***PASSED TEST: c07s02b04x00p20n01i02110" severity NOTE; assert ((result = ( 23 ns, 78 ns, 78 ns, 78 ns )) and (result(1) = 23 ns)) report "***FAILED TEST: c07s02b04x00p20n01i02110 - Concatenation of two TIME aliases failed." severity ERROR; wait; END PROCESS TESTING; END c07s02b04x00p20n01i02110arch;
gpl-2.0
c8769d02a9f14b08dc217b6142cb354e
0.640755
3.471037
false
true
false
false
tgingold/ghdl
testsuite/synth/oper01/snum04.vhdl
1
435
entity snum04 is port (ok : out boolean); end snum04; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; architecture behav of snum04 is -- add uns nat constant a1 : unsigned (7 downto 0) := x"1d"; constant b1 : unsigned (3 downto 0) := x"5"; constant r1 : unsigned (11 downto 0) := a1 * b1; signal er1 : unsigned (11 downto 0) := x"091"; begin -- ok <= r1 = x"20"; ok <= r1 = er1; end behav;
gpl-2.0
d4f5701cbcae8e47b7f7c69ecc0730dd
0.627586
2.824675
false
false
false
false
nickg/nvc
test/regress/case9.vhd
1
760
entity case9 is end entity; architecture test of case9 is type rec is record b : bit_vector(1 to 3); end record; signal x : rec; signal y : integer; begin p1: process (x) is begin case x.b is when "100" => y <= 1; when "101" => y <= 2; when "111" => y <= 3; when others => y <= -1; end case; end process; p2: process is begin wait for 0 ns; assert y = -1; x <= ( b => "100" ); wait for 1 ns; assert y = 1; x <= ( b => "101" ); wait for 1 ns; assert y = 2; x <= ( b => "111" ); wait for 1 ns; assert y = 3; wait; end process; end architecture;
gpl-3.0
3a4ef62cc6498190ee2046391ef9780b
0.430263
3.551402
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/image_conv_2D/image_conv_2D.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_dma_v7_1/hdl/src/vhdl/axi_dma_s2mm.vhd
3
17,060
-- (c) Copyright 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. ------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library unisim; use unisim.vcomponents.all; library axi_dma_v7_1_9; use axi_dma_v7_1_9.axi_dma_pkg.all; library lib_fifo_v1_0_4; use lib_fifo_v1_0_4.async_fifo_fg; entity axi_dma_s2mm is generic ( C_FAMILY : string := "virtex7" ); port ( clk_in : in std_logic; sg_clk : in std_logic; resetn : in std_logic; reset_sg : in std_logic; s2mm_tvalid : in std_logic; s2mm_tlast : in std_logic; s2mm_tdest : in std_logic_vector (4 downto 0); s2mm_tuser : in std_logic_vector (3 downto 0); s2mm_tid : in std_logic_vector (4 downto 0); s2mm_tready : in std_logic; desc_available : in std_logic; -- s2mm_eof : in std_logic; s2mm_eof_det : in std_logic_vector (1 downto 0); ch2_update_active : in std_logic; tdest_out : out std_logic_vector (6 downto 0); -- to select desc same_tdest : out std_logic; -- to select desc -- to DM s2mm_desc_info : out std_logic_vector (13 downto 0); -- updt_cmpt : out std_logic; s2mm_tvalid_out : out std_logic; s2mm_tlast_out : out std_logic; s2mm_tready_out : out std_logic; s2mm_tdest_out : out std_logic_vector (4 downto 0) ); end entity axi_dma_s2mm; architecture implementation of axi_dma_s2mm is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; signal first_data : std_logic; signal first_stream : std_logic; signal first_stream_del : std_logic; signal last_received : std_logic; signal first_received : std_logic; signal first_received1 : std_logic; signal open_window : std_logic; signal tdest_out_int : std_logic_vector (6 downto 0); signal fifo_wr : std_logic; signal last_update_over_int : std_logic; signal last_update_over_int1 : std_logic; signal last_update_over : std_logic; signal ch_updt_over_int : std_logic; signal ch_updt_over_int_cdc_from : std_logic; signal ch_updt_over_int_cdc_to : std_logic; signal ch_updt_over_int_cdc_to1 : std_logic; signal ch_updt_over_int_cdc_to2 : std_logic; -- Prevent x-propagation on clock-domain crossing register ATTRIBUTE async_reg : STRING; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to : SIGNAL IS "true"; --ATTRIBUTE async_reg OF ch_updt_over_int_cdc_to1 : SIGNAL IS "true"; signal fifo_rd : std_logic; signal first_read : std_logic; signal first_rd_en : std_logic; signal fifo_rd_int : std_logic; signal first_read_int : std_logic; signal fifo_empty : std_logic; signal fifo_full : std_logic; signal s2mm_desc_info_int : std_logic_vector (13 downto 0); signal updt_cmpt : std_logic; signal tdest_capture : std_logic_vector (4 downto 0); signal noread : std_logic; signal same_tdest_b2b : std_logic; signal fifo_reset : std_logic; begin process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then ch_updt_over_int_cdc_from <= '0'; else --if (sg_clk'event and sg_clk = '1') then ch_updt_over_int_cdc_from <= ch2_update_active; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then ch_updt_over_int_cdc_to <= '0'; ch_updt_over_int_cdc_to1 <= '0'; ch_updt_over_int_cdc_to2 <= '0'; else --if (clk_in'event and clk_in = '1') then ch_updt_over_int_cdc_to <= ch_updt_over_int_cdc_from; ch_updt_over_int_cdc_to1 <= ch_updt_over_int_cdc_to; ch_updt_over_int_cdc_to2 <= ch_updt_over_int_cdc_to1; end if; end if; end process; updt_cmpt <= (not ch_updt_over_int_cdc_to1) and ch_updt_over_int_cdc_to2; -- process (sg_clk) -- begin -- if (resetn = '0') then -- ch_updt_over_int <= '0'; -- elsif (sg_clk'event and sg_clk = '1') then -- ch_updt_over_int <= ch2_update_active; -- end if; -- end process; -- updt_cmpt <= (not ch2_update_active) and ch_updt_over_int; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then last_update_over_int <= '0'; last_update_over_int1 <= '0'; noread <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then last_update_over_int1 <= last_update_over_int; elsif (s2mm_eof_det(1) = '1' and noread = '0') then last_update_over_int <= '1'; noread <= '1'; elsif (s2mm_eof_det(0) = '1') then noread <= '0'; last_update_over_int <= '0'; elsif (fifo_empty = '0') then -- (updt_cmpt = '1') then last_update_over_int <= '0'; else last_update_over_int <= last_update_over_int; end if; end if; -- end if; end process; last_update_over <= (not last_update_over_int) and last_update_over_int1; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then fifo_rd_int <= '0'; first_read <= '0'; -- else --if (sg_clk'event and sg_clk = '1') then elsif (last_update_over_int = '1' and fifo_rd_int = '0') then fifo_rd_int <= '1'; else fifo_rd_int <= '0'; end if; end if; end process; process (sg_clk) begin if (sg_clk'event and sg_clk = '1') then if (reset_sg = '0') then first_read_int <= '0'; else --if (sg_clk'event and sg_clk = '1') then first_read_int <= first_read; end if; end if; end process; first_rd_en <= first_read and (not first_read_int); fifo_rd <= last_update_over_int; --(fifo_rd_int or first_rd_en); -- process (clk_in) -- begin -- if (resetn = '0') then -- first_data <= '0'; -- first_stream_del <= '0'; -- elsif (clk_in'event and clk_in = '1') then -- if (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- no tlast -- first_data <= '1'; -- just after the system comes out of reset -- end if; -- first_stream_del <= first_stream; -- end if; -- end process; first_stream <= (s2mm_tvalid and (not first_data)); -- pulse when first stream comes after reset process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then first_received1 <= '0'; first_stream_del <= '0'; else --if (clk_in'event and clk_in = '1') then first_received1 <= first_received; --'0'; first_stream_del <= first_stream; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then last_received <= '0'; first_received <= '0'; tdest_capture <= (others => '0'); first_data <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (s2mm_tvalid = '1' and first_data = '0' and s2mm_tready = '1') then -- first stream afetr reset s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; tdest_capture <= s2mm_tdest; -- latching tdest on first beat first_data <= '1'; -- just after the system comes out of reset elsif (s2mm_tlast = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for last beat last_received <= '1'; first_received <= '0'; s2mm_desc_info_int <= s2mm_desc_info_int; elsif (last_received = '1' and s2mm_tvalid = '1' and s2mm_tready = '1') then -- catch for following first beat last_received <= '0'; first_received <= '1'; tdest_capture <= s2mm_tdest; -- latching tdest on first beat s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; else s2mm_desc_info_int <= s2mm_desc_info_int; last_received <= last_received; if (updt_cmpt = '1') then first_received <= '0'; else first_received <= first_received; -- hold the first received until update comes for previous tlast end if; end if; end if; end process; fifo_wr <= first_stream_del or (first_received and not (first_received1)); -- writing the tdest,tuser,tid into FIFO process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then tdest_out_int <= "0100000"; same_tdest_b2b <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (first_received = '1' or first_stream = '1') then if (first_stream = '1') then -- when first stream is received, capture the tdest tdest_out_int (6) <= not tdest_out_int (6); -- signifies a new stream has come tdest_out_int (5 downto 0) <= '0' & s2mm_tdest; same_tdest_b2b <= '0'; -- elsif (updt_cmpt = '1' or (first_received = '1' and first_received1 = '0')) then -- when subsequent streams are received, pass the latched value of tdest -- elsif (first_received = '1' and first_received1 = '0') then -- when subsequent streams are received, pass the latched value of tdest -- Following change made to allow b2b same channel pkt elsif ((first_received = '1' and first_received1 = '0') and (tdest_out_int (4 downto 0) /= tdest_capture)) then -- when subsequent streams are received, pass the latched value of tdest tdest_out_int (6) <= not tdest_out_int (6); tdest_out_int (5 downto 0) <= '0' & tdest_capture; --s2mm_tdest; elsif (first_received = '1' and first_received1 = '0') then same_tdest_b2b <= not (same_tdest_b2b); end if; else tdest_out_int <= tdest_out_int; end if; end if; end process; tdest_out <= tdest_out_int; same_tdest <= same_tdest_b2b; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then open_window <= '0'; -- else --if (clk_in'event and clk_in = '1') then elsif (desc_available = '1') then open_window <= '1'; elsif (s2mm_tlast = '1') then open_window <= '0'; else open_window <= open_window; end if; end if; end process; process (clk_in) begin if (clk_in'event and clk_in = '1') then if (resetn = '0') then s2mm_tvalid_out <= '0'; s2mm_tready_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; -- else --if (clk_in'event and clk_in = '1') then elsif (open_window = '1') then s2mm_tvalid_out <= s2mm_tvalid; s2mm_tready_out <= s2mm_tready; s2mm_tlast_out <= s2mm_tlast; s2mm_tdest_out <= s2mm_tdest; else s2mm_tready_out <= '0'; s2mm_tvalid_out <= '0'; s2mm_tlast_out <= '0'; s2mm_tdest_out <= "00000"; end if; end if; end process; fifo_reset <= not (resetn); -- s2mm_desc_info_int <= s2mm_tuser & s2mm_tid & s2mm_tdest; -- Following FIFO is used to store the Tuser, Tid and xCache info I_ASYNC_FIFOGEN_FIFO : entity lib_fifo_v1_0_4.async_fifo_fg generic map ( -- C_ALLOW_2N_DEPTH => 1, C_ALLOW_2N_DEPTH => 0, C_FAMILY => C_FAMILY, C_DATA_WIDTH => 14, C_ENABLE_RLOCS => 0, C_FIFO_DEPTH => 31, C_HAS_ALMOST_EMPTY => 1, C_EN_SAFETY_CKT => 1, C_HAS_ALMOST_FULL => 1, C_HAS_RD_ACK => 1, C_HAS_RD_COUNT => 1, C_HAS_RD_ERR => 0, C_HAS_WR_ACK => 0, C_HAS_WR_COUNT => 1, C_HAS_WR_ERR => 0, C_RD_ACK_LOW => 0, C_RD_COUNT_WIDTH => 5, C_RD_ERR_LOW => 0, C_USE_BLOCKMEM => 0, C_WR_ACK_LOW => 0, C_WR_COUNT_WIDTH => 5, C_WR_ERR_LOW => 0, C_SYNCHRONIZER_STAGE => C_FIFO_MTBF, C_USE_EMBEDDED_REG => 0 -- 0 ; -- C_PRELOAD_REGS => 0, -- 0 ; -- C_PRELOAD_LATENCY => 1 -- 1 ; ) port Map ( Din => s2mm_desc_info_int, Wr_en => fifo_wr, Wr_clk => clk_in, Rd_en => fifo_rd, Rd_clk => sg_clk, Ainit => fifo_reset, Dout => s2mm_desc_info, Full => fifo_Full, Empty => fifo_empty, Almost_full => open, Almost_empty => open, Wr_count => open, Rd_count => open, Rd_ack => open, Rd_err => open, -- Not used by axi_dma Wr_ack => open, -- Not used by axi_dma Wr_err => open -- Not used by axi_dma ); end implementation;
gpl-3.0
605636d6fbed172bb3ec1aaf9245123d
0.51524
3.57652
false
false
false
false
tgingold/ghdl
testsuite/synth/uassoc01/uassoc02.vhdl
1
821
library ieee; use ieee.std_logic_1164.all; entity uassoc02_sub is port (i : std_logic_vector; o : out std_logic_vector); end uassoc02_sub; architecture behav of uassoc02_sub is begin o <= not i; end behav; library ieee; use ieee.std_logic_1164.all; entity uassoc02 is port (i1 : std_logic_vector(3 downto 0); i2 : std_logic_vector(7 downto 0); o : out std_logic_vector(3 downto 0)); end uassoc02; architecture rtl of uassoc02 is component uassoc02_sub is port (i : std_logic_vector; o : out std_logic_vector); end component; signal o1: std_logic_vector(3 downto 0); signal o2: std_logic_vector(7 downto 0); begin dut1: uassoc02_sub port map (i => i1, o => o1); dut2: uassoc02_sub port map (i => i2, o => o2); o <= o1 xor o2 (3 downto 0); end rtl;
gpl-2.0
337224c729cc6ff9f5eb82366c12e97c
0.64799
2.942652
false
false
false
false
nickg/nvc
test/lower/vunit1.vhd
1
2,534
package string_ptr_pkg is subtype index_t is integer range -1 to integer'high; subtype byte_t is integer range 0 to 255; type storage_mode_t is (internal, extfnc, extacc); type string_access_t is access string; type string_access_vector_t is array (natural range <>) of string_access_t; type string_access_vector_access_t is access string_access_vector_t; type extstring_access_t is access string(1 to integer'high); type extstring_access_vector_t is array (natural range <>) of extstring_access_t; type extstring_access_vector_access_t is access extstring_access_vector_t; type string_ptr_t is record ref : index_t; end record; constant null_string_ptr : string_ptr_t := (ref => -1); alias ptr_t is string_ptr_t; alias val_t is character; alias vec_t is string; alias vav_t is string_access_vector_t; alias evav_t is extstring_access_vector_t; alias vava_t is string_access_vector_access_t; alias evava_t is extstring_access_vector_access_t; procedure set ( ptr : ptr_t; index : positive; value : val_t ); end package; package body string_ptr_pkg is type prot_storage_t is protected procedure set ( ref : natural; index : positive; value : val_t ); end protected; type prot_storage_t is protected body type storage_t is record id : integer; mode : storage_mode_t; length : integer; end record; constant null_storage : storage_t := (integer'low, internal, integer'low); type storage_vector_t is array (natural range <>) of storage_t; type storage_vector_access_t is access storage_vector_t; type ptr_storage is record idx : natural; ptr : natural; eptr : natural; idxs : storage_vector_access_t; ptrs : vava_t; eptrs : evava_t; end record; variable st : ptr_storage := (0, 0, 0, null, null, null); procedure set ( ref : natural; index : positive; value : val_t ) is variable s : storage_t := st.idxs(ref); begin case s.mode is when extfnc => null;--write_char(s.id, index-1, value); when extacc => st.eptrs(s.id)(index) := value; when internal => st.ptrs(s.id)(index) := value; end case; end; end protected body; shared variable vec_ptr_storage : prot_storage_t; procedure set ( ptr : ptr_t; index : positive; value : val_t ) is begin vec_ptr_storage.set(ptr.ref, index, value); end; end package body;
gpl-3.0
28f01fdb1474eb2a210e22c593eb2962
0.638516
3.338603
false
false
false
false
tgingold/ghdl
testsuite/gna/issue418/repro3.vhdl
1
782
entity repro3 is generic (blen : natural := 8); end; architecture behav of repro3 is -- AXI-Lite Interface signals type address_channel is record --DUT inputs awaddr : bit_vector; awvalid : bit; end record; type t_if is record write_channel : address_channel; data : bit_vector (blen - 1 downto 0); end record; subtype ST_IF_32 is t_if ( write_channel ( awaddr(31 downto 0) ) ); signal s : st_if_32; begin s.write_channel.awaddr <= x"0000_1000", x"1000_ffff" after 2 ns; s.data <= (others => '1'); process begin wait for 1 ns; assert s.write_channel.awvalid = '0'; assert s.write_channel.awaddr(12) = '1'; wait for 2 ns; assert s.write_channel.awaddr(14) = '1'; wait; end process; end;
gpl-2.0
769c177cfd741f2fd707c699d2095899
0.616368
3.231405
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/disputed/tc851.vhd
4
10,055
-- 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: tc851.vhd,v 1.2 2001-10-26 16:30:04 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- package c01s03b01x00p12n01i00851pkg_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 c01s03b01x00p12n01i00851pkg_b; package body c01s03b01x00p12n01i00851pkg_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 c01s03b01x00p12n01i00851pkg_b; use work.c01s03b01x00p12n01i00851pkg_b.all; package c01s03b01x00p12n01i00851pkg_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; 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 c01s03b01x00p12n01i00851pkg_a; use work.c01s03b01x00p12n01i00851pkg_a.all; use work.c01s03b01x00p12n01i00851pkg_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.c01s03b01x00p12n01i00851pkg_a.all; use work.c01s03b01x00p12n01i00851pkg_b.all; ENTITY c01s03b01x00p12n01i00851ent IS END c01s03b01x00p12n01i00851ent; ARCHITECTURE c01s03b01x00p12n01i00851arch OF c01s03b01x00p12n01i00851ent 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: c01s03b01x00p12n01i00851" 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: c01s03b01x00p12n01i00851 - 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 c01s03b01x00p12n01i00851arch; configuration c01s03b01x00p12n01i00851cfg of c01s03b01x00p12n01i00851ent is for c01s03b01x00p12n01i00851arch for K for T5:test use configuration work.testbench; end for; for G(three downto zero) for T1:test use configuration work.testbench; end for; end for; end for; end for; end;
gpl-2.0
dd0f4e5d6bd1b456f8240f470f73664c
0.599204
3.348318
false
true
false
false
tgingold/ghdl
testsuite/gna/issue531/repro1.vhdl
1
1,280
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity submodule is port ( clk : in std_logic; arg : in std_logic_vector(7 downto 0); res : out std_logic_vector(7 downto 0) ); end submodule; architecture rtl of submodule is begin sub_proc : process(clk) variable last : std_logic_vector(7 downto 0); begin if rising_edge(clk) then res <= arg XOR last; last := arg; end if; end process sub_proc; monitor : process(clk) begin if rising_edge(clk) then report "arg: " & integer'image(to_integer(unsigned(arg))); end if; end process; end rtl; library ieee; use ieee.std_logic_1164.all; entity sliced_ex is port ( arg_a : in std_logic_vector(3 downto 0); arg_b : in std_logic_vector(3 downto 0) ); end sliced_ex; architecture rtl of sliced_ex is signal clk : std_logic; begin process begin clk <= '0'; for i in 1 to 5 * 2 loop wait for 10 ns; clk <= not clk; end loop; wait; end process; sub_module : entity work.submodule port map ( clk => clk, -- This one fails arg(3 downto 0) => arg_a(3 downto 0), arg(7 downto 4) => arg_b(3 downto 0), res => OPEN ); end rtl;
gpl-2.0
4bf87ffe148187cd0a9b73f67e524b23
0.59375
3.256997
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc365.vhd
4
1,972
-- 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: tc365.vhd,v 1.2 2001-10-26 16:29:53 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c03s02b01x01p03n01i00365ent IS END c03s02b01x01p03n01i00365ent; ARCHITECTURE c03s02b01x01p03n01i00365arch OF c03s02b01x01p03n01i00365ent IS subtype decade is integer; type MVL_vector is array (decade range 1 to 50) of integer; BEGIN TESTING: PROCESS variable k : MVL_vector; BEGIN k(1) := 2; k(50) := 5; assert NOT (k(1)=2 and k(50)=5) report "***PASSED TEST: c03s02b01x01p03n01i00365" severity NOTE; assert (k(1)=2 and k(50)=5) report "***FAILED TEST: c03s02b01x01p03n01i00365 - If an index constraint appears after a type mark in a subtype indication, then the type or subtype denoted by the type mark must not already impose an index constraint." severity ERROR; wait; END PROCESS TESTING; END c03s02b01x01p03n01i00365arch;
gpl-2.0
ebfd6bca26d894ea67824e52efdaeecb
0.674442
3.672253
false
true
false
false
tgingold/ghdl
testsuite/synth/synth60/spin1.vhdl
1
1,166
architecture spin1 of leds is signal nrst : std_logic := '0'; signal clk_4hz: std_logic; signal leds : std_ulogic_vector (1 to 5); begin (led1, led2, led3, led4, led5) <= leds; led6 <= '0'; led7 <= '0'; led8 <= '0'; process (clk) variable cnt : unsigned (1 downto 0) := "00"; begin if rising_edge (clk) then if cnt = 3 then nrst <= '1'; else cnt := cnt + 1; end if; end if; end process; process (clk) -- 3_000_000 is 0x2dc6c0 variable counter : unsigned (23 downto 0); begin if rising_edge(clk) then if nrst = '0' then counter := x"000000"; else if counter = 2_999_999 then counter := x"000000"; clk_4hz <= '1'; else counter := counter + 1; clk_4hz <= '0'; end if; end if; end if; end process; process (clk) begin if rising_edge(clk) then if nrst = '0' then -- Initialize leds <= "11000"; elsif clk_4hz = '1' then -- Rotate leds <= (leds (4), leds (1), leds (2), leds (3), '0'); end if; end if; end process; end spin1;
gpl-2.0
b956ccb4084c562ec121b6ad887c94bb
0.505146
3.275281
false
false
false
false
tgingold/ghdl
testsuite/synth/oper01/snum03.vhdl
1
412
entity snum03 is port (ok : out boolean); end snum03; library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; architecture behav of snum03 is -- add uns nat constant a1 : unsigned (7 downto 0) := x"1d"; constant b1 : integer := 3; constant r1 : unsigned (7 downto 0) := a1 + b1; signal er1 : unsigned (7 downto 0) := x"20"; begin -- ok <= r1 = x"20"; ok <= r1 = er1; end behav;
gpl-2.0
5153b65c0a94e614ab2280af3aa16ade
0.631068
2.821918
false
false
false
false
tgingold/ghdl
testsuite/synth/mem2d01/tb_dpram2w.vhdl
1
1,683
entity tb_dpram2w is end tb_dpram2w; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_dpram2w is signal waddr : natural range 0 to 3; signal wnib : natural range 0 to 1; signal wdat : std_logic_vector (3 downto 0); signal raddr : natural range 0 to 3; signal rdat : std_logic_vector(7 downto 0); signal clk : std_logic; begin dut: entity work.dpram2w port map (waddr => waddr, wnib => wnib, wdat => wdat, raddr => raddr, rdat => rdat, clk => clk); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin waddr <= 0; wnib <= 0; wdat <= x"0"; raddr <= 1; pulse; waddr <= 0; wnib <= 1; wdat <= x"f"; raddr <= 1; pulse; waddr <= 1; wnib <= 1; wdat <= x"e"; raddr <= 0; pulse; assert rdat = x"f0" severity failure; waddr <= 1; wnib <= 0; wdat <= x"1"; raddr <= 0; pulse; assert rdat = x"f0" severity failure; waddr <= 3; wnib <= 0; wdat <= x"3"; raddr <= 1; pulse; assert rdat = x"e1" severity failure; waddr <= 3; wnib <= 1; wdat <= x"c"; raddr <= 1; pulse; assert rdat = x"e1" severity failure; waddr <= 2; wnib <= 1; wdat <= x"d"; raddr <= 3; pulse; assert rdat = x"c3" severity failure; waddr <= 2; wnib <= 0; wdat <= x"2"; raddr <= 3; pulse; assert rdat = x"c3" severity failure; waddr <= 1; wnib <= 0; wdat <= x"1"; raddr <= 2; pulse; assert rdat = x"d2" severity failure; wait; end process; end behav;
gpl-2.0
2c62f3880e786170040a767992d5f37e
0.519311
3.306483
false
false
false
false
tgingold/ghdl
testsuite/synth/dff02/tb_dff08a.vhdl
1
1,137
entity tb_dff08a is end tb_dff08a; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_dff08a is signal clk : std_logic; signal rst : std_logic; signal en : std_logic; signal din : std_logic_vector (7 downto 0); signal dout : std_logic_vector (7 downto 0); begin dut: entity work.dff08a port map ( q => dout, d => din, en => en, clk => clk, rst => rst); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin rst <= '1'; en <= '1'; pulse; assert dout = x"00" severity failure; rst <= '0'; din <= x"38"; pulse; assert dout = x"38" severity failure; din <= x"af"; pulse; assert dout = x"af" severity failure; en <= '0'; din <= x"b3"; pulse; assert dout = x"af" severity failure; en <= '0'; rst <= '1'; din <= x"b4"; pulse; assert dout = x"af" severity failure; en <= '1'; rst <= '1'; din <= x"b5"; pulse; assert dout = x"00" severity failure; wait; end process; end behav;
gpl-2.0
9bcc577309adf99ba1456db67d4ada29
0.532102
3.202817
false
false
false
false
Darkin47/Zynq-TX-UTT
Vivado/Hist_Stretch/Hist_Stretch.srcs/sources_1/bd/design_1/ipshared/xilinx.com/axi_bram_ctrl_v4_0/hdl/vhdl/axi_bram_ctrl.vhd
2
43,654
------------------------------------------------------------------------------- -- axi_bram_ctrl.vhd ------------------------------------------------------------------------------- -- -- -- (c) Copyright [2010 - 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. -- -- ------------------------------------------------------------------------------- -- Filename: axi_bram_ctrl_wrapper.vhd -- -- Description: This file is the top level module for the AXI BRAM -- controller IP core. -- -- VHDL-Standard: VHDL'93 -- ------------------------------------------------------------------------------- -- Structure: -- axi_bram_ctrl.vhd (v4_0) -- | -- |--axi_bram_ctrl_top.vhd -- | -- |-- full_axi.vhd -- | -- sng_port_arb.vhd -- | -- lite_ecc_reg.vhd -- | -- axi_lite_if.vhd -- | -- wr_chnl.vhd -- | -- wrap_brst.vhd -- | -- ua_narrow.vhd -- | -- checkbit_handler.vhd -- | -- xor18.vhd -- | -- parity.vhd -- | -- checkbit_handler_64.vhd -- | -- (same helper components as checkbit_handler) -- | -- parity.vhd -- | -- correct_one_bit.vhd -- | -- correct_one_bit_64.vhd -- | -- ecc_gen.vhd -- | -- | -- rd_chnl.vhd -- | -- wrap_brst.vhd -- | -- ua_narrow.vhd -- | -- checkbit_handler.vhd -- | -- xor18.vhd -- | -- parity.vhd -- | -- checkbit_handler_64.vhd -- | -- (same helper components as checkbit_handler) -- | -- parity.vhd -- | -- correct_one_bit.vhd -- | -- correct_one_bit_64.vhd -- | -- ecc_gen.vhd -- | -- |-- axi_lite.vhd -- | -- lite_ecc_reg.vhd -- | -- axi_lite_if.vhd -- | -- checkbit_handler.vhd -- | -- xor18.vhd -- | -- parity.vhd -- | -- correct_one_bit.vhd -- | -- ecc_gen.vhd -- ------------------------------------------------------------------------------- -- Library declarations library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.numeric_std.all; library work; use work.axi_bram_ctrl_top; use work.axi_bram_ctrl_funcs.all; --use work.coregen_comp_defs.all; library blk_mem_gen_v8_3_2; use blk_mem_gen_v8_3_2.all; ------------------------------------------------------------------------------ entity axi_bram_ctrl is generic ( C_BRAM_INST_MODE : string := "EXTERNAL"; -- external ; internal --determines whether the bmg is external or internal to axi bram ctrl wrapper C_MEMORY_DEPTH : integer := 4096; --Memory depth specified by the user C_BRAM_ADDR_WIDTH : integer := 12; -- Width of AXI address bus (in bits) C_S_AXI_ADDR_WIDTH : integer := 32; -- Width of AXI address bus (in bits) C_S_AXI_DATA_WIDTH : integer := 32; -- Width of AXI data bus (in bits) C_S_AXI_ID_WIDTH : INTEGER := 4; -- AXI ID vector width C_S_AXI_PROTOCOL : string := "AXI4"; -- Set to AXI4LITE to optimize out burst transaction support C_S_AXI_SUPPORTS_NARROW_BURST : INTEGER := 1; -- Support for narrow burst operations C_SINGLE_PORT_BRAM : INTEGER := 0; -- Enable single port usage of BRAM C_FAMILY : string := "virtex7"; -- Specify the target architecture type -- AXI-Lite Register Parameters C_S_AXI_CTRL_ADDR_WIDTH : integer := 32; -- Width of AXI-Lite address bus (in bits) C_S_AXI_CTRL_DATA_WIDTH : integer := 32; -- Width of AXI-Lite data bus (in bits) -- ECC Parameters C_ECC : integer := 0; -- Enables or disables ECC functionality C_ECC_TYPE : integer := 1; C_FAULT_INJECT : integer := 0; -- Enable fault injection registers -- (default = disabled) C_ECC_ONOFF_RESET_VALUE : integer := 1 -- By default, ECC checking is on -- (can disable ECC @ reset by setting this to 0) ); port ( -- AXI Interface Signals -- AXI Clock and Reset s_axi_aclk : in std_logic; s_axi_aresetn : in std_logic; ecc_interrupt : out std_logic := '0'; ecc_ue : out std_logic := '0'; -- axi write address channel Signals (AW) s_axi_awid : in std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_awaddr : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); s_axi_awlen : in std_logic_vector(7 downto 0); s_axi_awsize : in std_logic_vector(2 downto 0); s_axi_awburst : in std_logic_vector(1 downto 0); s_axi_awlock : in std_logic; s_axi_awcache : in std_logic_vector(3 downto 0); s_axi_awprot : in std_logic_vector(2 downto 0); s_axi_awvalid : in std_logic; s_axi_awready : out std_logic; -- axi write data channel Signals (W) 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_wlast : in std_logic; s_axi_wvalid : in std_logic; s_axi_wready : out std_logic; -- axi write data response Channel Signals (B) s_axi_bid : out std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_bresp : out std_logic_vector(1 downto 0); s_axi_bvalid : out std_logic; s_axi_bready : in std_logic; -- axi read address channel Signals (AR) s_axi_arid : in std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); s_axi_araddr : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0); s_axi_arlen : in std_logic_vector(7 downto 0); s_axi_arsize : in std_logic_vector(2 downto 0); s_axi_arburst : in std_logic_vector(1 downto 0); s_axi_arlock : in std_logic; s_axi_arcache : in std_logic_vector(3 downto 0); s_axi_arprot : in std_logic_vector(2 downto 0); s_axi_arvalid : in std_logic; s_axi_arready : out std_logic; -- axi read data channel Signals (R) s_axi_rid : out std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0); 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_rlast : out std_logic; s_axi_rvalid : out std_logic; s_axi_rready : in std_logic; -- axi-lite ecc register Interface Signals -- axi-lite clock and Reset -- note: axi-lite control IF and AXI IF share the same clock. -- s_axi_ctrl_aclk : in std_logic; -- s_axi_ctrl_aresetn : in std_logic; -- axi-lite write address Channel Signals (AW) s_axi_ctrl_awvalid : in std_logic; s_axi_ctrl_awready : out std_logic; s_axi_ctrl_awaddr : in std_logic_vector(C_S_AXI_CTRL_ADDR_WIDTH-1 downto 0); -- axi-lite write data Channel Signals (W) s_axi_ctrl_wdata : in std_logic_vector(C_S_AXI_CTRL_DATA_WIDTH-1 downto 0); s_axi_ctrl_wvalid : in std_logic; s_axi_ctrl_wready : out std_logic; -- axi-lite write data Response Channel Signals (B) s_axi_ctrl_bresp : out std_logic_vector(1 downto 0); s_axi_ctrl_bvalid : out std_logic; s_axi_ctrl_bready : in std_logic; -- axi-lite read address Channel Signals (AR) s_axi_ctrl_araddr : in std_logic_vector(C_S_AXI_CTRL_ADDR_WIDTH-1 downto 0); s_axi_ctrl_arvalid : in std_logic; s_axi_ctrl_arready : out std_logic; -- axi-lite read data Channel Signals (R) s_axi_ctrl_rdata : out std_logic_vector(C_S_AXI_CTRL_DATA_WIDTH-1 downto 0); s_axi_ctrl_rresp : out std_logic_vector(1 downto 0); s_axi_ctrl_rvalid : out std_logic; s_axi_ctrl_rready : in std_logic; -- bram interface signals (Port A) bram_rst_a : out std_logic; bram_clk_a : out std_logic; bram_en_a : out std_logic; bram_we_a : out std_logic_vector (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_addr_a : out std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); bram_wrdata_a : out std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_rddata_a : in std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); -- bram interface signals (Port B) bram_rst_b : out std_logic; bram_clk_b : out std_logic; bram_en_b : out std_logic; bram_we_b : out std_logic_vector (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_addr_b : out std_logic_vector (C_S_AXI_ADDR_WIDTH-1 downto 0); bram_wrdata_b : out std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); bram_rddata_b : in std_logic_vector (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) ); end entity axi_bram_ctrl; ------------------------------------------------------------------------------- architecture implementation of axi_bram_ctrl is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------ -- FUNCTION: if_then_else -- This function is used to implement an IF..THEN when such a statement is not -- allowed. ------------------------------------------------------------------------------ FUNCTION if_then_else ( condition : BOOLEAN; true_case : INTEGER; false_case : INTEGER) RETURN INTEGER IS VARIABLE retval : INTEGER := 0; BEGIN IF NOT condition THEN retval:=false_case; ELSE retval:=true_case; END IF; RETURN retval; END if_then_else; --------------------------------------------------------------------------- -- FUNCTION : log2roundup --------------------------------------------------------------------------- FUNCTION log2roundup (data_value : integer) RETURN integer IS VARIABLE width : integer := 0; VARIABLE cnt : integer := 1; CONSTANT lower_limit : integer := 1; CONSTANT upper_limit : integer := 8; BEGIN IF (data_value <= 1) THEN width := 0; ELSE WHILE (cnt < data_value) LOOP width := width + 1; cnt := cnt *2; END LOOP; END IF; RETURN width; END log2roundup; ------------------------------------------------------------------------------- -- Constants ------------------------------------------------------------------------------- -- Only instantiate logic based on C_S_AXI_PROTOCOL. -- Determine external ECC width. -- Use function defined in axi_bram_ctrl_funcs package. -- Set internal parameters for ECC register enabling when C_ECC = 1 -- Catastrophic error indicated with ECC_UE & Interrupt flags. -- Counter only sized when C_ECC = 1. -- Selects CE counter width/threshold to assert ECC_Interrupt -- Hard coded at 8-bits to capture and count up to 256 correctable errors. -- ECC algorithm format, 0 = Hamming code, 1 = Hsiao code constant GND : std_logic := '0'; constant VCC : std_logic := '1'; constant ZERO1 : std_logic_vector(0 downto 0) := (others => '0'); constant ZERO2 : std_logic_vector(1 downto 0) := (others => '0'); constant ZERO3 : std_logic_vector(2 downto 0) := (others => '0'); constant ZERO4 : std_logic_vector(3 downto 0) := (others => '0'); constant ZERO8 : std_logic_vector(7 downto 0) := (others => '0'); constant WSTRB_ZERO : std_logic_vector(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); constant ZERO16 : std_logic_vector(15 downto 0) := (others => '0'); constant ZERO32 : std_logic_vector(31 downto 0) := (others => '0'); constant ZERO64 : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); CONSTANT MEM_TYPE : INTEGER := if_then_else((C_SINGLE_PORT_BRAM=1),0,2); CONSTANT BWE_B : INTEGER := if_then_else((C_SINGLE_PORT_BRAM=1),0,1); CONSTANT BMG_ADDR_WIDTH : INTEGER := log2roundup(C_MEMORY_DEPTH) + log2roundup(C_S_AXI_DATA_WIDTH/8) ; ------------------------------------------------------------------------------- -- Signals ------------------------------------------------------------------------------- signal clka_bram_clka_i : std_logic := '0'; signal rsta_bram_rsta_i : std_logic := '0'; signal ena_bram_ena_i : std_logic := '0'; signal REGCEA : std_logic := '0'; signal wea_bram_wea_i : std_logic_vector(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal addra_bram_addra_i : std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); signal dina_bram_dina_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal douta_bram_douta_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); signal clkb_bram_clkb_i : std_logic := '0'; signal rstb_bram_rstb_i : std_logic := '0'; signal enb_bram_enb_i : std_logic := '0'; signal REGCEB : std_logic := '0'; signal web_bram_web_i : std_logic_vector(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal addrb_bram_addrb_i : std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0) := (others => '0'); signal dinb_bram_dinb_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0) := (others => '0'); signal doutb_bram_doutb_i : std_logic_vector(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); ----------------------------------------------------------------------- -- Architecture Body ----------------------------------------------------------------------- begin gint_inst: IF (C_BRAM_INST_MODE = "INTERNAL" ) GENERATE constant c_addrb_width : INTEGER := log2roundup(C_MEMORY_DEPTH); constant C_WEA_WIDTH_I : INTEGER := (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))) ; constant C_WRITE_WIDTH_A_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) ; constant C_READ_WIDTH_A_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))); constant C_ADDRA_WIDTH_I : INTEGER := log2roundup(C_MEMORY_DEPTH); constant C_WEB_WIDTH_I : INTEGER := (C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))); constant C_WRITE_WIDTH_B_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))); constant C_READ_WIDTH_B_I : INTEGER := (C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))); signal s_axi_rdaddrecc_bmg_int : STD_LOGIC_VECTOR(c_addrb_width-1 DOWNTO 0); signal s_axi_dbiterr_bmg_int : STD_LOGIC; signal s_axi_sbiterr_bmg_int : STD_LOGIC; signal s_axi_rvalid_bmg_int : STD_LOGIC; signal s_axi_rlast_bmg_int : STD_LOGIC; signal s_axi_rresp_bmg_int : STD_LOGIC_VECTOR(1 DOWNTO 0); signal s_axi_rdata_bmg_int : STD_LOGIC_VECTOR(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))-1 downto 0); signal s_axi_rid_bmg_int : STD_LOGIC_VECTOR(3 DOWNTO 0); signal s_axi_arready_bmg_int : STD_LOGIC; signal s_axi_bvalid_bmg_int : STD_LOGIC; signal s_axi_bresp_bmg_int : STD_LOGIC_VECTOR(1 DOWNTO 0); signal s_axi_bid_bmg_int : STD_LOGIC_VECTOR(3 DOWNTO 0); signal s_axi_wready_bmg_int : STD_LOGIC; signal s_axi_awready_bmg_int : STD_LOGIC; signal rdaddrecc_bmg_int : STD_LOGIC_VECTOR(c_addrb_width-1 DOWNTO 0); signal dbiterr_bmg_int : STD_LOGIC; signal sbiterr_bmg_int : STD_LOGIC; begin bmgv81_inst : entity blk_mem_gen_v8_3_2.blk_mem_gen_v8_3_2 GENERIC MAP( ---------------------------------------------------------------------------- -- Generic Declarations ---------------------------------------------------------------------------- --Device Family & Elaboration Directory Parameters: C_FAMILY => C_FAMILY, C_XDEVICEFAMILY => C_FAMILY, ---- C_ELABORATION_DIR => "NULL" , C_INTERFACE_TYPE => 0 , --General Memory Parameters: ----- C_ENABLE_32BIT_ADDRESS => 0 , C_MEM_TYPE => MEM_TYPE , C_BYTE_SIZE => 8 , C_ALGORITHM => 1 , C_PRIM_TYPE => 1 , --Memory Initialization Parameters: C_LOAD_INIT_FILE => 0 , C_INIT_FILE_NAME => "no_coe_file_loaded" , C_USE_DEFAULT_DATA => 0 , C_DEFAULT_DATA => "NULL" , --Port A Parameters: --Reset Parameters: C_HAS_RSTA => 0 , --Enable Parameters: C_HAS_ENA => 1 , C_HAS_REGCEA => 0 , --Byte Write Enable Parameters: C_USE_BYTE_WEA => 1 , C_WEA_WIDTH => C_WEA_WIDTH_I, --(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))) , --Write Mode: C_WRITE_MODE_A => "WRITE_FIRST" , --Data-Addr Width Parameters: C_WRITE_WIDTH_A => C_WRITE_WIDTH_A_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_READ_WIDTH_A => C_READ_WIDTH_A_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_WRITE_DEPTH_A => C_MEMORY_DEPTH , C_READ_DEPTH_A => C_MEMORY_DEPTH , C_ADDRA_WIDTH => C_ADDRA_WIDTH_I,--log2roundup(C_MEMORY_DEPTH) , --Port B Parameters: --Reset Parameters: C_HAS_RSTB => 0 , --Enable Parameters: C_HAS_ENB => 1 , C_HAS_REGCEB => 0 , --Byte Write Enable Parameters: C_USE_BYTE_WEB => BWE_B , C_WEB_WIDTH => C_WEB_WIDTH_I,--(C_S_AXI_DATA_WIDTH/8 + C_ECC*(1+(C_S_AXI_DATA_WIDTH/128))) , --Write Mode: C_WRITE_MODE_B => "WRITE_FIRST" , --Data-Addr Width Parameters: C_WRITE_WIDTH_B => C_WRITE_WIDTH_B_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_READ_WIDTH_B => C_READ_WIDTH_B_I,--(C_S_AXI_DATA_WIDTH+C_ECC*8*(1+(C_S_AXI_DATA_WIDTH/128))) , C_WRITE_DEPTH_B => C_MEMORY_DEPTH , C_READ_DEPTH_B => C_MEMORY_DEPTH , C_ADDRB_WIDTH => C_ADDRB_WIDTH,--log2roundup(C_MEMORY_DEPTH) , --Output Registers/ Pipelining Parameters: C_HAS_MEM_OUTPUT_REGS_A => 0 , C_HAS_MEM_OUTPUT_REGS_B => 0 , C_HAS_MUX_OUTPUT_REGS_A => 0 , C_HAS_MUX_OUTPUT_REGS_B => 0 , C_MUX_PIPELINE_STAGES => 0 , --Input/Output Registers for SoftECC : C_HAS_SOFTECC_INPUT_REGS_A => 0 , C_HAS_SOFTECC_OUTPUT_REGS_B=> 0 , --ECC Parameters C_USE_ECC => 0 , C_USE_SOFTECC => 0 , C_HAS_INJECTERR => 0 , C_EN_ECC_PIPE => 0, C_EN_SLEEP_PIN => 0, C_USE_URAM => 0, C_EN_RDADDRA_CHG => 0, C_EN_RDADDRB_CHG => 0, C_EN_DEEPSLEEP_PIN => 0, C_EN_SHUTDOWN_PIN => 0, --Simulation Model Parameters: C_SIM_COLLISION_CHECK => "NONE" , C_COMMON_CLK => 1 , C_DISABLE_WARN_BHV_COLL => 1 , C_DISABLE_WARN_BHV_RANGE => 1 ) PORT MAP( ---------------------------------------------------------------------------- -- Input and Output Declarations ---------------------------------------------------------------------------- -- Native BMG Input and Output Port Declarations --Port A: clka => clka_bram_clka_i , rsta => rsta_bram_rsta_i , ena => ena_bram_ena_i , regcea => GND , wea => wea_bram_wea_i , addra => addra_bram_addra_i(BMG_ADDR_WIDTH-1 downto (BMG_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , --addra => addra_bram_addra_i(C_S_AXI_ADDR_WIDTH-1 downto (C_S_AXI_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , dina => dina_bram_dina_i , douta => douta_bram_douta_i , --port b: clkb => clkb_bram_clkb_i , rstb => rstb_bram_rstb_i , enb => enb_bram_enb_i , regceb => GND , web => web_bram_web_i , addrb => addrb_bram_addrb_i(BMG_ADDR_WIDTH-1 downto (BMG_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , --addrb => addrb_bram_addrb_i(C_S_AXI_ADDR_WIDTH-1 downto (C_S_AXI_ADDR_WIDTH - C_BRAM_ADDR_WIDTH)) , dinb => dinb_bram_dinb_i , doutb => doutb_bram_doutb_i , --ecc: injectsbiterr => GND , injectdbiterr => GND , sbiterr => sbiterr_bmg_int, dbiterr => dbiterr_bmg_int, rdaddrecc => rdaddrecc_bmg_int, eccpipece => GND, sleep => GND, deepsleep => GND, shutdown => GND, -- axi bmg input and output Port Declarations -- axi global signals s_aclk => GND , s_aresetn => GND , -- axi full/lite slave write (write side) s_axi_awid => ZERO4 , s_axi_awaddr => ZERO32 , s_axi_awlen => ZERO8 , s_axi_awsize => ZERO3 , s_axi_awburst => ZERO2 , s_axi_awvalid => GND , s_axi_awready => s_axi_awready_bmg_int, s_axi_wdata => ZERO64 , s_axi_wstrb => WSTRB_ZERO, s_axi_wlast => GND , s_axi_wvalid => GND , s_axi_wready => s_axi_wready_bmg_int, s_axi_bid => s_axi_bid_bmg_int, s_axi_bresp => s_axi_bresp_bmg_int, s_axi_bvalid => s_axi_bvalid_bmg_int, s_axi_bready => GND , -- axi full/lite slave read (Write side) s_axi_arid => ZERO4, s_axi_araddr => "00000000000000000000000000000000", s_axi_arlen => "00000000", s_axi_arsize => "000", s_axi_arburst => "00", s_axi_arvalid => '0', s_axi_arready => s_axi_arready_bmg_int, s_axi_rid => s_axi_rid_bmg_int, s_axi_rdata => s_axi_rdata_bmg_int, s_axi_rresp => s_axi_rresp_bmg_int, s_axi_rlast => s_axi_rlast_bmg_int, s_axi_rvalid => s_axi_rvalid_bmg_int, s_axi_rready => GND , -- axi full/lite sideband Signals s_axi_injectsbiterr => GND , s_axi_injectdbiterr => GND , s_axi_sbiterr => s_axi_sbiterr_bmg_int, s_axi_dbiterr => s_axi_dbiterr_bmg_int, s_axi_rdaddrecc => s_axi_rdaddrecc_bmg_int ); abcv4_0_int_inst : entity work.axi_bram_ctrl_top generic map( -- AXI Parameters C_BRAM_ADDR_WIDTH => C_BRAM_ADDR_WIDTH , C_S_AXI_ADDR_WIDTH => C_S_AXI_ADDR_WIDTH , -- Width of AXI address bus (in bits) C_S_AXI_DATA_WIDTH => C_S_AXI_DATA_WIDTH , -- Width of AXI data bus (in bits) C_S_AXI_ID_WIDTH => C_S_AXI_ID_WIDTH , -- AXI ID vector width C_S_AXI_PROTOCOL => C_S_AXI_PROTOCOL , -- Set to AXI4LITE to optimize out burst transaction support C_S_AXI_SUPPORTS_NARROW_BURST => C_S_AXI_SUPPORTS_NARROW_BURST , -- Support for narrow burst operations C_SINGLE_PORT_BRAM => C_SINGLE_PORT_BRAM , -- Enable single port usage of BRAM -- AXI-Lite Register Parameters C_S_AXI_CTRL_ADDR_WIDTH => C_S_AXI_CTRL_ADDR_WIDTH , -- Width of AXI-Lite address bus (in bits) C_S_AXI_CTRL_DATA_WIDTH => C_S_AXI_CTRL_DATA_WIDTH , -- Width of AXI-Lite data bus (in bits) -- ECC Parameters C_ECC => C_ECC , -- Enables or disables ECC functionality C_ECC_TYPE => C_ECC_TYPE , C_FAULT_INJECT => C_FAULT_INJECT , -- Enable fault injection registers -- (default = disabled) C_ECC_ONOFF_RESET_VALUE => C_ECC_ONOFF_RESET_VALUE -- By default, ECC checking is on -- (can disable ECC @ reset by setting this to 0) ) port map( -- AXI Interface Signals -- AXI Clock and Reset S_AXI_ACLK => S_AXI_ACLK , S_AXI_ARESETN => S_AXI_ARESETN , ECC_Interrupt => ECC_Interrupt , ECC_UE => ECC_UE , -- AXI Write Address Channel Signals (AW) S_AXI_AWID => S_AXI_AWID , S_AXI_AWADDR => S_AXI_AWADDR , S_AXI_AWLEN => S_AXI_AWLEN , S_AXI_AWSIZE => S_AXI_AWSIZE , S_AXI_AWBURST => S_AXI_AWBURST , S_AXI_AWLOCK => S_AXI_AWLOCK , S_AXI_AWCACHE => S_AXI_AWCACHE , S_AXI_AWPROT => S_AXI_AWPROT , S_AXI_AWVALID => S_AXI_AWVALID , S_AXI_AWREADY => S_AXI_AWREADY , -- AXI Write Data Channel Signals (W) S_AXI_WDATA => S_AXI_WDATA , S_AXI_WSTRB => S_AXI_WSTRB , S_AXI_WLAST => S_AXI_WLAST , S_AXI_WVALID => S_AXI_WVALID , S_AXI_WREADY => S_AXI_WREADY , -- AXI Write Data Response Channel Signals (B) S_AXI_BID => S_AXI_BID , S_AXI_BRESP => S_AXI_BRESP , S_AXI_BVALID => S_AXI_BVALID , S_AXI_BREADY => S_AXI_BREADY , -- AXI Read Address Channel Signals (AR) S_AXI_ARID => S_AXI_ARID , S_AXI_ARADDR => S_AXI_ARADDR , S_AXI_ARLEN => S_AXI_ARLEN , S_AXI_ARSIZE => S_AXI_ARSIZE , S_AXI_ARBURST => S_AXI_ARBURST , S_AXI_ARLOCK => S_AXI_ARLOCK , S_AXI_ARCACHE => S_AXI_ARCACHE , S_AXI_ARPROT => S_AXI_ARPROT , S_AXI_ARVALID => S_AXI_ARVALID , S_AXI_ARREADY => S_AXI_ARREADY , -- AXI Read Data Channel Signals (R) S_AXI_RID => S_AXI_RID , S_AXI_RDATA => S_AXI_RDATA , S_AXI_RRESP => S_AXI_RRESP , S_AXI_RLAST => S_AXI_RLAST , S_AXI_RVALID => S_AXI_RVALID , S_AXI_RREADY => S_AXI_RREADY , -- AXI-Lite ECC Register Interface Signals -- AXI-Lite Write Address Channel Signals (AW) S_AXI_CTRL_AWVALID => S_AXI_CTRL_AWVALID , S_AXI_CTRL_AWREADY => S_AXI_CTRL_AWREADY , S_AXI_CTRL_AWADDR => S_AXI_CTRL_AWADDR , -- AXI-Lite Write Data Channel Signals (W) S_AXI_CTRL_WDATA => S_AXI_CTRL_WDATA , S_AXI_CTRL_WVALID => S_AXI_CTRL_WVALID , S_AXI_CTRL_WREADY => S_AXI_CTRL_WREADY , -- AXI-Lite Write Data Response Channel Signals (B) S_AXI_CTRL_BRESP => S_AXI_CTRL_BRESP , S_AXI_CTRL_BVALID => S_AXI_CTRL_BVALID , S_AXI_CTRL_BREADY => S_AXI_CTRL_BREADY , -- AXI-Lite Read Address Channel Signals (AR) S_AXI_CTRL_ARADDR => S_AXI_CTRL_ARADDR , S_AXI_CTRL_ARVALID => S_AXI_CTRL_ARVALID , S_AXI_CTRL_ARREADY => S_AXI_CTRL_ARREADY , -- AXI-Lite Read Data Channel Signals (R) S_AXI_CTRL_RDATA => S_AXI_CTRL_RDATA , S_AXI_CTRL_RRESP => S_AXI_CTRL_RRESP , S_AXI_CTRL_RVALID => S_AXI_CTRL_RVALID , S_AXI_CTRL_RREADY => S_AXI_CTRL_RREADY , -- BRAM Interface Signals (Port A) BRAM_Rst_A => rsta_bram_rsta_i , BRAM_Clk_A => clka_bram_clka_i , BRAM_En_A => ena_bram_ena_i , BRAM_WE_A => wea_bram_wea_i , BRAM_Addr_A => addra_bram_addra_i, BRAM_WrData_A => dina_bram_dina_i , BRAM_RdData_A => douta_bram_douta_i , -- BRAM Interface Signals (Port B) BRAM_Rst_B => rstb_bram_rstb_i , BRAM_Clk_B => clkb_bram_clkb_i , BRAM_En_B => enb_bram_enb_i , BRAM_WE_B => web_bram_web_i , BRAM_Addr_B => addrb_bram_addrb_i , BRAM_WrData_B => dinb_bram_dinb_i , BRAM_RdData_B => doutb_bram_doutb_i ); -- The following signals are driven 0's to remove the synthesis warnings bram_rst_a <= '0'; bram_clk_a <= '0'; bram_en_a <= '0'; bram_we_a <= (others => '0'); bram_addr_a <= (others => '0'); bram_wrdata_a <= (others => '0'); bram_rst_b <= '0'; bram_clk_b <= '0'; bram_en_b <= '0'; bram_we_b <= (others => '0'); bram_addr_b <= (others => '0'); bram_wrdata_b <= (others => '0'); END GENERATE gint_inst; -- End of internal bram instance gext_inst: IF (C_BRAM_INST_MODE = "EXTERNAL" ) GENERATE abcv4_0_ext_inst : entity work.axi_bram_ctrl_top generic map( -- AXI Parameters C_BRAM_ADDR_WIDTH => C_BRAM_ADDR_WIDTH , C_S_AXI_ADDR_WIDTH => C_S_AXI_ADDR_WIDTH , -- Width of AXI address bus (in bits) C_S_AXI_DATA_WIDTH => C_S_AXI_DATA_WIDTH , -- Width of AXI data bus (in bits) C_S_AXI_ID_WIDTH => C_S_AXI_ID_WIDTH , -- AXI ID vector width C_S_AXI_PROTOCOL => C_S_AXI_PROTOCOL , -- Set to AXI4LITE to optimize out burst transaction support C_S_AXI_SUPPORTS_NARROW_BURST => C_S_AXI_SUPPORTS_NARROW_BURST , -- Support for narrow burst operations C_SINGLE_PORT_BRAM => C_SINGLE_PORT_BRAM , -- Enable single port usage of BRAM -- AXI-Lite Register Parameters C_S_AXI_CTRL_ADDR_WIDTH => C_S_AXI_CTRL_ADDR_WIDTH , -- Width of AXI-Lite address bus (in bits) C_S_AXI_CTRL_DATA_WIDTH => C_S_AXI_CTRL_DATA_WIDTH , -- Width of AXI-Lite data bus (in bits) -- ECC Parameters C_ECC => C_ECC , -- Enables or disables ECC functionality C_ECC_TYPE => C_ECC_TYPE , C_FAULT_INJECT => C_FAULT_INJECT , -- Enable fault injection registers -- (default = disabled) C_ECC_ONOFF_RESET_VALUE => C_ECC_ONOFF_RESET_VALUE -- By default, ECC checking is on -- (can disable ECC @ reset by setting this to 0) ) port map( -- AXI Interface Signals -- AXI Clock and Reset s_axi_aclk => s_axi_aclk , s_axi_aresetn => s_axi_aresetn , ecc_interrupt => ecc_interrupt , ecc_ue => ecc_ue , -- axi write address channel signals (aw) s_axi_awid => s_axi_awid , s_axi_awaddr => s_axi_awaddr , s_axi_awlen => s_axi_awlen , s_axi_awsize => s_axi_awsize , s_axi_awburst => s_axi_awburst , s_axi_awlock => s_axi_awlock , s_axi_awcache => s_axi_awcache , s_axi_awprot => s_axi_awprot , s_axi_awvalid => s_axi_awvalid , s_axi_awready => s_axi_awready , -- axi write data channel signals (w) s_axi_wdata => s_axi_wdata , s_axi_wstrb => s_axi_wstrb , s_axi_wlast => s_axi_wlast , s_axi_wvalid => s_axi_wvalid , s_axi_wready => s_axi_wready , -- axi write data response channel signals (b) s_axi_bid => s_axi_bid , s_axi_bresp => s_axi_bresp , s_axi_bvalid => s_axi_bvalid , s_axi_bready => s_axi_bready , -- axi read address channel signals (ar) s_axi_arid => s_axi_arid , s_axi_araddr => s_axi_araddr , s_axi_arlen => s_axi_arlen , s_axi_arsize => s_axi_arsize , s_axi_arburst => s_axi_arburst , s_axi_arlock => s_axi_arlock , s_axi_arcache => s_axi_arcache , s_axi_arprot => s_axi_arprot , s_axi_arvalid => s_axi_arvalid , s_axi_arready => s_axi_arready , -- axi read data channel signals (r) s_axi_rid => s_axi_rid , s_axi_rdata => s_axi_rdata , s_axi_rresp => s_axi_rresp , s_axi_rlast => s_axi_rlast , s_axi_rvalid => s_axi_rvalid , s_axi_rready => s_axi_rready , -- axi-lite ecc register interface signals -- axi-lite write address channel signals (aw) s_axi_ctrl_awvalid => s_axi_ctrl_awvalid , s_axi_ctrl_awready => s_axi_ctrl_awready , s_axi_ctrl_awaddr => s_axi_ctrl_awaddr , -- axi-lite write data channel signals (w) s_axi_ctrl_wdata => s_axi_ctrl_wdata , s_axi_ctrl_wvalid => s_axi_ctrl_wvalid , s_axi_ctrl_wready => s_axi_ctrl_wready , -- axi-lite write data response channel signals (b) s_axi_ctrl_bresp => s_axi_ctrl_bresp , s_axi_ctrl_bvalid => s_axi_ctrl_bvalid , s_axi_ctrl_bready => s_axi_ctrl_bready , -- axi-lite read address channel signals (ar) s_axi_ctrl_araddr => s_axi_ctrl_araddr , s_axi_ctrl_arvalid => s_axi_ctrl_arvalid , s_axi_ctrl_arready => s_axi_ctrl_arready , -- axi-lite read data channel signals (r) s_axi_ctrl_rdata => s_axi_ctrl_rdata , s_axi_ctrl_rresp => s_axi_ctrl_rresp , s_axi_ctrl_rvalid => s_axi_ctrl_rvalid , s_axi_ctrl_rready => s_axi_ctrl_rready , -- bram interface signals (port a) bram_rst_a => bram_rst_a , bram_clk_a => bram_clk_a , bram_en_a => bram_en_a , bram_we_a => bram_we_a , bram_addr_a => bram_addr_a , bram_wrdata_a => bram_wrdata_a , bram_rddata_a => bram_rddata_a , -- bram interface signals (port b) bram_rst_b => bram_rst_b , bram_clk_b => bram_clk_b , bram_en_b => bram_en_b , bram_we_b => bram_we_b , bram_addr_b => bram_addr_b , bram_wrdata_b => bram_wrdata_b , bram_rddata_b => bram_rddata_b ); END GENERATE gext_inst; -- End of internal bram instance end architecture implementation;
gpl-3.0
f4e4fde998bcc91e9a9357b46cb8f8f5
0.443831
3.905
false
false
false
false
tgingold/ghdl
testsuite/synth/int01/tb_prio02.vhdl
1
509
entity tb_prio02 is end tb_prio02; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_prio02 is signal d : std_logic_vector(15 downto 0); signal p : natural; begin dut: entity work.prio02 port map (d, p); process begin d <= x"0004"; wait for 1 ns; assert p = 2 severity failure; d <= x"8000"; wait for 1 ns; assert p = 15 severity failure; d <= x"0024"; wait for 1 ns; assert p = 5 severity failure; wait; end process; end behav;
gpl-2.0
2be7811774073f9b00b0e5ba56f3dc14
0.624754
3.242038
false
false
false
false
tgingold/ghdl
testsuite/synth/dff03/tb_dff05.vhdl
1
1,062
entity tb_dff05 is end tb_dff05; library ieee; use ieee.std_logic_1164.all; architecture behav of tb_dff05 is signal clk : std_logic; signal en1 : std_logic; signal en2 : std_logic; signal din : std_logic; signal dout : std_logic; begin dut: entity work.dff05 port map ( q => dout, d => din, en1 => en1, en2 => en2, clk => clk); process procedure pulse is begin clk <= '0'; wait for 1 ns; clk <= '1'; wait for 1 ns; end pulse; begin en1 <= '1'; en2 <= '1'; din <= '0'; pulse; assert dout = '0' severity failure; din <= '1'; pulse; assert dout = '1' severity failure; en1 <= '0'; din <= '0'; pulse; assert dout = '1' severity failure; en1 <= '1'; din <= '0'; pulse; assert dout = '0' severity failure; en2 <= '0'; din <= '1'; pulse; assert dout = '0' severity failure; en2 <= '1'; din <= '1'; pulse; assert dout = '1' severity failure; wait; end process; end behav;
gpl-2.0
fe709f2ee7bdd158707dd4b647f42810
0.521657
3.208459
false
false
false
false
tgingold/ghdl
testsuite/vests/vhdl-93/billowitch/compliant/tc290.vhd
4
1,842
-- 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: tc290.vhd,v 1.2 2001-10-26 16:29:50 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c03s01b03x00p13n01i00290ent IS type mytime is range 1 to 30 units fs; end units; END c03s01b03x00p13n01i00290ent; ARCHITECTURE c03s01b03x00p13n01i00290arch OF c03s01b03x00p13n01i00290ent IS BEGIN TESTING: PROCESS variable t,a :mytime; variable b :integer; BEGIN a:=30 fs; b := 10; t:= a/b; assert NOT(t = 3 fs) report "***PASSED TEST: c03s01b03x00p13n01i00290" severity NOTE; assert (t = 3 fs) report "***FAILED TEST: c03s01b03x00p13n01i00290 - Physical type value arithmetic operation failed." severity ERROR; wait; END PROCESS TESTING; END c03s01b03x00p13n01i00290arch;
gpl-2.0
4609516fd7b843b041d38f18349729a7
0.657438
3.625984
false
true
false
false
tgingold/ghdl
libraries/ieee2008/numeric_bit.vhdl
2
63,541
-- ----------------------------------------------------------------- -- -- Copyright 2019 IEEE P1076 WG Authors -- -- See the LICENSE file distributed with this work for copyright and -- licensing information and the AUTHORS file. -- -- This file to you under the Apache License, Version 2.0 (the "License"). -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -- implied. See the License for the specific language governing -- permissions and limitations under the License. -- -- Title : Standard VHDL Synthesis Packages -- : (NUMERIC_BIT package declaration) -- : -- Library : This package shall be compiled into a library -- : symbolically named IEEE. -- : -- Developers: IEEE DASC Synthesis Working Group, -- : Accellera VHDL-TC, and IEEE P1076 Working Group -- : -- Purpose : This package defines numeric types and arithmetic functions -- : for use with synthesis tools. Two numeric types are defined: -- : -- > UNSIGNED: represents an UNSIGNED number in vector form -- : -- > SIGNED: represents a SIGNED number in vector form -- : The base element type is type BIT. -- : The leftmost bit is treated as the most significant bit. -- : Signed vectors are represented in two's complement form. -- : This package contains overloaded arithmetic operators on -- : the SIGNED and UNSIGNED types. The package also contains -- : useful type conversions functions, clock detection -- : functions, and other utility functions. -- : -- : If any argument to a function is a null array, a null array -- : is returned (exceptions, if any, are noted individually). -- -- Note : This package may be modified to include additional data -- : required by tools, but it must in no way change the -- : external interfaces or simulation behavior of the -- : description. It is permissible to add comments and/or -- : attributes to the package declarations, but not to change -- : or delete any original lines of the package declaration. -- : The package body may be changed only in accordance with -- : the terms of Clause 16 of this standard. -- : -- -------------------------------------------------------------------- -- $Revision: 1220 $ -- $Date: 2008-04-10 17:16:09 +0930 (Thu, 10 Apr 2008) $ -- -------------------------------------------------------------------- use STD.TEXTIO.all; package NUMERIC_BIT is constant CopyRightNotice : STRING := "Copyright © 2008 IEEE. All rights reserved."; --============================================================================ -- Numeric Array Type Definitions --============================================================================ type UNSIGNED is array (NATURAL range <>) of BIT; type SIGNED is array (NATURAL range <>) of BIT; --============================================================================ -- Arithmetic Operators: --============================================================================ -- Id: A.1 function "abs" (ARG : SIGNED) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: Returns the absolute value of a SIGNED vector ARG. -- Id: A.2 function "-" (ARG : SIGNED) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: Returns the value of the unary minus operation on a -- SIGNED vector ARG. --============================================================================ -- Id: A.3 function "+" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0) -- Result: Adds two UNSIGNED vectors that may be of different lengths. -- Id: A.3R function "+"(L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Similar to A.3 where R is a one bit UNSIGNED -- Id: A.3L function "+"(L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Similar to A.3 where L is a one bit UNSIGNED -- Id: A.4 function "+" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0) -- Result: Adds two SIGNED vectors that may be of different lengths. -- Id: A.4R function "+"(L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Similar to A.4 where R is bit 0 of a non-negative. -- Id: A.4L function "+"(L : BIT; R : SIGNED) return SIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Similar to A.4 where L is bit 0 of a non-negative. -- Id: A.5 function "+" (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Adds an UNSIGNED vector, L, with a nonnegative INTEGER, R. -- Id: A.6 function "+" (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Adds a nonnegative INTEGER, L, with an UNSIGNED vector, R. -- Id: A.7 function "+" (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Adds an INTEGER, L(may be positive or negative), to a SIGNED -- vector, R. -- Id: A.8 function "+" (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Adds a SIGNED vector, L, to an INTEGER, R. --============================================================================ -- Id: A.9 function "-" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0) -- Result: Subtracts two UNSIGNED vectors that may be of different lengths. -- Id: A.9R function "-"(L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Similar to A.9 where R is a one bit UNSIGNED -- Id: A.9L function "-"(L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Similar to A.9 where L is a one bit UNSIGNED -- Id: A.10 function "-" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(MAXIMUM(L'LENGTH, R'LENGTH)-1 downto 0) -- Result: Subtracts a SIGNED vector, R, from another SIGNED vector, L, -- that may possibly be of different lengths. -- Id: A.10R function "-"(L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Similar to A.10 where R is bit 0 of a non-negative. -- Id: A.10L function "-"(L : BIT; R : SIGNED) return SIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Similar to A.10 where R is bit 0 of a non-negative. -- Id: A.11 function "-" (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Subtracts a nonnegative INTEGER, R, from an UNSIGNED vector, L. -- Id: A.12 function "-" (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Subtracts an UNSIGNED vector, R, from a nonnegative INTEGER, L. -- Id: A.13 function "-" (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Subtracts an INTEGER, R, from a SIGNED vector, L. -- Id: A.14 function "-" (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Subtracts a SIGNED vector, R, from an INTEGER, L. --============================================================================ -- Id: A.15 function "*" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED((L'LENGTH+R'LENGTH-1) downto 0) -- Result: Performs the multiplication operation on two UNSIGNED vectors -- that may possibly be of different lengths. -- Id: A.16 function "*" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED((L'LENGTH+R'LENGTH-1) downto 0) -- Result: Multiplies two SIGNED vectors that may possibly be of -- different lengths. -- Id: A.17 function "*" (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED((L'LENGTH+L'LENGTH-1) downto 0) -- Result: Multiplies an UNSIGNED vector, L, with a nonnegative -- INTEGER, R. R is converted to an UNSIGNED vector of -- size L'LENGTH before multiplication. -- Id: A.18 function "*" (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED((R'LENGTH+R'LENGTH-1) downto 0) -- Result: Multiplies an UNSIGNED vector, R, with a nonnegative -- INTEGER, L. L is converted to an UNSIGNED vector of -- size R'LENGTH before multiplication. -- Id: A.19 function "*" (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED((L'LENGTH+L'LENGTH-1) downto 0) -- Result: Multiplies a SIGNED vector, L, with an INTEGER, R. R is -- converted to a SIGNED vector of size L'LENGTH before -- multiplication. -- Id: A.20 function "*" (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED((R'LENGTH+R'LENGTH-1) downto 0) -- Result: Multiplies a SIGNED vector, R, with an INTEGER, L. L is -- converted to a SIGNED vector of size R'LENGTH before -- multiplication. --============================================================================ -- -- NOTE: If second argument is zero for "/" operator, a severity level -- of ERROR is issued. -- Id: A.21 function "/" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Divides an UNSIGNED vector, L, by another UNSIGNED vector, R. -- Id: A.22 function "/" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Divides an SIGNED vector, L, by another SIGNED vector, R. -- Id: A.23 function "/" (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Divides an UNSIGNED vector, L, by a nonnegative INTEGER, R. -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH. -- Id: A.24 function "/" (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Divides a nonnegative INTEGER, L, by an UNSIGNED vector, R. -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH. -- Id: A.25 function "/" (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Divides a SIGNED vector, L, by an INTEGER, R. -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH. -- Id: A.26 function "/" (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Divides an INTEGER, L, by a SIGNED vector, R. -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH. --============================================================================ -- -- NOTE: If second argument is zero for "rem" operator, a severity level -- of ERROR is issued. -- Id: A.27 function "rem" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L rem R" where L and R are UNSIGNED vectors. -- Id: A.28 function "rem" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L rem R" where L and R are SIGNED vectors. -- Id: A.29 function "rem" (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Computes "L rem R" where L is an UNSIGNED vector and R is a -- nonnegative INTEGER. -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH. -- Id: A.30 function "rem" (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L rem R" where R is an UNSIGNED vector and L is a -- nonnegative INTEGER. -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH. -- Id: A.31 function "rem" (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Computes "L rem R" where L is SIGNED vector and R is an INTEGER. -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH. -- Id: A.32 function "rem" (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L rem R" where R is SIGNED vector and L is an INTEGER. -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH. --============================================================================ -- -- NOTE: If second argument is zero for "mod" operator, a severity level -- of ERROR is issued. -- Id: A.33 function "mod" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L mod R" where L and R are UNSIGNED vectors. -- Id: A.34 function "mod" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L mod R" where L and R are SIGNED vectors. -- Id: A.35 function "mod" (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Computes "L mod R" where L is an UNSIGNED vector and R -- is a nonnegative INTEGER. -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH. -- Id: A.36 function "mod" (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L mod R" where R is an UNSIGNED vector and L -- is a nonnegative INTEGER. -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH. -- Id: A.37 function "mod" (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Computes "L mod R" where L is a SIGNED vector and -- R is an INTEGER. -- If NO_OF_BITS(R) > L'LENGTH, result is truncated to L'LENGTH. -- Id: A.38 function "mod" (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Computes "L mod R" where L is an INTEGER and -- R is a SIGNED vector. -- If NO_OF_BITS(L) > R'LENGTH, result is truncated to R'LENGTH. --============================================================================ -- Id: A.39 function find_leftmost (ARG : UNSIGNED; Y : BIT) return INTEGER; -- Result subtype: INTEGER -- Result: Finds the leftmost occurrence of the value of Y in ARG. -- Returns the index of the occurrence if it exists, or -1 otherwise. -- Id: A.40 function find_leftmost (ARG : SIGNED; Y : BIT) return INTEGER; -- Result subtype: INTEGER -- Result: Finds the leftmost occurrence of the value of Y in ARG. -- Returns the index of the occurrence if it exists, or -1 otherwise. -- Id: A.41 function find_rightmost (ARG : UNSIGNED; Y : BIT) return INTEGER; -- Result subtype: INTEGER -- Result: Finds the leftmost occurrence of the value of Y in ARG. -- Returns the index of the occurrence if it exists, or -1 otherwise. -- Id: A.42 function find_rightmost (ARG : SIGNED; Y : BIT) return INTEGER; -- Result subtype: INTEGER -- Result: Finds the leftmost occurrence of the value of Y in ARG. -- Returns the index of the occurrence if it exists, or -1 otherwise. --============================================================================ -- Comparison Operators --============================================================================ -- Id: C.1 function ">" (L, R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.2 function ">" (L, R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L > R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.3 function ">" (L : NATURAL; R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L > R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.4 function ">" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L > R" where L is a INTEGER and -- R is a SIGNED vector. -- Id: C.5 function ">" (L : UNSIGNED; R : NATURAL) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L > R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.6 function ">" (L : SIGNED; R : INTEGER) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L > R" where L is a SIGNED vector and -- R is a INTEGER. --============================================================================ -- Id: C.7 function "<" (L, R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.8 function "<" (L, R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L < R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.9 function "<" (L : NATURAL; R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L < R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.10 function "<" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L < R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.11 function "<" (L : UNSIGNED; R : NATURAL) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L < R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.12 function "<" (L : SIGNED; R : INTEGER) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L < R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.13 function "<=" (L, R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.14 function "<=" (L, R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L <= R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.15 function "<=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L <= R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.16 function "<=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L <= R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.17 function "<=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L <= R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.18 function "<=" (L : SIGNED; R : INTEGER) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L <= R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.19 function ">=" (L, R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.20 function ">=" (L, R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L >= R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.21 function ">=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L >= R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.22 function ">=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L >= R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.23 function ">=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L >= R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.24 function ">=" (L : SIGNED; R : INTEGER) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L >= R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.25 function "=" (L, R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.26 function "=" (L, R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L = R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.27 function "=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L = R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.28 function "=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L = R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.29 function "=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L = R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.30 function "=" (L : SIGNED; R : INTEGER) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L = R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.31 function "/=" (L, R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.32 function "/=" (L, R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L /= R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.33 function "/=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L /= R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.34 function "/=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L /= R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.35 function "/=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L /= R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.36 function "/=" (L : SIGNED; R : INTEGER) return BOOLEAN; -- Result subtype: BOOLEAN -- Result: Computes "L /= R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.37 function MINIMUM (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED -- Result: Returns the lesser of two UNSIGNED vectors that may be -- of different lengths. -- Id: C.38 function MINIMUM (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED -- Result: Returns the lesser of two SIGNED vectors that may be -- of different lengths. -- Id: C.39 function MINIMUM (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED -- Result: Returns the lesser of a nonnegative INTEGER, L, and -- an UNSIGNED vector, R. -- Id: C.40 function MINIMUM (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED -- Result: Returns the lesser of an INTEGER, L, and a SIGNED -- vector, R. -- Id: C.41 function MINIMUM (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED -- Result: Returns the lesser of an UNSIGNED vector, L, and -- a nonnegative INTEGER, R. -- Id: C.42 function MINIMUM (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED -- Result: Returns the lesser of a SIGNED vector, L, and -- an INTEGER, R. --============================================================================ -- Id: C.43 function MAXIMUM (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED -- Result: Returns the greater of two UNSIGNED vectors that may be -- of different lengths. -- Id: C.44 function MAXIMUM (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED -- Result: Returns the greater of two SIGNED vectors that may be -- of different lengths. -- Id: C.45 function MAXIMUM (L : NATURAL; R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED -- Result: Returns the greater of a nonnegative INTEGER, L, and -- an UNSIGNED vector, R. -- Id: C.46 function MAXIMUM (L : INTEGER; R : SIGNED) return SIGNED; -- Result subtype: SIGNED -- Result: Returns the greater of an INTEGER, L, and a SIGNED -- vector, R. -- Id: C.47 function MAXIMUM (L : UNSIGNED; R : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED -- Result: Returns the greater of an UNSIGNED vector, L, and -- a nonnegative INTEGER, R. -- Id: C.48 function MAXIMUM (L : SIGNED; R : INTEGER) return SIGNED; -- Result subtype: SIGNED -- Result: Returns the greater of a SIGNED vector, L, and -- an INTEGER, R. --============================================================================ -- Id: C.49 function "?>" (L, R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L > R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.50 function "?>" (L, R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L > R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.51 function "?>" (L : NATURAL; R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L > R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.52 function "?>" (L : INTEGER; R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L > R" where L is a INTEGER and -- R is a SIGNED vector. -- Id: C.53 function "?>" (L : UNSIGNED; R : NATURAL) return BIT; -- Result subtype: BIT -- Result: Computes "L > R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.54 function "?>" (L : SIGNED; R : INTEGER) return BIT; -- Result subtype: BIT -- Result: Computes "L > R" where L is a SIGNED vector and -- R is a INTEGER. --============================================================================ -- Id: C.55 function "?<" (L, R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L < R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.56 function "?<" (L, R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L < R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.57 function "?<" (L : NATURAL; R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L < R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.58 function "?<" (L : INTEGER; R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L < R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.59 function "?<" (L : UNSIGNED; R : NATURAL) return BIT; -- Result subtype: BIT -- Result: Computes "L < R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.60 function "?<" (L : SIGNED; R : INTEGER) return BIT; -- Result subtype: BIT -- Result: Computes "L < R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.61 function "?<=" (L, R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L <= R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.62 function "?<=" (L, R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L <= R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.63 function "?<=" (L : NATURAL; R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L <= R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.64 function "?<=" (L : INTEGER; R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L <= R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.65 function "?<=" (L : UNSIGNED; R : NATURAL) return BIT; -- Result subtype: BIT -- Result: Computes "L <= R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.66 function "?<=" (L : SIGNED; R : INTEGER) return BIT; -- Result subtype: BIT -- Result: Computes "L <= R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.67 function "?>=" (L, R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L >= R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.68 function "?>=" (L, R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L >= R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.69 function "?>=" (L : NATURAL; R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L >= R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.70 function "?>=" (L : INTEGER; R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L >= R" where L is an INTEGER and -- R is a SIGNED vector. -- Id: C.71 function "?>=" (L : UNSIGNED; R : NATURAL) return BIT; -- Result subtype: BIT -- Result: Computes "L >= R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.72 function "?>=" (L : SIGNED; R : INTEGER) return BIT; -- Result subtype: BIT -- Result: Computes "L >= R" where L is a SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.73 function "?=" (L, R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L = R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.74 function "?=" (L, R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L = R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.75 function "?=" (L : NATURAL; R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L = R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.76 function "?=" (L : INTEGER; R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L = R" where L is an INTEGER and -- R is an SIGNED vector. -- Id: C.77 function "?=" (L : UNSIGNED; R : NATURAL) return BIT; -- Result subtype: BIT -- Result: Computes "L = R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.78 function "?=" (L : SIGNED; R : INTEGER) return BIT; -- Result subtype: BIT -- Result: Computes "L = R" where L is an SIGNED vector and -- R is an INTEGER. --============================================================================ -- Id: C.79 function "?/=" (L, R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L /= R" where L and R are UNSIGNED vectors possibly -- of different lengths. -- Id: C.80 function "?/=" (L, R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L /= R" where L and R are SIGNED vectors possibly -- of different lengths. -- Id: C.81 function "?/=" (L : NATURAL; R : UNSIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L /= R" where L is a nonnegative INTEGER and -- R is an UNSIGNED vector. -- Id: C.82 function "?/=" (L : INTEGER; R : SIGNED) return BIT; -- Result subtype: BIT -- Result: Computes "L /= R" where L is an INTEGER and -- R is an SIGNED vector. -- Id: C.83 function "?/=" (L : UNSIGNED; R : NATURAL) return BIT; -- Result subtype: BIT -- Result: Computes "L /= R" where L is an UNSIGNED vector and -- R is a nonnegative INTEGER. -- Id: C.84 function "?/=" (L : SIGNED; R : INTEGER) return BIT; -- Result subtype: BIT -- Result: Computes "L /= R" where L is an SIGNED vector and -- R is an INTEGER. --============================================================================ -- Shift and Rotate Functions --============================================================================ -- Id: S.1 function SHIFT_LEFT (ARG : UNSIGNED; COUNT : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a shift-left on an UNSIGNED vector COUNT times. -- The vacated positions are filled with Bit '0'. -- The COUNT leftmost bits are lost. -- Id: S.2 function SHIFT_RIGHT (ARG : UNSIGNED; COUNT : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a shift-right on an UNSIGNED vector COUNT times. -- The vacated positions are filled with Bit '0'. -- The COUNT rightmost bits are lost. -- Id: S.3 function SHIFT_LEFT (ARG : SIGNED; COUNT : NATURAL) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a shift-left on a SIGNED vector COUNT times. -- The vacated positions are filled with Bit '0'. -- The COUNT leftmost bits are lost. -- Id: S.4 function SHIFT_RIGHT (ARG : SIGNED; COUNT : NATURAL) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a shift-right on a SIGNED vector COUNT times. -- The vacated positions are filled with the leftmost bit, ARG'LEFT. -- The COUNT rightmost bits are lost. --============================================================================ -- Id: S.5 function ROTATE_LEFT (ARG : UNSIGNED; COUNT : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a rotate-left of an UNSIGNED vector COUNT times. -- Id: S.6 function ROTATE_RIGHT (ARG : UNSIGNED; COUNT : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a rotate-right of an UNSIGNED vector COUNT times. -- Id: S.7 function ROTATE_LEFT (ARG : SIGNED; COUNT : NATURAL) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a logical rotate-left of a SIGNED vector COUNT times. -- Id: S.8 function ROTATE_RIGHT (ARG : SIGNED; COUNT : NATURAL) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: Performs a logical rotate-right of a SIGNED vector COUNT times. --============================================================================ ------------------------------------------------------------------------------ -- Note: Function S.9 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.9 function "sll" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_LEFT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.10 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.10 function "sll" (ARG : SIGNED; COUNT : INTEGER) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_LEFT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.11 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.11 function "srl" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_RIGHT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.12 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.12 function "srl" (ARG : SIGNED; COUNT : INTEGER) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: SIGNED(SHIFT_RIGHT(UNSIGNED(ARG), COUNT)) ------------------------------------------------------------------------------ -- Note: Function S.13 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.13 function "rol" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: ROTATE_LEFT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.14 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.14 function "rol" (ARG : SIGNED; COUNT : INTEGER) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: ROTATE_LEFT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.15 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.15 function "ror" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: ROTATE_RIGHT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.16 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.16 function "ror" (ARG : SIGNED; COUNT : INTEGER) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: ROTATE_RIGHT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.17 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.17 function "sla" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_LEFT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.18 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.18 function "sla" (ARG : SIGNED; COUNT : INTEGER) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_LEFT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.19 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.19 function "sra" (ARG : UNSIGNED; COUNT : INTEGER) return UNSIGNED; -- Result subtype: UNSIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_RIGHT(ARG, COUNT) ------------------------------------------------------------------------------ -- Note: Function S.20 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: S.20 function "sra" (ARG : SIGNED; COUNT : INTEGER) return SIGNED; -- Result subtype: SIGNED(ARG'LENGTH-1 downto 0) -- Result: SHIFT_RIGHT(ARG, COUNT) --============================================================================ -- RESIZE Functions --============================================================================ -- Id: R.1 function RESIZE (ARG : SIGNED; NEW_SIZE : NATURAL) return SIGNED; -- Result subtype: SIGNED(NEW_SIZE-1 downto 0) -- Result: Resizes the SIGNED vector ARG to the specified size. -- To create a larger vector, the new [leftmost] bit positions -- are filled with the sign bit (ARG'LEFT). When truncating, -- the sign bit is retained along with the rightmost part. -- Id: R.2 function RESIZE (ARG : UNSIGNED; NEW_SIZE : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(NEW_SIZE-1 downto 0) -- Result: Resizes the UNSIGNED vector ARG to the specified size. -- To create a larger vector, the new [leftmost] bit positions -- are filled with '0'. When truncating, the leftmost bits -- are dropped. function RESIZE (ARG, SIZE_RES : UNSIGNED) return UNSIGNED; -- Result subtype: UNRESOLVED_UNSIGNED (SIZE_RES'length-1 downto 0) function RESIZE (ARG, SIZE_RES : SIGNED) return SIGNED; -- Result subtype: UNRESOLVED_SIGNED (SIZE_RES'length-1 downto 0) --============================================================================ -- Conversion Functions --============================================================================ -- Id: D.1 function TO_INTEGER (ARG : UNSIGNED) return NATURAL; -- Result subtype: NATURAL. Value cannot be negative since parameter is an -- UNSIGNED vector. -- Result: Converts the UNSIGNED vector to an INTEGER. -- Id: D.2 function TO_INTEGER (ARG : SIGNED) return INTEGER; -- Result subtype: INTEGER -- Result: Converts a SIGNED vector to an INTEGER. -- Id: D.3 function TO_UNSIGNED (ARG, SIZE : NATURAL) return UNSIGNED; -- Result subtype: UNSIGNED(SIZE-1 downto 0) -- Result: Converts a nonnegative INTEGER to an UNSIGNED vector with -- the specified size. -- Id: D.4 function TO_SIGNED (ARG : INTEGER; SIZE : NATURAL) return SIGNED; -- Result subtype: SIGNED(SIZE-1 downto 0) -- Result: Converts an INTEGER to a SIGNED vector of the specified size. function TO_UNSIGNED (ARG : NATURAL; SIZE_RES : UNSIGNED) return UNSIGNED; -- Result subtype: UNRESOLVED_UNSIGNED(SIZE_RES'length-1 downto 0) function TO_SIGNED (ARG : INTEGER; SIZE_RES : SIGNED) return SIGNED; -- Result subtype: UNRESOLVED_SIGNED(SIZE_RES'length-1 downto 0) --============================================================================ -- Logical Operators --============================================================================ -- Id: L.1 function "not" (L : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Termwise inversion -- Id: L.2 function "and" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Vector AND operation -- Id: L.3 function "or" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Vector OR operation -- Id: L.4 function "nand" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Vector NAND operation -- Id: L.5 function "nor" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Vector NOR operation -- Id: L.6 function "xor" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Vector XOR operation ------------------------------------------------------------------------------ -- Note: Function L.7 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: L.7 function "xnor" (L, R : UNSIGNED) return UNSIGNED; -- Result subtype: UNSIGNED(L'LENGTH-1 downto 0) -- Result: Vector XNOR operation -- Id: L.8 function "not" (L : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Termwise inversion -- Id: L.9 function "and" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector AND operation -- Id: L.10 function "or" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector OR operation -- Id: L.11 function "nand" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector NAND operation -- Id: L.12 function "nor" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector NOR operation -- Id: L.13 function "xor" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector XOR operation ------------------------------------------------------------------------------ -- Note: Function L.14 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: L.14 function "xnor" (L, R : SIGNED) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector XNOR operation -- Id: L.15 function "and" (L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector AND operation -- Id: L.16 function "and" (L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar AND operation -- Id: L.17 function "or" (L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector OR operation -- Id: L.18 function "or" (L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar OR operation -- Id: L.19 function "nand" (L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector NAND operation -- Id: L.20 function "nand" (L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar NAND operation -- Id: L.21 function "nor" (L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector NOR operation -- Id: L.22 function "nor" (L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar NOR operation -- Id: L.23 function "xor" (L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector XOR operation -- Id: L.24 function "xor" (L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar XOR operation ------------------------------------------------------------------------------ -- Note: Function L.25 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: L.25 function "xnor" (L : BIT; R : UNSIGNED) return UNSIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector XNOR operation ------------------------------------------------------------------------------ -- Note: Function L.26 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: L.26 function "xnor" (L : UNSIGNED; R : BIT) return UNSIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar XNOR operation -- Id: L.27 function "and" (L : BIT; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector AND operation -- Id: L.28 function "and" (L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar AND operation -- Id: L.29 function "or" (L : BIT; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector OR operation -- Id: L.30 function "or" (L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar OR operation -- Id: L.31 function "nand" (L : BIT; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector NAND operation -- Id: L.32 function "nand" (L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar NAND operation -- Id: L.33 function "nor" (L : BIT; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector NOR operation -- Id: L.34 function "nor" (L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar NOR operation -- Id: L.35 function "xor" (L : BIT; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector XOR operation -- Id: L.36 function "xor" (L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar XOR operation ------------------------------------------------------------------------------ -- Note: Function L.37 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: L.37 function "xnor" (L : BIT; R : SIGNED) return SIGNED; -- Result subtype: SIGNED(R'LENGTH-1 downto 0) -- Result: Scalar/Vector XNOR operation ------------------------------------------------------------------------------ -- Note: Function L.38 is not compatible with IEEE Std 1076-1987. Comment -- out the function (declaration and body) for IEEE Std 1076-1987 compatibility. ------------------------------------------------------------------------------ -- Id: L.38 function "xnor" (L : SIGNED; R : BIT) return SIGNED; -- Result subtype: SIGNED(L'LENGTH-1 downto 0) -- Result: Vector/Scalar XNOR operation ------------------------------------------------------------------------------ -- Note: Function L.39 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.39 function "and" (L : SIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of and'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.40 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.40 function "nand" (L : SIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of nand'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.41 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.41 function "or" (L : SIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of or'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.42 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.42 function "nor" (L : SIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of nor'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.43 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.43 function "xor" (L : SIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of xor'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.44 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.44 function "xnor" (L : SIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of xnor'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.45 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.45 function "and" (L : UNSIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of and'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.46 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.46 function "nand" (L : UNSIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of nand'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.47 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.47 function "or" (L : UNSIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of or'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.48 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.48 function "nor" (L : UNSIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of nor'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.49 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.49 function "xor" (L : UNSIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of xor'ing all of the bits of the vector. ------------------------------------------------------------------------------ -- Note: Function L.50 is not compatible with editions of IEEE Std 1076 from -- 1987 through 2002. Comment out the function (declaration and body) for -- compatibility with these editions. ------------------------------------------------------------------------------ -- Id: L.50 function "xnor" (L : UNSIGNED) return BIT; -- Result subtype: BIT. -- Result: Result of xnor'ing all of the bits of the vector. --============================================================================ -- Edge Detection Functions --============================================================================ -- Id: E.1 alias RISING_EDGE is STD.STANDARD.RISING_EDGE [STD.STANDARD.BIT return STD.STANDARD.BOOLEAN]; -- Result subtype: BOOLEAN -- Result: Returns TRUE if an event is detected on signal S and the -- value changed from a '0' to a '1'. -- Id: E.2 alias FALLING_EDGE is STD.STANDARD.FALLING_EDGE [STD.STANDARD.BIT return STD.STANDARD.BOOLEAN]; -- Result subtype: BOOLEAN -- Result: Returns TRUE if an event is detected on signal S and the -- value changed from a '1' to a '0'. --============================================================================ -- string conversion and write operations --============================================================================ -- the following operations are predefined -- FUNCTION TO_STRING ( value : UNSIGNED ) RETURN string; -- FUNCTION TO_STRING ( value : SIGNED ) RETURN string; -- explicitly defined operations alias TO_BSTRING is TO_STRING [UNSIGNED return STRING]; alias TO_BSTRING is TO_STRING [SIGNED return STRING]; alias to_binary_string is TO_STRING [UNSIGNED return STRING]; alias to_binary_string is TO_STRING [SIGNED return STRING]; function TO_OSTRING (value : UNSIGNED) return STRING; function TO_OSTRING (value : SIGNED) return STRING; alias to_octal_string is TO_OSTRING [UNSIGNED return STRING]; alias to_octal_string is TO_OSTRING [SIGNED return STRING]; function to_hstring (value : UNSIGNED) return STRING; function to_hstring (value : SIGNED) return STRING; alias to_hex_string is to_hstring [UNSIGNED return STRING]; alias to_hex_string is to_hstring [SIGNED return STRING]; procedure READ(L : inout LINE; VALUE : out UNSIGNED; GOOD : out BOOLEAN); procedure READ(L : inout LINE; VALUE : out UNSIGNED); procedure READ(L : inout LINE; VALUE : out SIGNED; GOOD : out BOOLEAN); procedure READ(L : inout LINE; VALUE : out SIGNED); procedure WRITE (L : inout LINE; VALUE : in UNSIGNED; JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure WRITE (L : inout LINE; VALUE : in SIGNED; JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); alias BREAD is READ [LINE, UNSIGNED, BOOLEAN]; alias BREAD is READ [LINE, SIGNED, BOOLEAN]; alias BREAD is READ [LINE, UNSIGNED]; alias BREAD is READ [LINE, SIGNED]; alias BINARY_READ is READ [LINE, UNSIGNED, BOOLEAN]; alias BINARY_READ is READ [LINE, SIGNED, BOOLEAN]; alias BINARY_READ is READ [LINE, UNSIGNED]; alias BINARY_READ is READ [LINE, SIGNED]; procedure OREAD (L : inout LINE; VALUE : out UNSIGNED; GOOD : out BOOLEAN); procedure OREAD (L : inout LINE; VALUE : out SIGNED; GOOD : out BOOLEAN); procedure OREAD (L : inout LINE; VALUE : out UNSIGNED); procedure OREAD (L : inout LINE; VALUE : out SIGNED); alias OCTAL_READ is OREAD [LINE, UNSIGNED, BOOLEAN]; alias OCTAL_READ is OREAD [LINE, SIGNED, BOOLEAN]; alias OCTAL_READ is OREAD [LINE, UNSIGNED]; alias OCTAL_READ is OREAD [LINE, SIGNED]; procedure HREAD (L : inout LINE; VALUE : out UNSIGNED; GOOD : out BOOLEAN); procedure HREAD (L : inout LINE; VALUE : out SIGNED; GOOD : out BOOLEAN); procedure HREAD (L : inout LINE; VALUE : out UNSIGNED); procedure HREAD (L : inout LINE; VALUE : out SIGNED); alias HEX_READ is HREAD [LINE, UNSIGNED, BOOLEAN]; alias HEX_READ is HREAD [LINE, SIGNED, BOOLEAN]; alias HEX_READ is HREAD [LINE, UNSIGNED]; alias HEX_READ is HREAD [LINE, SIGNED]; alias BWRITE is WRITE [LINE, UNSIGNED, SIDE, WIDTH]; alias BWRITE is WRITE [LINE, SIGNED, SIDE, WIDTH]; alias BINARY_WRITE is WRITE [LINE, UNSIGNED, SIDE, WIDTH]; alias BINARY_WRITE is WRITE [LINE, SIGNED, SIDE, WIDTH]; procedure OWRITE (L : inout LINE; VALUE : in UNSIGNED; JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure OWRITE (L : inout LINE; VALUE : in SIGNED; JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); alias OCTAL_WRITE is OWRITE [LINE, UNSIGNED, SIDE, WIDTH]; alias OCTAL_WRITE is OWRITE [LINE, SIGNED, SIDE, WIDTH]; procedure HWRITE (L : inout LINE; VALUE : in UNSIGNED; JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); procedure HWRITE (L : inout LINE; VALUE : in SIGNED; JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0); alias HEX_WRITE is HWRITE [LINE, UNSIGNED, SIDE, WIDTH]; alias HEX_WRITE is HWRITE [LINE, SIGNED, SIDE, WIDTH]; end package NUMERIC_BIT;
gpl-2.0
27936515dd677cd90b2c68d33df83be7
0.562188
4.27109
false
false
false
false