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
freecores/usb_fpga_1_11
examples/usb-fpga-2.16/2.16b/mmio/fpga/ucecho.vhd
4
3,683
library ieee; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; --#use IEEE.numeric_std.all; Library UNISIM; use UNISIM.vcomponents.all; entity ucecho is port( fxclk_in : in std_logic; MM_A : in std_logic_vector(15 downto 0); MM_D : inout std_logic_vector(7 downto 0); MM_WRN : in std_logic; MM_RDN : in std_logic; MM_PSENN : in std_logic ); end ucecho; architecture RTL of ucecho is --signal declaration signal rd : std_logic := '1'; signal rd0,rd1 : std_logic := '1'; signal wr : std_logic := '1'; signal wr0,wr1 : std_logic := '1'; signal datain : std_logic_vector(7 downto 0); signal dataout : std_logic_vector(7 downto 0); signal fxclk : std_logic; -- 96 MHz signal fxclk_fb : std_logic; begin -- PLL is used as clock filter fxclk_pll : PLLE2_BASE generic map ( BANDWIDTH => "OPTIMIZED", -- OPTIMIZED, HIGH, LOW CLKFBOUT_MULT => 20, -- Multiply value for all CLKOUT, (2-64) CLKFBOUT_PHASE => 0.0, -- Phase offset in degrees of CLKFB, (-360.000-360.000). CLKIN1_PERIOD => 0.0, -- Input clock period in ns to ps resolution (i.e. 33.333 is 30 MHz). -- CLKOUT0_DIVIDE - CLKOUT5_DIVIDE: Divide amount for each CLKOUT (1-128) CLKOUT0_DIVIDE => 10, CLKOUT1_DIVIDE => 1, CLKOUT2_DIVIDE => 1, CLKOUT3_DIVIDE => 1, CLKOUT4_DIVIDE => 1, CLKOUT5_DIVIDE => 1, -- CLKOUT0_DUTY_CYCLE - CLKOUT5_DUTY_CYCLE: Duty cycle for each CLKOUT (0.001-0.999). CLKOUT0_DUTY_CYCLE => 0.5, CLKOUT1_DUTY_CYCLE => 0.5, CLKOUT2_DUTY_CYCLE => 0.5, CLKOUT3_DUTY_CYCLE => 0.5, CLKOUT4_DUTY_CYCLE => 0.5, CLKOUT5_DUTY_CYCLE => 0.5, -- CLKOUT0_PHASE - CLKOUT5_PHASE: Phase offset for each CLKOUT (-360.000-360.000). CLKOUT0_PHASE => 0.0, CLKOUT1_PHASE => 0.0, CLKOUT2_PHASE => 0.0, CLKOUT3_PHASE => 0.0, CLKOUT4_PHASE => 0.0, CLKOUT5_PHASE => 0.0, DIVCLK_DIVIDE => 1, -- Master division value, (1-56) REF_JITTER1 => 0.0, -- Reference input jitter in UI, (0.000-0.999). STARTUP_WAIT => "FALSE" -- Delay DONE until PLL Locks, ("TRUE"/"FALSE") ) port map ( CLKOUT0 => fxclk, CLKFBOUT => fxclk_fb, -- 1-bit output: Feedback clock CLKIN1 => fxclk_in, -- 1-bit input: Input clock PWRDWN => '0', -- 1-bit input: Power-down RST => '0', -- 1-bit input: Reset CLKFBIN => fxclk_fb -- 1-bit input: Feedback clock ); rd <= MM_RDN and MM_PSENN; wr <= MM_WRN; MM_D <= dataout when ((rd1 or rd0 or rd) = '0') else ( others => 'Z' ); -- enable output dpUCECHO: process(fxclk) begin if fxclk' event and fxclk = '1' then if (wr1 = '1') and (wr0 = '0') -- EZ-USB write strobe then if MM_A = conv_std_logic_vector(16#5001#,16) -- read data from EZ-USB if addr=0x5001 then datain <= MM_D; end if; elsif (rd1 = '1') and (rd0 = '0') -- EZ-USB read strobe then if MM_A = conv_std_logic_vector(16#5002#,16) -- write data to EZ-USB if addr=0x5002 then if ( datain >= conv_std_logic_vector(97,8) ) and ( datain <= conv_std_logic_vector(122,8) ) -- do the upercase conversion then dataout <= datain - conv_std_logic_vector(32,8); else dataout <= datain ; end if; end if; end if; rd0 <= rd; rd1 <= rd0; wr0 <= wr; wr1 <= wr0; end if; end process dpUCECHO; end RTL;
gpl-3.0
14754cf823cd2514811275dede460cb7
0.556611
3.169535
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/game_over/example_design/game_over_exdes.vhd
1
4,342
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7.1 Core - Top-level core wrapper -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006-2010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: game_over_exdes.vhd -- -- Description: -- This is the actual BMG core wrapper. -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: August 31, 2005 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY UNISIM; USE UNISIM.VCOMPONENTS.ALL; -------------------------------------------------------------------------------- -- Entity Declaration -------------------------------------------------------------------------------- ENTITY game_over_exdes IS PORT ( --Inputs - Port A ADDRA : IN STD_LOGIC_VECTOR(14 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END game_over_exdes; ARCHITECTURE xilinx OF game_over_exdes IS COMPONENT BUFG IS PORT ( I : IN STD_ULOGIC; O : OUT STD_ULOGIC ); END COMPONENT; COMPONENT game_over IS PORT ( --Port A ADDRA : IN STD_LOGIC_VECTOR(14 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END COMPONENT; SIGNAL CLKA_buf : STD_LOGIC; SIGNAL CLKB_buf : STD_LOGIC; SIGNAL S_ACLK_buf : STD_LOGIC; BEGIN bufg_A : BUFG PORT MAP ( I => CLKA, O => CLKA_buf ); bmg0 : game_over PORT MAP ( --Port A ADDRA => ADDRA, DOUTA => DOUTA, CLKA => CLKA_buf ); END xilinx;
mit
24be6642b27899234af1818df77f1a74
0.57485
4.79779
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_src0_data_stream_0_V.vhd
2
4,621
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_src0_data_stream_0_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_src0_data_stream_0_V_shiftReg; architecture rtl of FIFO_image_filter_src0_data_stream_0_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_src0_data_stream_0_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_src0_data_stream_0_V is component FIFO_image_filter_src0_data_stream_0_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_src0_data_stream_0_V_shiftReg : FIFO_image_filter_src0_data_stream_0_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
30dfa1457c80a3d984e60b7b46786994
0.538628
3.464018
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-ml403/leon3mp.vhd
1
25,944
----------------------------------------------------------------------------- -- LEON3 Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib, techmap; use grlib.amba.all; use grlib.devices.all; use grlib.stdlib.all; use techmap.gencomp.all; use techmap.allclkgen.all; library gaisler; use gaisler.memctrl.all; use gaisler.ddrpkg.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.i2c.all; use gaisler.net.all; use gaisler.jtag.all; use gaisler.spacewire.all; library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( sys_rst_in : in std_ulogic; sys_clk : in std_ulogic; -- 100 MHz main clock --pragma translate_off plb_error : out std_logic; -- ERRORn --pragma translate_on opb_error : out std_logic; -- DSU active sram_flash_addr : out std_logic_vector(20 downto 0); sram_flash_data : inout std_logic_vector(31 downto 0); sram_cen : out std_logic; sram_bw : out std_logic_vector (0 to 3); sram_flash_oe_n : out std_ulogic; sram_flash_we_n : out std_ulogic; flash_ce : out std_logic; sram_clk : out std_ulogic; sram_clk_fb : in std_ulogic; sram_adv_ld_n : out std_ulogic; --pragma translate_off iosn : out std_ulogic; --pragma translate_on ddr_clk : out std_logic; ddr_clkb : out std_logic; ddr_clk_fb : in std_logic; ddr_cke : out std_logic; ddr_csb : out std_logic; ddr_web : out std_ulogic; -- ddr write enable ddr_rasb : out std_ulogic; -- ddr ras ddr_casb : out std_ulogic; -- ddr cas ddr_dm : out std_logic_vector (3 downto 0); -- ddr dm ddr_dqs : inout std_logic_vector (3 downto 0); -- ddr dqs ddr_ad : out std_logic_vector (12 downto 0); -- ddr address ddr_ba : out std_logic_vector (1 downto 0); -- ddr bank address ddr_dq : inout std_logic_vector (31 downto 0); -- ddr data txd1 : out std_ulogic; -- UART1 tx data rxd1 : in std_ulogic; -- UART1 rx data gpio : inout std_logic_vector(13 downto 0); -- I/O port phy_gtx_clk : out std_logic; phy_mii_data : inout std_logic; -- ethernet PHY interface phy_tx_clk : in std_ulogic; phy_rx_clk : in std_ulogic; phy_rx_data : in std_logic_vector(7 downto 0); phy_dv : in std_ulogic; phy_rx_er : in std_ulogic; phy_col : in std_ulogic; phy_crs : in std_ulogic; phy_tx_data : out std_logic_vector(7 downto 0); phy_tx_en : out std_ulogic; phy_tx_er : out std_ulogic; phy_mii_clk : out std_ulogic; phy_rst_n : out std_ulogic; ps2_keyb_clk : inout std_logic; ps2_keyb_data : inout std_logic; ps2_mouse_clk : inout std_logic; ps2_mouse_data : inout std_logic; tft_lcd_clk : out std_ulogic; vid_hsync : out std_ulogic; vid_vsync : out std_ulogic; vid_r : out std_logic_vector(7 downto 3); vid_g : out std_logic_vector(7 downto 3); vid_b : out std_logic_vector(7 downto 3); usb_csn : out std_logic; iic_scl : inout std_ulogic; iic_sda : inout std_ulogic ); end; architecture rtl of leon3mp is constant blength : integer := 12; constant fifodepth : integer := 8; constant maxahbm : integer := NCPU+CFG_AHB_UART +CFG_GRETH+CFG_AHB_JTAG+CFG_SVGA_ENABLE; signal vcc, gnd : std_logic_vector(4 downto 0); signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal sdi : sdctrl_in_type; signal sdo : sdctrl_out_type; signal sdo2 : sdctrl_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, rstraw, srclkl : std_ulogic; signal clkm_90, clkm_180, clkm_270 : std_ulogic; signal cgi, cgi2 : clkgen_in_type; signal cgo, cgo2 : clkgen_out_type; signal u1i, u2i, dui : uart_in_type; signal u1o, u2o, duo : uart_out_type; signal irqi : irq_in_vector(0 to NCPU-1); signal irqo : irq_out_vector(0 to NCPU-1); signal dbgi : l3_debug_in_vector(0 to NCPU-1); signal dbgo : l3_debug_out_vector(0 to NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal ethi, ethi1, ethi2 : eth_in_type; signal etho, etho1, etho2 : eth_out_type; signal gpti : gptimer_in_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal clklock, lock, lclk, clkml, rst, ndsuact : std_ulogic; signal tck, tckn, tms, tdi, tdo : std_ulogic; signal ddrclk, ddrrst : std_ulogic; signal ethclk, egtx_clk_fb : std_ulogic; signal egtx_clk, legtx_clk, l2egtx_clk : std_ulogic; signal kbdi : ps2_in_type; signal kbdo : ps2_out_type; signal moui : ps2_in_type; signal mouo : ps2_out_type; signal vgao : apbvga_out_type; signal clk_sel : std_logic_vector(1 downto 0); signal clkval : std_logic_vector(1 downto 0); signal clkvga, clk1x, video_clk, dac_clk : std_ulogic; signal i2ci : i2c_in_type; signal i2co : i2c_out_type; constant BOARD_FREQ : integer := 100000; -- input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz constant I2C_FILTER : integer := (CPU_FREQ*5+50000)/100000+1; constant IOAEN : integer := CFG_DDRSP; signal stati : ahbstat_in_type; signal ddrclkfb, ssrclkfb, ddr_clkl, ddr_clk90l, ddr_clknl, ddr_clk270l : std_ulogic; signal ddr_clkv : std_logic_vector(2 downto 0); signal ddr_clkbv : std_logic_vector(2 downto 0); signal ddr_ckev : std_logic_vector(1 downto 0); signal ddr_csbv : std_logic_vector(1 downto 0); signal ddr_adl : std_logic_vector (13 downto 0); attribute syn_keep : boolean; attribute syn_preserve : boolean; attribute syn_keep of clkml : signal is true; attribute syn_preserve of clkml : signal is true; attribute syn_keep of egtx_clk : signal is true; attribute syn_preserve of egtx_clk : signal is true; attribute keep : boolean; attribute keep of lock : signal is true; attribute keep of clkml : signal is true; attribute keep of clkm : signal is true; attribute keep of egtx_clk : signal is true; signal romsn : std_ulogic; constant SPW_LOOP_BACK : integer := 0; begin usb_csn <= '1'; ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= (others => '1'); gnd <= (others => '0'); cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; cgi.pllref <= ssrclkfb; ssrref_pad : clkpad generic map (tech => padtech) port map (sram_clk_fb, ssrclkfb); clk_pad : clkpad generic map (tech => padtech, arch => 2) port map (sys_clk, lclk); srclk_pad : outpad generic map (tech => padtech, slew => 1, strength => 24) port map (sram_clk, srclkl); clkgen0 : clkgen -- system clock generator generic map (CFG_FABTECH, CFG_CLKMUL, CFG_CLKDIV, 1, 0, 0, 0, 0, BOARD_FREQ, 0) port map (lclk, gnd(0), clkm, open, open, srclkl, open, cgi, cgo, open, clk1x); g1clk : if CFG_GRETH1G /= 0 generate clkgen1 : clkgen -- Ethernet 1G PHY clock generator generic map (CFG_FABTECH, 5, 4, 0, 0, 0, 0, 0, BOARD_FREQ, 0) port map (lclk, gnd(0), egtx_clk, open, open, open, open, cgi2, cgo2); cgi2.pllctrl <= "00"; cgi2.pllrst <= rstraw; --cgi2.pllref <= egtx_clk_fb; egtx_clk_pad : outpad generic map (tech => padtech) port map (phy_gtx_clk, egtx_clk); clklock <= lock and cgo2.clklock; end generate; nog1clk : if CFG_GRETH1G = 0 generate clklock <= lock; end generate; resetn_pad : inpad generic map (tech => padtech) port map (sys_rst_in, rst); rst0 : rstgen -- reset generator port map (rst, clkm, clklock, rstn, rstraw); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, devid => XILINX_ML401, ioen => IOAEN, nahbm => maxahbm, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- l3 : if CFG_LEON3 = 1 generate cpu : for i in 0 to NCPU-1 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; --pragma translate_off errorn_pad : odpad generic map (tech => padtech) port map (plb_error, dbgo(0).error); --pragma translate_on dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); -- dsuen_pad : inpad generic map (tech => padtech) port map (dsuen, dsui.enable); dsui.enable <= '1'; -- dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsui.break <= gpioo.val(11); -- South Button -- dsuact_pad : outpad generic map (tech => padtech) port map (dsuact, ndsuact); dsuact_pad : outpad generic map (tech => padtech) port map (opb_error, ndsuact); ndsuact <= not dsuo.active; end generate; end generate; nodsu : if CFG_DSU = 0 generate dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_UART = 1 generate dcom0: ahbuart -- Debug UART generic map (hindex => NCPU, pindex => 7, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(7), ahbmi, ahbmo(NCPU)); -- dsurx_pad : inpad generic map (tech => padtech) port map (rxd1, dui.rxd); -- dsutx_pad : outpad generic map (tech => padtech) port map (txd1, duo.txd); dui.rxd <= rxd1 when gpioo.val(13) = '1' else '1'; end generate; txd1 <= duo.txd when gpioo.val(13) = '1' else u1o.txd; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd(0)); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "10"; memi.brdyn <= '1'; memi.bexcn <= '1'; ssr0 : if CFG_SSCTRL = 1 generate ssrctrl0 : ssrctrl generic map (hindex => 3, pindex => 0, ramaddr => 16#600#) port map (rstn, clkm, ahbsi, ahbso(3), apbi, apbo(0), memi, memo); end generate; mctrl0 : if CFG_MCTRL_LEON2 = 1 generate mctrl0 : mctrl generic map (hindex => 3, pindex => 0, ramaddr => 16#C00#, rammask => 16#FF0#, paddr => 0, srbanks => 1, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT, sden => CFG_MCTRL_SDEN, invclk => CFG_MCTRL_INVCLK, sepbus => CFG_MCTRL_SEPBUS) port map (rstn, clkm, memi, memo, ahbsi, ahbso(3), apbi, apbo(0), wpo, open); end generate; romsn <= not memo.romsn(0); sram_adv_ld_n_pad : outpad generic map (tech => padtech) port map (sram_adv_ld_n, gnd(0)); addr_pad : outpadv generic map (width => 21, tech => padtech) port map (sram_flash_addr, memo.address(22 downto 2)); rams_pad : outpad generic map ( tech => padtech) port map (sram_cen, memo.ramsn(0)); roms_pad : outpad generic map (tech => padtech) port map (flash_ce, romsn); oen_pad : outpad generic map (tech => padtech) port map (sram_flash_oe_n, memo.oen); --pragma translate_off iosn_pad : outpad generic map (tech => padtech) port map (iosn, memo.iosn); --pragma translate_on rwen_pad : outpadv generic map (width => 4, tech => padtech) port map (sram_bw, memo.wrn); wri_pad : outpad generic map (tech => padtech) port map (sram_flash_we_n, memo.writen); data_pads : iopadvv generic map (tech => padtech, width => 32) port map (sram_flash_data, memo.data, memo.vbdrive, memi.data); ddrsp0 : if (CFG_DDRSP /= 0) generate ddrc0 : ddrspa generic map ( fabtech => CFG_FABTECH, memtech => memtech, hindex => 0, haddr => 16#400#, hmask => 16#F00#, ioaddr => 1, pwron => CFG_DDRSP_INIT, MHz => BOARD_FREQ/1000, clkmul => CFG_DDRSP_FREQ/10, clkdiv => 10, ahbfreq => CPU_FREQ/1000, col => CFG_DDRSP_COL, Mbyte => CFG_DDRSP_SIZE, ddrbits => 32, phyiconf => 1) port map ( rst, rstn, lclk, clkm, lock, clkml, clkml, ahbsi, ahbso(0), ddr_clkv, ddr_clkbv, open, ddr_clk_fb, ddr_ckev, ddr_csbv, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_adl, ddr_ba, ddr_dq); ddr_ad <= ddr_adl(12 downto 0); ddr_clk <= ddr_clkv(0); ddr_clkb <= ddr_clkbv(0); ddr_cke <= ddr_ckev(0); ddr_csb <= ddr_csbv(0); end generate; noddr : if (CFG_DDRSP = 0) generate lock <= '1'; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR, nslaves => 16) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo ); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.extclk <= '0'; u1i.ctsn <= '0'; u1i.rxd <= rxd1 when gpioo.val(13) = '0' else '1'; end generate; irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; nogpt : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; kbd : if CFG_KBD_ENABLE /= 0 generate ps21 : apbps2 generic map(pindex => 4, paddr => 4, pirq => 4) port map(rstn, clkm, apbi, apbo(4), moui, mouo); ps20 : apbps2 generic map(pindex => 5, paddr => 5, pirq => 5) port map(rstn, clkm, apbi, apbo(5), kbdi, kbdo); end generate; nokbd : if CFG_KBD_ENABLE = 0 generate apbo(5) <= apb_none; kbdo <= ps2o_none; end generate; kbdclk_pad : iopad generic map (tech => padtech) port map (ps2_keyb_clk,kbdo.ps2_clk_o, kbdo.ps2_clk_oe, kbdi.ps2_clk_i); kbdata_pad : iopad generic map (tech => padtech) port map (ps2_keyb_data, kbdo.ps2_data_o, kbdo.ps2_data_oe, kbdi.ps2_data_i); mouclk_pad : iopad generic map (tech => padtech) port map (ps2_mouse_clk, mouo.ps2_clk_o, mouo.ps2_clk_oe, moui.ps2_clk_i); mouata_pad : iopad generic map (tech => padtech) port map (ps2_mouse_data, mouo.ps2_data_o, mouo.ps2_data_oe, moui.ps2_data_i); vga : if CFG_VGA_ENABLE /= 0 generate vga0 : apbvga generic map(memtech => memtech, pindex => 6, paddr => 6) port map(rstn, clkm, ethclk, apbi, apbo(6), vgao); clk_sel <= "00"; end generate; svga : if CFG_SVGA_ENABLE /= 0 generate svga0 : svgactrl generic map(memtech => memtech, pindex => 6, paddr => 6, hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, clk0 => 4*(1000000000/BOARD_FREQ), clk1 => 2*(1000000000/BOARD_FREQ), clk2 => 1000000000/CPU_FREQ, burstlen => 6) port map(rstn, clkm, clkvga, apbi, apbo(6), vgao, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), clk_sel); end generate; vgadiv : if (CFG_VGA_ENABLE + CFG_SVGA_ENABLE) /= 0 generate clkdiv : process(clk1x, rstn) begin if rstn = '0' then clkval <= "00"; elsif rising_edge(clk1x) then clkval <= clkval + 1; end if; end process; video_clk <= clkval(1) when clk_sel = "00" else clkval(0) when clk_sel = "01" else clkm; b1 : techbuf generic map (2, CFG_FABTECH) port map (video_clk, clkvga); dac_clk <= not clkvga; end generate; novga : if (CFG_VGA_ENABLE + CFG_SVGA_ENABLE) = 0 generate apbo(6) <= apb_none; vgao <= vgao_none; end generate; vert_sync_pad : outpad generic map (tech => padtech) port map (vid_vsync, vgao.vsync); horiz_sync_pad : outpad generic map (tech => padtech) port map (vid_hsync, vgao.hsync); video_out_r_pad : outpadv generic map (width => 5, tech => padtech) port map (vid_r(7 downto 3), vgao.video_out_r(7 downto 3)); video_out_g_pad : outpadv generic map (width => 5, tech => padtech) port map (vid_g(7 downto 3), vgao.video_out_g(7 downto 3)); video_out_b_pad : outpadv generic map (width => 5, tech => padtech) port map (vid_b(7 downto 3), vgao.video_out_b(7 downto 3)); video_clock_pad : outpad generic map ( tech => padtech) port map (tft_lcd_clk, dac_clk); gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GPIO unit grgpio0: grgpio generic map(pindex => 8, paddr => 8, imask => 16#00F0#, nbits => 14) port map(rst => rstn, clk => clkm, apbi => apbi, apbo => apbo(8), gpioi => gpioi, gpioo => gpioo); gpio_pads : iopadvv generic map (tech => padtech, width => 14) port map (gpio, gpioo.dout(13 downto 0), gpioo.oen(13 downto 0), gpioi.din(13 downto 0)); end generate; ahbs : if CFG_AHBSTAT = 1 generate -- AHB status register ahbstat0 : ahbstat generic map (pindex => 15, paddr => 15, pirq => 7, nftslv => CFG_AHBSTATN) port map (rstn, clkm, ahbmi, ahbsi, stati, apbi, apbo(15)); end generate; i2cm: if CFG_I2C_ENABLE = 1 generate -- I2C master i2c0 : i2cmst generic map (pindex => 12, paddr => 12, pmask => 16#FFF#, pirq => 11, filter => I2C_FILTER) port map (rstn, clkm, apbi, apbo(12), i2ci, i2co); i2c_scl_pad : iopad generic map (tech => padtech) port map (iic_scl, i2co.scl, i2co.scloen, i2ci.scl); i2c_sda_pad : iopad generic map (tech => padtech) port map (iic_sda, i2co.sda, i2co.sdaoen, i2ci.sda); end generate i2cm; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth1 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : grethm generic map(hindex => NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_SVGA_ENABLE, pindex => 11, paddr => 11, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL, giga => CFG_GRETH1G) port map( rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_SVGA_ENABLE), apbi => apbi, apbo => apbo(11), ethi => ethi, etho => etho); emdio_pad : iopad generic map (tech => padtech) port map (phy_mii_data, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : clkpad generic map (tech => padtech, arch => 2) port map (phy_tx_clk, ethi.tx_clk); erxc_pad : clkpad generic map (tech => padtech, arch => 2) port map (phy_rx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 8) port map (phy_rx_data, ethi.rxd(7 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (phy_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (phy_rx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (phy_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (phy_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 8) port map (phy_tx_data, etho.txd(7 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map ( phy_tx_en, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (phy_tx_er, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (phy_mii_clk, etho.mdc); erst_pad : outpad generic map (tech => padtech) port map (phy_rst_n, rstn); ethi.gtx_clk <= egtx_clk; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ocram : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 7, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map ( rstn, clkm, ahbsi, ahbso(7)); end generate; ----------------------------------------------------------------------- --- AHB DEBUG -------------------------------------------------------- ----------------------------------------------------------------------- -- dma0 : ahbdma -- generic map (hindex => CFG_NCPU+CFG_AHB_UART+CFG_GRETH+CFG_AHB_JTAG, -- pindex => 13, paddr => 13, dbuf => 6) -- port map (rstn, clkm, apbi, apbo(13), ahbmi, -- ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_GRETH+CFG_AHB_JTAG)); -- at0 : ahbtrace -- generic map ( hindex => 7, ioaddr => 16#200#, iomask => 16#E00#, -- tech => memtech, irq => 0, kbytes => 8) -- port map ( rstn, clkm, ahbmi, ahbsi, ahbso(7)); ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- -- nam1 : for i in (NCPU+CFG_AHB_UART+CFG_ETH+CFG_AHB_ETH+CFG_AHB_JTAG) to NAHBMST-1 generate -- ahbmo(i) <= ahbm_none; -- end generate; -- nap0 : for i in 11 to NAPBSLV-1 generate apbo(i) <= apb_none; end generate; -- nah0 : for i in 8 to NAHBSLV-1 generate ahbso(i) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Avnet ML401 (Virtex4 LX25) Demonstration design", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
a701db7c830eb6fdff2534cfbbc47703
0.573312
3.436747
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/arith/div32.vhd
1
6,374
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: div32 -- File: div32.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: This unit implemets a divide unit to execute 64-bit by 32-bit -- division. The divider leaves no remainder. -- Overflow detection is performed according to the -- SPARC V8 manual, method B (page 116) -- Division is made using the non-restoring algorithm, -- and takes 36 clocks. The operands must be stable during -- the calculations. The result is available one clock after -- the ready signal is asserted. ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.config_types.all; use grlib.config.all; use grlib.stdlib.all; library gaisler; use gaisler.arith.all; entity div32 is port ( rst : in std_ulogic; clk : in std_ulogic; holdn : in std_ulogic; divi : in div32_in_type; divo : out div32_out_type ); end; architecture rtl of div32 is type div_regtype is record x : std_logic_vector(64 downto 0); state : std_logic_vector(2 downto 0); zero : std_logic; zero2 : std_logic; qcorr : std_logic; zcorr : std_logic; qzero : std_logic; qmsb : std_logic; ovf : std_logic; neg : std_logic; cnt : std_logic_vector(4 downto 0); end record; constant RESET_ALL : boolean := GRLIB_CONFIG_ARRAY(grlib_sync_reset_enable_all) = 1; constant RRES : div_regtype := ( x => (others => '0'), state => (others => '0'), zero => '0', zero2 => '0', qcorr => '0', zcorr => '0', qzero => '0', qmsb => '0', ovf => '0', neg => '0', cnt => (others => '0')); signal r, rin : div_regtype; signal addin1, addin2, addout: std_logic_vector(32 downto 0); signal addsub : std_logic; begin divcomb : process (r, rst, divi, addout) variable v : div_regtype; variable vready, vnready : std_logic; variable vaddin1, vaddin2 : std_logic_vector(32 downto 0); variable vaddsub, ymsb : std_logic; constant zero33: std_logic_vector(32 downto 0) := "000000000000000000000000000000000"; begin vready := '0'; vnready := '0'; v := r; if addout = zero33 then v.zero := '1'; else v.zero := '0'; end if; vaddin1 := r.x(63 downto 31); vaddin2 := divi.op2; vaddsub := not (divi.op2(32) xor r.x(64)); v.zero2 := r.zero; case r.state is when "000" => v.cnt := "00000"; if (divi.start = '1') then v.x(64) := divi.y(32); v.state := "001"; end if; when "001" => v.x := divi.y & divi.op1(31 downto 0); v.neg := divi.op2(32) xor divi.y(32); if divi.signed = '1' then vaddin1 := divi.y(31 downto 0) & divi.op1(31); v.ovf := not (addout(32) xor divi.y(32)); else vaddin1 := divi.y; vaddsub := '1'; v.ovf := not addout(32); end if; v.state := "010"; when "010" => if ((divi.signed and r.neg and r.zero) = '1') and (divi.op1 = zero33) then v.ovf := '0'; end if; v.qmsb := vaddsub; v.qzero := '1'; v.x(64 downto 32) := addout; v.x(31 downto 0) := r.x(30 downto 0) & vaddsub; v.state := "011"; v.zcorr := v.zero; v.cnt := r.cnt + 1; when "011" => v.qzero := r.qzero and (vaddsub xor r.qmsb); v.zcorr := r.zcorr or v.zero; v.x(64 downto 32) := addout; v.x(31 downto 0) := r.x(30 downto 0) & vaddsub; if (r.cnt = "11111") then v.state := "100"; vnready := '1'; else v.cnt := r.cnt + 1; end if; v.qcorr := v.x(64) xor divi.y(32); when "100" => vaddin1 := r.x(64 downto 32); v.state := "101"; when others => vaddin1 := ((not r.x(31)) & r.x(30 downto 0) & '1'); vaddin2 := (others => '0'); vaddin2(0) := '1'; vaddsub := (not r.neg);-- or (r.zcorr and not r.qcorr); if ((r.qcorr = '1') or (r.zero = '1')) and (r.zero2 = '0') then if (r.zero = '1') and ((r.qcorr = '0') and (r.zcorr = '1')) then vaddsub := r.neg; v.qzero := '0'; end if; v.x(64 downto 32) := addout; else v.x(64 downto 32) := vaddin1; v.qzero := '0'; end if; if (r.ovf = '1') then v.qzero := '0'; v.x(63 downto 32) := (others => '1'); if divi.signed = '1' then if r.neg = '1' then v.x(62 downto 32) := (others => '0'); else v.x(63) := '0'; end if; end if; end if; vready := '1'; v.state := "000"; end case; divo.icc <= r.x(63) & r.qzero & r.ovf & '0'; if (divi.flush = '1') then v.state := "000"; end if; if (not RESET_ALL) and (rst = '0') then v.state := RRES.state; v.cnt := RRES.cnt; end if; rin <= v; divo.ready <= vready; divo.nready <= vnready; divo.result(31 downto 0) <= r.x(63 downto 32); addin1 <= vaddin1; addin2 <= vaddin2; addsub <= vaddsub; end process; divadd : process(addin1, addin2, addsub) variable b : std_logic_vector(32 downto 0); begin if addsub = '1' then b := not addin2; else b := addin2; end if; addout <= addin1 + b + addsub; end process; reg : process(clk) begin if rising_edge(clk) then if (holdn = '1') then r <= rin; end if; if (rst = '0') then if RESET_ALL then r <= RRES; else r.state <= RRES.state; r.cnt <= RRES.cnt; end if; end if; end if; end process; end;
gpl-2.0
549ca9991aeaff10de2b8b6ecaf4526b
0.55899
3.149209
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/acme/prj/solution1/syn/vhdl/image_filter_Loop_1_proc.vhd
2
106,763
-- ============================================================== -- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- =========================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity image_filter_Loop_1_proc is port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); img_0_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_0_V_empty_n : IN STD_LOGIC; img_0_data_stream_0_V_read : OUT STD_LOGIC; img_0_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_1_V_empty_n : IN STD_LOGIC; img_0_data_stream_1_V_read : OUT STD_LOGIC; img_0_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_2_V_empty_n : IN STD_LOGIC; img_0_data_stream_2_V_read : OUT STD_LOGIC; img_1_data_stream_0_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_0_V_full_n : IN STD_LOGIC; img_1_data_stream_0_V_write : OUT STD_LOGIC; img_1_data_stream_1_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_1_V_full_n : IN STD_LOGIC; img_1_data_stream_1_V_write : OUT STD_LOGIC; img_1_data_stream_2_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_2_V_full_n : IN STD_LOGIC; img_1_data_stream_2_V_write : OUT STD_LOGIC ); end; architecture behav of image_filter_Loop_1_proc is constant ap_const_logic_1 : STD_LOGIC := '1'; constant ap_const_logic_0 : STD_LOGIC := '0'; constant ap_ST_st1_fsm_0 : STD_LOGIC_VECTOR (3 downto 0) := "0001"; constant ap_ST_st2_fsm_1 : STD_LOGIC_VECTOR (3 downto 0) := "0010"; constant ap_ST_pp0_stg0_fsm_2 : STD_LOGIC_VECTOR (3 downto 0) := "0100"; constant ap_ST_st14_fsm_3 : STD_LOGIC_VECTOR (3 downto 0) := "1000"; constant ap_const_lv32_0 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000000"; constant ap_const_lv1_1 : STD_LOGIC_VECTOR (0 downto 0) := "1"; constant ap_const_lv32_1 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000001"; constant ap_const_lv1_0 : STD_LOGIC_VECTOR (0 downto 0) := "0"; constant ap_const_lv32_2 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000010"; constant ap_const_lv11_0 : STD_LOGIC_VECTOR (10 downto 0) := "00000000000"; constant ap_const_lv32_3 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000011"; constant ap_const_lv8_0 : STD_LOGIC_VECTOR (7 downto 0) := "00000000"; constant ap_const_lv11_7FF : STD_LOGIC_VECTOR (10 downto 0) := "11111111111"; constant ap_const_lv11_1 : STD_LOGIC_VECTOR (10 downto 0) := "00000000001"; constant ap_const_lv12_FFF : STD_LOGIC_VECTOR (11 downto 0) := "111111111111"; constant ap_const_lv12_0 : STD_LOGIC_VECTOR (11 downto 0) := "000000000000"; constant ap_const_lv13_19 : STD_LOGIC_VECTOR (12 downto 0) := "0000000011001"; constant ap_const_lv10_80 : STD_LOGIC_VECTOR (9 downto 0) := "0010000000"; constant ap_const_lv6_0 : STD_LOGIC_VECTOR (5 downto 0) := "000000"; constant ap_const_lv7_0 : STD_LOGIC_VECTOR (6 downto 0) := "0000000"; constant ap_const_lv32_8 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000001000"; constant ap_const_lv32_F : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000001111"; constant ap_const_lv8_10 : STD_LOGIC_VECTOR (7 downto 0) := "00010000"; constant ap_const_lv22_556 : STD_LOGIC_VECTOR (21 downto 0) := "0000000000010101010110"; constant ap_const_lv8_37 : STD_LOGIC_VECTOR (7 downto 0) := "00110111"; constant ap_const_lv8_CD : STD_LOGIC_VECTOR (7 downto 0) := "11001101"; constant ap_const_lv32_C : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000001100"; constant ap_const_lv32_14 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000010100"; constant ap_const_lv32_13 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000010011"; constant ap_const_lv8_FF : STD_LOGIC_VECTOR (7 downto 0) := "11111111"; constant ap_const_lv9_3C : STD_LOGIC_VECTOR (8 downto 0) := "000111100"; constant ap_const_lv9_22 : STD_LOGIC_VECTOR (8 downto 0) := "000100010"; constant ap_true : BOOLEAN := true; signal ap_done_reg : STD_LOGIC := '0'; signal ap_CS_fsm : STD_LOGIC_VECTOR (3 downto 0) := "0001"; attribute fsm_encoding : string; attribute fsm_encoding of ap_CS_fsm : signal is "none"; signal ap_sig_cseq_ST_st1_fsm_0 : STD_LOGIC; signal ap_sig_bdd_23 : BOOLEAN; signal col_reg_357 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_15_cast_fu_390_p1 : STD_LOGIC_VECTOR (11 downto 0); signal ap_sig_bdd_65 : BOOLEAN; signal tmp_16_cast_fu_404_p1 : STD_LOGIC_VECTOR (11 downto 0); signal tmp_9_fu_408_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_10_fu_414_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_21_fu_420_p1 : STD_LOGIC_VECTOR (11 downto 0); signal tmp_24_fu_424_p1 : STD_LOGIC_VECTOR (11 downto 0); signal exitcond1_fu_432_p2 : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_cseq_ST_st2_fsm_1 : STD_LOGIC; signal ap_sig_bdd_85 : BOOLEAN; signal row_1_fu_437_p2 : STD_LOGIC_VECTOR (10 downto 0); signal row_1_reg_1360 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_11_fu_443_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_11_reg_1365 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_12_fu_454_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_12_reg_1370 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_13_fu_460_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_13_reg_1375 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_s_fu_466_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_s_reg_1380 : STD_LOGIC_VECTOR (0 downto 0); signal exitcond_fu_471_p2 : STD_LOGIC_VECTOR (0 downto 0); signal exitcond_reg_1385 : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_cseq_ST_pp0_stg0_fsm_2 : STD_LOGIC; signal ap_sig_bdd_107 : BOOLEAN; signal ap_reg_ppiten_pp0_it0 : STD_LOGIC := '0'; signal or_cond_reg_1394 : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_bdd_124 : BOOLEAN; signal ap_reg_ppiten_pp0_it1 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it2 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it3 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it4 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it5 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it6 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it7 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it8 : STD_LOGIC := '0'; signal ap_reg_ppiten_pp0_it9 : STD_LOGIC := '0'; signal or_cond2_reg_1444 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it9 : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_bdd_156 : BOOLEAN; signal ap_reg_ppiten_pp0_it10 : STD_LOGIC := '0'; signal ap_reg_ppstg_exitcond_reg_1385_pp0_it1 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it2 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it3 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it4 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it5 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it6 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it7 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_exitcond_reg_1385_pp0_it8 : STD_LOGIC_VECTOR (0 downto 0); signal col_1_fu_476_p2 : STD_LOGIC_VECTOR (10 downto 0); signal or_cond_fu_491_p2 : STD_LOGIC_VECTOR (0 downto 0); signal line_buffer_1_0_val_addr_reg_1398 : STD_LOGIC_VECTOR (10 downto 0); signal ap_reg_ppstg_line_buffer_1_0_val_addr_reg_1398_pp0_it1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_1_val_addr_reg_1404 : STD_LOGIC_VECTOR (10 downto 0); signal ap_reg_ppstg_line_buffer_1_1_val_addr_reg_1404_pp0_it1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_2_val_addr_reg_1410 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_0_val_addr_reg_1416 : STD_LOGIC_VECTOR (10 downto 0); signal ap_reg_ppstg_line_buffer_0_0_val_addr_reg_1416_pp0_it1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_1_val_addr_reg_1422 : STD_LOGIC_VECTOR (10 downto 0); signal ap_reg_ppstg_line_buffer_0_1_val_addr_reg_1422_pp0_it1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_2_val_addr_reg_1428 : STD_LOGIC_VECTOR (10 downto 0); signal ap_reg_ppstg_line_buffer_0_2_val_addr_reg_1428_pp0_it1 : STD_LOGIC_VECTOR (10 downto 0); signal tmp10_fu_523_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp10_reg_1434 : STD_LOGIC_VECTOR (0 downto 0); signal tmp11_fu_528_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp11_reg_1439 : STD_LOGIC_VECTOR (0 downto 0); signal or_cond2_fu_539_p2 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it1 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it2 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it3 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it4 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it5 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it6 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it7 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond2_reg_1444_pp0_it8 : STD_LOGIC_VECTOR (0 downto 0); signal line_buffer_0_2_val_q0 : STD_LOGIC_VECTOR (7 downto 0); signal pix_val_2_reg_1453 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_2_reg_1453_pp0_it2 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_2_reg_1453_pp0_it3 : STD_LOGIC_VECTOR (7 downto 0); signal or_cond3_fu_569_p2 : STD_LOGIC_VECTOR (0 downto 0); signal or_cond3_reg_1459 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it2 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it3 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it4 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it5 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it6 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it7 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ppstg_or_cond3_reg_1459_pp0_it8 : STD_LOGIC_VECTOR (0 downto 0); signal G_5_reg_1463 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_G_5_reg_1463_pp0_it3 : STD_LOGIC_VECTOR (7 downto 0); signal R_5_reg_1469 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_1_0_val_q0 : STD_LOGIC_VECTOR (7 downto 0); signal R_reg_1475 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_1_1_val_q0 : STD_LOGIC_VECTOR (7 downto 0); signal G_reg_1480 : STD_LOGIC_VECTOR (7 downto 0); signal tmp1_fu_597_p2 : STD_LOGIC_VECTOR (9 downto 0); signal tmp1_reg_1486 : STD_LOGIC_VECTOR (9 downto 0); signal line_buffer_0_0_val_q0 : STD_LOGIC_VECTOR (7 downto 0); signal pix_val_0_reg_1491 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_0_reg_1491_pp0_it3 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_0_reg_1491_pp0_it4 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_0_reg_1491_pp0_it5 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_0_reg_1491_pp0_it6 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_0_1_val_q0 : STD_LOGIC_VECTOR (7 downto 0); signal pix_val_1_reg_1498 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_pix_val_1_reg_1498_pp0_it3 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_i_reg_1515 : STD_LOGIC_VECTOR (7 downto 0); signal tmp4_fu_703_p2 : STD_LOGIC_VECTOR (9 downto 0); signal tmp4_reg_1520 : STD_LOGIC_VECTOR (9 downto 0); signal tmp_6_i2_fu_741_p2 : STD_LOGIC_VECTOR (14 downto 0); signal tmp_6_i2_reg_1525 : STD_LOGIC_VECTOR (14 downto 0); signal y_window_2_2_1_reg_1530 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_y_window_2_2_1_reg_1530_pp0_it5 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_2_1_2_fu_750_p2 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_2_1_2_reg_1536 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_y_window_2_1_2_reg_1536_pp0_it5 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_i1_reg_1541 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_i2_reg_1546 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_2_i3_fu_880_p2 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_2_i3_reg_1551 : STD_LOGIC_VECTOR (8 downto 0); signal ap_reg_ppstg_tmp_2_i3_reg_1551_pp0_it5 : STD_LOGIC_VECTOR (8 downto 0); signal ap_reg_ppstg_tmp_2_i3_reg_1551_pp0_it6 : STD_LOGIC_VECTOR (8 downto 0); signal y_window_1_1_1_fu_891_p2 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_1_1_1_reg_1556 : STD_LOGIC_VECTOR (7 downto 0); signal x_weight_2_0_2_i_fu_927_p2 : STD_LOGIC_VECTOR (8 downto 0); signal x_weight_2_0_2_i_reg_1562 : STD_LOGIC_VECTOR (8 downto 0); signal y_weight_2_1_2_i_fu_943_p2 : STD_LOGIC_VECTOR (9 downto 0); signal y_weight_2_1_2_i_reg_1567 : STD_LOGIC_VECTOR (9 downto 0); signal x_weight_2_2_2_i_fu_1045_p2 : STD_LOGIC_VECTOR (10 downto 0); signal x_weight_2_2_2_i_reg_1572 : STD_LOGIC_VECTOR (10 downto 0); signal y_weight_2_2_2_i_fu_1051_p2 : STD_LOGIC_VECTOR (10 downto 0); signal y_weight_2_2_2_i_reg_1577 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_28_fu_1057_p1 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_28_reg_1582 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_29_fu_1061_p1 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_29_reg_1588 : STD_LOGIC_VECTOR (7 downto 0); signal edge_weight_i_fu_1115_p2 : STD_LOGIC_VECTOR (7 downto 0); signal edge_weight_i_reg_1594 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_edge_weight_i_reg_1594_pp0_it8 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_15_i_fu_1143_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_15_i_reg_1606 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_17_i_fu_1148_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_17_i_reg_1612 : STD_LOGIC_VECTOR (0 downto 0); signal B_cast_i_reg_1617 : STD_LOGIC_VECTOR (8 downto 0); signal sepia_val_0_reg_1623 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_ppstg_sepia_val_0_reg_1623_pp0_it9 : STD_LOGIC_VECTOR (7 downto 0); signal edge_val_1_fu_1195_p3 : STD_LOGIC_VECTOR (7 downto 0); signal sepia_val_2_fu_1225_p3 : STD_LOGIC_VECTOR (7 downto 0); signal sepia_val_2_reg_1633 : STD_LOGIC_VECTOR (7 downto 0); signal sepia_val_1_fu_1245_p3 : STD_LOGIC_VECTOR (7 downto 0); signal sepia_val_1_reg_1638 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_0_0_val_address0 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_0_val_ce0 : STD_LOGIC; signal line_buffer_0_0_val_address1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_0_val_ce1 : STD_LOGIC; signal line_buffer_0_0_val_we1 : STD_LOGIC; signal line_buffer_0_0_val_d1 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_0_1_val_address0 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_1_val_ce0 : STD_LOGIC; signal line_buffer_0_1_val_address1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_1_val_ce1 : STD_LOGIC; signal line_buffer_0_1_val_we1 : STD_LOGIC; signal line_buffer_0_1_val_d1 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_0_2_val_address0 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_2_val_ce0 : STD_LOGIC; signal line_buffer_0_2_val_address1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_0_2_val_ce1 : STD_LOGIC; signal line_buffer_0_2_val_we1 : STD_LOGIC; signal line_buffer_0_2_val_d1 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_1_0_val_address0 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_0_val_ce0 : STD_LOGIC; signal line_buffer_1_0_val_address1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_0_val_ce1 : STD_LOGIC; signal line_buffer_1_0_val_we1 : STD_LOGIC; signal line_buffer_1_0_val_d1 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_1_1_val_address0 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_1_val_ce0 : STD_LOGIC; signal line_buffer_1_1_val_address1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_1_val_ce1 : STD_LOGIC; signal line_buffer_1_1_val_we1 : STD_LOGIC; signal line_buffer_1_1_val_d1 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_1_2_val_address0 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_2_val_ce0 : STD_LOGIC; signal line_buffer_1_2_val_q0 : STD_LOGIC_VECTOR (7 downto 0); signal line_buffer_1_2_val_address1 : STD_LOGIC_VECTOR (10 downto 0); signal line_buffer_1_2_val_ce1 : STD_LOGIC; signal line_buffer_1_2_val_we1 : STD_LOGIC; signal line_buffer_1_2_val_d1 : STD_LOGIC_VECTOR (7 downto 0); signal row_reg_346 : STD_LOGIC_VECTOR (10 downto 0); signal ap_sig_cseq_ST_st14_fsm_3 : STD_LOGIC; signal ap_sig_bdd_429 : BOOLEAN; signal ap_reg_phiprechg_edge_val1_reg_368pp0_it9 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it10 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it1 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it2 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it3 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it4 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it5 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it6 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it7 : STD_LOGIC_VECTOR (7 downto 0); signal ap_reg_phiprechg_edge_val1_reg_368pp0_it8 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_16_fu_496_p1 : STD_LOGIC_VECTOR (63 downto 0); signal B_2_fu_152 : STD_LOGIC_VECTOR (7 downto 0); signal G_2_fu_156 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_0_1_fu_160 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_0_1_1_fu_896_p2 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_0_2_fu_164 : STD_LOGIC_VECTOR (7 downto 0); signal R_2_fu_168 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_1_1_fu_172 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_1_2_fu_176 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_2_2_fu_180 : STD_LOGIC_VECTOR (7 downto 0); signal y_window_2_1_fu_184 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_fu_380_p1 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_7_fu_384_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_2_fu_394_p1 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_8_fu_398_p2 : STD_LOGIC_VECTOR (10 downto 0); signal row_cast_fu_428_p1 : STD_LOGIC_VECTOR (11 downto 0); signal output_row_fu_448_p2 : STD_LOGIC_VECTOR (11 downto 0); signal col_cast_fu_482_p1 : STD_LOGIC_VECTOR (11 downto 0); signal tmp_14_fu_486_p2 : STD_LOGIC_VECTOR (0 downto 0); signal output_col_fu_506_p2 : STD_LOGIC_VECTOR (11 downto 0); signal tmp_17_fu_512_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_18_fu_518_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_19_fu_533_p2 : STD_LOGIC_VECTOR (0 downto 0); signal grp_fu_563_p0 : STD_LOGIC_VECTOR (7 downto 0); signal grp_fu_563_p1 : STD_LOGIC_VECTOR (5 downto 0); signal p_shl2_i_fu_585_p3 : STD_LOGIC_VECTOR (8 downto 0); signal p_shl2_cast_i_cast_fu_593_p1 : STD_LOGIC_VECTOR (9 downto 0); signal grp_fu_606_p0 : STD_LOGIC_VECTOR (7 downto 0); signal grp_fu_606_p1 : STD_LOGIC_VECTOR (5 downto 0); signal grp_fu_616_p0 : STD_LOGIC_VECTOR (7 downto 0); signal grp_fu_616_p1 : STD_LOGIC_VECTOR (5 downto 0); signal p_shl1_i_fu_622_p3 : STD_LOGIC_VECTOR (13 downto 0); signal p_shl_i_fu_636_p3 : STD_LOGIC_VECTOR (14 downto 0); signal tmp55_cast_fu_647_p1 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl1_cast_i_fu_629_p1 : STD_LOGIC_VECTOR (14 downto 0); signal tmp_6_i_fu_650_p2 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl_cast_i_fu_643_p1 : STD_LOGIC_VECTOR (15 downto 0); signal tmp_6_cast_i_fu_656_p1 : STD_LOGIC_VECTOR (15 downto 0); signal grp_fu_563_p2 : STD_LOGIC_VECTOR (12 downto 0); signal tmp_2_cast3_i_cast_fu_633_p1 : STD_LOGIC_VECTOR (12 downto 0); signal tmp3_fu_666_p2 : STD_LOGIC_VECTOR (12 downto 0); signal tmp57_cast_fu_672_p1 : STD_LOGIC_VECTOR (15 downto 0); signal tmp2_fu_660_p2 : STD_LOGIC_VECTOR (15 downto 0); signal tmp_8_i_fu_676_p2 : STD_LOGIC_VECTOR (15 downto 0); attribute use_dsp48 : string; attribute use_dsp48 of tmp_8_i_fu_676_p2 : signal is "no"; signal p_shl2_i6_fu_692_p3 : STD_LOGIC_VECTOR (8 downto 0); signal p_shl2_cast_i7_cast_fu_699_p1 : STD_LOGIC_VECTOR (9 downto 0); signal p_shl1_i1_fu_709_p3 : STD_LOGIC_VECTOR (13 downto 0); signal p_shl2_i1_fu_720_p3 : STD_LOGIC_VECTOR (8 downto 0); signal p_shl2_cast_i29_cast_fu_727_p1 : STD_LOGIC_VECTOR (9 downto 0); signal tmp7_fu_731_p2 : STD_LOGIC_VECTOR (9 downto 0); signal tmp61_cast_fu_737_p1 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl1_cast_i1_fu_716_p1 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl1_i4_fu_755_p3 : STD_LOGIC_VECTOR (13 downto 0); signal p_shl_i1_fu_769_p3 : STD_LOGIC_VECTOR (14 downto 0); signal tmp58_cast_fu_780_p1 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl1_cast_i5_fu_762_p1 : STD_LOGIC_VECTOR (14 downto 0); signal tmp_6_i1_fu_783_p2 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl_cast_i1_fu_776_p1 : STD_LOGIC_VECTOR (15 downto 0); signal tmp_6_cast_i1_fu_789_p1 : STD_LOGIC_VECTOR (15 downto 0); signal grp_fu_606_p2 : STD_LOGIC_VECTOR (12 downto 0); signal tmp_2_cast3_i9_cast_fu_766_p1 : STD_LOGIC_VECTOR (12 downto 0); signal tmp6_fu_799_p2 : STD_LOGIC_VECTOR (12 downto 0); signal tmp60_cast_fu_805_p1 : STD_LOGIC_VECTOR (15 downto 0); signal tmp5_fu_793_p2 : STD_LOGIC_VECTOR (15 downto 0); signal tmp_8_i1_fu_809_p2 : STD_LOGIC_VECTOR (15 downto 0); attribute use_dsp48 of tmp_8_i1_fu_809_p2 : signal is "no"; signal p_shl_i2_fu_828_p3 : STD_LOGIC_VECTOR (14 downto 0); signal p_shl_cast_i2_fu_835_p1 : STD_LOGIC_VECTOR (15 downto 0); signal tmp_6_cast_i2_fu_839_p1 : STD_LOGIC_VECTOR (15 downto 0); signal grp_fu_616_p2 : STD_LOGIC_VECTOR (12 downto 0); signal tmp_2_cast3_i31_cast_fu_825_p1 : STD_LOGIC_VECTOR (12 downto 0); signal tmp9_fu_848_p2 : STD_LOGIC_VECTOR (12 downto 0); signal tmp63_cast_fu_854_p1 : STD_LOGIC_VECTOR (15 downto 0); signal tmp8_fu_842_p2 : STD_LOGIC_VECTOR (15 downto 0); signal tmp_8_i2_fu_858_p2 : STD_LOGIC_VECTOR (15 downto 0); attribute use_dsp48 of tmp_8_i2_fu_858_p2 : signal is "no"; signal tmp_cast_i_fu_877_p1 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_cast_i2_fu_874_p1 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_23_0_1_i_fu_911_p3 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_19_0_2_cast8_i_cast_fu_923_p1 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_19_0_cast9_i_cast_fu_907_p1 : STD_LOGIC_VECTOR (8 downto 0); signal tmp12_fu_933_p2 : STD_LOGIC_VECTOR (8 downto 0); signal tmp66_cast_fu_939_p1 : STD_LOGIC_VECTOR (9 downto 0); signal tmp_23_0_1_cast_i_fu_919_p1 : STD_LOGIC_VECTOR (9 downto 0); signal p_shl8_i_fu_971_p3 : STD_LOGIC_VECTOR (8 downto 0); signal x_weight_2_0_2_cast_i_fu_968_p1 : STD_LOGIC_VECTOR (10 downto 0); signal p_shl8_cast_i_fu_978_p1 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_21_1_2_i_fu_988_p3 : STD_LOGIC_VECTOR (8 downto 0); signal x_weight_2_1_1_i_fu_982_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_21_1_2_cast_i_fu_996_p1 : STD_LOGIC_VECTOR (10 downto 0); signal x_weight_2_1_2_i_fu_1000_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_19_2_cast_i_fu_1009_p1 : STD_LOGIC_VECTOR (10 downto 0); signal y_weight_2_1_2_cast_i_fu_1006_p1 : STD_LOGIC_VECTOR (10 downto 0); signal p_shl_i3_fu_1024_p3 : STD_LOGIC_VECTOR (8 downto 0); signal y_weight_2_2_i_fu_1018_p2 : STD_LOGIC_VECTOR (10 downto 0); signal p_shl_cast_i3_fu_1031_p1 : STD_LOGIC_VECTOR (10 downto 0); signal x_weight_2_2_i_fu_1012_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_19_2_2_cast_i_fu_1041_p1 : STD_LOGIC_VECTOR (10 downto 0); signal y_weight_2_2_1_i_fu_1035_p2 : STD_LOGIC_VECTOR (10 downto 0); signal tmp_i_29_fu_1081_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_22_fu_1086_p2 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_11_i_fu_1098_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_25_fu_1103_p2 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_26_fu_1108_p3 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_23_fu_1091_p3 : STD_LOGIC_VECTOR (7 downto 0); signal tmp_2_cast_i3_fu_1124_p1 : STD_LOGIC_VECTOR (9 downto 0); signal tmp_1_cast_i_fu_1121_p1 : STD_LOGIC_VECTOR (9 downto 0); signal tmp_3_i_fu_1127_p2 : STD_LOGIC_VECTOR (9 downto 0); signal grp_fu_1137_p0 : STD_LOGIC_VECTOR (9 downto 0); signal grp_fu_1137_p1 : STD_LOGIC_VECTOR (11 downto 0); signal grp_fu_1137_p2 : STD_LOGIC_VECTOR (21 downto 0); signal not_tmp_15_i_fu_1178_p2 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_27_fu_1191_p2 : STD_LOGIC_VECTOR (0 downto 0); signal p_i_cast_fu_1183_p3 : STD_LOGIC_VECTOR (7 downto 0); signal edge_val_fu_1173_p2 : STD_LOGIC_VECTOR (7 downto 0); signal R_3_fu_1203_p2 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_30_fu_1213_p3 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_31_fu_1221_p1 : STD_LOGIC_VECTOR (7 downto 0); signal G_3_fu_1208_p2 : STD_LOGIC_VECTOR (8 downto 0); signal tmp_32_fu_1233_p3 : STD_LOGIC_VECTOR (0 downto 0); signal tmp_33_fu_1241_p1 : STD_LOGIC_VECTOR (7 downto 0); signal grp_fu_563_ce : STD_LOGIC; signal grp_fu_606_ce : STD_LOGIC; signal grp_fu_616_ce : STD_LOGIC; signal grp_fu_1137_ce : STD_LOGIC; signal ap_NS_fsm : STD_LOGIC_VECTOR (3 downto 0); signal grp_fu_1137_p00 : STD_LOGIC_VECTOR (21 downto 0); signal grp_fu_563_p00 : STD_LOGIC_VECTOR (12 downto 0); signal grp_fu_606_p00 : STD_LOGIC_VECTOR (12 downto 0); signal grp_fu_616_p00 : STD_LOGIC_VECTOR (12 downto 0); signal ap_sig_bdd_349 : BOOLEAN; signal ap_sig_bdd_436 : BOOLEAN; signal ap_sig_bdd_459 : BOOLEAN; signal ap_sig_bdd_444 : BOOLEAN; component image_filter_mul_8ns_6ns_13_3 IS generic ( ID : INTEGER; NUM_STAGE : INTEGER; din0_WIDTH : INTEGER; din1_WIDTH : INTEGER; dout_WIDTH : INTEGER ); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; din0 : IN STD_LOGIC_VECTOR (7 downto 0); din1 : IN STD_LOGIC_VECTOR (5 downto 0); ce : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR (12 downto 0) ); end component; component image_filter_mul_10ns_12ns_22_2 IS generic ( ID : INTEGER; NUM_STAGE : INTEGER; din0_WIDTH : INTEGER; din1_WIDTH : INTEGER; dout_WIDTH : INTEGER ); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; din0 : IN STD_LOGIC_VECTOR (9 downto 0); din1 : IN STD_LOGIC_VECTOR (11 downto 0); ce : IN STD_LOGIC; dout : OUT STD_LOGIC_VECTOR (21 downto 0) ); end component; component image_filter_Loop_1_proc_line_buffer_0_0_val IS generic ( DataWidth : INTEGER; AddressRange : INTEGER; AddressWidth : INTEGER ); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; address0 : IN STD_LOGIC_VECTOR (10 downto 0); ce0 : IN STD_LOGIC; q0 : OUT STD_LOGIC_VECTOR (7 downto 0); address1 : IN STD_LOGIC_VECTOR (10 downto 0); ce1 : IN STD_LOGIC; we1 : IN STD_LOGIC; d1 : IN STD_LOGIC_VECTOR (7 downto 0) ); end component; begin line_buffer_0_0_val_U : component image_filter_Loop_1_proc_line_buffer_0_0_val generic map ( DataWidth => 8, AddressRange => 1921, AddressWidth => 11) port map ( clk => ap_clk, reset => ap_rst, address0 => line_buffer_0_0_val_address0, ce0 => line_buffer_0_0_val_ce0, q0 => line_buffer_0_0_val_q0, address1 => line_buffer_0_0_val_address1, ce1 => line_buffer_0_0_val_ce1, we1 => line_buffer_0_0_val_we1, d1 => line_buffer_0_0_val_d1); line_buffer_0_1_val_U : component image_filter_Loop_1_proc_line_buffer_0_0_val generic map ( DataWidth => 8, AddressRange => 1921, AddressWidth => 11) port map ( clk => ap_clk, reset => ap_rst, address0 => line_buffer_0_1_val_address0, ce0 => line_buffer_0_1_val_ce0, q0 => line_buffer_0_1_val_q0, address1 => line_buffer_0_1_val_address1, ce1 => line_buffer_0_1_val_ce1, we1 => line_buffer_0_1_val_we1, d1 => line_buffer_0_1_val_d1); line_buffer_0_2_val_U : component image_filter_Loop_1_proc_line_buffer_0_0_val generic map ( DataWidth => 8, AddressRange => 1921, AddressWidth => 11) port map ( clk => ap_clk, reset => ap_rst, address0 => line_buffer_0_2_val_address0, ce0 => line_buffer_0_2_val_ce0, q0 => line_buffer_0_2_val_q0, address1 => line_buffer_0_2_val_address1, ce1 => line_buffer_0_2_val_ce1, we1 => line_buffer_0_2_val_we1, d1 => line_buffer_0_2_val_d1); line_buffer_1_0_val_U : component image_filter_Loop_1_proc_line_buffer_0_0_val generic map ( DataWidth => 8, AddressRange => 1921, AddressWidth => 11) port map ( clk => ap_clk, reset => ap_rst, address0 => line_buffer_1_0_val_address0, ce0 => line_buffer_1_0_val_ce0, q0 => line_buffer_1_0_val_q0, address1 => line_buffer_1_0_val_address1, ce1 => line_buffer_1_0_val_ce1, we1 => line_buffer_1_0_val_we1, d1 => line_buffer_1_0_val_d1); line_buffer_1_1_val_U : component image_filter_Loop_1_proc_line_buffer_0_0_val generic map ( DataWidth => 8, AddressRange => 1921, AddressWidth => 11) port map ( clk => ap_clk, reset => ap_rst, address0 => line_buffer_1_1_val_address0, ce0 => line_buffer_1_1_val_ce0, q0 => line_buffer_1_1_val_q0, address1 => line_buffer_1_1_val_address1, ce1 => line_buffer_1_1_val_ce1, we1 => line_buffer_1_1_val_we1, d1 => line_buffer_1_1_val_d1); line_buffer_1_2_val_U : component image_filter_Loop_1_proc_line_buffer_0_0_val generic map ( DataWidth => 8, AddressRange => 1921, AddressWidth => 11) port map ( clk => ap_clk, reset => ap_rst, address0 => line_buffer_1_2_val_address0, ce0 => line_buffer_1_2_val_ce0, q0 => line_buffer_1_2_val_q0, address1 => line_buffer_1_2_val_address1, ce1 => line_buffer_1_2_val_ce1, we1 => line_buffer_1_2_val_we1, d1 => line_buffer_1_2_val_d1); image_filter_mul_8ns_6ns_13_3_U15 : component image_filter_mul_8ns_6ns_13_3 generic map ( ID => 1, NUM_STAGE => 3, din0_WIDTH => 8, din1_WIDTH => 6, dout_WIDTH => 13) port map ( clk => ap_clk, reset => ap_rst, din0 => grp_fu_563_p0, din1 => grp_fu_563_p1, ce => grp_fu_563_ce, dout => grp_fu_563_p2); image_filter_mul_8ns_6ns_13_3_U16 : component image_filter_mul_8ns_6ns_13_3 generic map ( ID => 1, NUM_STAGE => 3, din0_WIDTH => 8, din1_WIDTH => 6, dout_WIDTH => 13) port map ( clk => ap_clk, reset => ap_rst, din0 => grp_fu_606_p0, din1 => grp_fu_606_p1, ce => grp_fu_606_ce, dout => grp_fu_606_p2); image_filter_mul_8ns_6ns_13_3_U17 : component image_filter_mul_8ns_6ns_13_3 generic map ( ID => 1, NUM_STAGE => 3, din0_WIDTH => 8, din1_WIDTH => 6, dout_WIDTH => 13) port map ( clk => ap_clk, reset => ap_rst, din0 => grp_fu_616_p0, din1 => grp_fu_616_p1, ce => grp_fu_616_ce, dout => grp_fu_616_p2); image_filter_mul_10ns_12ns_22_2_U18 : component image_filter_mul_10ns_12ns_22_2 generic map ( ID => 1, NUM_STAGE => 2, din0_WIDTH => 10, din1_WIDTH => 12, dout_WIDTH => 22) port map ( clk => ap_clk, reset => ap_rst, din0 => grp_fu_1137_p0, din1 => grp_fu_1137_p1, ce => grp_fu_1137_ce, dout => grp_fu_1137_p2); -- the current state (ap_CS_fsm) of the state machine. -- ap_CS_fsm_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_CS_fsm <= ap_ST_st1_fsm_0; else ap_CS_fsm <= ap_NS_fsm; end if; end if; end process; -- ap_done_reg assign process. -- ap_done_reg_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_done_reg <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_continue)) then ap_done_reg <= ap_const_logic_0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((exitcond1_fu_432_p2 = ap_const_lv1_0)))) then ap_done_reg <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it0 assign process. -- ap_reg_ppiten_pp0_it0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it0 <= ap_const_logic_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and not((ap_const_lv1_0 = exitcond_fu_471_p2)))) then ap_reg_ppiten_pp0_it0 <= ap_const_logic_0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond1_fu_432_p2 = ap_const_lv1_0))) then ap_reg_ppiten_pp0_it0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it1 assign process. -- ap_reg_ppiten_pp0_it1_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it1 <= ap_const_logic_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_ppiten_pp0_it1 <= ap_reg_ppiten_pp0_it0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond1_fu_432_p2 = ap_const_lv1_0))) then ap_reg_ppiten_pp0_it1 <= ap_const_logic_0; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it10 assign process. -- ap_reg_ppiten_pp0_it10_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it10 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it10 <= ap_reg_ppiten_pp0_it9; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond1_fu_432_p2 = ap_const_lv1_0))) then ap_reg_ppiten_pp0_it10 <= ap_const_logic_0; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it2 assign process. -- ap_reg_ppiten_pp0_it2_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it2 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it2 <= ap_reg_ppiten_pp0_it1; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it3 assign process. -- ap_reg_ppiten_pp0_it3_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it3 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it3 <= ap_reg_ppiten_pp0_it2; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it4 assign process. -- ap_reg_ppiten_pp0_it4_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it4 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it4 <= ap_reg_ppiten_pp0_it3; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it5 assign process. -- ap_reg_ppiten_pp0_it5_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it5 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then if (not((ap_const_logic_1 = ap_reg_ppiten_pp0_it3))) then ap_reg_ppiten_pp0_it5 <= ap_const_logic_0; elsif ((ap_const_logic_1 = ap_reg_ppiten_pp0_it3)) then ap_reg_ppiten_pp0_it5 <= ap_reg_ppiten_pp0_it4; end if; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it6 assign process. -- ap_reg_ppiten_pp0_it6_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it6 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it6 <= ap_reg_ppiten_pp0_it5; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it7 assign process. -- ap_reg_ppiten_pp0_it7_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it7 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it7 <= ap_reg_ppiten_pp0_it6; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it8 assign process. -- ap_reg_ppiten_pp0_it8_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it8 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it8 <= ap_reg_ppiten_pp0_it7; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it9 assign process. -- ap_reg_ppiten_pp0_it9_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it9 <= ap_const_logic_0; else if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then ap_reg_ppiten_pp0_it9 <= ap_reg_ppiten_pp0_it8; end if; end if; end if; end process; -- ap_reg_phiprechg_edge_val1_reg_368pp0_it10 assign process. -- ap_reg_phiprechg_edge_val1_reg_368pp0_it10_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_sig_bdd_436) then if (ap_sig_bdd_349) then ap_reg_phiprechg_edge_val1_reg_368pp0_it10 <= edge_val_1_fu_1195_p3; elsif ((ap_true = ap_true)) then ap_reg_phiprechg_edge_val1_reg_368pp0_it10 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it9; end if; end if; end if; end process; -- ap_reg_phiprechg_edge_val1_reg_368pp0_it2 assign process. -- ap_reg_phiprechg_edge_val1_reg_368pp0_it2_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_sig_bdd_444) then if (ap_sig_bdd_459) then ap_reg_phiprechg_edge_val1_reg_368pp0_it2 <= ap_const_lv8_0; elsif ((ap_true = ap_true)) then ap_reg_phiprechg_edge_val1_reg_368pp0_it2 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it1; end if; end if; end if; end process; -- col_reg_357 assign process. -- col_reg_357_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it0) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = exitcond_fu_471_p2))) then col_reg_357 <= col_1_fu_476_p2; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond1_fu_432_p2 = ap_const_lv1_0))) then col_reg_357 <= ap_const_lv11_0; end if; end if; end process; -- row_reg_346 assign process. -- row_reg_346_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((ap_const_logic_1 = ap_sig_cseq_ST_st14_fsm_3)) then row_reg_346 <= row_1_reg_1360; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) and not(ap_sig_bdd_65))) then row_reg_346 <= ap_const_lv11_0; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then B_2_fu_152 <= img_0_data_stream_2_V_dout; G_2_fu_156 <= img_0_data_stream_1_V_dout; R_2_fu_168 <= img_0_data_stream_0_V_dout; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))) then B_cast_i_reg_1617 <= grp_fu_1137_p2(20 downto 12); ap_reg_ppstg_G_5_reg_1463_pp0_it3 <= G_5_reg_1463; ap_reg_ppstg_edge_weight_i_reg_1594_pp0_it8 <= edge_weight_i_reg_1594; ap_reg_ppstg_exitcond_reg_1385_pp0_it2 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it1; ap_reg_ppstg_exitcond_reg_1385_pp0_it3 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it2; ap_reg_ppstg_exitcond_reg_1385_pp0_it4 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it3; ap_reg_ppstg_exitcond_reg_1385_pp0_it5 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it4; ap_reg_ppstg_exitcond_reg_1385_pp0_it6 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it5; ap_reg_ppstg_exitcond_reg_1385_pp0_it7 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it6; ap_reg_ppstg_exitcond_reg_1385_pp0_it8 <= ap_reg_ppstg_exitcond_reg_1385_pp0_it7; ap_reg_ppstg_or_cond2_reg_1444_pp0_it2 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it1; ap_reg_ppstg_or_cond2_reg_1444_pp0_it3 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it2; ap_reg_ppstg_or_cond2_reg_1444_pp0_it4 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it3; ap_reg_ppstg_or_cond2_reg_1444_pp0_it5 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it4; ap_reg_ppstg_or_cond2_reg_1444_pp0_it6 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it5; ap_reg_ppstg_or_cond2_reg_1444_pp0_it7 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it6; ap_reg_ppstg_or_cond2_reg_1444_pp0_it8 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it7; ap_reg_ppstg_or_cond2_reg_1444_pp0_it9 <= ap_reg_ppstg_or_cond2_reg_1444_pp0_it8; ap_reg_ppstg_or_cond3_reg_1459_pp0_it2 <= or_cond3_reg_1459; ap_reg_ppstg_or_cond3_reg_1459_pp0_it3 <= ap_reg_ppstg_or_cond3_reg_1459_pp0_it2; ap_reg_ppstg_or_cond3_reg_1459_pp0_it4 <= ap_reg_ppstg_or_cond3_reg_1459_pp0_it3; ap_reg_ppstg_or_cond3_reg_1459_pp0_it5 <= ap_reg_ppstg_or_cond3_reg_1459_pp0_it4; ap_reg_ppstg_or_cond3_reg_1459_pp0_it6 <= ap_reg_ppstg_or_cond3_reg_1459_pp0_it5; ap_reg_ppstg_or_cond3_reg_1459_pp0_it7 <= ap_reg_ppstg_or_cond3_reg_1459_pp0_it6; ap_reg_ppstg_or_cond3_reg_1459_pp0_it8 <= ap_reg_ppstg_or_cond3_reg_1459_pp0_it7; ap_reg_ppstg_pix_val_0_reg_1491_pp0_it3 <= pix_val_0_reg_1491; ap_reg_ppstg_pix_val_0_reg_1491_pp0_it4 <= ap_reg_ppstg_pix_val_0_reg_1491_pp0_it3; ap_reg_ppstg_pix_val_0_reg_1491_pp0_it5 <= ap_reg_ppstg_pix_val_0_reg_1491_pp0_it4; ap_reg_ppstg_pix_val_0_reg_1491_pp0_it6 <= ap_reg_ppstg_pix_val_0_reg_1491_pp0_it5; ap_reg_ppstg_pix_val_1_reg_1498_pp0_it3 <= pix_val_1_reg_1498; ap_reg_ppstg_pix_val_2_reg_1453_pp0_it2 <= pix_val_2_reg_1453; ap_reg_ppstg_pix_val_2_reg_1453_pp0_it3 <= ap_reg_ppstg_pix_val_2_reg_1453_pp0_it2; ap_reg_ppstg_sepia_val_0_reg_1623_pp0_it9 <= sepia_val_0_reg_1623; ap_reg_ppstg_tmp_2_i3_reg_1551_pp0_it5 <= tmp_2_i3_reg_1551; ap_reg_ppstg_tmp_2_i3_reg_1551_pp0_it6 <= ap_reg_ppstg_tmp_2_i3_reg_1551_pp0_it5; ap_reg_ppstg_y_window_2_1_2_reg_1536_pp0_it5 <= y_window_2_1_2_reg_1536; ap_reg_ppstg_y_window_2_2_1_reg_1530_pp0_it5 <= y_window_2_2_1_reg_1530; sepia_val_0_reg_1623 <= grp_fu_1137_p2(19 downto 12); sepia_val_1_reg_1638 <= sepia_val_1_fu_1245_p3; sepia_val_2_reg_1633 <= sepia_val_2_fu_1225_p3; y_window_2_2_1_reg_1530 <= y_window_2_1_fu_184; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1))) then G_5_reg_1463 <= G_2_fu_156; G_reg_1480 <= line_buffer_1_1_val_q0; R_5_reg_1469 <= R_2_fu_168; R_reg_1475 <= line_buffer_1_0_val_q0; pix_val_0_reg_1491 <= line_buffer_0_0_val_q0; pix_val_1_reg_1498 <= line_buffer_0_1_val_q0; tmp1_reg_1486(1) <= tmp1_fu_597_p2(1); tmp1_reg_1486(2) <= tmp1_fu_597_p2(2); tmp1_reg_1486(3) <= tmp1_fu_597_p2(3); tmp1_reg_1486(4) <= tmp1_fu_597_p2(4); tmp1_reg_1486(5) <= tmp1_fu_597_p2(5); tmp1_reg_1486(6) <= tmp1_fu_597_p2(6); tmp1_reg_1486(7) <= tmp1_fu_597_p2(7); tmp1_reg_1486(8) <= tmp1_fu_597_p2(8); tmp1_reg_1486(9) <= tmp1_fu_597_p2(9); end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it3 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it3) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it4 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it3; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it4) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it5 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it4; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it5) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it6 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it5; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it6) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it7 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it6; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it7) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it8 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it7; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it8) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_phiprechg_edge_val1_reg_368pp0_it9 <= ap_reg_phiprechg_edge_val1_reg_368pp0_it8; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then ap_reg_ppstg_exitcond_reg_1385_pp0_it1 <= exitcond_reg_1385; ap_reg_ppstg_line_buffer_0_0_val_addr_reg_1416_pp0_it1 <= line_buffer_0_0_val_addr_reg_1416; ap_reg_ppstg_line_buffer_0_1_val_addr_reg_1422_pp0_it1 <= line_buffer_0_1_val_addr_reg_1422; ap_reg_ppstg_line_buffer_0_2_val_addr_reg_1428_pp0_it1 <= line_buffer_0_2_val_addr_reg_1428; ap_reg_ppstg_line_buffer_1_0_val_addr_reg_1398_pp0_it1 <= line_buffer_1_0_val_addr_reg_1398; ap_reg_ppstg_line_buffer_1_1_val_addr_reg_1404_pp0_it1 <= line_buffer_1_1_val_addr_reg_1404; ap_reg_ppstg_or_cond2_reg_1444_pp0_it1 <= or_cond2_reg_1444; exitcond_reg_1385 <= exitcond_fu_471_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it6) and (ap_const_lv1_0 = ap_reg_ppstg_or_cond3_reg_1459_pp0_it6))) then edge_weight_i_reg_1594 <= edge_weight_i_fu_1115_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = exitcond_fu_471_p2))) then line_buffer_0_0_val_addr_reg_1416 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_0_1_val_addr_reg_1422 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_0_2_val_addr_reg_1428 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_1_0_val_addr_reg_1398 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_1_1_val_addr_reg_1404 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_1_2_val_addr_reg_1410 <= tmp_16_fu_496_p1(11 - 1 downto 0); or_cond2_reg_1444 <= or_cond2_fu_539_p2; or_cond_reg_1394 <= or_cond_fu_491_p2; tmp10_reg_1434 <= tmp10_fu_523_p2; tmp11_reg_1439 <= tmp11_fu_528_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_lv1_0 = exitcond_reg_1385) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then or_cond3_reg_1459 <= or_cond3_fu_569_p2; pix_val_2_reg_1453 <= line_buffer_0_2_val_q0; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1)) then row_1_reg_1360 <= row_1_fu_437_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it2))) then tmp4_reg_1520(1) <= tmp4_fu_703_p2(1); tmp4_reg_1520(2) <= tmp4_fu_703_p2(2); tmp4_reg_1520(3) <= tmp4_fu_703_p2(3); tmp4_reg_1520(4) <= tmp4_fu_703_p2(4); tmp4_reg_1520(5) <= tmp4_fu_703_p2(5); tmp4_reg_1520(6) <= tmp4_fu_703_p2(6); tmp4_reg_1520(7) <= tmp4_fu_703_p2(7); tmp4_reg_1520(8) <= tmp4_fu_703_p2(8); tmp4_reg_1520(9) <= tmp4_fu_703_p2(9); tmp_6_i2_reg_1525(1) <= tmp_6_i2_fu_741_p2(1); tmp_6_i2_reg_1525(2) <= tmp_6_i2_fu_741_p2(2); tmp_6_i2_reg_1525(3) <= tmp_6_i2_fu_741_p2(3); tmp_6_i2_reg_1525(4) <= tmp_6_i2_fu_741_p2(4); tmp_6_i2_reg_1525(5) <= tmp_6_i2_fu_741_p2(5); tmp_6_i2_reg_1525(6) <= tmp_6_i2_fu_741_p2(6); tmp_6_i2_reg_1525(7) <= tmp_6_i2_fu_741_p2(7); tmp_6_i2_reg_1525(8) <= tmp_6_i2_fu_741_p2(8); tmp_6_i2_reg_1525(9) <= tmp_6_i2_fu_741_p2(9); tmp_6_i2_reg_1525(10) <= tmp_6_i2_fu_741_p2(10); tmp_6_i2_reg_1525(11) <= tmp_6_i2_fu_741_p2(11); tmp_6_i2_reg_1525(12) <= tmp_6_i2_fu_741_p2(12); tmp_6_i2_reg_1525(13) <= tmp_6_i2_fu_741_p2(13); tmp_6_i2_reg_1525(14) <= tmp_6_i2_fu_741_p2(14); tmp_i_reg_1515 <= tmp_8_i_fu_676_p2(15 downto 8); end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond1_fu_432_p2 = ap_const_lv1_0))) then tmp_11_reg_1365 <= tmp_11_fu_443_p2; tmp_12_reg_1370 <= tmp_12_fu_454_p2; tmp_13_reg_1375 <= tmp_13_fu_460_p2; tmp_s_reg_1380 <= tmp_s_fu_466_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it7) and (ap_const_lv1_0 = ap_reg_ppstg_or_cond3_reg_1459_pp0_it7))) then tmp_15_i_reg_1606 <= tmp_15_i_fu_1143_p2; tmp_17_i_reg_1612 <= tmp_17_i_fu_1148_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it5) and (ap_const_lv1_0 = ap_reg_ppstg_or_cond3_reg_1459_pp0_it5))) then tmp_28_reg_1582 <= tmp_28_fu_1057_p1; tmp_29_reg_1588 <= tmp_29_fu_1061_p1; x_weight_2_2_2_i_reg_1572 <= x_weight_2_2_2_i_fu_1045_p2; y_weight_2_2_2_i_reg_1577 <= y_weight_2_2_2_i_fu_1051_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it3))) then tmp_2_i3_reg_1551 <= tmp_2_i3_fu_880_p2; tmp_i1_reg_1541 <= tmp_8_i1_fu_809_p2(15 downto 8); tmp_i2_reg_1546 <= tmp_8_i2_fu_858_p2(15 downto 8); y_window_2_1_2_reg_1536 <= y_window_2_1_2_fu_750_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it4) and (ap_const_lv1_0 = ap_reg_ppstg_or_cond3_reg_1459_pp0_it4))) then x_weight_2_0_2_i_reg_1562 <= x_weight_2_0_2_i_fu_927_p2; y_weight_2_1_2_i_reg_1567 <= y_weight_2_1_2_i_fu_943_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it5) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it4))) then y_window_0_1_fu_160 <= y_window_0_1_1_fu_896_p2; y_window_0_2_fu_164 <= y_window_0_1_fu_160; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it4))) then y_window_1_1_1_reg_1556 <= y_window_1_1_1_fu_891_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it6) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it5))) then y_window_1_1_fu_172 <= y_window_1_1_1_reg_1556; y_window_1_2_fu_176 <= y_window_1_1_fu_172; y_window_2_2_fu_180 <= ap_reg_ppstg_y_window_2_2_1_reg_1530_pp0_it5; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it4) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it3))) then y_window_2_1_fu_184 <= y_window_2_1_2_fu_750_p2; end if; end if; end process; tmp1_reg_1486(0) <= '0'; tmp4_reg_1520(0) <= '0'; tmp_6_i2_reg_1525(0) <= '0'; -- the next state (ap_NS_fsm) of the state machine. -- ap_NS_fsm_assign_proc : process (ap_CS_fsm, ap_sig_bdd_65, exitcond1_fu_432_p2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it3, ap_reg_ppiten_pp0_it4, ap_reg_ppiten_pp0_it5, ap_reg_ppiten_pp0_it9, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin case ap_CS_fsm is when ap_ST_st1_fsm_0 => if (not(ap_sig_bdd_65)) then ap_NS_fsm <= ap_ST_st2_fsm_1; else ap_NS_fsm <= ap_ST_st1_fsm_0; end if; when ap_ST_st2_fsm_1 => if (not((exitcond1_fu_432_p2 = ap_const_lv1_0))) then ap_NS_fsm <= ap_ST_st1_fsm_0; else ap_NS_fsm <= ap_ST_pp0_stg0_fsm_2; end if; when ap_ST_pp0_stg0_fsm_2 => if ((not(((ap_const_logic_1 = ap_reg_ppiten_pp0_it10) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and not((ap_const_logic_1 = ap_reg_ppiten_pp0_it9)))) and not(((ap_const_logic_1 = ap_reg_ppiten_pp0_it4) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and not((ap_const_logic_1 = ap_reg_ppiten_pp0_it3)) and not((ap_const_logic_1 = ap_reg_ppiten_pp0_it5)))))) then ap_NS_fsm <= ap_ST_pp0_stg0_fsm_2; elsif ((((ap_const_logic_1 = ap_reg_ppiten_pp0_it10) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and not((ap_const_logic_1 = ap_reg_ppiten_pp0_it9))) or ((ap_const_logic_1 = ap_reg_ppiten_pp0_it4) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and not((ap_const_logic_1 = ap_reg_ppiten_pp0_it3)) and not((ap_const_logic_1 = ap_reg_ppiten_pp0_it5))))) then ap_NS_fsm <= ap_ST_st14_fsm_3; else ap_NS_fsm <= ap_ST_pp0_stg0_fsm_2; end if; when ap_ST_st14_fsm_3 => ap_NS_fsm <= ap_ST_st2_fsm_1; when others => ap_NS_fsm <= "XXXX"; end case; end process; G_3_fu_1208_p2 <= std_logic_vector(unsigned(B_cast_i_reg_1617) + unsigned(ap_const_lv9_22)); R_3_fu_1203_p2 <= std_logic_vector(unsigned(B_cast_i_reg_1617) + unsigned(ap_const_lv9_3C)); -- ap_done assign process. -- ap_done_assign_proc : process(ap_done_reg, exitcond1_fu_432_p2, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_done_reg) or ((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((exitcond1_fu_432_p2 = ap_const_lv1_0))))) then ap_done <= ap_const_logic_1; else ap_done <= ap_const_logic_0; end if; end process; -- ap_idle assign process. -- ap_idle_assign_proc : process(ap_start, ap_sig_cseq_ST_st1_fsm_0) begin if ((not((ap_const_logic_1 = ap_start)) and (ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0))) then ap_idle <= ap_const_logic_1; else ap_idle <= ap_const_logic_0; end if; end process; -- ap_ready assign process. -- ap_ready_assign_proc : process(exitcond1_fu_432_p2, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((exitcond1_fu_432_p2 = ap_const_lv1_0)))) then ap_ready <= ap_const_logic_1; else ap_ready <= ap_const_logic_0; end if; end process; ap_reg_phiprechg_edge_val1_reg_368pp0_it1 <= "XXXXXXXX"; -- ap_sig_bdd_107 assign process. -- ap_sig_bdd_107_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_107 <= (ap_const_lv1_1 = ap_CS_fsm(2 downto 2)); end process; -- ap_sig_bdd_124 assign process. -- ap_sig_bdd_124_assign_proc : process(img_0_data_stream_0_V_empty_n, img_0_data_stream_1_V_empty_n, img_0_data_stream_2_V_empty_n, exitcond_reg_1385, or_cond_reg_1394) begin ap_sig_bdd_124 <= (((img_0_data_stream_0_V_empty_n = ap_const_logic_0) and (ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394))) or ((ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394)) and (img_0_data_stream_1_V_empty_n = ap_const_logic_0)) or ((ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394)) and (img_0_data_stream_2_V_empty_n = ap_const_logic_0))); end process; -- ap_sig_bdd_156 assign process. -- ap_sig_bdd_156_assign_proc : process(img_1_data_stream_0_V_full_n, img_1_data_stream_1_V_full_n, img_1_data_stream_2_V_full_n, ap_reg_ppstg_or_cond2_reg_1444_pp0_it9) begin ap_sig_bdd_156 <= (((img_1_data_stream_0_V_full_n = ap_const_logic_0) and not((ap_const_lv1_0 = ap_reg_ppstg_or_cond2_reg_1444_pp0_it9))) or (not((ap_const_lv1_0 = ap_reg_ppstg_or_cond2_reg_1444_pp0_it9)) and (img_1_data_stream_1_V_full_n = ap_const_logic_0)) or (not((ap_const_lv1_0 = ap_reg_ppstg_or_cond2_reg_1444_pp0_it9)) and (img_1_data_stream_2_V_full_n = ap_const_logic_0))); end process; -- ap_sig_bdd_23 assign process. -- ap_sig_bdd_23_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_23 <= (ap_CS_fsm(0 downto 0) = ap_const_lv1_1); end process; -- ap_sig_bdd_349 assign process. -- ap_sig_bdd_349_assign_proc : process(ap_reg_ppstg_exitcond_reg_1385_pp0_it8, ap_reg_ppstg_or_cond3_reg_1459_pp0_it8) begin ap_sig_bdd_349 <= ((ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it8) and (ap_const_lv1_0 = ap_reg_ppstg_or_cond3_reg_1459_pp0_it8)); end process; -- ap_sig_bdd_429 assign process. -- ap_sig_bdd_429_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_429 <= (ap_const_lv1_1 = ap_CS_fsm(3 downto 3)); end process; -- ap_sig_bdd_436 assign process. -- ap_sig_bdd_436_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it9, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin ap_sig_bdd_436 <= ((ap_const_logic_1 = ap_reg_ppiten_pp0_it9) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))); end process; -- ap_sig_bdd_444 assign process. -- ap_sig_bdd_444_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin ap_sig_bdd_444 <= ((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))); end process; -- ap_sig_bdd_459 assign process. -- ap_sig_bdd_459_assign_proc : process(exitcond_reg_1385, or_cond3_fu_569_p2) begin ap_sig_bdd_459 <= ((ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond3_fu_569_p2))); end process; -- ap_sig_bdd_65 assign process. -- ap_sig_bdd_65_assign_proc : process(ap_start, ap_done_reg) begin ap_sig_bdd_65 <= ((ap_start = ap_const_logic_0) or (ap_done_reg = ap_const_logic_1)); end process; -- ap_sig_bdd_85 assign process. -- ap_sig_bdd_85_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_85 <= (ap_const_lv1_1 = ap_CS_fsm(1 downto 1)); end process; -- ap_sig_cseq_ST_pp0_stg0_fsm_2 assign process. -- ap_sig_cseq_ST_pp0_stg0_fsm_2_assign_proc : process(ap_sig_bdd_107) begin if (ap_sig_bdd_107) then ap_sig_cseq_ST_pp0_stg0_fsm_2 <= ap_const_logic_1; else ap_sig_cseq_ST_pp0_stg0_fsm_2 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st14_fsm_3 assign process. -- ap_sig_cseq_ST_st14_fsm_3_assign_proc : process(ap_sig_bdd_429) begin if (ap_sig_bdd_429) then ap_sig_cseq_ST_st14_fsm_3 <= ap_const_logic_1; else ap_sig_cseq_ST_st14_fsm_3 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st1_fsm_0 assign process. -- ap_sig_cseq_ST_st1_fsm_0_assign_proc : process(ap_sig_bdd_23) begin if (ap_sig_bdd_23) then ap_sig_cseq_ST_st1_fsm_0 <= ap_const_logic_1; else ap_sig_cseq_ST_st1_fsm_0 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st2_fsm_1 assign process. -- ap_sig_cseq_ST_st2_fsm_1_assign_proc : process(ap_sig_bdd_85) begin if (ap_sig_bdd_85) then ap_sig_cseq_ST_st2_fsm_1 <= ap_const_logic_1; else ap_sig_cseq_ST_st2_fsm_1 <= ap_const_logic_0; end if; end process; col_1_fu_476_p2 <= std_logic_vector(unsigned(col_reg_357) + unsigned(ap_const_lv11_1)); col_cast_fu_482_p1 <= std_logic_vector(resize(unsigned(col_reg_357),12)); edge_val_1_fu_1195_p3 <= p_i_cast_fu_1183_p3 when (tmp_27_fu_1191_p2(0) = '1') else edge_val_fu_1173_p2; edge_val_fu_1173_p2 <= (ap_reg_ppstg_edge_weight_i_reg_1594_pp0_it8 xor ap_const_lv8_FF); edge_weight_i_fu_1115_p2 <= std_logic_vector(unsigned(tmp_26_fu_1108_p3) + unsigned(tmp_23_fu_1091_p3)); exitcond1_fu_432_p2 <= "1" when (row_reg_346 = tmp_10_fu_414_p2) else "0"; exitcond_fu_471_p2 <= "1" when (col_reg_357 = tmp_9_fu_408_p2) else "0"; -- grp_fu_1137_ce assign process. -- grp_fu_1137_ce_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then grp_fu_1137_ce <= ap_const_logic_1; else grp_fu_1137_ce <= ap_const_logic_0; end if; end process; grp_fu_1137_p0 <= grp_fu_1137_p00(10 - 1 downto 0); grp_fu_1137_p00 <= std_logic_vector(resize(unsigned(tmp_3_i_fu_1127_p2),22)); grp_fu_1137_p1 <= ap_const_lv22_556(12 - 1 downto 0); -- grp_fu_563_ce assign process. -- grp_fu_563_ce_assign_proc : process(exitcond_reg_1385, ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1, ap_reg_ppstg_exitcond_reg_1385_pp0_it2) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and ((ap_const_lv1_0 = exitcond_reg_1385) or (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1) or (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it2)))) then grp_fu_563_ce <= ap_const_logic_1; else grp_fu_563_ce <= ap_const_logic_0; end if; end process; grp_fu_563_p0 <= grp_fu_563_p00(8 - 1 downto 0); grp_fu_563_p00 <= std_logic_vector(resize(unsigned(line_buffer_1_2_val_q0),13)); grp_fu_563_p1 <= ap_const_lv13_19(6 - 1 downto 0); -- grp_fu_606_ce assign process. -- grp_fu_606_ce_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1, ap_reg_ppstg_exitcond_reg_1385_pp0_it2, ap_reg_ppstg_exitcond_reg_1385_pp0_it3) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and ((ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1) or (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it2) or (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it3)))) then grp_fu_606_ce <= ap_const_logic_1; else grp_fu_606_ce <= ap_const_logic_0; end if; end process; grp_fu_606_p0 <= grp_fu_606_p00(8 - 1 downto 0); grp_fu_606_p00 <= std_logic_vector(resize(unsigned(pix_val_2_reg_1453),13)); grp_fu_606_p1 <= ap_const_lv13_19(6 - 1 downto 0); -- grp_fu_616_ce assign process. -- grp_fu_616_ce_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1, ap_reg_ppstg_exitcond_reg_1385_pp0_it2, ap_reg_ppstg_exitcond_reg_1385_pp0_it3) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and ((ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1) or (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it2) or (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it3)))) then grp_fu_616_ce <= ap_const_logic_1; else grp_fu_616_ce <= ap_const_logic_0; end if; end process; grp_fu_616_p0 <= grp_fu_616_p00(8 - 1 downto 0); grp_fu_616_p00 <= std_logic_vector(resize(unsigned(B_2_fu_152),13)); grp_fu_616_p1 <= ap_const_lv13_19(6 - 1 downto 0); -- img_0_data_stream_0_V_read assign process. -- img_0_data_stream_0_V_read_assign_proc : process(exitcond_reg_1385, ap_sig_cseq_ST_pp0_stg0_fsm_2, or_cond_reg_1394, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then img_0_data_stream_0_V_read <= ap_const_logic_1; else img_0_data_stream_0_V_read <= ap_const_logic_0; end if; end process; -- img_0_data_stream_1_V_read assign process. -- img_0_data_stream_1_V_read_assign_proc : process(exitcond_reg_1385, ap_sig_cseq_ST_pp0_stg0_fsm_2, or_cond_reg_1394, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then img_0_data_stream_1_V_read <= ap_const_logic_1; else img_0_data_stream_1_V_read <= ap_const_logic_0; end if; end process; -- img_0_data_stream_2_V_read assign process. -- img_0_data_stream_2_V_read_assign_proc : process(exitcond_reg_1385, ap_sig_cseq_ST_pp0_stg0_fsm_2, or_cond_reg_1394, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_lv1_0 = exitcond_reg_1385) and not((ap_const_lv1_0 = or_cond_reg_1394)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then img_0_data_stream_2_V_read <= ap_const_logic_1; else img_0_data_stream_2_V_read <= ap_const_logic_0; end if; end process; img_1_data_stream_0_V_din <= std_logic_vector(unsigned(ap_reg_ppstg_sepia_val_0_reg_1623_pp0_it9) + unsigned(ap_reg_phiprechg_edge_val1_reg_368pp0_it10)); -- img_1_data_stream_0_V_write assign process. -- img_1_data_stream_0_V_write_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppstg_or_cond2_reg_1444_pp0_it9, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if ((not((ap_const_lv1_0 = ap_reg_ppstg_or_cond2_reg_1444_pp0_it9)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then img_1_data_stream_0_V_write <= ap_const_logic_1; else img_1_data_stream_0_V_write <= ap_const_logic_0; end if; end process; img_1_data_stream_1_V_din <= std_logic_vector(unsigned(sepia_val_1_reg_1638) + unsigned(ap_reg_phiprechg_edge_val1_reg_368pp0_it10)); -- img_1_data_stream_1_V_write assign process. -- img_1_data_stream_1_V_write_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppstg_or_cond2_reg_1444_pp0_it9, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if ((not((ap_const_lv1_0 = ap_reg_ppstg_or_cond2_reg_1444_pp0_it9)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then img_1_data_stream_1_V_write <= ap_const_logic_1; else img_1_data_stream_1_V_write <= ap_const_logic_0; end if; end process; img_1_data_stream_2_V_din <= std_logic_vector(unsigned(sepia_val_2_reg_1633) + unsigned(ap_reg_phiprechg_edge_val1_reg_368pp0_it10)); -- img_1_data_stream_2_V_write assign process. -- img_1_data_stream_2_V_write_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppstg_or_cond2_reg_1444_pp0_it9, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if ((not((ap_const_lv1_0 = ap_reg_ppstg_or_cond2_reg_1444_pp0_it9)) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then img_1_data_stream_2_V_write <= ap_const_logic_1; else img_1_data_stream_2_V_write <= ap_const_logic_0; end if; end process; line_buffer_0_0_val_address0 <= line_buffer_0_0_val_addr_reg_1416; line_buffer_0_0_val_address1 <= ap_reg_ppstg_line_buffer_0_0_val_addr_reg_1416_pp0_it1; -- line_buffer_0_0_val_ce0 assign process. -- line_buffer_0_0_val_ce0_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_0_0_val_ce0 <= ap_const_logic_1; else line_buffer_0_0_val_ce0 <= ap_const_logic_0; end if; end process; -- line_buffer_0_0_val_ce1 assign process. -- line_buffer_0_0_val_ce1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_0_0_val_ce1 <= ap_const_logic_1; else line_buffer_0_0_val_ce1 <= ap_const_logic_0; end if; end process; line_buffer_0_0_val_d1 <= R_2_fu_168; -- line_buffer_0_0_val_we1 assign process. -- line_buffer_0_0_val_we1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1) begin if ((((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1)))) then line_buffer_0_0_val_we1 <= ap_const_logic_1; else line_buffer_0_0_val_we1 <= ap_const_logic_0; end if; end process; line_buffer_0_1_val_address0 <= line_buffer_0_1_val_addr_reg_1422; line_buffer_0_1_val_address1 <= ap_reg_ppstg_line_buffer_0_1_val_addr_reg_1422_pp0_it1; -- line_buffer_0_1_val_ce0 assign process. -- line_buffer_0_1_val_ce0_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_0_1_val_ce0 <= ap_const_logic_1; else line_buffer_0_1_val_ce0 <= ap_const_logic_0; end if; end process; -- line_buffer_0_1_val_ce1 assign process. -- line_buffer_0_1_val_ce1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_0_1_val_ce1 <= ap_const_logic_1; else line_buffer_0_1_val_ce1 <= ap_const_logic_0; end if; end process; line_buffer_0_1_val_d1 <= G_2_fu_156; -- line_buffer_0_1_val_we1 assign process. -- line_buffer_0_1_val_we1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1) begin if ((((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1)))) then line_buffer_0_1_val_we1 <= ap_const_logic_1; else line_buffer_0_1_val_we1 <= ap_const_logic_0; end if; end process; line_buffer_0_2_val_address0 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_0_2_val_address1 <= ap_reg_ppstg_line_buffer_0_2_val_addr_reg_1428_pp0_it1; -- line_buffer_0_2_val_ce0 assign process. -- line_buffer_0_2_val_ce0_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_reg_ppiten_pp0_it0, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it0) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_0_2_val_ce0 <= ap_const_logic_1; else line_buffer_0_2_val_ce0 <= ap_const_logic_0; end if; end process; -- line_buffer_0_2_val_ce1 assign process. -- line_buffer_0_2_val_ce1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_0_2_val_ce1 <= ap_const_logic_1; else line_buffer_0_2_val_ce1 <= ap_const_logic_0; end if; end process; line_buffer_0_2_val_d1 <= B_2_fu_152; -- line_buffer_0_2_val_we1 assign process. -- line_buffer_0_2_val_we1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1) begin if ((((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1)))) then line_buffer_0_2_val_we1 <= ap_const_logic_1; else line_buffer_0_2_val_we1 <= ap_const_logic_0; end if; end process; line_buffer_1_0_val_address0 <= line_buffer_1_0_val_addr_reg_1398; line_buffer_1_0_val_address1 <= ap_reg_ppstg_line_buffer_1_0_val_addr_reg_1398_pp0_it1; -- line_buffer_1_0_val_ce0 assign process. -- line_buffer_1_0_val_ce0_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_1_0_val_ce0 <= ap_const_logic_1; else line_buffer_1_0_val_ce0 <= ap_const_logic_0; end if; end process; -- line_buffer_1_0_val_ce1 assign process. -- line_buffer_1_0_val_ce1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_1_0_val_ce1 <= ap_const_logic_1; else line_buffer_1_0_val_ce1 <= ap_const_logic_0; end if; end process; line_buffer_1_0_val_d1 <= line_buffer_0_0_val_q0; -- line_buffer_1_0_val_we1 assign process. -- line_buffer_1_0_val_we1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1) begin if ((((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1)))) then line_buffer_1_0_val_we1 <= ap_const_logic_1; else line_buffer_1_0_val_we1 <= ap_const_logic_0; end if; end process; line_buffer_1_1_val_address0 <= line_buffer_1_1_val_addr_reg_1404; line_buffer_1_1_val_address1 <= ap_reg_ppstg_line_buffer_1_1_val_addr_reg_1404_pp0_it1; -- line_buffer_1_1_val_ce0 assign process. -- line_buffer_1_1_val_ce0_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_1_1_val_ce0 <= ap_const_logic_1; else line_buffer_1_1_val_ce0 <= ap_const_logic_0; end if; end process; -- line_buffer_1_1_val_ce1 assign process. -- line_buffer_1_1_val_ce1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_1_1_val_ce1 <= ap_const_logic_1; else line_buffer_1_1_val_ce1 <= ap_const_logic_0; end if; end process; line_buffer_1_1_val_d1 <= line_buffer_0_1_val_q0; -- line_buffer_1_1_val_we1 assign process. -- line_buffer_1_1_val_we1_assign_proc : process(ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_reg_ppiten_pp0_it2, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10, ap_reg_ppstg_exitcond_reg_1385_pp0_it1) begin if ((((ap_const_logic_1 = ap_reg_ppiten_pp0_it2) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))) and (ap_const_lv1_0 = ap_reg_ppstg_exitcond_reg_1385_pp0_it1)))) then line_buffer_1_1_val_we1 <= ap_const_logic_1; else line_buffer_1_1_val_we1 <= ap_const_logic_0; end if; end process; line_buffer_1_2_val_address0 <= tmp_16_fu_496_p1(11 - 1 downto 0); line_buffer_1_2_val_address1 <= line_buffer_1_2_val_addr_reg_1410; -- line_buffer_1_2_val_ce0 assign process. -- line_buffer_1_2_val_ce0_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_reg_ppiten_pp0_it0, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it0) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_1_2_val_ce0 <= ap_const_logic_1; else line_buffer_1_2_val_ce0 <= ap_const_logic_0; end if; end process; -- line_buffer_1_2_val_ce1 assign process. -- line_buffer_1_2_val_ce1_assign_proc : process(ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10)))))) then line_buffer_1_2_val_ce1 <= ap_const_logic_1; else line_buffer_1_2_val_ce1 <= ap_const_logic_0; end if; end process; line_buffer_1_2_val_d1 <= line_buffer_0_2_val_q0; -- line_buffer_1_2_val_we1 assign process. -- line_buffer_1_2_val_we1_assign_proc : process(exitcond_reg_1385, ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_124, ap_reg_ppiten_pp0_it1, ap_sig_bdd_156, ap_reg_ppiten_pp0_it10) begin if ((((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_lv1_0 = exitcond_reg_1385) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_124 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)) or (ap_sig_bdd_156 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it10))))))) then line_buffer_1_2_val_we1 <= ap_const_logic_1; else line_buffer_1_2_val_we1 <= ap_const_logic_0; end if; end process; not_tmp_15_i_fu_1178_p2 <= (tmp_15_i_reg_1606 xor ap_const_lv1_1); or_cond2_fu_539_p2 <= (tmp_13_reg_1375 and tmp_19_fu_533_p2); or_cond3_fu_569_p2 <= (tmp11_reg_1439 or tmp10_reg_1434); or_cond_fu_491_p2 <= (tmp_11_reg_1365 and tmp_14_fu_486_p2); output_col_fu_506_p2 <= std_logic_vector(unsigned(col_cast_fu_482_p1) + unsigned(ap_const_lv12_FFF)); output_row_fu_448_p2 <= std_logic_vector(unsigned(row_cast_fu_428_p1) + unsigned(ap_const_lv12_FFF)); p_i_cast_fu_1183_p3 <= ap_const_lv8_FF when (not_tmp_15_i_fu_1178_p2(0) = '1') else ap_const_lv8_0; p_shl1_cast_i1_fu_716_p1 <= std_logic_vector(resize(unsigned(p_shl1_i1_fu_709_p3),15)); p_shl1_cast_i5_fu_762_p1 <= std_logic_vector(resize(unsigned(p_shl1_i4_fu_755_p3),15)); p_shl1_cast_i_fu_629_p1 <= std_logic_vector(resize(unsigned(p_shl1_i_fu_622_p3),15)); p_shl1_i1_fu_709_p3 <= (R_5_reg_1469 & ap_const_lv6_0); p_shl1_i4_fu_755_p3 <= (ap_reg_ppstg_pix_val_0_reg_1491_pp0_it3 & ap_const_lv6_0); p_shl1_i_fu_622_p3 <= (R_reg_1475 & ap_const_lv6_0); p_shl2_cast_i29_cast_fu_727_p1 <= std_logic_vector(resize(unsigned(p_shl2_i1_fu_720_p3),10)); p_shl2_cast_i7_cast_fu_699_p1 <= std_logic_vector(resize(unsigned(p_shl2_i6_fu_692_p3),10)); p_shl2_cast_i_cast_fu_593_p1 <= std_logic_vector(resize(unsigned(p_shl2_i_fu_585_p3),10)); p_shl2_i1_fu_720_p3 <= (R_5_reg_1469 & ap_const_lv1_0); p_shl2_i6_fu_692_p3 <= (pix_val_0_reg_1491 & ap_const_lv1_0); p_shl2_i_fu_585_p3 <= (line_buffer_1_0_val_q0 & ap_const_lv1_0); p_shl8_cast_i_fu_978_p1 <= std_logic_vector(resize(unsigned(p_shl8_i_fu_971_p3),11)); p_shl8_i_fu_971_p3 <= (y_window_1_1_1_reg_1556 & ap_const_lv1_0); p_shl_cast_i1_fu_776_p1 <= std_logic_vector(resize(unsigned(p_shl_i1_fu_769_p3),16)); p_shl_cast_i2_fu_835_p1 <= std_logic_vector(resize(unsigned(p_shl_i2_fu_828_p3),16)); p_shl_cast_i3_fu_1031_p1 <= std_logic_vector(resize(unsigned(p_shl_i3_fu_1024_p3),11)); p_shl_cast_i_fu_643_p1 <= std_logic_vector(resize(unsigned(p_shl_i_fu_636_p3),16)); p_shl_i1_fu_769_p3 <= (ap_reg_ppstg_pix_val_1_reg_1498_pp0_it3 & ap_const_lv7_0); p_shl_i2_fu_828_p3 <= (ap_reg_ppstg_G_5_reg_1463_pp0_it3 & ap_const_lv7_0); p_shl_i3_fu_1024_p3 <= (ap_reg_ppstg_y_window_2_2_1_reg_1530_pp0_it5 & ap_const_lv1_0); p_shl_i_fu_636_p3 <= (G_reg_1480 & ap_const_lv7_0); row_1_fu_437_p2 <= std_logic_vector(unsigned(row_reg_346) + unsigned(ap_const_lv11_1)); row_cast_fu_428_p1 <= std_logic_vector(resize(unsigned(row_reg_346),12)); sepia_val_1_fu_1245_p3 <= ap_const_lv8_FF when (tmp_32_fu_1233_p3(0) = '1') else tmp_33_fu_1241_p1; sepia_val_2_fu_1225_p3 <= ap_const_lv8_FF when (tmp_30_fu_1213_p3(0) = '1') else tmp_31_fu_1221_p1; tmp10_fu_523_p2 <= (tmp_12_reg_1370 or tmp_17_fu_512_p2); tmp11_fu_528_p2 <= (tmp_s_reg_1380 or tmp_18_fu_518_p2); tmp12_fu_933_p2 <= std_logic_vector(unsigned(tmp_19_0_cast9_i_cast_fu_907_p1) + unsigned(tmp_19_0_2_cast8_i_cast_fu_923_p1)); tmp1_fu_597_p2 <= std_logic_vector(unsigned(p_shl2_cast_i_cast_fu_593_p1) + unsigned(ap_const_lv10_80)); tmp2_fu_660_p2 <= std_logic_vector(unsigned(p_shl_cast_i_fu_643_p1) + unsigned(tmp_6_cast_i_fu_656_p1)); tmp3_fu_666_p2 <= std_logic_vector(unsigned(grp_fu_563_p2) + unsigned(tmp_2_cast3_i_cast_fu_633_p1)); tmp4_fu_703_p2 <= std_logic_vector(unsigned(p_shl2_cast_i7_cast_fu_699_p1) + unsigned(ap_const_lv10_80)); tmp55_cast_fu_647_p1 <= std_logic_vector(resize(unsigned(tmp1_reg_1486),15)); tmp57_cast_fu_672_p1 <= std_logic_vector(resize(unsigned(tmp3_fu_666_p2),16)); tmp58_cast_fu_780_p1 <= std_logic_vector(resize(unsigned(tmp4_reg_1520),15)); tmp5_fu_793_p2 <= std_logic_vector(unsigned(p_shl_cast_i1_fu_776_p1) + unsigned(tmp_6_cast_i1_fu_789_p1)); tmp60_cast_fu_805_p1 <= std_logic_vector(resize(unsigned(tmp6_fu_799_p2),16)); tmp61_cast_fu_737_p1 <= std_logic_vector(resize(unsigned(tmp7_fu_731_p2),15)); tmp63_cast_fu_854_p1 <= std_logic_vector(resize(unsigned(tmp9_fu_848_p2),16)); tmp66_cast_fu_939_p1 <= std_logic_vector(resize(unsigned(tmp12_fu_933_p2),10)); tmp6_fu_799_p2 <= std_logic_vector(unsigned(grp_fu_606_p2) + unsigned(tmp_2_cast3_i9_cast_fu_766_p1)); tmp7_fu_731_p2 <= std_logic_vector(unsigned(p_shl2_cast_i29_cast_fu_727_p1) + unsigned(ap_const_lv10_80)); tmp8_fu_842_p2 <= std_logic_vector(unsigned(p_shl_cast_i2_fu_835_p1) + unsigned(tmp_6_cast_i2_fu_839_p1)); tmp9_fu_848_p2 <= std_logic_vector(unsigned(grp_fu_616_p2) + unsigned(tmp_2_cast3_i31_cast_fu_825_p1)); tmp_10_fu_414_p2 <= std_logic_vector(unsigned(tmp_fu_380_p1) + unsigned(ap_const_lv11_1)); tmp_11_fu_443_p2 <= "1" when (signed(row_cast_fu_428_p1) < signed(tmp_21_fu_420_p1)) else "0"; tmp_11_i_fu_1098_p2 <= "1" when (signed(y_weight_2_2_2_i_reg_1577) > signed(ap_const_lv11_0)) else "0"; tmp_12_fu_454_p2 <= "1" when (output_row_fu_448_p2 = ap_const_lv12_0) else "0"; tmp_13_fu_460_p2 <= "0" when (row_reg_346 = ap_const_lv11_0) else "1"; tmp_14_fu_486_p2 <= "1" when (signed(col_cast_fu_482_p1) < signed(tmp_24_fu_424_p1)) else "0"; tmp_15_cast_fu_390_p1 <= std_logic_vector(resize(unsigned(tmp_7_fu_384_p2),12)); tmp_15_i_fu_1143_p2 <= "1" when (unsigned(edge_weight_i_reg_1594) < unsigned(ap_const_lv8_37)) else "0"; tmp_16_cast_fu_404_p1 <= std_logic_vector(resize(unsigned(tmp_8_fu_398_p2),12)); tmp_16_fu_496_p1 <= std_logic_vector(resize(unsigned(col_reg_357),64)); tmp_17_fu_512_p2 <= "1" when (output_col_fu_506_p2 = ap_const_lv12_0) else "0"; tmp_17_i_fu_1148_p2 <= "1" when (unsigned(edge_weight_i_reg_1594) > unsigned(ap_const_lv8_CD)) else "0"; tmp_18_fu_518_p2 <= "1" when (output_col_fu_506_p2 = tmp_16_cast_fu_404_p1) else "0"; tmp_19_0_2_cast8_i_cast_fu_923_p1 <= std_logic_vector(resize(unsigned(y_window_0_2_fu_164),9)); tmp_19_0_cast9_i_cast_fu_907_p1 <= std_logic_vector(resize(unsigned(y_window_0_1_1_fu_896_p2),9)); tmp_19_2_2_cast_i_fu_1041_p1 <= std_logic_vector(resize(unsigned(y_window_2_2_fu_180),11)); tmp_19_2_cast_i_fu_1009_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_y_window_2_1_2_reg_1536_pp0_it5),11)); tmp_19_fu_533_p2 <= "0" when (col_reg_357 = ap_const_lv11_0) else "1"; tmp_1_cast_i_fu_1121_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_pix_val_0_reg_1491_pp0_it6),10)); tmp_21_1_2_cast_i_fu_996_p1 <= std_logic_vector(resize(unsigned(tmp_21_1_2_i_fu_988_p3),11)); tmp_21_1_2_i_fu_988_p3 <= (y_window_1_2_fu_176 & ap_const_lv1_0); tmp_21_fu_420_p1 <= rows(12 - 1 downto 0); tmp_22_fu_1086_p2 <= std_logic_vector(unsigned(ap_const_lv8_0) - unsigned(tmp_28_reg_1582)); tmp_23_0_1_cast_i_fu_919_p1 <= std_logic_vector(resize(unsigned(tmp_23_0_1_i_fu_911_p3),10)); tmp_23_0_1_i_fu_911_p3 <= (y_window_0_1_fu_160 & ap_const_lv1_0); tmp_23_fu_1091_p3 <= tmp_28_reg_1582 when (tmp_i_29_fu_1081_p2(0) = '1') else tmp_22_fu_1086_p2; tmp_24_fu_424_p1 <= cols(12 - 1 downto 0); tmp_25_fu_1103_p2 <= std_logic_vector(unsigned(ap_const_lv8_0) - unsigned(tmp_29_reg_1588)); tmp_26_fu_1108_p3 <= tmp_29_reg_1588 when (tmp_11_i_fu_1098_p2(0) = '1') else tmp_25_fu_1103_p2; tmp_27_fu_1191_p2 <= (tmp_15_i_reg_1606 or tmp_17_i_reg_1612); tmp_28_fu_1057_p1 <= x_weight_2_2_2_i_fu_1045_p2(8 - 1 downto 0); tmp_29_fu_1061_p1 <= y_weight_2_2_2_i_fu_1051_p2(8 - 1 downto 0); tmp_2_cast3_i31_cast_fu_825_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_G_5_reg_1463_pp0_it3),13)); tmp_2_cast3_i9_cast_fu_766_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_pix_val_1_reg_1498_pp0_it3),13)); tmp_2_cast3_i_cast_fu_633_p1 <= std_logic_vector(resize(unsigned(G_reg_1480),13)); tmp_2_cast_i3_fu_1124_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_tmp_2_i3_reg_1551_pp0_it6),10)); tmp_2_fu_394_p1 <= cols(11 - 1 downto 0); tmp_2_i3_fu_880_p2 <= std_logic_vector(unsigned(tmp_cast_i_fu_877_p1) + unsigned(tmp_cast_i2_fu_874_p1)); tmp_30_fu_1213_p3 <= R_3_fu_1203_p2(8 downto 8); tmp_31_fu_1221_p1 <= R_3_fu_1203_p2(8 - 1 downto 0); tmp_32_fu_1233_p3 <= G_3_fu_1208_p2(8 downto 8); tmp_33_fu_1241_p1 <= G_3_fu_1208_p2(8 - 1 downto 0); tmp_3_i_fu_1127_p2 <= std_logic_vector(unsigned(tmp_2_cast_i3_fu_1124_p1) + unsigned(tmp_1_cast_i_fu_1121_p1)); tmp_6_cast_i1_fu_789_p1 <= std_logic_vector(resize(unsigned(tmp_6_i1_fu_783_p2),16)); tmp_6_cast_i2_fu_839_p1 <= std_logic_vector(resize(unsigned(tmp_6_i2_reg_1525),16)); tmp_6_cast_i_fu_656_p1 <= std_logic_vector(resize(unsigned(tmp_6_i_fu_650_p2),16)); tmp_6_i1_fu_783_p2 <= std_logic_vector(unsigned(tmp58_cast_fu_780_p1) + unsigned(p_shl1_cast_i5_fu_762_p1)); tmp_6_i2_fu_741_p2 <= std_logic_vector(unsigned(tmp61_cast_fu_737_p1) + unsigned(p_shl1_cast_i1_fu_716_p1)); tmp_6_i_fu_650_p2 <= std_logic_vector(unsigned(tmp55_cast_fu_647_p1) + unsigned(p_shl1_cast_i_fu_629_p1)); tmp_7_fu_384_p2 <= std_logic_vector(unsigned(tmp_fu_380_p1) + unsigned(ap_const_lv11_7FF)); tmp_8_fu_398_p2 <= std_logic_vector(unsigned(tmp_2_fu_394_p1) + unsigned(ap_const_lv11_7FF)); tmp_8_i1_fu_809_p2 <= std_logic_vector(unsigned(tmp60_cast_fu_805_p1) + unsigned(tmp5_fu_793_p2)); tmp_8_i2_fu_858_p2 <= std_logic_vector(unsigned(tmp63_cast_fu_854_p1) + unsigned(tmp8_fu_842_p2)); tmp_8_i_fu_676_p2 <= std_logic_vector(unsigned(tmp57_cast_fu_672_p1) + unsigned(tmp2_fu_660_p2)); tmp_9_fu_408_p2 <= std_logic_vector(unsigned(tmp_2_fu_394_p1) + unsigned(ap_const_lv11_1)); tmp_cast_i2_fu_874_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_pix_val_2_reg_1453_pp0_it3),9)); tmp_cast_i_fu_877_p1 <= std_logic_vector(resize(unsigned(ap_reg_ppstg_pix_val_1_reg_1498_pp0_it3),9)); tmp_fu_380_p1 <= rows(11 - 1 downto 0); tmp_i_29_fu_1081_p2 <= "1" when (signed(x_weight_2_2_2_i_reg_1572) > signed(ap_const_lv11_0)) else "0"; tmp_s_fu_466_p2 <= "1" when (output_row_fu_448_p2 = tmp_15_cast_fu_390_p1) else "0"; x_weight_2_0_2_cast_i_fu_968_p1 <= std_logic_vector(resize(signed(x_weight_2_0_2_i_reg_1562),11)); x_weight_2_0_2_i_fu_927_p2 <= std_logic_vector(unsigned(tmp_19_0_2_cast8_i_cast_fu_923_p1) - unsigned(tmp_19_0_cast9_i_cast_fu_907_p1)); x_weight_2_1_1_i_fu_982_p2 <= std_logic_vector(signed(x_weight_2_0_2_cast_i_fu_968_p1) - signed(p_shl8_cast_i_fu_978_p1)); x_weight_2_1_2_i_fu_1000_p2 <= std_logic_vector(signed(x_weight_2_1_1_i_fu_982_p2) + signed(tmp_21_1_2_cast_i_fu_996_p1)); x_weight_2_2_2_i_fu_1045_p2 <= std_logic_vector(signed(x_weight_2_2_i_fu_1012_p2) + signed(tmp_19_2_2_cast_i_fu_1041_p1)); x_weight_2_2_i_fu_1012_p2 <= std_logic_vector(signed(x_weight_2_1_2_i_fu_1000_p2) - signed(tmp_19_2_cast_i_fu_1009_p1)); y_weight_2_1_2_cast_i_fu_1006_p1 <= std_logic_vector(resize(unsigned(y_weight_2_1_2_i_reg_1567),11)); y_weight_2_1_2_i_fu_943_p2 <= std_logic_vector(unsigned(tmp66_cast_fu_939_p1) + unsigned(tmp_23_0_1_cast_i_fu_919_p1)); y_weight_2_2_1_i_fu_1035_p2 <= std_logic_vector(unsigned(y_weight_2_2_i_fu_1018_p2) - unsigned(p_shl_cast_i3_fu_1031_p1)); y_weight_2_2_2_i_fu_1051_p2 <= std_logic_vector(unsigned(y_weight_2_2_1_i_fu_1035_p2) - unsigned(tmp_19_2_2_cast_i_fu_1041_p1)); y_weight_2_2_i_fu_1018_p2 <= std_logic_vector(unsigned(y_weight_2_1_2_cast_i_fu_1006_p1) - unsigned(tmp_19_2_cast_i_fu_1009_p1)); y_window_0_1_1_fu_896_p2 <= std_logic_vector(unsigned(tmp_i2_reg_1546) + unsigned(ap_const_lv8_10)); y_window_1_1_1_fu_891_p2 <= std_logic_vector(unsigned(tmp_i1_reg_1541) + unsigned(ap_const_lv8_10)); y_window_2_1_2_fu_750_p2 <= std_logic_vector(unsigned(tmp_i_reg_1515) + unsigned(ap_const_lv8_10)); end behav;
gpl-3.0
9f2574619acfa09fc3c4ea1b17bac7a2
0.610127
2.539678
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_mask_cols_V.vhd
2
4,556
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_mask_cols_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_mask_cols_V_shiftReg; architecture rtl of FIFO_image_filter_mask_cols_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_mask_cols_V is generic ( MEM_STYLE : string := "shiftreg"; DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_mask_cols_V is component FIFO_image_filter_mask_cols_V_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_mask_cols_V_shiftReg : FIFO_image_filter_mask_cols_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
248f8a54d15b4dae6b123077907bbd91
0.535558
3.520866
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/median/prj/solution1/syn/vhdl/image_filter.vhd
2
64,300
-- ============================================================== -- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- =========================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity image_filter is port ( INPUT_STREAM_TDATA : IN STD_LOGIC_VECTOR (31 downto 0); INPUT_STREAM_TKEEP : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TSTRB : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TUSER : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TLAST : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TID : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TDEST : IN STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDATA : OUT STD_LOGIC_VECTOR (31 downto 0); OUTPUT_STREAM_TKEEP : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TSTRB : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TUSER : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TLAST : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TID : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDEST : OUT STD_LOGIC_VECTOR (0 downto 0); rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); ap_clk : IN STD_LOGIC; ap_rst_n : IN STD_LOGIC; ap_start : IN STD_LOGIC; INPUT_STREAM_TVALID : IN STD_LOGIC; INPUT_STREAM_TREADY : OUT STD_LOGIC; OUTPUT_STREAM_TVALID : OUT STD_LOGIC; OUTPUT_STREAM_TREADY : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC ); end; architecture behav of image_filter is attribute CORE_GENERATION_INFO : STRING; attribute CORE_GENERATION_INFO of behav : architecture is "image_filter,hls_ip_2014_4,{HLS_INPUT_TYPE=cxx,HLS_INPUT_FLOAT=0,HLS_INPUT_FIXED=0,HLS_INPUT_PART=xc7z020clg484-1,HLS_INPUT_CLOCK=6.666670,HLS_INPUT_ARCH=dataflow,HLS_SYN_CLOCK=5.758000,HLS_SYN_LAT=-1,HLS_SYN_TPT=-1,HLS_SYN_MEM=0,HLS_SYN_DSP=0,HLS_SYN_FF=586,HLS_SYN_LUT=990}"; constant ap_const_lv32_0 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000000"; constant ap_const_lv4_0 : STD_LOGIC_VECTOR (3 downto 0) := "0000"; constant ap_const_lv1_0 : STD_LOGIC_VECTOR (0 downto 0) := "0"; constant ap_true : BOOLEAN := true; constant ap_const_logic_0 : STD_LOGIC := '0'; constant ap_const_logic_1 : STD_LOGIC := '1'; constant ap_const_lv8_0 : STD_LOGIC_VECTOR (7 downto 0) := "00000000"; constant ap_const_lv8_1 : STD_LOGIC_VECTOR (7 downto 0) := "00000001"; signal ap_rst_n_inv : STD_LOGIC; signal image_filter_Block_proc_U0_ap_start : STD_LOGIC; signal image_filter_Block_proc_U0_ap_done : STD_LOGIC; signal image_filter_Block_proc_U0_ap_continue : STD_LOGIC; signal image_filter_Block_proc_U0_ap_idle : STD_LOGIC; signal image_filter_Block_proc_U0_ap_ready : STD_LOGIC; signal image_filter_Block_proc_U0_rows : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Block_proc_U0_cols : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Block_proc_U0_ap_return_0 : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Block_proc_U0_ap_return_1 : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Block_proc_U0_ap_return_2 : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Block_proc_U0_ap_return_3 : STD_LOGIC_VECTOR (11 downto 0); signal ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V : STD_LOGIC; signal img_1_rows_V_full_n : STD_LOGIC; signal ap_reg_ready_img_1_rows_V_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_1_rows_V_full_n : STD_LOGIC; signal ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel : STD_LOGIC; signal img_0_rows_V_channel_full_n : STD_LOGIC; signal ap_reg_ready_img_0_rows_V_channel_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_0_rows_V_channel_full_n : STD_LOGIC; signal ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V : STD_LOGIC; signal img_1_cols_V_full_n : STD_LOGIC; signal ap_reg_ready_img_1_cols_V_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_1_cols_V_full_n : STD_LOGIC; signal ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel : STD_LOGIC; signal img_0_cols_V_channel_full_n : STD_LOGIC; signal ap_reg_ready_img_0_cols_V_channel_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_0_cols_V_channel_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_start : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_done : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_continue : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_idle : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_ready : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDATA : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TVALID : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TREADY : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TKEEP : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TSTRB : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TUSER : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TLAST : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TID : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDEST : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_img_rows_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_AXIvideo2Mat_U0_img_cols_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_write : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_write : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_start : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_done : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_continue : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_idle : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_ready : STD_LOGIC; signal image_filter_Loop_1_proc_U0_rows : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Loop_1_proc_U0_cols : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_full_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_full_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_full_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_empty_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_read : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_empty_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_read : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_empty_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_read : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_0_address0 : STD_LOGIC_VECTOR (1 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_0_ce0 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_0_we0 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_0_d0 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_0_q0 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_0_address1 : STD_LOGIC_VECTOR (1 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_0_ce1 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_0_we1 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_0_d1 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_0_q1 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_1_address0 : STD_LOGIC_VECTOR (1 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_1_ce0 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_1_we0 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_1_d0 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_1_q0 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_1_address1 : STD_LOGIC_VECTOR (1 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_1_ce1 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_1_we1 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_1_d1 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_1_q1 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_2_address0 : STD_LOGIC_VECTOR (1 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_2_ce0 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_2_we0 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_2_d0 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_2_q0 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_2_address1 : STD_LOGIC_VECTOR (1 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_2_ce1 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_2_we1 : STD_LOGIC; signal image_filter_Loop_1_proc_U0_buffer_val_2_d1 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_buffer_val_2_q1 : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_ap_start : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_done : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_continue : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_idle : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_ready : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_rows_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Mat2AXIvideo_U0_img_cols_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_empty_n : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_read : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_empty_n : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_read : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_empty_n : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_read : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDATA : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TVALID : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TREADY : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TKEEP : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TSTRB : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TUSER : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TLAST : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TID : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDEST : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_hs_continue : STD_LOGIC; signal img_0_rows_V_channel_U_ap_dummy_ce : STD_LOGIC; signal img_0_rows_V_channel_din : STD_LOGIC_VECTOR (11 downto 0); signal img_0_rows_V_channel_write : STD_LOGIC; signal img_0_rows_V_channel_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_0_rows_V_channel_empty_n : STD_LOGIC; signal img_0_rows_V_channel_read : STD_LOGIC; signal img_0_cols_V_channel_U_ap_dummy_ce : STD_LOGIC; signal img_0_cols_V_channel_din : STD_LOGIC_VECTOR (11 downto 0); signal img_0_cols_V_channel_write : STD_LOGIC; signal img_0_cols_V_channel_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_0_cols_V_channel_empty_n : STD_LOGIC; signal img_0_cols_V_channel_read : STD_LOGIC; signal img_1_rows_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_rows_V_din : STD_LOGIC_VECTOR (11 downto 0); signal img_1_rows_V_write : STD_LOGIC; signal img_1_rows_V_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_1_rows_V_empty_n : STD_LOGIC; signal img_1_rows_V_read : STD_LOGIC; signal img_1_cols_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_cols_V_din : STD_LOGIC_VECTOR (11 downto 0); signal img_1_cols_V_write : STD_LOGIC; signal img_1_cols_V_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_1_cols_V_empty_n : STD_LOGIC; signal img_1_cols_V_read : STD_LOGIC; signal img_0_data_stream_0_V_U_ap_dummy_ce : STD_LOGIC; signal img_0_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_0_V_full_n : STD_LOGIC; signal img_0_data_stream_0_V_write : STD_LOGIC; signal img_0_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_0_V_empty_n : STD_LOGIC; signal img_0_data_stream_0_V_read : STD_LOGIC; signal img_0_data_stream_1_V_U_ap_dummy_ce : STD_LOGIC; signal img_0_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_1_V_full_n : STD_LOGIC; signal img_0_data_stream_1_V_write : STD_LOGIC; signal img_0_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_1_V_empty_n : STD_LOGIC; signal img_0_data_stream_1_V_read : STD_LOGIC; signal img_0_data_stream_2_V_U_ap_dummy_ce : STD_LOGIC; signal img_0_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_2_V_full_n : STD_LOGIC; signal img_0_data_stream_2_V_write : STD_LOGIC; signal img_0_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_2_V_empty_n : STD_LOGIC; signal img_0_data_stream_2_V_read : STD_LOGIC; signal img_1_data_stream_0_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_0_V_full_n : STD_LOGIC; signal img_1_data_stream_0_V_write : STD_LOGIC; signal img_1_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_0_V_empty_n : STD_LOGIC; signal img_1_data_stream_0_V_read : STD_LOGIC; signal img_1_data_stream_1_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_1_V_full_n : STD_LOGIC; signal img_1_data_stream_1_V_write : STD_LOGIC; signal img_1_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_1_V_empty_n : STD_LOGIC; signal img_1_data_stream_1_V_read : STD_LOGIC; signal img_1_data_stream_2_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_2_V_full_n : STD_LOGIC; signal img_1_data_stream_2_V_write : STD_LOGIC; signal img_1_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_2_V_empty_n : STD_LOGIC; signal img_1_data_stream_2_V_read : STD_LOGIC; signal ap_reg_procdone_image_filter_Block_proc_U0 : STD_LOGIC := '0'; signal ap_sig_hs_done : STD_LOGIC; signal ap_reg_procdone_image_filter_AXIvideo2Mat_U0 : STD_LOGIC := '0'; signal ap_reg_procdone_image_filter_Loop_1_proc_U0 : STD_LOGIC := '0'; signal ap_reg_procdone_image_filter_Mat2AXIvideo_U0 : STD_LOGIC := '0'; signal ap_CS : STD_LOGIC; signal ap_sig_top_allready : STD_LOGIC; component image_filter_Block_proc IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); ap_return_0 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_1 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_2 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_3 : OUT STD_LOGIC_VECTOR (11 downto 0) ); end component; component image_filter_AXIvideo2Mat IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; INPUT_STREAM_TDATA : IN STD_LOGIC_VECTOR (31 downto 0); INPUT_STREAM_TVALID : IN STD_LOGIC; INPUT_STREAM_TREADY : OUT STD_LOGIC; INPUT_STREAM_TKEEP : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TSTRB : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TUSER : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TLAST : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TID : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TDEST : IN STD_LOGIC_VECTOR (0 downto 0); img_rows_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_cols_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_data_stream_0_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_data_stream_0_V_full_n : IN STD_LOGIC; img_data_stream_0_V_write : OUT STD_LOGIC; img_data_stream_1_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_data_stream_1_V_full_n : IN STD_LOGIC; img_data_stream_1_V_write : OUT STD_LOGIC; img_data_stream_2_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_data_stream_2_V_full_n : IN STD_LOGIC; img_data_stream_2_V_write : OUT STD_LOGIC ); end component; component image_filter_Loop_1_proc IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); img_1_data_stream_0_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_0_V_full_n : IN STD_LOGIC; img_1_data_stream_0_V_write : OUT STD_LOGIC; img_1_data_stream_1_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_1_V_full_n : IN STD_LOGIC; img_1_data_stream_1_V_write : OUT STD_LOGIC; img_1_data_stream_2_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_2_V_full_n : IN STD_LOGIC; img_1_data_stream_2_V_write : OUT STD_LOGIC; img_0_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_0_V_empty_n : IN STD_LOGIC; img_0_data_stream_0_V_read : OUT STD_LOGIC; img_0_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_1_V_empty_n : IN STD_LOGIC; img_0_data_stream_1_V_read : OUT STD_LOGIC; img_0_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_2_V_empty_n : IN STD_LOGIC; img_0_data_stream_2_V_read : OUT STD_LOGIC; buffer_val_0_address0 : OUT STD_LOGIC_VECTOR (1 downto 0); buffer_val_0_ce0 : OUT STD_LOGIC; buffer_val_0_we0 : OUT STD_LOGIC; buffer_val_0_d0 : OUT STD_LOGIC_VECTOR (7 downto 0); buffer_val_0_q0 : IN STD_LOGIC_VECTOR (7 downto 0); buffer_val_0_address1 : OUT STD_LOGIC_VECTOR (1 downto 0); buffer_val_0_ce1 : OUT STD_LOGIC; buffer_val_0_we1 : OUT STD_LOGIC; buffer_val_0_d1 : OUT STD_LOGIC_VECTOR (7 downto 0); buffer_val_0_q1 : IN STD_LOGIC_VECTOR (7 downto 0); buffer_val_1_address0 : OUT STD_LOGIC_VECTOR (1 downto 0); buffer_val_1_ce0 : OUT STD_LOGIC; buffer_val_1_we0 : OUT STD_LOGIC; buffer_val_1_d0 : OUT STD_LOGIC_VECTOR (7 downto 0); buffer_val_1_q0 : IN STD_LOGIC_VECTOR (7 downto 0); buffer_val_1_address1 : OUT STD_LOGIC_VECTOR (1 downto 0); buffer_val_1_ce1 : OUT STD_LOGIC; buffer_val_1_we1 : OUT STD_LOGIC; buffer_val_1_d1 : OUT STD_LOGIC_VECTOR (7 downto 0); buffer_val_1_q1 : IN STD_LOGIC_VECTOR (7 downto 0); buffer_val_2_address0 : OUT STD_LOGIC_VECTOR (1 downto 0); buffer_val_2_ce0 : OUT STD_LOGIC; buffer_val_2_we0 : OUT STD_LOGIC; buffer_val_2_d0 : OUT STD_LOGIC_VECTOR (7 downto 0); buffer_val_2_q0 : IN STD_LOGIC_VECTOR (7 downto 0); buffer_val_2_address1 : OUT STD_LOGIC_VECTOR (1 downto 0); buffer_val_2_ce1 : OUT STD_LOGIC; buffer_val_2_we1 : OUT STD_LOGIC; buffer_val_2_d1 : OUT STD_LOGIC_VECTOR (7 downto 0); buffer_val_2_q1 : IN STD_LOGIC_VECTOR (7 downto 0) ); end component; component image_filter_Mat2AXIvideo IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; img_rows_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_cols_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_0_V_empty_n : IN STD_LOGIC; img_data_stream_0_V_read : OUT STD_LOGIC; img_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_1_V_empty_n : IN STD_LOGIC; img_data_stream_1_V_read : OUT STD_LOGIC; img_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_2_V_empty_n : IN STD_LOGIC; img_data_stream_2_V_read : OUT STD_LOGIC; OUTPUT_STREAM_TDATA : OUT STD_LOGIC_VECTOR (31 downto 0); OUTPUT_STREAM_TVALID : OUT STD_LOGIC; OUTPUT_STREAM_TREADY : IN STD_LOGIC; OUTPUT_STREAM_TKEEP : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TSTRB : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TUSER : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TLAST : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TID : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDEST : OUT STD_LOGIC_VECTOR (0 downto 0) ); end component; component FIFO_image_filter_img_0_rows_V_channel IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_cols_V_channel IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_rows_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_cols_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_data_stream_0_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_data_stream_1_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_data_stream_2_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_data_stream_0_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_data_stream_1_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_data_stream_2_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; begin image_filter_Block_proc_U0 : component image_filter_Block_proc port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_Block_proc_U0_ap_start, ap_done => image_filter_Block_proc_U0_ap_done, ap_continue => image_filter_Block_proc_U0_ap_continue, ap_idle => image_filter_Block_proc_U0_ap_idle, ap_ready => image_filter_Block_proc_U0_ap_ready, rows => image_filter_Block_proc_U0_rows, cols => image_filter_Block_proc_U0_cols, ap_return_0 => image_filter_Block_proc_U0_ap_return_0, ap_return_1 => image_filter_Block_proc_U0_ap_return_1, ap_return_2 => image_filter_Block_proc_U0_ap_return_2, ap_return_3 => image_filter_Block_proc_U0_ap_return_3); image_filter_AXIvideo2Mat_U0 : component image_filter_AXIvideo2Mat port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_AXIvideo2Mat_U0_ap_start, ap_done => image_filter_AXIvideo2Mat_U0_ap_done, ap_continue => image_filter_AXIvideo2Mat_U0_ap_continue, ap_idle => image_filter_AXIvideo2Mat_U0_ap_idle, ap_ready => image_filter_AXIvideo2Mat_U0_ap_ready, INPUT_STREAM_TDATA => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDATA, INPUT_STREAM_TVALID => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TVALID, INPUT_STREAM_TREADY => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TREADY, INPUT_STREAM_TKEEP => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TKEEP, INPUT_STREAM_TSTRB => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TSTRB, INPUT_STREAM_TUSER => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TUSER, INPUT_STREAM_TLAST => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TLAST, INPUT_STREAM_TID => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TID, INPUT_STREAM_TDEST => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDEST, img_rows_V_read => image_filter_AXIvideo2Mat_U0_img_rows_V_read, img_cols_V_read => image_filter_AXIvideo2Mat_U0_img_cols_V_read, img_data_stream_0_V_din => image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_din, img_data_stream_0_V_full_n => image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_full_n, img_data_stream_0_V_write => image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_write, img_data_stream_1_V_din => image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_din, img_data_stream_1_V_full_n => image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_full_n, img_data_stream_1_V_write => image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_write, img_data_stream_2_V_din => image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_din, img_data_stream_2_V_full_n => image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_full_n, img_data_stream_2_V_write => image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_write); image_filter_Loop_1_proc_U0 : component image_filter_Loop_1_proc port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_Loop_1_proc_U0_ap_start, ap_done => image_filter_Loop_1_proc_U0_ap_done, ap_continue => image_filter_Loop_1_proc_U0_ap_continue, ap_idle => image_filter_Loop_1_proc_U0_ap_idle, ap_ready => image_filter_Loop_1_proc_U0_ap_ready, rows => image_filter_Loop_1_proc_U0_rows, cols => image_filter_Loop_1_proc_U0_cols, img_1_data_stream_0_V_din => image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_din, img_1_data_stream_0_V_full_n => image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_full_n, img_1_data_stream_0_V_write => image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_write, img_1_data_stream_1_V_din => image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_din, img_1_data_stream_1_V_full_n => image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_full_n, img_1_data_stream_1_V_write => image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_write, img_1_data_stream_2_V_din => image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_din, img_1_data_stream_2_V_full_n => image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_full_n, img_1_data_stream_2_V_write => image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_write, img_0_data_stream_0_V_dout => image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_dout, img_0_data_stream_0_V_empty_n => image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_empty_n, img_0_data_stream_0_V_read => image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_read, img_0_data_stream_1_V_dout => image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_dout, img_0_data_stream_1_V_empty_n => image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_empty_n, img_0_data_stream_1_V_read => image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_read, img_0_data_stream_2_V_dout => image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_dout, img_0_data_stream_2_V_empty_n => image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_empty_n, img_0_data_stream_2_V_read => image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_read, buffer_val_0_address0 => image_filter_Loop_1_proc_U0_buffer_val_0_address0, buffer_val_0_ce0 => image_filter_Loop_1_proc_U0_buffer_val_0_ce0, buffer_val_0_we0 => image_filter_Loop_1_proc_U0_buffer_val_0_we0, buffer_val_0_d0 => image_filter_Loop_1_proc_U0_buffer_val_0_d0, buffer_val_0_q0 => image_filter_Loop_1_proc_U0_buffer_val_0_q0, buffer_val_0_address1 => image_filter_Loop_1_proc_U0_buffer_val_0_address1, buffer_val_0_ce1 => image_filter_Loop_1_proc_U0_buffer_val_0_ce1, buffer_val_0_we1 => image_filter_Loop_1_proc_U0_buffer_val_0_we1, buffer_val_0_d1 => image_filter_Loop_1_proc_U0_buffer_val_0_d1, buffer_val_0_q1 => image_filter_Loop_1_proc_U0_buffer_val_0_q1, buffer_val_1_address0 => image_filter_Loop_1_proc_U0_buffer_val_1_address0, buffer_val_1_ce0 => image_filter_Loop_1_proc_U0_buffer_val_1_ce0, buffer_val_1_we0 => image_filter_Loop_1_proc_U0_buffer_val_1_we0, buffer_val_1_d0 => image_filter_Loop_1_proc_U0_buffer_val_1_d0, buffer_val_1_q0 => image_filter_Loop_1_proc_U0_buffer_val_1_q0, buffer_val_1_address1 => image_filter_Loop_1_proc_U0_buffer_val_1_address1, buffer_val_1_ce1 => image_filter_Loop_1_proc_U0_buffer_val_1_ce1, buffer_val_1_we1 => image_filter_Loop_1_proc_U0_buffer_val_1_we1, buffer_val_1_d1 => image_filter_Loop_1_proc_U0_buffer_val_1_d1, buffer_val_1_q1 => image_filter_Loop_1_proc_U0_buffer_val_1_q1, buffer_val_2_address0 => image_filter_Loop_1_proc_U0_buffer_val_2_address0, buffer_val_2_ce0 => image_filter_Loop_1_proc_U0_buffer_val_2_ce0, buffer_val_2_we0 => image_filter_Loop_1_proc_U0_buffer_val_2_we0, buffer_val_2_d0 => image_filter_Loop_1_proc_U0_buffer_val_2_d0, buffer_val_2_q0 => image_filter_Loop_1_proc_U0_buffer_val_2_q0, buffer_val_2_address1 => image_filter_Loop_1_proc_U0_buffer_val_2_address1, buffer_val_2_ce1 => image_filter_Loop_1_proc_U0_buffer_val_2_ce1, buffer_val_2_we1 => image_filter_Loop_1_proc_U0_buffer_val_2_we1, buffer_val_2_d1 => image_filter_Loop_1_proc_U0_buffer_val_2_d1, buffer_val_2_q1 => image_filter_Loop_1_proc_U0_buffer_val_2_q1); image_filter_Mat2AXIvideo_U0 : component image_filter_Mat2AXIvideo port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_Mat2AXIvideo_U0_ap_start, ap_done => image_filter_Mat2AXIvideo_U0_ap_done, ap_continue => image_filter_Mat2AXIvideo_U0_ap_continue, ap_idle => image_filter_Mat2AXIvideo_U0_ap_idle, ap_ready => image_filter_Mat2AXIvideo_U0_ap_ready, img_rows_V_read => image_filter_Mat2AXIvideo_U0_img_rows_V_read, img_cols_V_read => image_filter_Mat2AXIvideo_U0_img_cols_V_read, img_data_stream_0_V_dout => image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_dout, img_data_stream_0_V_empty_n => image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_empty_n, img_data_stream_0_V_read => image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_read, img_data_stream_1_V_dout => image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_dout, img_data_stream_1_V_empty_n => image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_empty_n, img_data_stream_1_V_read => image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_read, img_data_stream_2_V_dout => image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_dout, img_data_stream_2_V_empty_n => image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_empty_n, img_data_stream_2_V_read => image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_read, OUTPUT_STREAM_TDATA => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDATA, OUTPUT_STREAM_TVALID => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TVALID, OUTPUT_STREAM_TREADY => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TREADY, OUTPUT_STREAM_TKEEP => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TKEEP, OUTPUT_STREAM_TSTRB => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TSTRB, OUTPUT_STREAM_TUSER => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TUSER, OUTPUT_STREAM_TLAST => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TLAST, OUTPUT_STREAM_TID => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TID, OUTPUT_STREAM_TDEST => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDEST); img_0_rows_V_channel_U : component FIFO_image_filter_img_0_rows_V_channel port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_rows_V_channel_U_ap_dummy_ce, if_write_ce => img_0_rows_V_channel_U_ap_dummy_ce, if_din => img_0_rows_V_channel_din, if_full_n => img_0_rows_V_channel_full_n, if_write => img_0_rows_V_channel_write, if_dout => img_0_rows_V_channel_dout, if_empty_n => img_0_rows_V_channel_empty_n, if_read => img_0_rows_V_channel_read); img_0_cols_V_channel_U : component FIFO_image_filter_img_0_cols_V_channel port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_cols_V_channel_U_ap_dummy_ce, if_write_ce => img_0_cols_V_channel_U_ap_dummy_ce, if_din => img_0_cols_V_channel_din, if_full_n => img_0_cols_V_channel_full_n, if_write => img_0_cols_V_channel_write, if_dout => img_0_cols_V_channel_dout, if_empty_n => img_0_cols_V_channel_empty_n, if_read => img_0_cols_V_channel_read); img_1_rows_V_U : component FIFO_image_filter_img_1_rows_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_rows_V_U_ap_dummy_ce, if_write_ce => img_1_rows_V_U_ap_dummy_ce, if_din => img_1_rows_V_din, if_full_n => img_1_rows_V_full_n, if_write => img_1_rows_V_write, if_dout => img_1_rows_V_dout, if_empty_n => img_1_rows_V_empty_n, if_read => img_1_rows_V_read); img_1_cols_V_U : component FIFO_image_filter_img_1_cols_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_cols_V_U_ap_dummy_ce, if_write_ce => img_1_cols_V_U_ap_dummy_ce, if_din => img_1_cols_V_din, if_full_n => img_1_cols_V_full_n, if_write => img_1_cols_V_write, if_dout => img_1_cols_V_dout, if_empty_n => img_1_cols_V_empty_n, if_read => img_1_cols_V_read); img_0_data_stream_0_V_U : component FIFO_image_filter_img_0_data_stream_0_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_data_stream_0_V_U_ap_dummy_ce, if_write_ce => img_0_data_stream_0_V_U_ap_dummy_ce, if_din => img_0_data_stream_0_V_din, if_full_n => img_0_data_stream_0_V_full_n, if_write => img_0_data_stream_0_V_write, if_dout => img_0_data_stream_0_V_dout, if_empty_n => img_0_data_stream_0_V_empty_n, if_read => img_0_data_stream_0_V_read); img_0_data_stream_1_V_U : component FIFO_image_filter_img_0_data_stream_1_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_data_stream_1_V_U_ap_dummy_ce, if_write_ce => img_0_data_stream_1_V_U_ap_dummy_ce, if_din => img_0_data_stream_1_V_din, if_full_n => img_0_data_stream_1_V_full_n, if_write => img_0_data_stream_1_V_write, if_dout => img_0_data_stream_1_V_dout, if_empty_n => img_0_data_stream_1_V_empty_n, if_read => img_0_data_stream_1_V_read); img_0_data_stream_2_V_U : component FIFO_image_filter_img_0_data_stream_2_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_data_stream_2_V_U_ap_dummy_ce, if_write_ce => img_0_data_stream_2_V_U_ap_dummy_ce, if_din => img_0_data_stream_2_V_din, if_full_n => img_0_data_stream_2_V_full_n, if_write => img_0_data_stream_2_V_write, if_dout => img_0_data_stream_2_V_dout, if_empty_n => img_0_data_stream_2_V_empty_n, if_read => img_0_data_stream_2_V_read); img_1_data_stream_0_V_U : component FIFO_image_filter_img_1_data_stream_0_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_data_stream_0_V_U_ap_dummy_ce, if_write_ce => img_1_data_stream_0_V_U_ap_dummy_ce, if_din => img_1_data_stream_0_V_din, if_full_n => img_1_data_stream_0_V_full_n, if_write => img_1_data_stream_0_V_write, if_dout => img_1_data_stream_0_V_dout, if_empty_n => img_1_data_stream_0_V_empty_n, if_read => img_1_data_stream_0_V_read); img_1_data_stream_1_V_U : component FIFO_image_filter_img_1_data_stream_1_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_data_stream_1_V_U_ap_dummy_ce, if_write_ce => img_1_data_stream_1_V_U_ap_dummy_ce, if_din => img_1_data_stream_1_V_din, if_full_n => img_1_data_stream_1_V_full_n, if_write => img_1_data_stream_1_V_write, if_dout => img_1_data_stream_1_V_dout, if_empty_n => img_1_data_stream_1_V_empty_n, if_read => img_1_data_stream_1_V_read); img_1_data_stream_2_V_U : component FIFO_image_filter_img_1_data_stream_2_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_data_stream_2_V_U_ap_dummy_ce, if_write_ce => img_1_data_stream_2_V_U_ap_dummy_ce, if_din => img_1_data_stream_2_V_din, if_full_n => img_1_data_stream_2_V_full_n, if_write => img_1_data_stream_2_V_write, if_dout => img_1_data_stream_2_V_dout, if_empty_n => img_1_data_stream_2_V_empty_n, if_read => img_1_data_stream_2_V_read); -- ap_reg_procdone_image_filter_AXIvideo2Mat_U0 assign process. -- ap_reg_procdone_image_filter_AXIvideo2Mat_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_AXIvideo2Mat_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_AXIvideo2Mat_U0 <= ap_const_logic_0; elsif ((ap_const_logic_1 = image_filter_AXIvideo2Mat_U0_ap_done)) then ap_reg_procdone_image_filter_AXIvideo2Mat_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_procdone_image_filter_Block_proc_U0 assign process. -- ap_reg_procdone_image_filter_Block_proc_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_Block_proc_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_Block_proc_U0 <= ap_const_logic_0; elsif ((image_filter_Block_proc_U0_ap_done = ap_const_logic_1)) then ap_reg_procdone_image_filter_Block_proc_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_procdone_image_filter_Loop_1_proc_U0 assign process. -- ap_reg_procdone_image_filter_Loop_1_proc_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_Loop_1_proc_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_Loop_1_proc_U0 <= ap_const_logic_0; elsif ((ap_const_logic_1 = image_filter_Loop_1_proc_U0_ap_done)) then ap_reg_procdone_image_filter_Loop_1_proc_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_procdone_image_filter_Mat2AXIvideo_U0 assign process. -- ap_reg_procdone_image_filter_Mat2AXIvideo_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_Mat2AXIvideo_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_Mat2AXIvideo_U0 <= ap_const_logic_0; elsif ((ap_const_logic_1 = image_filter_Mat2AXIvideo_U0_ap_done)) then ap_reg_procdone_image_filter_Mat2AXIvideo_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_0_cols_V_channel_full_n assign process. -- ap_reg_ready_img_0_cols_V_channel_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_0_cols_V_channel_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_0_cols_V_channel_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (ap_const_logic_1 = img_0_cols_V_channel_full_n))) then ap_reg_ready_img_0_cols_V_channel_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_0_rows_V_channel_full_n assign process. -- ap_reg_ready_img_0_rows_V_channel_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_0_rows_V_channel_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_0_rows_V_channel_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (ap_const_logic_1 = img_0_rows_V_channel_full_n))) then ap_reg_ready_img_0_rows_V_channel_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_1_cols_V_full_n assign process. -- ap_reg_ready_img_1_cols_V_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_1_cols_V_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_1_cols_V_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (ap_const_logic_1 = img_1_cols_V_full_n))) then ap_reg_ready_img_1_cols_V_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_1_rows_V_full_n assign process. -- ap_reg_ready_img_1_rows_V_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_1_rows_V_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_1_rows_V_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (img_1_rows_V_full_n = ap_const_logic_1))) then ap_reg_ready_img_1_rows_V_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_CS assign process. -- ap_CS_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then ap_CS <= ap_const_logic_0; end if; end process; INPUT_STREAM_TREADY <= image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TREADY; OUTPUT_STREAM_TDATA <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDATA; OUTPUT_STREAM_TDEST <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDEST; OUTPUT_STREAM_TID <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TID; OUTPUT_STREAM_TKEEP <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TKEEP; OUTPUT_STREAM_TLAST <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TLAST; OUTPUT_STREAM_TSTRB <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TSTRB; OUTPUT_STREAM_TUSER <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TUSER; OUTPUT_STREAM_TVALID <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TVALID; -- ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_0_cols_V_channel_full_n) begin if ((ap_const_logic_1 = ap_reg_ready_img_0_cols_V_channel_full_n)) then ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel <= image_filter_Block_proc_U0_ap_done; end if; end process; -- ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_0_rows_V_channel_full_n) begin if ((ap_const_logic_1 = ap_reg_ready_img_0_rows_V_channel_full_n)) then ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel <= image_filter_Block_proc_U0_ap_done; end if; end process; -- ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_1_cols_V_full_n) begin if ((ap_const_logic_1 = ap_reg_ready_img_1_cols_V_full_n)) then ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V <= image_filter_Block_proc_U0_ap_done; end if; end process; -- ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_1_rows_V_full_n) begin if ((ap_reg_ready_img_1_rows_V_full_n = ap_const_logic_1)) then ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V <= image_filter_Block_proc_U0_ap_done; end if; end process; ap_done <= ap_sig_hs_done; -- ap_idle assign process. -- ap_idle_assign_proc : process(image_filter_Block_proc_U0_ap_idle, image_filter_AXIvideo2Mat_U0_ap_idle, image_filter_Loop_1_proc_U0_ap_idle, image_filter_Mat2AXIvideo_U0_ap_idle, img_0_rows_V_channel_empty_n, img_0_cols_V_channel_empty_n, img_1_rows_V_empty_n, img_1_cols_V_empty_n) begin if (((image_filter_Block_proc_U0_ap_idle = ap_const_logic_1) and (ap_const_logic_1 = image_filter_AXIvideo2Mat_U0_ap_idle) and (ap_const_logic_1 = image_filter_Loop_1_proc_U0_ap_idle) and (ap_const_logic_1 = image_filter_Mat2AXIvideo_U0_ap_idle) and (ap_const_logic_0 = img_0_rows_V_channel_empty_n) and (ap_const_logic_0 = img_0_cols_V_channel_empty_n) and (ap_const_logic_0 = img_1_rows_V_empty_n) and (ap_const_logic_0 = img_1_cols_V_empty_n))) then ap_idle <= ap_const_logic_1; else ap_idle <= ap_const_logic_0; end if; end process; ap_ready <= ap_sig_top_allready; -- ap_rst_n_inv assign process. -- ap_rst_n_inv_assign_proc : process(ap_rst_n) begin ap_rst_n_inv <= not(ap_rst_n); end process; ap_sig_hs_continue <= ap_const_logic_1; -- ap_sig_hs_done assign process. -- ap_sig_hs_done_assign_proc : process(image_filter_Mat2AXIvideo_U0_ap_done) begin if ((ap_const_logic_1 = image_filter_Mat2AXIvideo_U0_ap_done)) then ap_sig_hs_done <= ap_const_logic_1; else ap_sig_hs_done <= ap_const_logic_0; end if; end process; -- ap_sig_ready_img_0_cols_V_channel_full_n assign process. -- ap_sig_ready_img_0_cols_V_channel_full_n_assign_proc : process(img_0_cols_V_channel_full_n, ap_reg_ready_img_0_cols_V_channel_full_n) begin if ((ap_const_logic_0 = ap_reg_ready_img_0_cols_V_channel_full_n)) then ap_sig_ready_img_0_cols_V_channel_full_n <= img_0_cols_V_channel_full_n; else ap_sig_ready_img_0_cols_V_channel_full_n <= ap_const_logic_1; end if; end process; -- ap_sig_ready_img_0_rows_V_channel_full_n assign process. -- ap_sig_ready_img_0_rows_V_channel_full_n_assign_proc : process(img_0_rows_V_channel_full_n, ap_reg_ready_img_0_rows_V_channel_full_n) begin if ((ap_const_logic_0 = ap_reg_ready_img_0_rows_V_channel_full_n)) then ap_sig_ready_img_0_rows_V_channel_full_n <= img_0_rows_V_channel_full_n; else ap_sig_ready_img_0_rows_V_channel_full_n <= ap_const_logic_1; end if; end process; -- ap_sig_ready_img_1_cols_V_full_n assign process. -- ap_sig_ready_img_1_cols_V_full_n_assign_proc : process(img_1_cols_V_full_n, ap_reg_ready_img_1_cols_V_full_n) begin if ((ap_const_logic_0 = ap_reg_ready_img_1_cols_V_full_n)) then ap_sig_ready_img_1_cols_V_full_n <= img_1_cols_V_full_n; else ap_sig_ready_img_1_cols_V_full_n <= ap_const_logic_1; end if; end process; -- ap_sig_ready_img_1_rows_V_full_n assign process. -- ap_sig_ready_img_1_rows_V_full_n_assign_proc : process(img_1_rows_V_full_n, ap_reg_ready_img_1_rows_V_full_n) begin if ((ap_reg_ready_img_1_rows_V_full_n = ap_const_logic_0)) then ap_sig_ready_img_1_rows_V_full_n <= img_1_rows_V_full_n; else ap_sig_ready_img_1_rows_V_full_n <= ap_const_logic_1; end if; end process; ap_sig_top_allready <= image_filter_AXIvideo2Mat_U0_ap_ready; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDATA <= INPUT_STREAM_TDATA; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDEST <= INPUT_STREAM_TDEST; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TID <= INPUT_STREAM_TID; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TKEEP <= INPUT_STREAM_TKEEP; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TLAST <= INPUT_STREAM_TLAST; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TSTRB <= INPUT_STREAM_TSTRB; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TUSER <= INPUT_STREAM_TUSER; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TVALID <= INPUT_STREAM_TVALID; image_filter_AXIvideo2Mat_U0_ap_continue <= ap_const_logic_1; image_filter_AXIvideo2Mat_U0_ap_start <= (ap_start and img_0_rows_V_channel_empty_n and img_0_cols_V_channel_empty_n); image_filter_AXIvideo2Mat_U0_img_cols_V_read <= img_0_cols_V_channel_dout; image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_full_n <= img_0_data_stream_0_V_full_n; image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_full_n <= img_0_data_stream_1_V_full_n; image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_full_n <= img_0_data_stream_2_V_full_n; image_filter_AXIvideo2Mat_U0_img_rows_V_read <= img_0_rows_V_channel_dout; -- image_filter_Block_proc_U0_ap_continue assign process. -- image_filter_Block_proc_U0_ap_continue_assign_proc : process(ap_sig_ready_img_1_rows_V_full_n, ap_sig_ready_img_0_rows_V_channel_full_n, ap_sig_ready_img_1_cols_V_full_n, ap_sig_ready_img_0_cols_V_channel_full_n) begin if (((ap_sig_ready_img_1_rows_V_full_n = ap_const_logic_1) and (ap_const_logic_1 = ap_sig_ready_img_0_rows_V_channel_full_n) and (ap_const_logic_1 = ap_sig_ready_img_1_cols_V_full_n) and (ap_const_logic_1 = ap_sig_ready_img_0_cols_V_channel_full_n))) then image_filter_Block_proc_U0_ap_continue <= ap_const_logic_1; else image_filter_Block_proc_U0_ap_continue <= ap_const_logic_0; end if; end process; image_filter_Block_proc_U0_ap_start <= ap_start; image_filter_Block_proc_U0_cols <= cols; image_filter_Block_proc_U0_rows <= rows; image_filter_Loop_1_proc_U0_ap_continue <= ap_const_logic_1; image_filter_Loop_1_proc_U0_ap_start <= ap_start; image_filter_Loop_1_proc_U0_buffer_val_0_q0 <= ap_const_lv8_0; image_filter_Loop_1_proc_U0_buffer_val_0_q1 <= ap_const_lv8_0; image_filter_Loop_1_proc_U0_buffer_val_1_q0 <= ap_const_lv8_0; image_filter_Loop_1_proc_U0_buffer_val_1_q1 <= ap_const_lv8_0; image_filter_Loop_1_proc_U0_buffer_val_2_q0 <= ap_const_lv8_0; image_filter_Loop_1_proc_U0_buffer_val_2_q1 <= ap_const_lv8_0; image_filter_Loop_1_proc_U0_cols <= cols; image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_dout <= img_0_data_stream_0_V_dout; image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_empty_n <= img_0_data_stream_0_V_empty_n; image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_dout <= img_0_data_stream_1_V_dout; image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_empty_n <= img_0_data_stream_1_V_empty_n; image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_dout <= img_0_data_stream_2_V_dout; image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_empty_n <= img_0_data_stream_2_V_empty_n; image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_full_n <= img_1_data_stream_0_V_full_n; image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_full_n <= img_1_data_stream_1_V_full_n; image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_full_n <= img_1_data_stream_2_V_full_n; image_filter_Loop_1_proc_U0_rows <= rows; image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TREADY <= OUTPUT_STREAM_TREADY; image_filter_Mat2AXIvideo_U0_ap_continue <= ap_sig_hs_continue; image_filter_Mat2AXIvideo_U0_ap_start <= (img_1_rows_V_empty_n and img_1_cols_V_empty_n); image_filter_Mat2AXIvideo_U0_img_cols_V_read <= img_1_cols_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_dout <= img_1_data_stream_0_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_empty_n <= img_1_data_stream_0_V_empty_n; image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_dout <= img_1_data_stream_1_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_empty_n <= img_1_data_stream_1_V_empty_n; image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_dout <= img_1_data_stream_2_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_empty_n <= img_1_data_stream_2_V_empty_n; image_filter_Mat2AXIvideo_U0_img_rows_V_read <= img_1_rows_V_dout; img_0_cols_V_channel_U_ap_dummy_ce <= ap_const_logic_1; img_0_cols_V_channel_din <= image_filter_Block_proc_U0_ap_return_1; img_0_cols_V_channel_read <= image_filter_AXIvideo2Mat_U0_ap_ready; img_0_cols_V_channel_write <= ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel; img_0_data_stream_0_V_U_ap_dummy_ce <= ap_const_logic_1; img_0_data_stream_0_V_din <= image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_din; img_0_data_stream_0_V_read <= image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_read; img_0_data_stream_0_V_write <= image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_write; img_0_data_stream_1_V_U_ap_dummy_ce <= ap_const_logic_1; img_0_data_stream_1_V_din <= image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_din; img_0_data_stream_1_V_read <= image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_read; img_0_data_stream_1_V_write <= image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_write; img_0_data_stream_2_V_U_ap_dummy_ce <= ap_const_logic_1; img_0_data_stream_2_V_din <= image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_din; img_0_data_stream_2_V_read <= image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_read; img_0_data_stream_2_V_write <= image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_write; img_0_rows_V_channel_U_ap_dummy_ce <= ap_const_logic_1; img_0_rows_V_channel_din <= image_filter_Block_proc_U0_ap_return_0; img_0_rows_V_channel_read <= image_filter_AXIvideo2Mat_U0_ap_ready; img_0_rows_V_channel_write <= ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel; img_1_cols_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_cols_V_din <= image_filter_Block_proc_U0_ap_return_3; img_1_cols_V_read <= image_filter_Mat2AXIvideo_U0_ap_ready; img_1_cols_V_write <= ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V; img_1_data_stream_0_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_data_stream_0_V_din <= image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_din; img_1_data_stream_0_V_read <= image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_read; img_1_data_stream_0_V_write <= image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_write; img_1_data_stream_1_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_data_stream_1_V_din <= image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_din; img_1_data_stream_1_V_read <= image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_read; img_1_data_stream_1_V_write <= image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_write; img_1_data_stream_2_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_data_stream_2_V_din <= image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_din; img_1_data_stream_2_V_read <= image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_read; img_1_data_stream_2_V_write <= image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_write; img_1_rows_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_rows_V_din <= image_filter_Block_proc_U0_ap_return_2; img_1_rows_V_read <= image_filter_Mat2AXIvideo_U0_ap_ready; img_1_rows_V_write <= ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V; end behav;
gpl-3.0
33a0b66a50988eddc0cb01f69c140e04
0.639471
2.713538
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_p_src_data_stream_2_V.vhd
2
4,629
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_p_src_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_p_src_data_stream_2_V_shiftReg; architecture rtl of FIFO_image_filter_p_src_data_stream_2_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_p_src_data_stream_2_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_p_src_data_stream_2_V is component FIFO_image_filter_p_src_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_p_src_data_stream_2_V_shiftReg : FIFO_image_filter_p_src_data_stream_2_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
9db328511f84e81195f9f334fd04f2f6
0.537697
3.449329
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/bd/design_1/ip/design_1_axi_bram_ctrl_0_0/synth/design_1_axi_bram_ctrl_0_0.vhd
1
16,610
-- (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_bram_ctrl:4.0 -- IP Revision: 3 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY axi_bram_ctrl_v4_0; USE axi_bram_ctrl_v4_0.axi_bram_ctrl; ENTITY design_1_axi_bram_ctrl_0_0 IS PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awid : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_awaddr : IN STD_LOGIC_VECTOR(15 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; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wlast : IN STD_LOGIC; s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bid : OUT STD_LOGIC_VECTOR(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; s_axi_arid : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_araddr : IN STD_LOGIC_VECTOR(15 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; s_axi_rid : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rdata : OUT STD_LOGIC_VECTOR(31 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; 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(3 DOWNTO 0); bram_addr_a : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); bram_wrdata_a : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_a : IN STD_LOGIC_VECTOR(31 DOWNTO 0) ); END design_1_axi_bram_ctrl_0_0; ARCHITECTURE design_1_axi_bram_ctrl_0_0_arch OF design_1_axi_bram_ctrl_0_0 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : string; ATTRIBUTE DowngradeIPIdentifiedWarnings OF design_1_axi_bram_ctrl_0_0_arch: ARCHITECTURE IS "yes"; COMPONENT axi_bram_ctrl IS GENERIC ( C_BRAM_INST_MODE : STRING; C_MEMORY_DEPTH : INTEGER; C_BRAM_ADDR_WIDTH : INTEGER; C_S_AXI_ADDR_WIDTH : INTEGER; C_S_AXI_DATA_WIDTH : INTEGER; C_S_AXI_ID_WIDTH : INTEGER; C_S_AXI_PROTOCOL : STRING; C_S_AXI_SUPPORTS_NARROW_BURST : INTEGER; C_SINGLE_PORT_BRAM : INTEGER; C_FAMILY : STRING; C_S_AXI_CTRL_ADDR_WIDTH : INTEGER; C_S_AXI_CTRL_DATA_WIDTH : INTEGER; C_ECC : INTEGER; C_ECC_TYPE : INTEGER; C_FAULT_INJECT : INTEGER; C_ECC_ONOFF_RESET_VALUE : INTEGER ); PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; ecc_interrupt : OUT STD_LOGIC; ecc_ue : OUT STD_LOGIC; s_axi_awid : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_awaddr : IN STD_LOGIC_VECTOR(15 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; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wlast : IN STD_LOGIC; s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bid : OUT STD_LOGIC_VECTOR(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; s_axi_arid : IN STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_araddr : IN STD_LOGIC_VECTOR(15 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; s_axi_rid : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_rdata : OUT STD_LOGIC_VECTOR(31 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; s_axi_ctrl_awvalid : IN STD_LOGIC; s_axi_ctrl_awready : OUT STD_LOGIC; s_axi_ctrl_awaddr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_wvalid : IN STD_LOGIC; s_axi_ctrl_wready : OUT STD_LOGIC; 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; s_axi_ctrl_araddr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_arvalid : IN STD_LOGIC; s_axi_ctrl_arready : OUT STD_LOGIC; s_axi_ctrl_rdata : OUT STD_LOGIC_VECTOR(31 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_rst_a : OUT STD_LOGIC; bram_clk_a : OUT STD_LOGIC; bram_en_a : OUT STD_LOGIC; bram_we_a : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); bram_addr_a : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); bram_wrdata_a : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_a : IN STD_LOGIC_VECTOR(31 DOWNTO 0); 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(3 DOWNTO 0); bram_addr_b : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); bram_wrdata_b : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_b : IN STD_LOGIC_VECTOR(31 DOWNTO 0) ); END COMPONENT axi_bram_ctrl; ATTRIBUTE X_CORE_INFO : STRING; ATTRIBUTE X_CORE_INFO OF design_1_axi_bram_ctrl_0_0_arch: ARCHITECTURE IS "axi_bram_ctrl,Vivado 2014.4"; ATTRIBUTE CHECK_LICENSE_TYPE : STRING; ATTRIBUTE CHECK_LICENSE_TYPE OF design_1_axi_bram_ctrl_0_0_arch : ARCHITECTURE IS "design_1_axi_bram_ctrl_0_0,axi_bram_ctrl,{}"; ATTRIBUTE CORE_GENERATION_INFO : STRING; ATTRIBUTE CORE_GENERATION_INFO OF design_1_axi_bram_ctrl_0_0_arch: ARCHITECTURE IS "design_1_axi_bram_ctrl_0_0,axi_bram_ctrl,{x_ipProduct=Vivado 2014.4,x_ipVendor=xilinx.com,x_ipLibrary=ip,x_ipName=axi_bram_ctrl,x_ipVersion=4.0,x_ipCoreRevision=3,x_ipLanguage=VERILOG,x_ipSimLanguage=MIXED,C_BRAM_INST_MODE=EXTERNAL,C_MEMORY_DEPTH=16384,C_BRAM_ADDR_WIDTH=14,C_S_AXI_ADDR_WIDTH=16,C_S_AXI_DATA_WIDTH=32,C_S_AXI_ID_WIDTH=2,C_S_AXI_PROTOCOL=AXI4,C_S_AXI_SUPPORTS_NARROW_BURST=1,C_SINGLE_PORT_BRAM=1,C_FAMILY=zynq,C_S_AXI_CTRL_ADDR_WIDTH=32,C_S_AXI_CTRL_DATA_WIDTH=32,C_ECC=0,C_ECC_TYPE=0,C_FAULT_INJECT=0,C_ECC_ONOFF_RESET_VALUE=0}"; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 CLKIF CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aresetn: SIGNAL IS "xilinx.com:signal:reset:1.0 RSTIF RST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWID"; 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_awlen: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWLEN"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awsize: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWSIZE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awburst: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWBURST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awlock: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWLOCK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awcache: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWCACHE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awprot: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWPROT"; 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_wlast: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WLAST"; 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_bid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BID"; 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_arid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARID"; 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_arlen: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARLEN"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arsize: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARSIZE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arburst: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARBURST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arlock: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARLOCK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arcache: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARCACHE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arprot: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARPROT"; 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_rid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RID"; 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_rlast: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RLAST"; 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"; ATTRIBUTE X_INTERFACE_INFO OF bram_rst_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA RST"; ATTRIBUTE X_INTERFACE_INFO OF bram_clk_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA CLK"; ATTRIBUTE X_INTERFACE_INFO OF bram_en_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA EN"; ATTRIBUTE X_INTERFACE_INFO OF bram_we_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA WE"; ATTRIBUTE X_INTERFACE_INFO OF bram_addr_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA ADDR"; ATTRIBUTE X_INTERFACE_INFO OF bram_wrdata_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA DIN"; ATTRIBUTE X_INTERFACE_INFO OF bram_rddata_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA DOUT"; BEGIN U0 : axi_bram_ctrl GENERIC MAP ( C_BRAM_INST_MODE => "EXTERNAL", C_MEMORY_DEPTH => 16384, C_BRAM_ADDR_WIDTH => 14, C_S_AXI_ADDR_WIDTH => 16, C_S_AXI_DATA_WIDTH => 32, C_S_AXI_ID_WIDTH => 2, C_S_AXI_PROTOCOL => "AXI4", C_S_AXI_SUPPORTS_NARROW_BURST => 1, C_SINGLE_PORT_BRAM => 1, C_FAMILY => "zynq", C_S_AXI_CTRL_ADDR_WIDTH => 32, C_S_AXI_CTRL_DATA_WIDTH => 32, C_ECC => 0, C_ECC_TYPE => 0, C_FAULT_INJECT => 0, C_ECC_ONOFF_RESET_VALUE => 0 ) PORT MAP ( s_axi_aclk => s_axi_aclk, s_axi_aresetn => s_axi_aresetn, 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, 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, s_axi_bid => s_axi_bid, s_axi_bresp => s_axi_bresp, s_axi_bvalid => s_axi_bvalid, s_axi_bready => s_axi_bready, 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, 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, s_axi_ctrl_awvalid => '0', s_axi_ctrl_awaddr => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_wdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_wvalid => '0', s_axi_ctrl_bready => '0', s_axi_ctrl_araddr => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_arvalid => '0', s_axi_ctrl_rready => '0', 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_rddata_b => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)) ); END design_1_axi_bram_ctrl_0_0_arch;
gpl-3.0
90575119aff698d730b2d0be196a5480
0.675858
3.059495
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-gr-cpci-xc4v/leon3mp.vhd
1
34,682
----------------------------------------------------------------------------- -- LEON3 Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib, techmap; use grlib.amba.all; use grlib.stdlib.all; use techmap.gencomp.all; library gaisler; use gaisler.memctrl.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.can.all; use gaisler.pci.all; use gaisler.net.all; use gaisler.jtag.all; use gaisler.spacewire.all; library esa; use esa.memoryctrl.all; use esa.pcicomp.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( resetn : in std_logic; clk : in std_logic; pllref : in std_logic; errorn : out std_logic; wdogn : out std_logic; address : out std_logic_vector(27 downto 0); data : inout std_logic_vector(31 downto 0); sa : out std_logic_vector(14 downto 0); sd : inout std_logic_vector(63 downto 0); sdclk : out std_logic; sdcke : out std_logic_vector (1 downto 0); -- sdram clock enable sdcsn : out std_logic_vector (1 downto 0); -- sdram chip select sdwen : out std_logic; -- sdram write enable sdrasn : out std_logic; -- sdram ras sdcasn : out std_logic; -- sdram cas sddqm : out std_logic_vector (7 downto 0); -- sdram dqm dsutx : out std_logic; -- DSU tx data dsurx : in std_logic; -- DSU rx data dsuen : in std_logic; dsubre : in std_logic; dsuact : out std_logic; txd1 : out std_logic; -- UART1 tx data rxd1 : in std_logic; -- UART1 rx data txd2 : out std_logic; -- UART2 tx data rxd2 : in std_logic; -- UART2 rx data ramsn : out std_logic_vector (4 downto 0); ramoen : out std_logic_vector (4 downto 0); rwen : out std_logic_vector (3 downto 0); oen : out std_logic; writen : out std_logic; read : out std_logic; iosn : out std_logic; romsn : out std_logic_vector (1 downto 0); brdyn : in std_logic; -- bus ready bexcn : in std_logic; -- bus exception gpio : inout std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0); -- I/O port emdio : inout std_logic; -- ethernet PHY interface etx_clk : in std_logic; erx_clk : in std_logic; erxd : in std_logic_vector(3 downto 0); erx_dv : in std_logic; erx_er : in std_logic; erx_col : in std_logic; erx_crs : in std_logic; etxd : out std_logic_vector(3 downto 0); etx_en : out std_logic; etx_er : out std_logic; emdc : out std_logic; pci_rst : inout std_logic; -- PCI bus pci_clk : in std_logic; pci_gnt : in std_logic; pci_idsel : in std_logic; pci_lock : inout std_logic; pci_ad : inout std_logic_vector(31 downto 0); pci_cbe : inout std_logic_vector(3 downto 0); pci_frame : inout std_logic; pci_irdy : inout std_logic; pci_trdy : inout std_logic; pci_devsel : inout std_logic; pci_stop : inout std_logic; pci_perr : inout std_logic; pci_par : inout std_logic; pci_req : inout std_logic; pci_serr : inout std_logic; pci_host : in std_logic; pci_int : inout std_logic_vector(3 downto 0); pci_66 : in std_logic; pci_arb_req : in std_logic_vector(0 to 3); pci_arb_gnt : out std_logic_vector(0 to 3); can_txd : out std_logic_vector(0 to CFG_CAN_NUM-1); can_rxd : in std_logic_vector(0 to CFG_CAN_NUM-1); -- can_stb : out std_logic_vector(0 to CFG_CAN_NUM-1) spw_clk : in std_logic; spw_rxdp : in std_logic_vector(0 to CFG_SPW_NUM-1); spw_rxdn : in std_logic_vector(0 to CFG_SPW_NUM-1); spw_rxsp : in std_logic_vector(0 to CFG_SPW_NUM-1); spw_rxsn : in std_logic_vector(0 to CFG_SPW_NUM-1); spw_txdp : out std_logic_vector(0 to CFG_SPW_NUM-1); spw_txdn : out std_logic_vector(0 to CFG_SPW_NUM-1); spw_txsp : out std_logic_vector(0 to CFG_SPW_NUM-1); spw_txsn : out std_logic_vector(0 to CFG_SPW_NUM-1) ); end; architecture rtl of leon3mp is constant blength : integer := 12; constant fifodepth : integer := 8; signal vcc, gnd : std_logic_vector(4 downto 0); signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal sdi : sdctrl_in_type; signal sdo : sdram_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, rstraw, pciclk, sdclkl : std_logic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, u2i, dui : uart_in_type; signal u1o, u2o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal pcii : pci_in_type; signal pcio : pci_out_type; signal spwi : grspw_in_type_vector(0 to CFG_SPW_NUM-1); signal spwo : grspw_out_type_vector(0 to CFG_SPW_NUM-1); signal spw_rxclk : std_logic_vector(0 to CFG_SPW_NUM-1); signal dtmp : std_logic_vector(0 to CFG_SPW_NUM-1); signal stmp : std_logic_vector(0 to CFG_SPW_NUM-1); signal spw_rxtxclk : std_ulogic; signal spw_rxclkn : std_ulogic; signal spw_clkl : std_logic; signal stati : ahbstat_in_type; signal ethi, ethi1, ethi2 : eth_in_type; signal etho, etho1, etho2 : eth_out_type; signal gpti : gptimer_in_type; signal gpto : gptimer_out_type; signal wdog : std_logic; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal can_lrx, can_ltx : std_logic_vector(0 to 7); signal lclk, pci_lclk : std_logic; signal pci_arb_req_n, pci_arb_gnt_n : std_logic_vector(0 to 3); signal pci_dirq : std_logic_vector(3 downto 0); signal tck, tms, tdi, tdo : std_logic; signal fpi : grfpu_in_vector_type; signal fpo : grfpu_out_vector_type; constant BOARD_FREQ : integer := 50000; -- Board frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz constant IOAEN : integer := CFG_CAN + CFG_PCI + CFG_GRPCI2_MASTER; constant CFG_SDEN : integer := CFG_MCTRL_SDEN; constant CFG_INVCLK : integer := CFG_MCTRL_INVCLK; constant OEPOL : integer := padoen_polarity(padtech); begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= (others => '1'); gnd <= (others => '0'); cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; pllref_pad : clkpad generic map (tech => padtech) port map (pllref, cgi.pllref); clk_pad : clkpad generic map (tech => padtech) port map (clk, lclk); pci_clk_pad : clkpad generic map (tech => padtech, level => pci33) port map (pci_clk, pci_lclk); clkgen0 : clkgen -- clock generator generic map (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_SDEN, CFG_INVCLK, CFG_PCI+CFG_GRPCI2_MASTER+CFG_GRPCI2_TARGET, CFG_PCIDLL, CFG_PCISYSCLK, BOARD_FREQ) port map (lclk, pci_lclk, clkm, open, open, sdclkl, pciclk, cgi, cgo); sdclk_pad : outpad generic map (tech => padtech) port map (sdclk, sdclkl); rst0 : rstgen -- reset generator port map (resetn, clkm, cgo.clklock, rstn, rstraw); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => IOAEN, nahbm => CFG_NCPU+CFG_AHB_UART+CFG_GRPCI2_TARGET+CFG_GRPCI2_DMA+log2x(CFG_PCI)+CFG_AHB_JTAG+CFG_GRETH+CFG_SPW_NUM, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- cpu : for i in 0 to CFG_NCPU-1 generate nosh : if CFG_GRFPUSH = 0 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU*(1-CFG_GRFPUSH), CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1, 0, 0, CFG_MMU_PAGE, CFG_BP) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; end generate; sh : if CFG_GRFPUSH = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3sh -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1, 0, 0, CFG_MMU_PAGE, CFG_BP) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i), fpi(i), fpo(i)); end generate; grfpush0 : grfpushwx generic map ((CFG_FPU-1), CFG_NCPU, fabtech) port map (clkm, rstn, fpi, fpo); end generate; errorn_pad : odpad generic map (tech => padtech) port map (errorn, dbgo(0).error); dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsuen_pad : inpad generic map (tech => padtech) port map (dsuen, dsui.enable); dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsuact_pad : outpad generic map (tech => padtech) port map (dsuact, dsuo.active); end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_UART = 1 generate dcom0: ahbuart -- Debug UART generic map (hindex => CFG_NCPU, pindex => 7, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(7), ahbmi, ahbmo(CFG_NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (dsurx, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (dsutx, duo.txd); end generate; -- nouah : if CFG_AHB_UART = 0 generate apbo(7) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd(0)); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- memi.edac <= gpioo.val(2); memi.bwidth <= gpioo.val(1 downto 0); mctrl0 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : mctrl generic map (hindex => 0, pindex => 0, paddr => 0, srbanks => 4, sden => CFG_MCTRL_SDEN, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT, invclk => CFG_MCTRL_INVCLK, sepbus => CFG_MCTRL_SEPBUS, oepol => OEPOL, sdbits => 32 + 32*CFG_MCTRL_SD64, pageburst => CFG_MCTRL_PAGE) port map (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo); addr_pad : outpadv generic map (width => 28, tech => padtech) port map (address, memo.address(27 downto 0)); rams_pad : outpadv generic map (width => 5, tech => padtech) port map (ramsn, memo.ramsn(4 downto 0)); roms_pad : outpadv generic map (width => 2, tech => padtech) port map (romsn, memo.romsn(1 downto 0)); oen_pad : outpad generic map (tech => padtech) port map (oen, memo.oen); rwen_pad : outpadv generic map (width => 4, tech => padtech) port map (rwen, memo.wrn); roen_pad : outpadv generic map (width => 5, tech => padtech) port map (ramoen, memo.ramoen(4 downto 0)); wri_pad : outpad generic map (tech => padtech) port map (writen, memo.writen); read_pad : outpad generic map (tech => padtech) port map (read, memo.read); iosn_pad : outpad generic map (tech => padtech) port map (iosn, memo.iosn); data_pad : iopadvv generic map (tech => padtech, width => 32, oepol => OEPOL) port map (data, memo.data, memo.vbdrive, memi.data); brdyn_pad : inpad generic map (tech => padtech) port map (brdyn, memi.brdyn); bexcn_pad : inpad generic map (tech => padtech) port map (bexcn, memi.bexcn); memi.writen <= '1'; memi.wrn <= "1111"; sdpads : if CFG_MCTRL_SDEN = 1 generate -- SDRAM controller sd2 : if CFG_MCTRL_SEPBUS = 1 generate sa_pad : outpadv generic map (width => 15) port map (sa, memo.sa); sd_pad : iopadvv generic map (tech => padtech, width => 32, oepol => OEPOL) port map (sd(31 downto 0), memo.sddata(31 downto 0), memo.svbdrive(31 downto 0), memi.sd(31 downto 0)); sd2 : if CFG_MCTRL_SD64 = 1 generate sd_pad2 : iopadvv generic map (tech => padtech, width => 32) port map (sd(63 downto 32), memo.data(31 downto 0), memo.svbdrive(63 downto 32), memi.sd(63 downto 32)); end generate; end generate; sdwen_pad : outpad generic map (tech => padtech) port map (sdwen, sdo.sdwen); sdras_pad : outpad generic map (tech => padtech) port map (sdrasn, sdo.rasn); sdcas_pad : outpad generic map (tech => padtech) port map (sdcasn, sdo.casn); sddqm_pad : outpadv generic map (width => 8, tech => padtech) port map (sddqm, sdo.dqm); sdcke_pad : outpadv generic map (width => 2, tech => padtech) port map (sdcke, sdo.sdcke); sdcsn_pad : outpadv generic map (width => 2, tech => padtech) port map (sdcsn, sdo.sdcsn); end generate; end generate; nosd0 : if (CFG_SDEN = 0) generate -- no SDRAM controller sdcke_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcke, vcc(1 downto 0)); sdcsn_pad : outpadv generic map (width =>2, tech => padtech) port map (sdcsn, vcc(1 downto 0)); end generate; mg0 : if CFG_MCTRL_LEON2 = 0 generate -- No PROM/SRAM controller apbo(0) <= apb_none; ahbso(0) <= ahbs_none; rams_pad : outpadv generic map (width => 5, tech => padtech) port map (ramsn, vcc); roms_pad : outpadv generic map (width => 2, tech => padtech) port map (romsn, vcc(1 downto 0)); end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo ); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; ua2 : if CFG_UART2_ENABLE /= 0 generate uart2 : apbuart -- UART 2 generic map (pindex => 9, paddr => 9, pirq => 3, fifosize => CFG_UART2_FIFO) port map (rstn, clkm, apbi, apbo(9), u2i, u2o); u2i.rxd <= rxd2; u2i.ctsn <= '0'; u2i.extclk <= '0'; txd2 <= u2o.txd; end generate; noua1 : if CFG_UART2_ENABLE = 0 generate apbo(9) <= apb_none; end generate; irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; -- apbo(2) <= apb_none; end generate; pci_dirq(3 downto 1) <= (others => '0'); pci_dirq(0) <= orv(irqi(0).irl); gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, gpto); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; wdog <= gpto.wdogn when OEPOL = 0 else gpto.wdog; wdogn_pad : odpad generic map (tech => padtech, oepol => OEPOL) port map (wdogn, wdog); end generate; -- notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GR GPIO unit grgpio0: grgpio generic map( pindex => 6, paddr => 6, imask => CFG_GRGPIO_IMASK, nbits => CFG_GRGPIO_WIDTH) port map( rstn, clkm, apbi, apbo(6), gpioi, gpioo); pio_pads : for i in 0 to CFG_GRGPIO_WIDTH-1 generate pio_pad : iopad generic map (tech => padtech) port map (gpio(i), gpioo.dout(i), gpioo.oen(i), gpioi.din(i)); end generate; end generate; ahbs : if CFG_AHBSTAT = 1 generate -- AHB status register stati.cerror(0) <= memo.ce; ahbstat0 : ahbstat generic map (pindex => 15, paddr => 15, pirq => 1, nftslv => CFG_AHBSTATN) port map (rstn, clkm, ahbmi, ahbsi, stati, apbi, apbo(15)); end generate; nop2 : if CFG_AHBSTAT = 0 generate apbo(15) <= apb_none; end generate; ----------------------------------------------------------------------- --- PCI ------------------------------------------------------------ ----------------------------------------------------------------------- pci : if (CFG_GRPCI2_MASTER+CFG_GRPCI2_TARGET) /= 0 or CFG_PCI /= 0 generate grpci2x : if (CFG_GRPCI2_MASTER+CFG_GRPCI2_TARGET) /= 0 and CFG_PCI = 0 generate pci0 : grpci2 generic map ( memtech => memtech, oepol => OEPOL, hmindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, hdmindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+1, hsindex => 4, haddr => 16#C00#, hmask => 16#E00#, ioaddr => 16#000#, pindex => 4, paddr => 4, irq => 4, irqmode => 0, master => CFG_GRPCI2_MASTER, target => CFG_GRPCI2_TARGET, dma => CFG_GRPCI2_DMA, tracebuffer => CFG_GRPCI2_TRACE, vendorid => CFG_GRPCI2_VID, deviceid => CFG_GRPCI2_DID, classcode => CFG_GRPCI2_CLASS, revisionid => CFG_GRPCI2_RID, cap_pointer => CFG_GRPCI2_CAP, ext_cap_pointer => CFG_GRPCI2_NCAP, iobase => CFG_AHBIO, extcfg => CFG_GRPCI2_EXTCFG, bar0 => CFG_GRPCI2_BAR0, bar1 => CFG_GRPCI2_BAR1, bar2 => CFG_GRPCI2_BAR2, bar3 => CFG_GRPCI2_BAR3, bar4 => CFG_GRPCI2_BAR4, bar5 => CFG_GRPCI2_BAR5, fifo_depth => CFG_GRPCI2_FDEPTH, fifo_count => CFG_GRPCI2_FCOUNT, conv_endian => CFG_GRPCI2_ENDIAN, deviceirq => CFG_GRPCI2_DEVINT, deviceirqmask => CFG_GRPCI2_DEVINTMSK, hostirq => CFG_GRPCI2_HOSTINT, hostirqmask => CFG_GRPCI2_HOSTINTMSK, nsync => 2, hostrst => 1, bypass => CFG_GRPCI2_BYPASS, debug => 0, tbapben => 0, tbpindex => 5, tbpaddr => 16#400#, tbpmask => 16#C00# ) port map ( rstn, clkm, pciclk, pci_dirq, pcii, pcio, apbi, apbo(4), ahbsi, ahbso(4), ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+1), open, open, open, open); end generate; grpci1x : if (CFG_GRPCI2_MASTER+CFG_GRPCI2_TARGET) = 0 and CFG_PCI /= 0 generate pci_gr0 : if CFG_PCI = 1 generate -- simple target-only pci0 : pci_target generic map (hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, device_id => CFG_PCIDID, vendor_id => CFG_PCIVID) port map (rstn, clkm, pciclk, pcii, pcio, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG)); end generate; pci_mtf0 : if CFG_PCI = 2 generate -- master/target with fifo pci0 : pci_mtf generic map (memtech => memtech, hmstndx => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, fifodepth => log2(CFG_PCIDEPTH), device_id => CFG_PCIDID, vendor_id => CFG_PCIVID, hslvndx => 4, pindex => 4, paddr => 4, haddr => 16#E00#, ioaddr => 16#400#, nsync => 2, hostrst => 1) port map (rstn, clkm, pciclk, pcii, pcio, apbi, apbo(4), ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), ahbsi, ahbso(4)); end generate; pci_mtf1 : if CFG_PCI = 3 generate -- master/target with fifo and DMA dma : pcidma generic map (memtech => memtech, dmstndx => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+1, dapbndx => 5, dapbaddr => 5, blength => blength, mstndx => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, fifodepth => log2(fifodepth), device_id => CFG_PCIDID, vendor_id => CFG_PCIVID, slvndx => 4, apbndx => 4, apbaddr => 4, haddr => 16#E00#, ioaddr => 16#800#, nsync => 2, hostrst => 1) port map (rstn, clkm, pciclk, pcii, pcio, apbo(5), ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+1), apbi, apbo(4), ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), ahbsi, ahbso(4)); end generate; end generate; pci_trc0 : if CFG_PCITBUFEN /= 0 generate -- PCI trace buffer pt0 : pcitrace generic map (depth => (6 + log2(CFG_PCITBUF/256)), memtech => memtech, pindex => 13, paddr => 16#100#, pmask => 16#f00#) port map ( rstn, clkm, pciclk, pcii, apbi, apbo(13)); end generate; pcia0 : if CFG_PCI_ARB = 1 generate -- PCI arbiter pciarb0 : pciarb generic map (pindex => 8, paddr => 8, apb_en => CFG_PCI_ARBAPB) port map ( clk => pciclk, rst_n => pcii.rst, req_n => pci_arb_req_n, frame_n => pcii.frame, gnt_n => pci_arb_gnt_n, pclk => clkm, prst_n => rstn, apbi => apbi, apbo => apbo(8) ); pgnt_pad : outpadv generic map (tech => padtech, width => 4) port map (pci_arb_gnt, pci_arb_gnt_n); preq_pad : inpadv generic map (tech => padtech, width => 4) port map (pci_arb_req, pci_arb_req_n); end generate; pcipads0 : pcipads generic map (padtech => padtech, host => 1, oepol => OEPOL, noreset => 0, drivereset => 0, int => 10) -- PCI pads port map ( pci_rst, pci_gnt, pci_idsel, pci_lock, pci_ad, pci_cbe, pci_frame, pci_irdy, pci_trdy, pci_devsel, pci_stop, pci_perr, pci_par, pci_req, pci_serr, pci_host, pci_66, pcii, pcio, pci_int); end generate; -- nop1 : if CFG_PCI <= 1 generate apbo(4) <= apb_none; end generate; -- nop2 : if CFG_PCI <= 2 generate apbo(5) <= apb_none; end generate; -- nop3 : if CFG_PCI <= 1 generate ahbso(4) <= ahbs_none; end generate; -- notrc : if CFG_PCITBUFEN = 0 generate apbo(8) <= apb_none; end generate; -- noarb : if CFG_PCI_ARB = 0 generate apbo(10) <= apb_none; end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : greth generic map(hindex => CFG_NCPU+CFG_AHB_UART+CFG_GRPCI2_TARGET+CFG_GRPCI2_DMA+log2x(CFG_PCI)+CFG_AHB_JTAG, pindex => 14, paddr => 14, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL) port map( rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_GRPCI2_TARGET+CFG_GRPCI2_DMA+log2x(CFG_PCI)+CFG_AHB_JTAG), apbi => apbi, apbo => apbo(14), ethi => ethi, etho => etho); emdio_pad : iopad generic map (tech => padtech) port map (emdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : inpad generic map (tech => padtech) port map (etx_clk, ethi.tx_clk); erxc_pad : inpad generic map (tech => padtech) port map (erx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (erxd, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (erx_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (erx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (erx_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (erx_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (etxd, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map ( etx_en, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (etx_er, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (emdc, etho.mdc); -- emdis_pad : outpad generic map (tech => padtech) -- port map (emddis, vcc(0)); -- eepwrdwn_pad : outpad generic map (tech => padtech) -- port map (epwrdwn, gnd(0)); -- esleep_pad : outpad generic map (tech => padtech) -- port map (esleep, gnd(0)); -- epause_pad : outpad generic map (tech => padtech) -- port map (epause, gnd(0)); -- ereset_pad : outpad generic map (tech => padtech) -- port map (ereset, gnd(0)); end generate; ----------------------------------------------------------------------- --- CAN -------------------------------------------------------------- ----------------------------------------------------------------------- can0 : if CFG_CAN = 1 generate can0 : can_mc generic map (slvndx => 6, ioaddr => CFG_CANIO, iomask => 16#FF0#, irq => CFG_CANIRQ, memtech => memtech, ncores => CFG_CAN_NUM, sepirq => CFG_CANSEPIRQ) port map (rstn, clkm, ahbsi, ahbso(6), can_lrx, can_ltx ); can_pads : for i in 0 to CFG_CAN_NUM-1 generate can_tx_pad : outpad generic map (tech => padtech) port map (can_txd(i), can_ltx(i)); can_rx_pad : inpad generic map (tech => padtech) port map (can_rxd(i), can_lrx(i)); end generate; end generate; -- can_stb <= '0'; -- no standby ncan : if CFG_CAN = 0 generate ahbso(6) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- -- ocram : if CFG_AHBRAMEN = 1 generate -- ahbram0 : ftahbram generic map (hindex => 7, haddr => CFG_AHBRADDR, -- tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pindex => 6, -- paddr => 6, edacen => CFG_AHBRAEDAC, autoscrub => CFG_AHBRASCRU, -- errcnten => CFG_AHBRAECNT, cntbits => CFG_AHBRAEBIT) -- port map ( rstn, clkm, ahbsi, ahbso(7), apbi, apbo(6), open); -- end generate; -- -- nram : if CFG_AHBRAMEN = 0 generate ahbso(7) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- SPACEWIRE ------------------------------------------------------- ----------------------------------------------------------------------- spw : if CFG_SPW_EN > 0 generate spw_clk_pad : clkpad generic map (tech => padtech) port map (spw_clk, spw_clkl); -- spw_clkl <= pciclk; spw_rxtxclk <= spw_clkl; spw_rxclkn <= not spw_rxtxclk; swloop : for i in 0 to CFG_SPW_NUM-1 generate -- GRSPW2 PHY spw2_input : if CFG_SPW_GRSPW = 2 generate spw_phy0 : grspw2_phy generic map( scantest => 0, tech => fabtech, input_type => CFG_SPW_INPUT) port map( rstn => rstn, rxclki => spw_rxtxclk, rxclkin => spw_rxclkn, nrxclki => spw_rxtxclk, di => dtmp(i), si => stmp(i), do => spwi(i).d(1 downto 0), dov => spwi(i).dv(1 downto 0), dconnect => spwi(i).dconnect(1 downto 0), rxclko => spw_rxclk(i)); spwi(i).nd <= (others => '0'); -- Only used in GRSPW spwi(i).dv(3 downto 2) <= "00"; -- For second port end generate spw2_input; -- GRSPW PHY spw1_input: if CFG_SPW_GRSPW = 1 generate spw_phy0 : grspw_phy generic map( tech => fabtech, rxclkbuftype => 1, scantest => 0) port map( rxrst => spwo(i).rxrst, di => dtmp(i), si => stmp(i), rxclko => spw_rxclk(i), do => spwi(i).d(0), ndo => spwi(i).nd(4 downto 0), dconnect => spwi(i).dconnect(1 downto 0)); spwi(i).d(1) <= '0'; spwi(i).dv <= (others => '0'); -- Only used in GRSPW2 spwi(i).nd(9 downto 5) <= "00000"; -- For second port end generate spw1_input; spwi(i).d(3 downto 2) <= "00"; -- For second port spwi(i).dconnect(3 downto 2) <= "00"; -- For second port spwi(i).s(1 downto 0) <= "00"; -- Only used in PHY sw0 : grspwm generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART+CFG_GRPCI2_TARGET+CFG_GRPCI2_DMA+log2x(CFG_PCI)+CFG_AHB_JTAG+CFG_GRETH+i, pindex => 10+i, paddr => 10+i, pirq => 5+i, sysfreq => CPU_FREQ, nsync => 1, rmap => CFG_SPW_RMAP, rmapcrc => CFG_SPW_RMAPCRC, fifosize1 => CFG_SPW_AHBFIFO, fifosize2 => CFG_SPW_RXFIFO, rxclkbuftype => 1, memtech => memtech, rmapbufs => CFG_SPW_RMAPBUF,ft => CFG_SPW_FT, ports => 1, dmachan => CFG_SPW_DMACHAN, netlist => CFG_SPW_NETLIST, spwcore => CFG_SPW_GRSPW, input_type => CFG_SPW_INPUT, output_type => CFG_SPW_OUTPUT, rxtx_sameclk => CFG_SPW_RTSAME, rxunaligned => CFG_SPW_RXUNAL) port map(rstn, clkm, spw_rxclk(i), spw_rxclk(i), spw_rxtxclk, spw_rxtxclk, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_GRPCI2_TARGET+CFG_GRPCI2_DMA+log2x(CFG_PCI)+CFG_AHB_JTAG+CFG_GRETH+i), apbi, apbo(10+i), spwi(i), spwo(i)); spwi(i).tickin <= '0'; spwi(i).rmapen <= '0'; spwi(i).clkdiv10 <= conv_std_logic_vector(CPU_FREQ/10000-1, 8); spwi(i).dcrstval <= (others => '0'); spwi(i).timerrstval <= (others => '0'); spw_rxd_pad : inpad_ds generic map (padtech, lvds, x25v) port map (spw_rxdp(i), spw_rxdn(i), dtmp(i)); spw_rxs_pad : inpad_ds generic map (padtech, lvds, x25v) port map (spw_rxsp(i), spw_rxsn(i), stmp(i)); spw_txd_pad : outpad_ds generic map (padtech, lvds, x25v) port map (spw_txdp(i), spw_txdn(i), spwo(i).d(0), gnd(0)); spw_txs_pad : outpad_ds generic map (padtech, lvds, x25v) port map (spw_txsp(i), spw_txsn(i), spwo(i).s(0), gnd(0)); end generate; end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- -- nam1 : for i in (CFG_NCPU+CFG_AHB_UART+log2x(CFG_PCI)+CFG_AHB_JTAG) to NAHBMST-1 generate -- ahbmo(i) <= ahbm_none; -- end generate; -- nam2 : if CFG_PCI > 1 generate -- ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+log2x(CFG_PCI)-1) <= ahbm_none; -- end generate; -- nap0 : for i in 11 to NAPBSLV-1 generate apbo(i) <= apb_none; end generate; -- apbo(6) <= apb_none; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3FT GR-CPCI-XC4V Demonstration design", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
ecbed209384e5b84cd3015fd66b65848
0.562136
3.403199
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/eth/core/grethc.vhd
1
83,455
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: grethc -- File: grethc.vhd -- Author: Marko Isomaki -- Description: Ethernet Media Access Controller with Ethernet Debug -- Communication Link ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library grlib; use grlib.stdlib.all; library eth; use eth.grethpkg.all; entity grethc is generic( ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; mdcscaler : integer range 0 to 255 := 25; enable_mdio : integer range 0 to 1 := 0; fifosize : integer range 4 to 512 := 8; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 32 := 0; rmii : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; edclsepahbg : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0; mdiohold : integer := 1; maxsize : integer := 1500); port( rst : in std_ulogic; clk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --edcl ahb mst in ehgrant : in std_ulogic; ehready : in std_ulogic; ehresp : in std_logic_vector(1 downto 0); ehrdata : in std_logic_vector(31 downto 0); --edcl ahb mst out ehbusreq : out std_ulogic; ehlock : out std_ulogic; ehtrans : out std_logic_vector(1 downto 0); ehaddr : out std_logic_vector(31 downto 0); ehwrite : out std_ulogic; ehsize : out std_logic_vector(2 downto 0); ehburst : out std_logic_vector(2 downto 0); ehprot : out std_logic_vector(3 downto 0); ehwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --irq irq : out std_logic; --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(10 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(10 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(10 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(10 downto 0); txrdata : in std_logic_vector(31 downto 0); --edcl buf erenable : out std_ulogic; eraddress : out std_logic_vector(15 downto 0); ewritem : out std_ulogic; ewritel : out std_ulogic; ewaddressm : out std_logic_vector(15 downto 0); ewaddressl : out std_logic_vector(15 downto 0); ewdata : out std_logic_vector(31 downto 0); erdata : in std_logic_vector(31 downto 0); --ethernet input signals rmii_clk : in std_ulogic; tx_clk : in std_ulogic; rx_clk : in std_ulogic; rxd : in std_logic_vector(3 downto 0); rx_dv : in std_ulogic; rx_er : in std_ulogic; rx_col : in std_ulogic; rx_crs : in std_ulogic; mdio_i : in std_ulogic; phyrstaddr : in std_logic_vector(4 downto 0); mdint : in std_ulogic; --ethernet output signals reset : out std_ulogic; txd : out std_logic_vector(3 downto 0); tx_en : out std_ulogic; tx_er : out std_ulogic; mdc : out std_ulogic; mdio_o : out std_ulogic; mdio_oe : out std_ulogic; --scantest testrst : in std_ulogic; testen : in std_ulogic; testoen : in std_ulogic; edcladdr : in std_logic_vector(3 downto 0) := "0000"; edclsepahb : in std_ulogic; edcldisable : in std_ulogic; speed : out std_ulogic ); attribute sync_set_reset of rst : signal is "true"; end entity; architecture rtl of grethc is procedure sel_op_mode( capbil : in std_logic_vector(4 downto 0); speed : out std_ulogic; duplex : out std_ulogic) is variable vspeed : std_ulogic; variable vduplex : std_ulogic; begin vspeed := '0'; vduplex := '0'; vspeed := orv(capbil(4 downto 2)); vduplex := (vspeed and capbil(3)) or ((not vspeed) and capbil(1)); speed := vspeed; duplex := vduplex; end procedure; --host constants constant fabits : integer := log2(fifosize); constant burstlength : integer := setburstlength(fifosize); constant burstbits : integer := log2(burstlength); constant ctrlopcode : std_logic_vector(15 downto 0) := X"8808"; constant broadcast : std_logic_vector(47 downto 0) := X"FFFFFFFFFFFF"; -- constant maxsizetx : integer := 1514; constant index : integer := log2(edclbufsz); constant receiveOK : std_logic_vector(3 downto 0) := "0000"; constant frameCheckError : std_logic_vector(3 downto 0) := "0100"; constant alignmentError : std_logic_vector(3 downto 0) := "0001"; constant frameTooLong : std_logic_vector(3 downto 0) := "0010"; constant overrun : std_logic_vector(3 downto 0) := "1000"; constant minpload : std_logic_vector(10 downto 0) := conv_std_logic_vector(60, 11); --mdio constants constant divisor : std_logic_vector(7 downto 0) := conv_std_logic_vector(mdcscaler, 8); --receiver constants constant maxsizerx : unsigned(15 downto 0) := to_unsigned(maxsize + 18 - 4, 16); --tranceiver constants constant maxsizetx : unsigned(15 downto 0) := to_unsigned(maxsize + 18 - 4, 16); --edcl constants type szvct is array (0 to 6) of integer; constant ebuf : szvct := (64, 128, 128, 256, 256, 256, 256); constant blbits : szvct := (6, 7, 7, 8, 8, 8, 8); constant winsz : szvct := (4, 4, 8, 8, 16, 32, 64); constant macaddrt : std_logic_vector(47 downto 0) := conv_std_logic_vector(macaddrh, 24) & conv_std_logic_vector(macaddrl, 24); constant bpbits : integer := blbits(log2(edclbufsz)); constant wsz : integer := winsz(log2(edclbufsz)); constant bselbits : integer := log2(wsz); constant eabits: integer := log2(edclbufsz) + 8; constant ebufmax : std_logic_vector(bpbits-1 downto 0) := (others => '1'); constant bufsize : std_logic_vector(2 downto 0) := conv_std_logic_vector(log2(edclbufsz), 3); constant ebufsize : integer := ebuf(log2(edclbufsz)); constant txfifosize : integer := getfifosize(edcl, fifosize, ebufsize); constant txfabits : integer := log2(txfifosize); constant txfifosizev : std_logic_vector(txfabits downto 0) := conv_std_logic_vector(txfifosize, txfabits+1); constant rxburstlen : std_logic_vector(fabits downto 0) := conv_std_logic_vector(burstlength, fabits+1); constant txburstlen : std_logic_vector(txfabits downto 0) := conv_std_logic_vector(burstlength, txfabits+1); type edclrstate_type is (idle, wrda, wrdsa, wrsa, wrtype, ip, ipdata, oplength, arp, iplength, ipcrc, arpop, udp, spill); type duplexstate_type is (start, waitop, nextop, selmode, done); --host types type txd_state_type is (idle, read_desc, check_desc, req, fill_fifo, check_result, write_result, readhdr, start, wrbus1, etdone, getlen, ahberror, fill_fifo2, wrbus2); type rxd_state_type is (idle, read_desc, check_desc, read_req, read_fifo, discard, write_status, write_status2); --mdio types type mdio_state_type is (idle, preamble, startst, op, op2, phyadr, regadr, ta, ta2, ta3, data, dataend); type ctrl_reg_type is record txen : std_ulogic; rxen : std_ulogic; tx_irqen : std_ulogic; rx_irqen : std_ulogic; full_duplex : std_ulogic; prom : std_ulogic; reset : std_ulogic; speed : std_ulogic; pstatirqen : std_ulogic; mcasten : std_ulogic; ramdebugen : std_ulogic; edcldis : std_ulogic; end record; type status_reg_type is record tx_int : std_ulogic; rx_int : std_ulogic; rx_err : std_ulogic; tx_err : std_ulogic; txahberr : std_ulogic; rxahberr : std_ulogic; toosmall : std_ulogic; invaddr : std_ulogic; phystat : std_ulogic; end record; type mdio_ctrl_reg_type is record phyadr : std_logic_vector(4 downto 0); regadr : std_logic_vector(4 downto 0); write : std_ulogic; read : std_ulogic; data : std_logic_vector(15 downto 0); busy : std_ulogic; linkfail : std_ulogic; end record; subtype mac_addr_reg_type is std_logic_vector(47 downto 0); type fifo_access_in_type is record renable : std_ulogic; raddress : std_logic_vector(fabits-1 downto 0); write : std_ulogic; waddress : std_logic_vector(fabits-1 downto 0); datain : std_logic_vector(31 downto 0); end record; type fifo_access_out_type is record data : std_logic_vector(31 downto 0); end record; type tx_fifo_access_in_type is record renable : std_ulogic; raddress : std_logic_vector(txfabits-1 downto 0); write : std_ulogic; waddress : std_logic_vector(txfabits-1 downto 0); datain : std_logic_vector(31 downto 0); end record; type tx_fifo_access_out_type is record data : std_logic_vector(31 downto 0); end record; type edcl_ram_in_type is record renable : std_ulogic; raddress : std_logic_vector(eabits-1 downto 0); writem : std_ulogic; writel : std_ulogic; waddressm : std_logic_vector(eabits-1 downto 0); waddressl : std_logic_vector(eabits-1 downto 0); datain : std_logic_vector(31 downto 0); end record; type edcl_ram_out_type is record data : std_logic_vector(31 downto 0); end record; type reg_type is record --user registers ctrl : ctrl_reg_type; status : status_reg_type; mdio_ctrl : mdio_ctrl_reg_type; mac_addr : mac_addr_reg_type; hash : std_logic_vector(63 downto 0); txdesc : std_logic_vector(31 downto 10); rxdesc : std_logic_vector(31 downto 10); edclip : std_logic_vector(31 downto 0); --master tx interface txdsel : std_logic_vector(9 downto 3); tmsto : eth_tx_ahb_in_type; tmsto2 : eth_tx_ahb_in_type; txdstate : txd_state_type; txwrap : std_ulogic; txden : std_ulogic; txirq : std_ulogic; txaddr : std_logic_vector(31 downto 2); txlength : std_logic_vector(10 downto 0); txburstcnt : std_logic_vector(burstbits downto 0); tfwpnt : std_logic_vector(txfabits-1 downto 0); tfrpnt : std_logic_vector(txfabits-1 downto 0); tfcnt : std_logic_vector(txfabits downto 0); txcnt : std_logic_vector(10 downto 0); txstart : std_ulogic; txirqgen : std_ulogic; txstatus : std_logic_vector(1 downto 0); txvalid : std_ulogic; txdata : std_logic_vector(31 downto 0); writeok : std_ulogic; txread : std_logic_vector(nsync-1 downto 0); txrestart : std_logic_vector(nsync downto 0); txdone : std_logic_vector(nsync downto 0); txstart_sync : std_ulogic; txreadack : std_ulogic; txdataav : std_ulogic; txburstav : std_ulogic; --master rx interface rxrenable : std_ulogic; rxdsel : std_logic_vector(9 downto 3); rmsto : eth_rx_ahb_in_type; rxdstate : rxd_state_type; rxstatus : std_logic_vector(4 downto 0); rxaddr : std_logic_vector(31 downto 2); rxlength : std_logic_vector(10 downto 0); rxbytecount : std_logic_vector(10 downto 0); rxwrap : std_ulogic; rxirq : std_ulogic; rfwpnt : std_logic_vector(fabits-1 downto 0); rfrpnt : std_logic_vector(fabits-1 downto 0); rfcnt : std_logic_vector(fabits downto 0); rxcnt : std_logic_vector(10 downto 0); rxdoneold : std_ulogic; rxdoneack : std_ulogic; rxdone : std_logic_vector(nsync-1 downto 0); rxstart : std_logic_vector(nsync downto 0); rxwrite : std_logic_vector(nsync-1 downto 0); rxwriteack : std_ulogic; rxburstcnt : std_logic_vector(burstbits downto 0); addrok : std_ulogic; addrdone : std_ulogic; ctrlpkt : std_ulogic; check : std_ulogic; checkdata : std_logic_vector(31 downto 0); usesizefield : std_ulogic; rxden : std_ulogic; gotframe : std_ulogic; bcast : std_ulogic; msbgood : std_ulogic; rxburstav : std_ulogic; hashlookup : std_ulogic; mcast : std_ulogic; mcastacc : std_ulogic; --mdio mdccnt : std_logic_vector(7 downto 0); mdioclk : std_ulogic; mdioclkold : std_logic_vector(mdiohold-1 downto 0); mdio_state : mdio_state_type; mdioo : std_ulogic; mdioi : std_ulogic; mdioen : std_ulogic; cnt : std_logic_vector(4 downto 0); duplexstate : duplexstate_type; disableduplex : std_ulogic; init_busy : std_ulogic; ext : std_ulogic; extcap : std_ulogic; regaddr : std_logic_vector(4 downto 0); phywr : std_ulogic; rstphy : std_ulogic; capbil : std_logic_vector(4 downto 0); rstaneg : std_ulogic; mdint_sync : std_logic_vector(2 downto 0); --edcl erenable : std_ulogic; edclrstate : edclrstate_type; edclactive : std_ulogic; nak : std_ulogic; ewr : std_ulogic; write : std_logic_vector(wsz-1 downto 0); seq : std_logic_vector(13 downto 0); abufs : std_logic_vector(bselbits downto 0); tpnt : std_logic_vector(bselbits-1 downto 0); rpnt : std_logic_vector(bselbits-1 downto 0); tcnt : std_logic_vector(bpbits-1 downto 0); rcntm : std_logic_vector(bpbits-1 downto 0); rcntl : std_logic_vector(bpbits-1 downto 0); ipcrc : std_logic_vector(17 downto 0); applength : std_logic_vector(15 downto 0); oplen : std_logic_vector(9 downto 0); udpsrc : std_logic_vector(15 downto 0); ecnt : std_logic_vector(3 downto 0); tarp : std_ulogic; tnak : std_ulogic; tedcl : std_ulogic; edclbcast : std_ulogic; etxidle : std_ulogic; erxidle : std_ulogic; emacaddr : std_logic_vector(47 downto 0); edclsepahb : std_ulogic; end record; --host signals signal arst : std_ulogic; signal irst : std_ulogic; signal vcc : std_ulogic; signal tmsto : eth_tx_ahb_in_type; signal tmsti : eth_tx_ahb_out_type; signal tmsto2 : eth_tx_ahb_in_type; signal tmsti2 : eth_tx_ahb_out_type; signal rmsto : eth_rx_ahb_in_type; signal rmsti : eth_rx_ahb_out_type; signal ahbmi : ahbc_mst_in_type; signal ahbmo : ahbc_mst_out_type; signal ahbmi2 : ahbc_mst_in_type; signal ahbmo2 : ahbc_mst_out_type; signal txi : host_tx_type; signal txo : tx_host_type; signal rxi : host_rx_type; signal rxo : rx_host_type; signal r, rin : reg_type; attribute sync_set_reset of irst : signal is "true"; attribute async_set_reset of arst : signal is "true"; begin --reset generators for transmitter and receiver vcc <= '1'; arst <= testrst when (scanen = 1) and (testen = '1') else rst and not r.ctrl.reset; irst <= rst and not r.ctrl.reset; comb : process(rst, irst, r, rmsti, tmsti, txo, rxo, psel, paddr, penable, erdata, pwrite, pwdata, rxrdata, txrdata, mdio_i, phyrstaddr, testen, testrst, edcladdr, mdint, tmsti2, edcldisable, edclsepahb) is variable v : reg_type; variable vpirq : std_ulogic; variable vprdata : std_logic_vector(31 downto 0); variable txvalid : std_ulogic; variable vtxfi : tx_fifo_access_in_type; variable vrxfi : fifo_access_in_type; variable lengthav : std_ulogic; variable txdone : std_ulogic; variable txread : std_ulogic; variable txrestart : std_ulogic; variable rxstart : std_ulogic; variable rxdone : std_ulogic; variable vrxwrite : std_ulogic; variable ovrunstop : std_ulogic; variable edcldbgread : std_ulogic; --mdio variable mdioindex : integer range 0 to 31; variable mclk : std_ulogic; --rising mdio clk edge variable nmclk : std_ulogic; --falling mdio clk edge variable mclkvec : std_logic_vector(mdiohold downto 0); --edcl variable veri : edcl_ram_in_type; variable swap : std_ulogic; variable setmz : std_ulogic; variable ipcrctmp : std_logic_vector(15 downto 0); variable ipcrctmp2 : std_logic_vector(17 downto 0); variable vrxenable : std_ulogic; variable crctmp : std_ulogic; variable vecnt : integer; begin v := r; vprdata := (others => '0'); vpirq := '0'; v.check := '0'; lengthav := r.rxdoneold;-- or r.usesizefield; ovrunstop := '0'; vrxfi.raddress := v.rfrpnt; if edcl /= 0 then veri.renable := r.erenable; veri.datain := rxo.dataout; veri.writem := '0'; veri.writel := '0'; veri.waddressm := r.rpnt & r.rcntm; veri.waddressl := r.rpnt & r.rcntl; end if; vtxfi.renable := '0'; vtxfi.datain := tmsti.data; vtxfi.raddress := r.tfrpnt; vtxfi.write := '0'; vtxfi.waddress := r.tfwpnt; vrxfi.datain := rxo.dataout; vrxfi.write := '0'; vrxfi.waddress := r.rfwpnt; vrxfi.renable := r.rxrenable; vrxenable := r.ctrl.rxen; --synchronization v.txdone(0) := txo.done; v.txread(0) := txo.read; v.txrestart(0) := txo.restart; v.rxstart(0) := rxo.start; v.rxdone(0) := rxo.done; v.rxwrite(0) := rxo.write; if nsync = 2 then v.txdone(1) := r.txdone(0); v.txread(1) := r.txread(0); v.txrestart(1) := r.txrestart(0); v.rxstart(1) := r.rxstart(0); v.rxdone(1) := r.rxdone(0); v.rxwrite(1) := r.rxwrite(0); end if; if enable_mdint = 1 then v.mdint_sync(0) := mdint; v.mdint_sync(1) := r.mdint_sync(0); v.mdint_sync(2) := r.mdint_sync(1); end if; txdone := r.txdone(nsync) xor r.txdone(nsync-1); txread := r.txreadack xor r.txread(nsync-1); txrestart := r.txrestart(nsync) xor r.txrestart(nsync-1); rxstart := r.rxstart(nsync) xor r.rxstart(nsync-1); rxdone := r.rxdoneack xor r.rxdone(nsync-1); vrxwrite := r.rxwriteack xor r.rxwrite(nsync-1); if txdone = '1' then v.txstatus := txo.status; end if; ------------------------------------------------------------------------------- -- HOST INTERFACE ------------------------------------------------------------- ------------------------------------------------------------------------------- --SLAVE INTERFACE if ramdebug = 2 then edcldbgread := '0'; end if; --write if (psel and penable and pwrite) = '1' then if (ramdebug = 0) or (paddr(17 downto 16) = "00") then case paddr(5 downto 2) is when "0000" => --ctrl reg if ramdebug /= 0 then v.ctrl.ramdebugen := pwdata(13); end if; if edcl /= 0 then v.ctrl.edcldis := pwdata(14); v.disableduplex := pwdata(12); end if; if multicast = 1 then v.ctrl.mcasten := pwdata(11); end if; if enable_mdint = 1 then v.ctrl.pstatirqen := pwdata(10); end if; if rmii = 1 then v.ctrl.speed := pwdata(7); end if; v.ctrl.reset := pwdata(6); v.ctrl.prom := pwdata(5); v.ctrl.full_duplex := pwdata(4); v.ctrl.rx_irqen := pwdata(3); v.ctrl.tx_irqen := pwdata(2); v.ctrl.rxen := pwdata(1); v.ctrl.txen := pwdata(0); when "0001" => --status/int source reg if enable_mdint = 1 then if pwdata(8) = '1' then v.status.phystat := '0'; end if; end if; if pwdata(7) = '1' then v.status.invaddr := '0'; end if; if pwdata(6) = '1' then v.status.toosmall := '0'; end if; if pwdata(5) = '1' then v.status.txahberr := '0'; end if; if pwdata(4) = '1' then v.status.rxahberr := '0'; end if; if pwdata(3) = '1' then v.status.tx_int := '0'; end if; if pwdata(2) = '1' then v.status.rx_int := '0'; end if; if pwdata(1) = '1' then v.status.tx_err := '0'; end if; if pwdata(0) = '1' then v.status.rx_err := '0'; end if; when "0010" => --mac addr msb v.mac_addr(47 downto 32) := pwdata(15 downto 0); when "0011" => --mac addr lsb v.mac_addr(31 downto 0) := pwdata(31 downto 0); when "0100" => --mdio ctrl/status if enable_mdio = 1 then if r.mdio_ctrl.busy = '0' then v.mdio_ctrl.data := pwdata(31 downto 16); v.mdio_ctrl.phyadr := pwdata(15 downto 11); v.mdio_ctrl.regadr := pwdata(10 downto 6); v.mdio_ctrl.read := pwdata(1); v.mdio_ctrl.write := pwdata(0); v.mdio_ctrl.busy := pwdata(1) or pwdata(0); end if; end if; when "0101" => --tx descriptor v.txdesc := pwdata(31 downto 10); v.txdsel := pwdata(9 downto 3); when "0110" => --rx descriptor v.rxdesc := pwdata(31 downto 10); v.rxdsel := pwdata(9 downto 3); when "0111" => --edcl ip if (edcl /= 0) then v.edclip := pwdata; end if; when "1000" => --hash msb if multicast = 1 then v.hash(63 downto 32) := pwdata; end if; when "1001" => --hash lsb if multicast = 1 then v.hash(31 downto 0) := pwdata; end if; when "1010" => if edcl /= 0 then v.emacaddr(47 downto 32) := pwdata(15 downto 0); end if; when "1011" => if edcl /= 0 then v.emacaddr(31 downto 0) := pwdata; end if; when others => null; end case; elsif ((ramdebug /= 0) and (paddr(17 downto 16) = "01")) then if r.ctrl.ramdebugen = '1' then vtxfi.write := '1'; vtxfi.waddress := paddr(txfabits+1 downto 2); vtxfi.datain := pwdata; end if; elsif ((ramdebug /= 0) and (paddr(17 downto 16) = "10")) then if r.ctrl.ramdebugen = '1' then vrxfi.write := '1'; vrxfi.waddress := paddr(fabits+1 downto 2); vrxfi.datain := pwdata; end if; elsif ((ramdebug = 2) and (edcl /= 0) and (paddr(17 downto 16) = "11")) then if r.ctrl.ramdebugen = '1' then veri.datain := pwdata; veri.waddressm := paddr(eabits+1 downto 2); veri.waddressl := paddr(eabits+1 downto 2); veri.writem := '1'; veri.writel := '1'; end if; end if; end if; --read if (ramdebug = 0) or (paddr(17 downto 16) = "00") then case paddr(5 downto 2) is when "0000" => --ctrl reg if ramdebug /= 0 then vprdata(13) := r.ctrl.ramdebugen; end if; if (edcl /= 0) then vprdata(31) := '1'; vprdata(30 downto 28) := bufsize; vprdata(14) := r.ctrl.edcldis; vprdata(12) := r.disableduplex; end if; if enable_mdint = 1 then vprdata(26) := '1'; vprdata(10) := r.ctrl.pstatirqen; end if; if multicast = 1 then vprdata(25) := '1'; vprdata(11) := r.ctrl.mcasten; end if; if rmii = 1 then vprdata(7) := r.ctrl.speed; end if; vprdata(6) := r.ctrl.reset; vprdata(5) := r.ctrl.prom; vprdata(4) := r.ctrl.full_duplex; vprdata(3) := r.ctrl.rx_irqen; vprdata(2) := r.ctrl.tx_irqen; vprdata(1) := r.ctrl.rxen; vprdata(0) := r.ctrl.txen; when "0001" => --status/int source reg vprdata(9) := not (r.etxidle or r.erxidle); if enable_mdint = 1 then vprdata(8) := r.status.phystat; end if; vprdata(7) := r.status.invaddr; vprdata(6) := r.status.toosmall; vprdata(5) := r.status.txahberr; vprdata(4) := r.status.rxahberr; vprdata(3) := r.status.tx_int; vprdata(2) := r.status.rx_int; vprdata(1) := r.status.tx_err; vprdata(0) := r.status.rx_err; when "0010" => --mac addr msb/mdio address vprdata(15 downto 0) := r.mac_addr(47 downto 32); when "0011" => --mac addr lsb vprdata := r.mac_addr(31 downto 0); when "0100" => --mdio ctrl/status vprdata(31 downto 16) := r.mdio_ctrl.data; vprdata(15 downto 11) := r.mdio_ctrl.phyadr; vprdata(10 downto 6) := r.mdio_ctrl.regadr; vprdata(3) := r.mdio_ctrl.busy; vprdata(2) := r.mdio_ctrl.linkfail; vprdata(1) := r.mdio_ctrl.read; vprdata(0) := r.mdio_ctrl.write; when "0101" => --tx descriptor vprdata(31 downto 10) := r.txdesc; vprdata(9 downto 3) := r.txdsel; when "0110" => --rx descriptor vprdata(31 downto 10) := r.rxdesc; vprdata(9 downto 3) := r.rxdsel; when "0111" => --edcl ip if (edcl /= 0) then vprdata := r.edclip; end if; when "1000" => if multicast = 1 then vprdata := r.hash(63 downto 32); end if; when "1001" => if multicast = 1 then vprdata := r.hash(31 downto 0); end if; when "1010" => if edcl /= 0 then vprdata(15 downto 0) := r.emacaddr(47 downto 32); end if; when "1011" => if edcl /= 0 then vprdata := r.emacaddr(31 downto 0); end if; when others => null; end case; elsif ((ramdebug /= 0) and (paddr(17 downto 16) = "01")) then if r.ctrl.ramdebugen = '1' then vtxfi.renable := '1'; vtxfi.raddress := paddr(txfabits+1 downto 2); vprdata := txrdata; end if; elsif ((ramdebug /= 0) and (paddr(17 downto 16) = "10")) then if r.ctrl.ramdebugen = '1' then vrxfi.renable := '1'; vrxfi.raddress := paddr(fabits+1 downto 2); vprdata := rxrdata; end if; elsif ((ramdebug = 2) and (edcl /= 0) and (paddr(17 downto 16) = "11")) then if r.ctrl.ramdebugen = '1' then edcldbgread := '1'; veri.renable := '1'; veri.raddress := paddr(eabits+1 downto 2); vprdata := erdata; end if; end if; --PHY STATUS DETECTION if enable_mdint = 1 then if mdint_pol = 0 then if (r.mdint_sync(2) and not r.mdint_sync(1)) = '1' then v.status.phystat := '1'; if r.ctrl.pstatirqen = '1' then vpirq := '1'; end if; end if; else if (r.mdint_sync(1) and not r.mdint_sync(2)) = '1' then v.status.phystat := '1'; if r.ctrl.pstatirqen = '1' then vpirq := '1'; end if; end if; end if; end if; --MASTER INTERFACE v.txburstav := '0'; if (txfifosizev - r.tfcnt) >= txburstlen then v.txburstav := '1'; end if; if (conv_integer(r.abufs) /= 0) then v.etxidle := '0'; else v.etxidle := '1'; end if; --tx dma fsm case r.txdstate is when idle => v.txcnt := (others => '0'); v.txburstcnt := (others => '0'); if (edcl /= 0) then v.tedcl := '0'; v.erenable := '0'; end if; if (edcl /= 0) and (conv_integer(r.abufs) /= 0) and (r.ctrl.edcldis = '0') then v.erenable := '1'; v.etxidle := '0'; if r.erenable = '1' then v.txdstate := getlen; end if; v.tcnt := conv_std_logic_vector(10, bpbits); elsif r.ctrl.txen = '1' then v.txdstate := read_desc; v.tmsto.write := '0'; v.tmsto.addr := r.txdesc & r.txdsel & "000"; v.tmsto.req := '1'; end if; if r.txirqgen = '1' then vpirq := '1'; v.txirqgen := '0'; end if; if txrestart = '1' then v.txrestart(nsync) := r.txrestart(nsync-1); v.tfcnt := (others => '0'); v.tfrpnt := (others => '0'); v.tfwpnt := (others => '0'); end if; when read_desc => v.tmsto.write := '0'; v.txstatus := (others => '0'); v.tfwpnt := (others => '0'); v.tfrpnt := (others => '0'); v.tfcnt := (others => '0'); if tmsti.grant = '1' then v.txburstcnt := r.txburstcnt + 1; v.tmsto.addr := r.tmsto.addr + 4; if r.txburstcnt(0) = '1' then v.tmsto.req := '0'; end if; end if; if tmsti.ready = '1' then v.txcnt := r.txcnt + 1; case r.txcnt(1 downto 0) is when "00" => v.txlength := tmsti.data(10 downto 0); v.txden := tmsti.data(11); v.txwrap := tmsti.data(12); v.txirq := tmsti.data(13); v.ctrl.txen := tmsti.data(11); when "01" => v.txaddr := tmsti.data(31 downto 2); v.txdstate := check_desc; when others => null; end case; end if; when check_desc => v.txstart := '0'; v.txburstcnt := (others => '0'); if r.txden = '1' then if (unsigned(r.txlength) > unsigned(maxsizetx)) or (conv_integer(r.txlength) = 0) then v.txdstate := write_result; v.tmsto.req := '1'; v.tmsto.write := '1'; v.tmsto.addr := r.txdesc & r.txdsel & "000"; v.tmsto.data := (others => '0'); else v.txdstate := req; v.tmsto.addr := r.txaddr & "00"; v.txcnt(10 downto 0) := r.txlength; end if; else v.txdstate := idle; end if; when req => if txrestart = '1' then v.txdstate := idle; v.txstart := '0'; if (edcl /= 0) and (r.tedcl = '1') then v.txdstate := idle; end if; elsif txdone = '1' then v.txdstate := check_result; v.tfcnt := (others => '0'); v.tfrpnt := (others => '0'); v.tfwpnt := (others => '0'); if (edcl /= 0) and (r.tedcl = '1') then v.txdstate := etdone; end if; elsif conv_integer(r.txcnt) = 0 then v.txdstate := check_result; if (edcl /= 0) and (r.tedcl = '1') then v.txdstate := etdone; v.txstart_sync := not r.txstart_sync; end if; elsif (r.txburstav = '1') or (r.tedcl = '1') then if (edclsepahbg = 0) or (edcl = 0) or (r.edclsepahb = '0') or (r.tedcl = '0') then v.tmsto.req := '1'; v.txdstate := fill_fifo; else v.tmsto2.req := '1'; v.txdstate := fill_fifo2; end if; end if; v.txburstcnt := (others => '0'); when fill_fifo => v.txburstav := '0'; if tmsti.grant = '1' then v.tmsto.addr := r.tmsto.addr + 4; if ((conv_integer(r.txcnt) <= 8) and (tmsti.ready = '1')) or ((conv_integer(r.txcnt) <= 4) and (tmsti.ready = '0')) then v.tmsto.req := '0'; end if; v.txburstcnt := r.txburstcnt + 1; if (conv_integer(r.txburstcnt) = burstlength-1) then v.tmsto.req := '0'; end if; end if; if (tmsti.ready = '1') or ((edcl /= 0) and (r.tedcl and tmsti.error) = '1') then v.tfwpnt := r.tfwpnt + 1; v.tfcnt := r.tfcnt + 1; vtxfi.write := '1'; if r.tmsto.req = '0' then v.txdstate := req; if (r.txstart = '0') and not ((edcl /= 0) and (r.tedcl = '1')) then v.txstart := '1'; v.txstart_sync := not r.txstart_sync; end if; end if; if conv_integer(r.txcnt) > 3 then v.txcnt := r.txcnt - 4; else v.txcnt := (others => '0'); end if; end if; when fill_fifo2 => if edclsepahbg = 1 then v.txburstav := '0'; vtxfi.datain := tmsti2.data; if tmsti2.grant = '1' then v.tmsto2.addr := r.tmsto2.addr + 4; if ((conv_integer(r.txcnt) <= 8) and (tmsti2.ready = '1')) or ((conv_integer(r.txcnt) <= 4) and (tmsti2.ready = '0')) then v.tmsto2.req := '0'; end if; v.txburstcnt := r.txburstcnt + 1; if (conv_integer(r.txburstcnt) = burstlength-1) then v.tmsto2.req := '0'; end if; end if; if (tmsti2.ready = '1') or ((edcl /= 0) and (r.tedcl and tmsti2.error) = '1') then v.tfwpnt := r.tfwpnt + 1; v.tfcnt := r.tfcnt + 1; vtxfi.write := '1'; if r.tmsto2.req = '0' then v.txdstate := req; if (r.txstart = '0') and not ((edcl /= 0) and (r.tedcl = '1')) then v.txstart := '1'; v.txstart_sync := not r.txstart_sync; end if; end if; if conv_integer(r.txcnt) > 3 then v.txcnt := r.txcnt - 4; else v.txcnt := (others => '0'); end if; end if; end if; when check_result => if txdone = '1' then v.txdstate := write_result; v.tmsto.req := '1'; v.txstart := '0'; v.tmsto.write := '1'; v.tmsto.addr := r.txdesc & r.txdsel & "000"; v.tmsto.data(31 downto 16) := (others => '0'); v.tmsto.data(15 downto 14) := v.txstatus; v.tmsto.data(13 downto 0) := (others => '0'); v.txdone(nsync) := r.txdone(nsync-1); elsif txrestart = '1' then v.txdstate := idle; v.txstart := '0'; end if; when write_result => if tmsti.grant = '1' then v.tmsto.req := '0'; v.tmsto.addr := r.tmsto.addr + 4; end if; if tmsti.ready = '1' then v.txdstate := idle; v.txirqgen := r.ctrl.tx_irqen and r.txirq; if r.txwrap = '0' then v.txdsel := r.txdsel + 1; else v.txdsel := (others => '0'); end if; if conv_integer(r.txstatus) = 0 then v.status.tx_int := '1'; else v.status.tx_err := '1'; end if; end if; when ahberror => v.tfcnt := (others => '0'); v.tfwpnt := (others => '0'); v.tfrpnt := (others => '0'); v.status.txahberr := '1'; v.ctrl.txen := '0'; if not ((edcl /= 0) and (r.tedcl = '1')) then if r.txstart = '1' then if txdone = '1' then v.txdstate := idle; v.txdone(nsync) := r.txdone(nsync-1); end if; else v.txdstate := idle; end if; else v.txdstate := idle; v.abufs := r.abufs - 1; v.tpnt := r.tpnt + 1; end if; when others => null; end case; --tx fifo read v.txdataav := '0'; if conv_integer(r.tfcnt) /= 0 then v.txdataav := '1'; end if; if txread = '1' then v.txreadack := not r.txreadack; if r.txdataav = '1' then if conv_integer(r.tfcnt) < 2 then v.txdataav := '0'; end if; v.txvalid := '1'; v.tfcnt := v.tfcnt - 1; v.tfrpnt := r.tfrpnt + 1; else v.txvalid := '0'; end if; v.txdata := txrdata; end if; v.rxburstav := '0'; if r.rfcnt >= rxburstlen then v.rxburstav := '1'; end if; if ramdebug = 0 then vtxfi.renable := v.txdataav; else vtxfi.renable := vtxfi.renable or v.txdataav; end if; --rx dma fsm case r.rxdstate is when idle => v.rmsto.req := '0'; v.rmsto.write := '0'; v.addrok := '0'; v.rxburstcnt := (others => '0'); v.addrdone := '0'; v.rxcnt := (others => '0'); v.rxdoneold := '0'; v.ctrlpkt := '0'; v.bcast := '0'; v.edclactive := '0'; v.msbgood := '0'; v.rxrenable := '0'; if multicast = 1 then v.mcast := '0'; v.mcastacc := '0'; end if; if r.ctrl.rxen = '1' then v.rxdstate := read_desc; v.rmsto.req := '1'; v.rmsto.addr := r.rxdesc & r.rxdsel & "000"; elsif rxstart = '1' then v.rxstart(nsync) := r.rxstart(nsync-1); v.rxdstate := discard; end if; when read_desc => v.rxstatus := (others => '0'); if rmsti.grant = '1' then v.rxburstcnt := r.rxburstcnt + 1; v.rmsto.addr := r.rmsto.addr + 4; if r.rxburstcnt(0) = '1' then v.rmsto.req := '0'; end if; end if; if rmsti.ready = '1' then v.rxcnt := r.rxcnt + 1; case r.rxcnt(1 downto 0) is when "00" => v.ctrl.rxen := rmsti.data(11); v.rxden := rmsti.data(11); v.rxwrap := rmsti.data(12); v.rxirq := rmsti.data(13); when "01" => v.rxaddr := rmsti.data(31 downto 2); v.rxdstate := check_desc; v.rxrenable := '1'; when others => null; end case; end if; if rmsti.error = '1' then v.rmsto.req := '0'; v.rxdstate := idle; v.status.rxahberr := '1'; v.ctrl.rxen := '0'; end if; when check_desc => v.rxcnt := (others => '0'); v.usesizefield := '0'; v.rmsto.write := '1'; if r.rxden = '1' then if rxstart = '1' then v.rxdstate := read_req; v.rxstart(nsync) := r.rxstart(nsync-1); end if; else v.rxdstate := idle; end if; v.rmsto.addr := r.rxaddr & "00"; when read_req => if r.edclactive = '1' then v.rxdstate := discard; elsif (r.rxdoneold and r.rxstatus(3)) = '1' then v.rxdstate := write_status; v.rfcnt := (others => '0'); v.rfwpnt := (others => '0'); v.rfrpnt := (others => '0'); v.writeok := '1'; v.rxbytecount := (others => '0'); v.rxlength := (others => '0'); elsif ((r.addrdone and not r.addrok) or r.ctrlpkt) = '1' then v.rxdstate := discard; v.status.invaddr := '1'; elsif ((r.rxdoneold = '1') and r.rxcnt >= r.rxlength) then if r.gotframe = '1' then v.rxdstate := write_status; else v.rxdstate := discard; v.status.toosmall := '1'; end if; elsif (r.rxburstav or r.rxdoneold) = '1' then v.rmsto.req := '1'; v.rxdstate := read_fifo; v.rfrpnt := r.rfrpnt + 1; v.rfcnt := r.rfcnt - 1; end if; v.rxburstcnt := (others => '0'); v.rmsto.data := rxrdata; when read_fifo => v.rxburstav := '0'; if rmsti.grant = '1' then v.rmsto.addr := r.rmsto.addr + 4; if (lengthav = '1') then if ((conv_integer(r.rxcnt) >= (conv_integer(r.rxlength) - 8)) and (rmsti.ready = '1')) or ((conv_integer(r.rxcnt) >= (conv_integer(r.rxlength) - 4)) and (rmsti.ready = '0')) then v.rmsto.req := '0'; end if; end if; v.rxburstcnt := r.rxburstcnt + 1; if (conv_integer(r.rxburstcnt) = burstlength-1) then v.rmsto.req := '0'; end if; end if; if rmsti.ready = '1' then v.rmsto.data := rxrdata; v.rxcnt := r.rxcnt + 4; if r.rmsto.req = '0' then v.rxdstate := read_req; else v.rfcnt := r.rfcnt - 1; v.rfrpnt := r.rfrpnt + 1; end if; v.check := '1'; v.checkdata := r.rmsto.data; end if; if rmsti.error = '1' then v.rmsto.req := '0'; v.rxdstate := discard; v.rxcnt := r.rxcnt + 4; v.status.rxahberr := '1'; v.ctrl.rxen := '0'; end if; when write_status => v.rmsto.req := '1'; v.rmsto.addr := r.rxdesc & r.rxdsel & "000"; v.rxdstate := write_status2; if multicast = 1 then v.rmsto.data := "00000" & r.mcastacc & "0000000" & r.rxstatus & "000" & r.rxlength; else v.rmsto.data := "0000000000000" & r.rxstatus & "000" & r.rxlength; end if; when write_status2 => if rmsti.grant = '1' then v.rmsto.req := '0'; v.rmsto.addr := r.rmsto.addr + 4; end if; if rmsti.ready = '1' then if (r.rxstatus(4) or not r.rxstatus(3)) = '1' then v.rxdstate := discard; else v.rxdstate := idle; end if; if (r.ctrl.rx_irqen and r.rxirq) = '1' then vpirq := '1'; end if; if conv_integer(r.rxstatus) = 0 then v.status.rx_int := '1'; else v.status.rx_err := '1'; end if; if r.rxwrap = '1' then v.rxdsel := (others => '0'); else v.rxdsel := r.rxdsel + 1; end if; end if; if rmsti.error = '1' then v.rmsto.req := '0'; v.rxdstate := idle; v.status.rxahberr := '1'; v.ctrl.rxen := '0'; end if; when discard => if (r.rxdoneold = '0') then if conv_integer(r.rfcnt) /= 0 then v.rfrpnt := r.rfrpnt + 1; v.rfcnt := r.rfcnt - 1; v.rxcnt := r.rxcnt + 4; end if; else if r.rxstatus(3) = '1' then v.rfcnt := (others => '0'); v.rfwpnt := (others => '0'); v.rfrpnt := (others => '0'); v.writeok := '1'; v.rxbytecount := (others => '0'); v.rxlength := (others => '0'); v.rxdstate := idle; elsif (conv_integer(r.rxcnt) < conv_integer(r.rxbytecount)) then if conv_integer(r.rfcnt) /= 0 then v.rfrpnt := r.rfrpnt + 1; v.rfcnt := r.rfcnt - 1; v.rxcnt := r.rxcnt + 4; end if; else v.rxdstate := idle; v.ctrlpkt := '0'; end if; end if; when others => null; end case; --rx address/type check if r.check = '1' and r.rxcnt(10 downto 5) = "000000" then case r.rxcnt(4 downto 2) is when "001" => if r.ctrl.prom = '1' then v.addrok := '1'; end if; v.mcast := r.checkdata(24); if r.checkdata = broadcast(47 downto 16) then v.bcast := '1'; end if; if r.checkdata = r.mac_addr(47 downto 16) then v.msbgood := '1'; end if; when "010" => if r.checkdata(31 downto 16) = broadcast(15 downto 0) then if r.bcast = '1' then v.addrok := '1'; end if; else v.bcast := '0'; end if; if r.checkdata(31 downto 16) = r.mac_addr(15 downto 0) then if r.msbgood = '1' then v.addrok := '1'; end if; end if; if multicast = 1 then v.hashlookup := r.hash(conv_integer(rxo.mcasthash)); end if; when "011" => if multicast = 1 then if (r.hashlookup and r.ctrl.mcasten and r.mcast) = '1' then v.addrok := '1'; if r.bcast = '0' then v.mcastacc := '1'; end if; end if; end if; when "100" => if r.checkdata(31 downto 16) = ctrlopcode then v.ctrlpkt := '1'; end if; v.addrdone := '1'; when others => null; end case; end if; --rx packet done if (rxdone and not rxstart) = '1' then v.gotframe := rxo.gotframe; v.rxbytecount := rxo.byte_count; v.rxstatus(3 downto 0) := rxo.status; if (unsigned(rxo.lentype) > maxsizerx) or (rxo.status /= "0000") then v.rxlength := rxo.byte_count; else v.rxlength := rxo.lentype(10 downto 0); if (rxo.lentype(10 downto 0) > minpload) and (rxo.lentype(10 downto 0) /= rxo.byte_count) then if rxo.status(2 downto 0) = "000" then v.rxstatus(4) := '1'; v.rxlength := rxo.byte_count; v.usesizefield := '0'; end if; elsif (rxo.lentype(10 downto 0) <= minpload) and (rxo.byte_count /= minpload) then if rxo.status(2 downto 0) = "000" then v.rxstatus(4) := '1'; v.rxlength := rxo.byte_count; v.usesizefield := '0'; end if; end if; end if; v.rxdoneold := '1'; v.rxdoneack := not r.rxdoneack; end if; --rx fifo write if vrxwrite = '1' then v.rxwriteack := not r.rxwriteack; if (not r.rfcnt(fabits)) = '1' then v.rfwpnt := r.rfwpnt + 1; v.rfcnt := v.rfcnt + 1; v.writeok := '1'; vrxfi.write := '1'; else v.writeok := '0'; end if; end if; --must be placed here because it uses variable if (ramdebug = 0) or (r.ctrl.ramdebugen = '0') then vrxfi.raddress := v.rfrpnt; end if; ------------------------------------------------------------------------------- -- MDIO INTERFACE ------------------------------------------------------------- ------------------------------------------------------------------------------- --mdio commands if enable_mdio = 1 then mclkvec := r.mdioclkold & r.mdioclk; mclk := mclkvec(mdiohold-1) and not mclkvec(mdiohold); nmclk := mclkvec(1) and not mclkvec(0); v.mdioclkold := mclkvec(mdiohold-1 downto 0); if r.mdccnt = "00000000" then v.mdccnt := divisor; v.mdioclk := not r.mdioclk; else v.mdccnt := r.mdccnt - 1; end if; mdioindex := conv_integer(r.cnt); v.mdioi := mdio_i; case r.mdio_state is when idle => if (enable_mdio = 1) and (edcl = 0) and (r.ctrl.reset = '1') then v.mdio_state := idle; v.mdio_ctrl.read := '0'; v.mdio_ctrl.write := '0'; v.mdio_ctrl.busy := '0'; v.mdio_ctrl.data := (others => '0'); v.mdio_ctrl.regadr := (others => '0'); v.ctrl.reset := '0'; if OEPOL = 0 then v.mdioen := '1'; else v.mdioen := '0'; end if; end if; if mclk = '1' then v.cnt := (others => '0'); if r.mdio_ctrl.busy = '1' then v.mdio_ctrl.linkfail := '0'; if r.mdio_ctrl.read = '1' then v.mdio_ctrl.write := '0'; end if; v.mdio_state := preamble; v.mdioo := '1'; if OEPOL = 0 then v.mdioen := '0'; else v.mdioen := '1'; end if; end if; end if; when preamble => if mclk = '1' then v.cnt := r.cnt + 1; if r.cnt = "11111" then v.mdioo := '0'; v.mdio_state := startst; end if; end if; when startst => if mclk = '1' then v.mdioo := '1'; v.mdio_state := op; v.cnt := (others => '0'); end if; when op => if mclk = '1' then v.mdio_state := op2; if r.mdio_ctrl.read = '1' then v.mdioo := '1'; else v.mdioo := '0'; end if; end if; when op2 => if mclk = '1' then v.mdioo := not r.mdioo; v.mdio_state := phyadr; v.cnt := (others => '0'); end if; when phyadr => if mclk = '1' then v.cnt := r.cnt + 1; case mdioindex is when 0 => v.mdioo := r.mdio_ctrl.phyadr(4); when 1 => v.mdioo := r.mdio_ctrl.phyadr(3); when 2 => v.mdioo := r.mdio_ctrl.phyadr(2); when 3 => v.mdioo := r.mdio_ctrl.phyadr(1); when 4 => v.mdioo := r.mdio_ctrl.phyadr(0); v.mdio_state := regadr; v.cnt := (others => '0'); when others => null; end case; end if; when regadr => if mclk = '1' then v.cnt := r.cnt + 1; case mdioindex is when 0 => v.mdioo := r.mdio_ctrl.regadr(4); when 1 => v.mdioo := r.mdio_ctrl.regadr(3); when 2 => v.mdioo := r.mdio_ctrl.regadr(2); when 3 => v.mdioo := r.mdio_ctrl.regadr(1); when 4 => v.mdioo := r.mdio_ctrl.regadr(0); v.mdio_state := ta; v.cnt := (others => '0'); when others => null; end case; end if; when ta => if mclk = '1' then v.mdio_state := ta2; if r.mdio_ctrl.read = '1' then if OEPOL = 0 then v.mdioen := '1'; else v.mdioen := '0'; end if; else v.mdioo := '1'; end if; end if; when ta2 => if mclk = '1' then v.cnt := "01111"; v.mdio_state := ta3; if r.mdio_ctrl.write = '1' then v.mdioo := '0'; v.mdio_state := data; end if; end if; when ta3 => if mclk = '1' then v.mdio_state := data; end if; if nmclk = '1' then if r.mdioi /= '0' then v.mdio_ctrl.linkfail := '1'; end if; end if; when data => if mclk = '1' then v.cnt := r.cnt - 1; if r.cnt = "00000" then v.mdio_state := dataend; end if; if r.mdio_ctrl.read = '0' then v.mdioo := r.mdio_ctrl.data(mdioindex); end if; end if; if nmclk = '1' then if r.mdio_ctrl.read = '1' then v.mdio_ctrl.data(mdioindex) := r.mdioi; end if; end if; when dataend => if mclk = '1' then if (rmii = 1) or (edcl /= 0) then v.init_busy := '0'; if r.duplexstate = done then v.mdio_ctrl.busy := '0'; end if; else v.mdio_ctrl.busy := '0'; end if; v.mdio_ctrl.read := '0'; v.mdio_ctrl.write := '0'; v.mdio_state := idle; if OEPOL = 0 then v.mdioen := '1'; else v.mdioen := '0'; end if; end if; when others => null; end case; end if; ------------------------------------------------------------------------------- -- EDCL ----------------------------------------------------------------------- ------------------------------------------------------------------------------- if (edcl /= 0) then if (ramdebug /= 2) or (r.ctrl.ramdebugen = '0') then veri.renable := r.erenable; veri.writem := '0'; veri.writel := '0'; veri.waddressm := r.rpnt & r.rcntm; veri.waddressl := r.rpnt & r.rcntl; vrxenable := '1'; end if; swap := '0'; vecnt := conv_integer(r.ecnt); setmz := '0'; if vrxwrite = '1' then if r.ctrl.edcldis = '0' then v.rxwriteack := not r.rxwriteack; end if; end if; --edcl receiver case r.edclrstate is when idle => v.edclbcast := '0'; v.erxidle := '1'; if (ramdebug /= 2) or (r.ctrl.ramdebugen = '0') then if (rxstart and not r.ctrl.edcldis) = '1' then v.edclrstate := wrda; v.edclactive := '0'; v.erxidle := '0'; v.rcntm := conv_std_logic_vector(2, bpbits); v.rcntl := conv_std_logic_vector(1, bpbits); end if; end if; when wrda => if vrxwrite = '1' then v.edclrstate := wrdsa; veri.writem := '1'; veri.writel := '1'; swap := '1'; v.rcntm := r.rcntm - 2; v.rcntl := r.rcntl + 1; if (r.emacaddr(47 downto 16) /= rxo.dataout) and (X"FFFFFFFF" /= rxo.dataout) then v.edclrstate := spill; elsif (X"FFFFFFFF" = rxo.dataout) then v.edclbcast := '1'; end if; if conv_integer(r.abufs) = wsz then v.edclrstate := spill; end if; end if; if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; when wrdsa => if vrxwrite = '1' then v.edclrstate := wrsa; swap := '1'; veri.writem := '1'; veri.writel := '1'; v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl - 2; if (r.emacaddr(15 downto 0) /= rxo.dataout(31 downto 16)) and (X"FFFF" /= rxo.dataout(31 downto 16)) then v.edclrstate := spill; elsif (X"FFFF" = rxo.dataout(31 downto 16)) then v.edclbcast := r.edclbcast; end if; end if; if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; when wrsa => if vrxwrite = '1' then veri.writem := '1'; veri.writel := '1'; v.edclrstate := wrtype; swap := '1'; v.rcntm := r.rcntm + 2; v.rcntl := r.rcntl + 3; end if; if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; when wrtype => if vrxwrite = '1' then veri.writem := '1'; veri.writel := '1'; v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; if X"0800" = rxo.dataout(31 downto 16) and (r.edclbcast = '0') then v.edclrstate := ip; elsif X"0806" = rxo.dataout(31 downto 16) and (r.edclbcast = '1') then v.edclrstate := arp; else v.edclrstate := spill; end if; end if; v.ecnt := (others => '0'); v.ipcrc := (others => '0'); if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; when ip => if vrxwrite = '1' then v.ecnt := r.ecnt + 1; veri.writem := '1'; veri.writel := '1'; case vecnt is when 0 => v.ipcrc := crcadder(not rxo.dataout(31 downto 16), r.ipcrc); v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; when 1 => v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 2; when 2 => v.ipcrc := crcadder(not rxo.dataout(31 downto 16), r.ipcrc); v.rcntm := r.rcntm + 2; v.rcntl := r.rcntl - 1; when 3 => v.rcntm := r.rcntm - 1; v.rcntl := r.rcntl + 2; when 4 => v.udpsrc := rxo.dataout(15 downto 0); v.rcntm := r.rcntm + 2; v.rcntl := r.rcntl + 1; when 5 => setmz := '1'; v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; when 6 => v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; when 7 => v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; if (rxo.dataout(31 downto 18) = r.seq) then v.nak := '0'; else v.nak := '1'; veri.datain(31 downto 18) := r.seq; end if; veri.datain(17) := v.nak; v.ewr := rxo.dataout(17); if (rxo.dataout(17) or v.nak) = '1' then veri.datain(16 downto 7) := (others => '0'); end if; v.oplen := rxo.dataout(16 downto 7); v.applength := "000000" & veri.datain(16 downto 7); v.ipcrc := crcadder(v.applength + 38, r.ipcrc); v.write(conv_integer(r.rpnt)) := rxo.dataout(17); when 8 => ipcrctmp := (others => '0'); ipcrctmp(1 downto 0) := r.ipcrc(17 downto 16); ipcrctmp2 := "00" & r.ipcrc(15 downto 0); v.ipcrc := crcadder(ipcrctmp, ipcrctmp2); v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; v.edclrstate := ipdata; when others => null; end case; end if; if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; when ipdata => if (vrxwrite and r.ewr and not r.nak) = '1' and (r.rcntm /= ebufmax) then veri.writem := '1'; veri.writel := '1'; v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; end if; if rxdone = '1' then v.edclrstate := ipcrc; v.rcntm := conv_std_logic_vector(6, bpbits); ipcrctmp := (others => '0'); ipcrctmp(1 downto 0) := r.ipcrc(17 downto 16); ipcrctmp2 := "00" & r.ipcrc(15 downto 0); v.ipcrc := crcadder(ipcrctmp, ipcrctmp2); if conv_integer(v.rxstatus(3 downto 0)) /= 0 then v.edclrstate := idle; end if; end if; when ipcrc => veri.writem := '1'; veri.datain(31 downto 16) := not r.ipcrc(15 downto 0); v.edclrstate := udp; v.rcntm := conv_std_logic_vector(9, bpbits); v.rcntl := conv_std_logic_vector(9, bpbits); when udp => veri.writem := '1'; veri.writel := '1'; v.edclrstate := iplength; veri.datain(31 downto 16) := r.udpsrc; veri.datain(15 downto 0) := r.applength + 18; v.rcntm := conv_std_logic_vector(4, bpbits); when iplength => veri.writem := '1'; veri.datain(31 downto 16) := r.applength + 38; v.edclrstate := oplength; v.rcntm := conv_std_logic_vector(10, bpbits); v.rcntl := conv_std_logic_vector(10, bpbits); when oplength => if rxstart = '0' then v.abufs := r.abufs + 1; v.rpnt := r.rpnt + 1; veri.writel := '1'; veri.writem := '1'; end if; if r.nak = '0' then v.seq := r.seq + 1; end if; v.edclrstate := idle; veri.datain(31 downto 0) := (others => '0'); veri.datain(15 downto 0) := "00000" & r.nak & r.oplen; when arp => if vrxwrite = '1' then v.ecnt := r.ecnt + 1; veri.writem := '1'; veri.writel := '1'; case vecnt is when 0 => v.rcntm := r.rcntm + 4; when 1 => swap := '1'; veri.writel := '0'; v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 4; when 2 => swap := '1'; v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; when 3 => swap := '1'; v.rcntm := r.rcntm - 4; v.rcntl := r.rcntl - 4; when 4 => veri.datain := r.emacaddr(31 downto 16) & r.emacaddr(47 downto 32); v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1; when 5 => v.rcntl := r.rcntl + 1; veri.datain(31 downto 16) := rxo.dataout(15 downto 0); veri.datain(15 downto 0) := r.emacaddr(15 downto 0); if rxo.dataout(15 downto 0) /= r.edclip(31 downto 16) then v.edclrstate := spill; end if; when 6 => swap := '1'; veri.writem := '0'; v.rcntm := conv_std_logic_vector(5, bpbits); v.rcntl := conv_std_logic_vector(1, bpbits); if rxo.dataout(31 downto 16) /= r.edclip(15 downto 0) then v.edclrstate := spill; else v.edclactive := '1'; end if; when 7 => veri.writem := '0'; veri.datain(15 downto 0) := r.emacaddr(47 downto 32); v.rcntl := r.rcntl + 1; v.rcntm := conv_std_logic_vector(2, bpbits); when 8 => v.edclrstate := arpop; veri.datain := r.emacaddr(31 downto 0); v.rcntm := conv_std_logic_vector(5, bpbits); when others => null; end case; end if; if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; when arpop => veri.writem := '1'; veri.datain(31 downto 16) := X"0002"; if (rxdone and not rxstart) = '1' then v.edclrstate := idle; if conv_integer(v.rxstatus) = 0 and (rxo.gotframe = '1') then v.abufs := r.abufs + 1; v.rpnt := r.rpnt + 1; end if; end if; when spill => if (rxdone and not rxstart) = '1' then v.edclrstate := idle; end if; end case; --edcl transmitter case r.txdstate is when getlen => v.tcnt := r.tcnt + 1; if conv_integer(r.tcnt) = 10 then v.txlength := '0' & erdata(9 downto 0); v.tnak := erdata(10); v.txcnt := v.txlength; if (r.write(conv_integer(r.tpnt)) or v.tnak) = '1' then v.txlength := (others => '0'); end if; end if; if conv_integer(r.tcnt) = 11 then v.txdstate := readhdr; v.tcnt := (others => '0'); end if; when readhdr => v.tcnt := r.tcnt + 1; vtxfi.write := '1'; v.tfwpnt := r.tfwpnt + 1; v.tfcnt := v.tfcnt + 1; vtxfi.datain := erdata; if conv_integer(r.tcnt) = 12 then v.txaddr := erdata(31 downto 2); end if; if conv_integer(r.tcnt) = 3 then if erdata(31 downto 16) = X"0806" then v.tarp := '1'; v.txlength := conv_std_logic_vector(42, 11); else v.tarp := '0'; v.txlength := r.txlength + 52; end if; end if; if r.tarp = '0' then if conv_integer(r.tcnt) = 12 then v.txdstate := start; end if; else if conv_integer(r.tcnt) = 10 then v.txdstate := start; end if; end if; if (txrestart or txdone) = '1' then v.txdstate := etdone; end if; when start => v.tmsto.addr := r.txaddr & "00"; v.tmsto.write := r.write(conv_integer(r.tpnt)); if (edclsepahbg /= 0) and (edcl /= 0) then v.tmsto2.addr := r.txaddr & "00"; v.tmsto2.write := r.write(conv_integer(r.tpnt)); end if; if (conv_integer(r.txcnt) = 0) or (r.tarp or r.tnak) = '1' then v.txdstate := etdone; v.txstart_sync := not r.txstart_sync; v.tmsto.req := '0'; if (edclsepahbg /= 0) and (edcl /= 0) then v.tmsto2.req := '0'; end if; elsif r.write(conv_integer(r.tpnt)) = '0' then v.txdstate := req; v.tedcl := '1'; else v.txstart_sync := not r.txstart_sync; v.tedcl := '1'; v.tcnt := r.tcnt + 1; if (edclsepahbg = 0) or (edcl = 0) or (r.edclsepahb = '0') then v.tmsto.req := '1'; v.tmsto.data := erdata; v.txdstate := wrbus1; else v.tmsto2.req := '1'; v.tmsto2.data := erdata; v.txdstate := wrbus2; end if; end if; if (txrestart or txdone) = '1' then v.txdstate := etdone; end if; when wrbus1 => if tmsti.grant = '1' then v.tmsto.addr := r.tmsto.addr + 4; if ((conv_integer(r.txcnt) <= 4) and (tmsti.ready = '0')) or ((conv_integer(r.txcnt) <= 8) and (tmsti.ready = '1')) then v.tmsto.req := '0'; end if; end if; if (tmsti.ready or tmsti.error) = '1' then v.tmsto.data := erdata; v.tcnt := r.tcnt + 1; v.txcnt := r.txcnt - 4; if r.tmsto.req = '0' then v.txdstate := etdone; end if; end if; if tmsti.retry = '1' then v.tmsto.addr := r.tmsto.addr - 4; v.tmsto.req := '1'; end if; when wrbus2 => if tmsti2.grant = '1' then v.tmsto2.addr := r.tmsto2.addr + 4; if ((conv_integer(r.txcnt) <= 4) and (tmsti2.ready = '0')) or ((conv_integer(r.txcnt) <= 8) and (tmsti2.ready = '1')) then v.tmsto2.req := '0'; end if; end if; if (tmsti2.ready or tmsti2.error) = '1' then v.tmsto2.data := erdata; v.tcnt := r.tcnt + 1; v.txcnt := r.txcnt - 4; if r.tmsto2.req = '0' then v.txdstate := etdone; end if; end if; if tmsti2.retry = '1' then v.tmsto2.addr := r.tmsto2.addr - 4; v.tmsto2.req := '1'; end if; when etdone => if txdone = '1' then v.txdstate := idle; v.txdone(nsync) := r.txdone(nsync-1); v.abufs := v.abufs - 1; v.tpnt := r.tpnt + 1; v.tfcnt := (others => '0'); v.tfrpnt := (others => '0'); v.tfwpnt := (others => '0'); elsif txrestart = '1' then v.txdstate := idle; end if; when others => null; end case; if swap = '1' then veri.datain(31 downto 16) := rxo.dataout(15 downto 0); veri.datain(15 downto 0) := rxo.dataout(31 downto 16); end if; if setmz = '1' then veri.datain(31 downto 16) := (others => '0'); end if; if (ramdebug /= 2) or (edcl = 0) or (edcldbgread = '0') then veri.raddress := r.tpnt & v.tcnt; end if; end if; --edcl duplex mode read if (rmii = 1) or (edcl /= 0) then --edcl, gbit link mode check case r.duplexstate is when start => v.mdio_ctrl.regadr := r.regaddr; v.init_busy := '1'; v.mdio_ctrl.busy := '1'; v.duplexstate := waitop; if (r.phywr or r.rstphy) = '1' then v.mdio_ctrl.write := '1'; else v.mdio_ctrl.read := '1'; end if; if r.rstphy = '1' then v.mdio_ctrl.data := X"9000"; end if; when waitop => if r.init_busy = '0' then if r.mdio_ctrl.linkfail = '1' then v.duplexstate := start; elsif r.rstphy = '1' then v.duplexstate := start; v.rstphy := '0'; else v.duplexstate := nextop; end if; end if; when nextop => case r.regaddr is when "00000" => if r.mdio_ctrl.data(15) = '1' then --rst not finished v.duplexstate := start; elsif (r.phywr and not r.rstaneg) = '1' then --forced to 10 Mbit HD v.duplexstate := selmode; elsif r.mdio_ctrl.data(12) = '0' then --no auto neg v.duplexstate := start; v.phywr := '1'; v.mdio_ctrl.data := (others => '0'); else v.duplexstate := start; v.regaddr := "00001"; end if; if r.rstaneg = '1' then v.phywr := '0'; end if; when "00001" => v.ext := r.mdio_ctrl.data(8); --extended status register v.extcap := r.mdio_ctrl.data(1); --extended register capabilities v.duplexstate := start; if r.mdio_ctrl.data(0) = '0' then --no extended register capabilites, unable to read aneg config --forcing 10 Mbit v.duplexstate := start; v.phywr := '1'; v.mdio_ctrl.data := (others => '0'); v.regaddr := (others => '0'); elsif (r.mdio_ctrl.data(8) and not r.rstaneg) = '1' then --phy gbit capable, disable gbit v.regaddr := "01001"; elsif r.mdio_ctrl.data(5) = '1' then --auto neg completed v.regaddr := "00100"; elsif r.disableduplex = '1' then v.duplexstate := done; v.mdio_ctrl.busy := '0'; end if; when "00100" => v.duplexstate := start; v.regaddr := "00101"; v.capbil(4 downto 0) := r.mdio_ctrl.data(9 downto 5); when "00101" => v.duplexstate := selmode; v.capbil(4 downto 0) := r.capbil(4 downto 0) and r.mdio_ctrl.data(9 downto 5); when "01001" => if r.phywr = '0' then v.duplexstate := start; v.phywr := '1'; v.mdio_ctrl.data(9 downto 8) := (others => '0'); else v.regaddr := "00000"; v.duplexstate := start; v.phywr := '1'; v.mdio_ctrl.data := X"3300"; v.rstaneg := '1'; end if; when others => null; end case; when selmode => v.duplexstate := done; v.mdio_ctrl.busy := '0'; if r.phywr = '1' then v.ctrl.full_duplex := '0'; v.ctrl.speed := '0'; else sel_op_mode(r.capbil, v.ctrl.speed, v.ctrl.full_duplex); end if; when done => null; end case; end if; --transmitter retry if tmsti.retry = '1' then v.tmsto.req := '1'; v.tmsto.addr := r.tmsto.addr - 4; v.txburstcnt := r.txburstcnt - 1; end if; --transmitter AHB error if tmsti.error = '1' and (not ((edcl /= 0) and (r.tedcl = '1'))) then v.tmsto.req := '0'; v.txdstate := ahberror; end if; if (edclsepahbg /= 0) and (edcl /= 0) then --transmitter retry if tmsti2.retry = '1' then v.tmsto2.req := '1'; v.tmsto2.addr := r.tmsto2.addr - 4; v.txburstcnt := r.txburstcnt - 1; end if; --transmitter AHB error if tmsti2.error = '1' and (not ((edcl /= 0) and (r.tedcl = '1'))) then v.tmsto2.req := '0'; v.txdstate := ahberror; end if; end if; --receiver retry if rmsti.retry = '1' then v.rmsto.req := '1'; v.rmsto.addr := r.rmsto.addr - 4; v.rxburstcnt := r.rxburstcnt - 1; end if; ------------------------------------------------------------------------------ -- RESET ---------------------------------------------------------------------- ------------------------------------------------------------------------------- if irst = '0' then v.txdstate := idle; v.rxdstate := idle; v.rfrpnt := (others => '0'); v.tmsto.req := '0'; v.tmsto2.req := '0'; v.rfwpnt := (others => '0'); v.rfcnt := (others => '0'); v.ctrl.txen := '0'; v.txirqgen := '0'; v.ctrl.rxen := '0'; v.txdsel := (others => '0'); v.txstart_sync := '0'; v.txread := (others => '0'); v.txrestart := (others => '0'); v.txdone := (others => '0'); v.txreadack := '0'; v.rxdsel := (others => '0'); v.rxdone := (others => '0'); v.rxdoneold := '0'; v.rxdoneack := '0'; v.rxwriteack := '0'; v.rxstart := (others => '0'); v.rxwrite := (others => '0'); v.status.invaddr := '0'; v.status.toosmall := '0'; v.ctrl.full_duplex := '0'; v.writeok := '1'; if (enable_mdio = 0) or (edcl /= 0) then v.ctrl.reset := '0'; end if; if enable_mdint = 1 then v.status.phystat := '0'; v.ctrl.pstatirqen := '0'; end if; if (edcl /= 0) then v.tpnt := (others => '0'); v.rpnt := (others => '0'); v.tcnt := (others => '0'); v.edclactive := '0'; v.tarp := '0'; v.abufs := (others => '0'); v.edclrstate := idle; v.emacaddr := macaddrt; end if; if (rmii = 1) then v.ctrl.speed := '1'; end if; v.ctrl.tx_irqen := '0'; v.ctrl.rx_irqen := '0'; v.ctrl.prom := '0'; if multicast = 1 then v.ctrl.mcasten := '0'; end if; if ramdebug /= 0 then v.ctrl.ramdebugen := '0'; end if; end if; if edcl = 0 then v.edclrstate := idle; v.edclactive := '0'; v.nak := '0'; v.ewr := '0'; v.write := (others => '0'); v.seq := (others => '0'); v.abufs := (others => '0'); v.tpnt := (others => '0'); v.rpnt := (others => '0'); v.tcnt := (others => '0'); v.rcntm := (others => '0'); v.rcntl := (others => '0'); v.ipcrc := (others => '0'); v.applength := (others => '0'); v.oplen := (others => '0'); v.udpsrc := (others => '0'); v.ecnt := (others => '0'); v.tarp := '0'; v.tnak := '0'; v.tedcl := '0'; v.edclbcast := '0'; end if; --some parts of edcl are only affected by hw reset if rst = '0' then v.edclip := conv_std_logic_vector(ipaddrh, 16) & conv_std_logic_vector(ipaddrl, 16); if edcl > 1 then v.edclip(3 downto 0) := edcladdr; v.emacaddr(3 downto 0) := edcladdr; end if; v.duplexstate := start; v.regaddr := (others => '0'); v.phywr := '0'; v.rstphy := '1'; v.rstaneg := '0'; if phyrstadr /= 32 then v.mdio_ctrl.phyadr := conv_std_logic_vector(phyrstadr, 5); else v.mdio_ctrl.phyadr := phyrstaddr; end if; v.seq := (others => '0'); if (enable_mdio = 1) then v.mdccnt := divisor; v.mdioclk := '0'; end if; if edcl /= 0 then v.disableduplex := '0'; end if; if edcl = 3 then v.ctrl.edcldis := edcldisable; elsif edcl /= 0 then v.ctrl.edcldis := '0'; end if; v.ctrl.reset := '0'; if (enable_mdio = 1) then v.mdio_state := idle; v.mdio_ctrl.read := '0'; v.mdio_ctrl.write := '0'; v.mdio_ctrl.busy := '0'; v.mdio_ctrl.data := (others => '0'); v.mdio_ctrl.regadr := (others => '0'); v.ctrl.reset := '0'; v.mdio_ctrl.linkfail := '1'; if OEPOL = 0 then v.mdioen := '1'; else v.mdioen := '0'; end if; v.cnt := (others => '0'); end if; if edclsepahbg /= 0 then v.edclsepahb := edclsepahb; end if; v.txcnt := (others => '0'); v.txburstcnt := (others => '0'); v.tedcl := '0'; v.erenable := '0'; v.rmsto.req := '0'; v.rmsto.write := '0'; v.addrok := '0'; v.rxburstcnt := (others => '0'); v.addrdone := '0'; v.rxcnt := (others => '0'); v.rxdoneold := '0'; v.ctrlpkt := '0'; v.bcast := '0'; v.edclactive := '0'; v.msbgood := '0'; v.rxrenable := '0'; if multicast = 1 then v.mcast := '0'; v.mcastacc := '0'; end if; v.tnak := '0'; v.tedcl := '0'; v.edclbcast := '0'; v.gotframe := '0'; v.rxbytecount := (others => '0'); v.rxlength := (others => '0'); v.txburstav := '0'; v.txdataav := '0'; v.txstatus := (others => '0'); v.txstart := '0'; v.tfcnt := (others => '0'); v.tfrpnt := (others => '0'); v.tfwpnt := (others => '0'); v.txaddr := (others => '0'); v.cnt := (others => '0'); v.rxaddr := (others => '0'); v.rxstatus := (others => '0'); v.rxwrap := '0'; v.rxden := '0'; v.rmsto.addr := (others => '0'); v.tmsto.addr := (others => '0'); v.nak := '0'; v.ewr := '0'; v.write := (others => '0'); v.applength := (others => '0'); v.oplen := (others => '0'); v.udpsrc := (others => '0'); v.ecnt := (others => '0'); v.rcntm := (others => '0'); v.rcntl := (others => '0'); end if; ------------------------------------------------------------------------------- -- SIGNAL ASSIGNMENTS --------------------------------------------------------- ------------------------------------------------------------------------------- rin <= v; prdata <= vprdata; irq <= vpirq; --rx ahb fifo rxrenable <= vrxfi.renable; rxraddress(10 downto fabits) <= (others => '0'); rxraddress(fabits-1 downto 0) <= vrxfi.raddress; rxwrite <= vrxfi.write; rxwdata <= vrxfi.datain; rxwaddress(10 downto fabits) <= (others => '0'); rxwaddress(fabits-1 downto 0) <= vrxfi.waddress; --tx ahb fifo txrenable <= vtxfi.renable; txraddress(10 downto txfabits) <= (others => '0'); txraddress(txfabits-1 downto 0) <= vtxfi.raddress; txwrite <= vtxfi.write; txwdata <= vtxfi.datain; txwaddress(10 downto txfabits) <= (others => '0'); txwaddress(txfabits-1 downto 0) <= vtxfi.waddress; --edcl buf erenable <= veri.renable; eraddress(15 downto eabits) <= (others => '0'); eraddress(eabits-1 downto 0) <= veri.raddress; ewritem <= veri.writem; ewritel <= veri.writel; ewaddressm(15 downto eabits) <= (others => '0'); ewaddressm(eabits-1 downto 0) <= veri.waddressm(eabits-1 downto 0); ewaddressl(15 downto eabits) <= (others => '0'); ewaddressl(eabits-1 downto 0) <= veri.waddressl(eabits-1 downto 0); ewdata <= veri.datain; rxi.enable <= vrxenable; end process; rxi.writeack <= r.rxwriteack; rxi.doneack <= r.rxdoneack; rxi.speed <= r.ctrl.speed; rxi.writeok <= r.writeok; rxi.rxd <= rxd; rxi.rx_dv <= rx_dv; rxi.rx_crs <= rx_crs; rxi.rx_er <= rx_er; txi.rx_col <= rx_col; txi.rx_crs <= rx_crs; txi.full_duplex <= r.ctrl.full_duplex; txi.start <= r.txstart_sync; txi.readack <= r.txreadack; txi.speed <= r.ctrl.speed; txi.data <= r.txdata; txi.valid <= r.txvalid; txi.len <= r.txlength; mdc <= r.mdioclk; mdio_o <= r.mdioo; mdio_oe <= testoen when (scanen/=0 and testen/='0') else r.mdioen; tmsto <= r.tmsto; rmsto <= r.rmsto; tmsto2 <= r.tmsto2; txd <= txo.txd; tx_en <= txo.tx_en; tx_er <= txo.tx_er; ahbmi.hgrant <= hgrant; ahbmi.hready <= hready; ahbmi.hresp <= hresp; ahbmi.hrdata <= hrdata; hbusreq <= ahbmo.hbusreq; hlock <= ahbmo.hlock; htrans <= ahbmo.htrans; haddr <= ahbmo.haddr; hwrite <= ahbmo.hwrite; hsize <= ahbmo.hsize; hburst <= ahbmo.hburst; hprot <= ahbmo.hprot; hwdata <= ahbmo.hwdata; ahbmi2.hgrant <= ehgrant; ahbmi2.hready <= ehready; ahbmi2.hresp <= ehresp; ahbmi2.hrdata <= ehrdata; ehbusreq <= ahbmo2.hbusreq; ehlock <= ahbmo2.hlock; ehtrans <= ahbmo2.htrans; ehaddr <= ahbmo2.haddr; ehwrite <= ahbmo2.hwrite; ehsize <= ahbmo2.hsize; ehburst <= ahbmo2.hburst; ehprot <= ahbmo2.hprot; ehwdata <= ahbmo2.hwdata; speed <= r.ctrl.speed; reset <= irst; regs : process(clk) is begin if rising_edge(clk) then r <= rin; end if; end process; ------------------------------------------------------------------------------- -- TRANSMITTER----------------------------------------------------------------- ------------------------------------------------------------------------------- tx_rmii0 : if rmii = 0 generate tx0: greth_tx generic map( ifg_gap => ifg_gap, attempt_limit => attempt_limit, backoff_limit => backoff_limit, nsync => nsync, rmii => rmii) port map( rst => arst, clk => tx_clk, txi => txi, txo => txo); end generate; tx_rmii1 : if rmii = 1 generate tx0: greth_tx generic map( ifg_gap => ifg_gap, attempt_limit => attempt_limit, backoff_limit => backoff_limit, nsync => nsync, rmii => rmii) port map( rst => arst, clk => rmii_clk, txi => txi, txo => txo); end generate; ------------------------------------------------------------------------------- -- RECEIVER ------------------------------------------------------------------- ------------------------------------------------------------------------------- rx_rmii0 : if rmii = 0 generate rx0 : greth_rx generic map( nsync => nsync, rmii => rmii, multicast => multicast, maxsize => maxsize) port map( rst => arst, clk => rx_clk, rxi => rxi, rxo => rxo); end generate; rx_rmii1 : if rmii = 1 generate rx0 : greth_rx generic map( nsync => nsync, rmii => rmii, multicast => multicast, maxsize => maxsize) port map( rst => arst, clk => rmii_clk, rxi => rxi, rxo => rxo); end generate; ------------------------------------------------------------------------------- -- AHB MST INTERFACE ---------------------------------------------------------- ------------------------------------------------------------------------------- ahb0 : eth_ahb_mst port map(rst, clk, ahbmi, ahbmo, tmsto, tmsti, rmsto, rmsti); edclmst : if edclsepahbg = 1 generate ahb1 : eth_edcl_ahb_mst port map(rst, clk, ahbmi2, ahbmo2, tmsto2, tmsti2); end generate; end architecture;
gpl-2.0
895eccd559c0cc3270cb5a04e9c05bf3
0.48788
3.560215
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_dma_v7_1/2a047f91/hdl/src/vhdl/axi_dma_register.vhd
2
48,618
-- (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_register.vhd -- -- Description: This entity encompasses the channel register set. -- -- 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; use axi_dma_v7_1.axi_dma_pkg.all; ------------------------------------------------------------------------------- entity axi_dma_register is generic( C_NUM_REGISTERS : integer := 11 ; C_INCLUDE_SG : integer := 1 ; C_SG_LENGTH_WIDTH : integer range 8 to 23 := 14 ; C_S_AXI_LITE_DATA_WIDTH : integer range 32 to 32 := 32 ; C_M_AXI_SG_ADDR_WIDTH : integer range 32 to 64 := 32 ; C_MICRO_DMA : integer range 0 to 1 := 0 ; C_ENABLE_MULTI_CHANNEL : integer range 0 to 1 := 0 --C_CHANNEL_IS_S2MM : integer range 0 to 1 := 0 CR603034 ); port ( m_axi_sg_aclk : in std_logic ; -- m_axi_sg_aresetn : in std_logic ; -- -- -- AXI Interface Control -- axi2ip_wrce : in std_logic_vector -- (C_NUM_REGISTERS-1 downto 0) ; -- axi2ip_wrdata : in std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- -- -- DMASR Control -- stop_dma : in std_logic ; -- halted_clr : in std_logic ; -- halted_set : in std_logic ; -- idle_set : in std_logic ; -- idle_clr : in std_logic ; -- ioc_irq_set : in std_logic ; -- dly_irq_set : in std_logic ; -- irqdelay_status : in std_logic_vector(7 downto 0) ; -- irqthresh_status : in std_logic_vector(7 downto 0) ; -- irqthresh_wren : out std_logic ; -- irqdelay_wren : out std_logic ; -- dlyirq_dsble : out std_logic ; -- CR605888 -- -- Error Control -- dma_interr_set : in std_logic ; -- dma_slverr_set : in std_logic ; -- dma_decerr_set : in std_logic ; -- ftch_interr_set : in std_logic ; -- ftch_slverr_set : in std_logic ; -- ftch_decerr_set : in std_logic ; -- ftch_error_addr : in std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- updt_interr_set : in std_logic ; -- updt_slverr_set : in std_logic ; -- updt_decerr_set : in std_logic ; -- updt_error_addr : in std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- error_in : in std_logic ; -- error_out : out std_logic ; -- introut : out std_logic ; -- soft_reset_in : in std_logic ; -- soft_reset_clr : in std_logic ; -- -- -- CURDESC Update -- update_curdesc : in std_logic ; -- new_curdesc : in std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- -- TAILDESC Update -- tailpntr_updated : out std_logic ; -- -- -- Channel Register Out -- sg_ctl : out std_logic_vector (7 downto 0) ; dmacr : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- dmasr : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- curdesc_lsb : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- curdesc_msb : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- taildesc_lsb : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- taildesc_msb : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- buffer_address : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- buffer_length : out std_logic_vector -- (C_SG_LENGTH_WIDTH-1 downto 0) ; -- buffer_length_wren : out std_logic ; -- bytes_received : in std_logic_vector -- (C_SG_LENGTH_WIDTH-1 downto 0) ; -- bytes_received_wren : in std_logic -- ); -- end axi_dma_register; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_dma_register is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- constant DMACR_INDEX : integer := 0; -- DMACR Register index constant DMASR_INDEX : integer := 1; -- DMASR Register index constant CURDESC_LSB_INDEX : integer := 2; -- CURDESC LSB Reg index constant CURDESC_MSB_INDEX : integer := 3; -- CURDESC MSB Reg index constant TAILDESC_LSB_INDEX : integer := 4; -- TAILDESC LSB Reg index constant TAILDESC_MSB_INDEX : integer := 5; -- TAILDESC MSB Reg index -- CR603034 moved s2mm back to offset 6 --constant SA_ADDRESS_INDEX : integer := 6; -- Buffer Address Reg (SA) --constant DA_ADDRESS_INDEX : integer := 8; -- Buffer Address Reg (DA) -- -- --constant BUFF_ADDRESS_INDEX : integer := address_index_select -- Buffer Address Reg (SA or DA) -- (C_CHANNEL_IS_S2MM, -- Channel Type 1=rx 0=tx -- SA_ADDRESS_INDEX, -- Source Address Index -- DA_ADDRESS_INDEX); -- Destination Address Index constant BUFF_ADDRESS_INDEX : integer := 6; constant BUFF_LENGTH_INDEX : integer := 10; -- Buffer Length Reg constant SGCTL_INDEX : integer := 11; -- Buffer Length Reg constant ZERO_VALUE : std_logic_vector(31 downto 0) := (others => '0'); constant DMA_CONFIG : std_logic_vector(0 downto 0) := std_logic_vector(to_unsigned(C_INCLUDE_SG,1)); ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- signal dmacr_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal dmasr_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal curdesc_lsb_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 6) := (others => '0'); signal curdesc_msb_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal taildesc_lsb_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 6) := (others => '0'); signal taildesc_msb_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal buffer_address_i : std_logic_vector (C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal buffer_length_i : std_logic_vector (C_SG_LENGTH_WIDTH-1 downto 0) := (others => '0'); -- DMASR Signals signal halted : std_logic := '0'; signal idle : std_logic := '0'; signal cmplt : std_logic := '0'; signal error : std_logic := '0'; signal dma_interr : std_logic := '0'; signal dma_slverr : std_logic := '0'; signal dma_decerr : std_logic := '0'; signal sg_interr : std_logic := '0'; signal sg_slverr : std_logic := '0'; signal sg_decerr : std_logic := '0'; signal ioc_irq : std_logic := '0'; signal dly_irq : std_logic := '0'; signal error_d1 : std_logic := '0'; signal error_re : std_logic := '0'; signal err_irq : std_logic := '0'; signal sg_ftch_error : std_logic := '0'; signal sg_updt_error : std_logic := '0'; signal error_pointer_set : std_logic := '0'; -- interrupt coalescing support signals signal different_delay : std_logic := '0'; signal different_thresh : std_logic := '0'; signal threshold_is_zero : std_logic := '0'; -- soft reset support signals signal soft_reset_i : std_logic := '0'; signal run_stop_clr : std_logic := '0'; signal sg_cache_info : std_logic_vector (7 downto 0); signal diff_thresh_xor : std_logic_vector (7 downto 0); signal sig_cur_updated : std_logic; signal tmp11 : std_logic; signal tailpntr_updated_d1 : std_logic; signal tailpntr_updated_d2 : std_logic; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin dmacr <= dmacr_i ; dmasr <= dmasr_i ; curdesc_lsb <= curdesc_lsb_i (31 downto 6) & "000000" ; curdesc_msb <= curdesc_msb_i ; taildesc_lsb <= taildesc_lsb_i (31 downto 6) & "000000" ; taildesc_msb <= taildesc_msb_i ; buffer_address <= buffer_address_i ; buffer_length <= buffer_length_i ; --------------------------------------------------------------------------- -- DMA Control Register --------------------------------------------------------------------------- -- DMACR - Interrupt Delay Value ------------------------------------------------------------------------------- DMACR_DELAY : 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 dmacr_i(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT) <= (others => '0'); elsif(axi2ip_wrce(DMACR_INDEX) = '1')then dmacr_i(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT) <= axi2ip_wrdata(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT); end if; end if; end process DMACR_DELAY; -- If written delay is different than previous value then assert write enable different_delay <= '1' when dmacr_i(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT) /= axi2ip_wrdata(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT) else '0'; -- delay value different, drive write of delay value to interrupt controller NEW_DELAY_WRITE : 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 irqdelay_wren <= '0'; -- If AXI Lite write to DMACR and delay different than current -- setting then update delay value elsif(axi2ip_wrce(DMACR_INDEX) = '1' and different_delay = '1')then irqdelay_wren <= '1'; else irqdelay_wren <= '0'; end if; end if; end process NEW_DELAY_WRITE; ------------------------------------------------------------------------------- -- DMACR - Interrupt Threshold Value ------------------------------------------------------------------------------- threshold_is_zero <= '1' when axi2ip_wrdata(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) = ZERO_THRESHOLD else '0'; DMACR_THRESH : 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 dmacr_i(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) <= ONE_THRESHOLD; -- On AXI Lite write elsif(axi2ip_wrce(DMACR_INDEX) = '1')then -- If value is 0 then set threshold to 1 if(threshold_is_zero='1')then dmacr_i(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) <= ONE_THRESHOLD; -- else set threshold to axi lite wrdata value else dmacr_i(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) <= axi2ip_wrdata(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT); end if; end if; end if; end process DMACR_THRESH; --diff_thresh_xor <= dmacr_i(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) xor -- axi2ip_wrdata(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT); --different_thresh <= '0' when diff_thresh_xor = "00000000" -- else '1'; -- If written threshold is different than previous value then assert write enable different_thresh <= '1' when dmacr_i(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) /= axi2ip_wrdata(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT) else '0'; -- new treshold written therefore drive write of threshold out NEW_THRESH_WRITE : 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 irqthresh_wren <= '0'; -- If AXI Lite write to DMACR and threshold different than current -- setting then update threshold value elsif(axi2ip_wrce(DMACR_INDEX) = '1' and different_thresh = '1')then irqthresh_wren <= '1'; else irqthresh_wren <= '0'; end if; end if; end process NEW_THRESH_WRITE; ------------------------------------------------------------------------------- -- DMACR - Remainder of DMA Control Register, Bit 3 for Key hole operation ------------------------------------------------------------------------------- DMACR_REGISTER : 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 dmacr_i(DMACR_IRQTHRESH_LSB_BIT-1 downto DMACR_RESERVED5_BIT) <= (others => '0'); elsif(axi2ip_wrce(DMACR_INDEX) = '1')then dmacr_i(DMACR_IRQTHRESH_LSB_BIT-1 -- bit 15 downto DMACR_RESERVED5_BIT) <= ZERO_VALUE(DMACR_RESERVED15_BIT) -- bit 14 & axi2ip_wrdata(DMACR_ERR_IRQEN_BIT) -- bit 13 & axi2ip_wrdata(DMACR_DLY_IRQEN_BIT) -- bit 12 & axi2ip_wrdata(DMACR_IOC_IRQEN_BIT) -- bits 11 downto 3 & ZERO_VALUE(DMACR_RESERVED11_BIT downto DMACR_RESERVED5_BIT); end if; end if; end process DMACR_REGISTER; DMACR_REGISTER1 : 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 C_ENABLE_MULTI_CHANNEL = 1)then dmacr_i(DMACR_KH_BIT) <= '0'; dmacr_i(CYCLIC_BIT) <= '0'; elsif(axi2ip_wrce(DMACR_INDEX) = '1')then dmacr_i(DMACR_KH_BIT) <= axi2ip_wrdata(DMACR_KH_BIT); dmacr_i(CYCLIC_BIT) <= axi2ip_wrdata(CYCLIC_BIT); end if; end if; end process DMACR_REGISTER1; ------------------------------------------------------------------------------- -- DMACR - Reset Bit ------------------------------------------------------------------------------- DMACR_RESET : process(m_axi_sg_aclk) begin if(m_axi_sg_aclk'EVENT and m_axi_sg_aclk = '1')then if(soft_reset_clr = '1')then dmacr_i(DMACR_RESET_BIT) <= '0'; -- If soft reset set in other channel then set -- reset bit here too elsif(soft_reset_in = '1')then dmacr_i(DMACR_RESET_BIT) <= '1'; -- If DMACR Write then pass axi lite write bus to DMARC reset bit elsif(soft_reset_i = '0' and axi2ip_wrce(DMACR_INDEX) = '1')then dmacr_i(DMACR_RESET_BIT) <= axi2ip_wrdata(DMACR_RESET_BIT); end if; end if; end process DMACR_RESET; soft_reset_i <= dmacr_i(DMACR_RESET_BIT); ------------------------------------------------------------------------------- -- Tail Pointer Enable fixed at 1 for this release of axi dma ------------------------------------------------------------------------------- dmacr_i(DMACR_TAILPEN_BIT) <= '1'; ------------------------------------------------------------------------------- -- DMACR - Run/Stop Bit ------------------------------------------------------------------------------- run_stop_clr <= '1' when error = '1' -- MM2S DataMover Error or error_in = '1' -- S2MM Error or stop_dma = '1' -- Stop due to error or soft_reset_i = '1' -- MM2S Soft Reset or soft_reset_in = '1' -- S2MM Soft Reset else '0'; DMACR_RUNSTOP : 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 dmacr_i(DMACR_RS_BIT) <= '0'; -- Clear on sg error (i.e. error) or other channel -- error (i.e. error_in) or dma error or soft reset elsif(run_stop_clr = '1')then dmacr_i(DMACR_RS_BIT) <= '0'; elsif(axi2ip_wrce(DMACR_INDEX) = '1')then dmacr_i(DMACR_RS_BIT) <= axi2ip_wrdata(DMACR_RS_BIT); end if; end if; end process DMACR_RUNSTOP; --------------------------------------------------------------------------- -- DMA Status Halted bit (BIT 0) - Set by dma controller indicating DMA -- channel is halted. --------------------------------------------------------------------------- DMASR_HALTED : 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 halted_set = '1')then halted <= '1'; elsif(halted_clr = '1')then halted <= '0'; end if; end if; end process DMASR_HALTED; --------------------------------------------------------------------------- -- DMA Status Idle bit (BIT 1) - Set by dma controller indicating DMA -- channel is IDLE waiting at tail pointer. Update of Tail Pointer -- will cause engine to resume. Note: Halted channels return to a -- reset condition. --------------------------------------------------------------------------- DMASR_IDLE : 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 idle_clr = '1' or halted_set = '1')then idle <= '0'; elsif(idle_set = '1')then idle <= '1'; end if; end if; end process DMASR_IDLE; --------------------------------------------------------------------------- -- DMA Status Error bit (BIT 3) -- Note: any error will cause entire engine to halt --------------------------------------------------------------------------- error <= dma_interr or dma_slverr or dma_decerr or sg_interr or sg_slverr or sg_decerr; -- Scatter Gather Error --sg_ftch_error <= ftch_interr_set or ftch_slverr_set or ftch_decerr_set; -- SG Update Errors or DMA errors assert flag on descriptor update -- Used to latch current descriptor pointer --sg_updt_error <= updt_interr_set or updt_slverr_set or updt_decerr_set -- or dma_interr or dma_slverr or dma_decerr; -- Map out to halt opposing channel error_out <= error; SG_FTCH_ERROR_PROC : 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 sg_ftch_error <= '0'; sg_updt_error <= '0'; else sg_ftch_error <= ftch_interr_set or ftch_slverr_set or ftch_decerr_set; sg_updt_error <= updt_interr_set or updt_slverr_set or updt_decerr_set or dma_interr or dma_slverr or dma_decerr; end if; end if; end process SG_FTCH_ERROR_PROC; --------------------------------------------------------------------------- -- DMA Status DMA Internal Error bit (BIT 4) --------------------------------------------------------------------------- DMASR_DMAINTERR : 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 dma_interr <= '0'; elsif(dma_interr_set = '1' )then dma_interr <= '1'; end if; end if; end process DMASR_DMAINTERR; --------------------------------------------------------------------------- -- DMA Status DMA Slave Error bit (BIT 5) --------------------------------------------------------------------------- DMASR_DMASLVERR : 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 dma_slverr <= '0'; elsif(dma_slverr_set = '1' )then dma_slverr <= '1'; end if; end if; end process DMASR_DMASLVERR; --------------------------------------------------------------------------- -- DMA Status DMA Decode Error bit (BIT 6) --------------------------------------------------------------------------- DMASR_DMADECERR : 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 dma_decerr <= '0'; elsif(dma_decerr_set = '1' )then dma_decerr <= '1'; end if; end if; end process DMASR_DMADECERR; --------------------------------------------------------------------------- -- DMA Status SG Internal Error bit (BIT 8) -- (SG Mode only - trimmed at build time if simple mode) --------------------------------------------------------------------------- DMASR_SGINTERR : 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 sg_interr <= '0'; elsif(ftch_interr_set = '1' or updt_interr_set = '1')then sg_interr <= '1'; end if; end if; end process DMASR_SGINTERR; --------------------------------------------------------------------------- -- DMA Status SG Slave Error bit (BIT 9) -- (SG Mode only - trimmed at build time if simple mode) --------------------------------------------------------------------------- DMASR_SGSLVERR : 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 sg_slverr <= '0'; elsif(ftch_slverr_set = '1' or updt_slverr_set = '1')then sg_slverr <= '1'; end if; end if; end process DMASR_SGSLVERR; --------------------------------------------------------------------------- -- DMA Status SG Decode Error bit (BIT 10) -- (SG Mode only - trimmed at build time if simple mode) --------------------------------------------------------------------------- DMASR_SGDECERR : 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 sg_decerr <= '0'; elsif(ftch_decerr_set = '1' or updt_decerr_set = '1')then sg_decerr <= '1'; end if; end if; end process DMASR_SGDECERR; --------------------------------------------------------------------------- -- DMA Status IOC Interrupt status bit (BIT 11) --------------------------------------------------------------------------- DMASR_IOCIRQ : 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 ioc_irq <= '0'; -- CPU Writing a '1' to clear - OR'ed with setting to prevent -- missing a 'set' during the write. elsif(axi2ip_wrce(DMASR_INDEX) = '1' )then ioc_irq <= (ioc_irq and not(axi2ip_wrdata(DMASR_IOCIRQ_BIT))) or ioc_irq_set; elsif(ioc_irq_set = '1')then ioc_irq <= '1'; end if; end if; end process DMASR_IOCIRQ; --------------------------------------------------------------------------- -- DMA Status Delay Interrupt status bit (BIT 12) --------------------------------------------------------------------------- DMASR_DLYIRQ : 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 dly_irq <= '0'; -- CPU Writing a '1' to clear - OR'ed with setting to prevent -- missing a 'set' during the write. elsif(axi2ip_wrce(DMASR_INDEX) = '1' )then dly_irq <= (dly_irq and not(axi2ip_wrdata(DMASR_DLYIRQ_BIT))) or dly_irq_set; elsif(dly_irq_set = '1')then dly_irq <= '1'; end if; end if; end process DMASR_DLYIRQ; -- CR605888 Disable delay timer if halted or on delay irq set --dlyirq_dsble <= dmasr_i(DMASR_HALTED_BIT) -- CR606348 dlyirq_dsble <= not dmacr_i(DMACR_RS_BIT) -- CR606348 or dmasr_i(DMASR_DLYIRQ_BIT); --------------------------------------------------------------------------- -- DMA Status Error Interrupt status bit (BIT 12) --------------------------------------------------------------------------- -- Delay error setting for generation of error strobe GEN_ERROR_RE : 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 error_d1 <= '0'; else error_d1 <= error; end if; end if; end process GEN_ERROR_RE; -- Generate rising edge pulse on error error_re <= error and not error_d1; DMASR_ERRIRQ : 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 err_irq <= '0'; -- CPU Writing a '1' to clear - OR'ed with setting to prevent -- missing a 'set' during the write. elsif(axi2ip_wrce(DMASR_INDEX) = '1' )then err_irq <= (err_irq and not(axi2ip_wrdata(DMASR_ERRIRQ_BIT))) or error_re; elsif(error_re = '1')then err_irq <= '1'; end if; end if; end process DMASR_ERRIRQ; --------------------------------------------------------------------------- -- DMA Interrupt OUT --------------------------------------------------------------------------- REG_INTR : 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 soft_reset_i = '1')then introut <= '0'; else introut <= (dly_irq and dmacr_i(DMACR_DLY_IRQEN_BIT)) or (ioc_irq and dmacr_i(DMACR_IOC_IRQEN_BIT)) or (err_irq and dmacr_i(DMACR_ERR_IRQEN_BIT)); end if; end if; end process; --------------------------------------------------------------------------- -- DMA Status Register --------------------------------------------------------------------------- dmasr_i <= irqdelay_status -- Bits 31 downto 24 & irqthresh_status -- Bits 23 downto 16 & '0' -- Bit 15 & err_irq -- Bit 14 & dly_irq -- Bit 13 & ioc_irq -- Bit 12 & '0' -- Bit 11 & sg_decerr -- Bit 10 & sg_slverr -- Bit 9 & sg_interr -- Bit 8 & '0' -- Bit 7 & dma_decerr -- Bit 6 & dma_slverr -- Bit 5 & dma_interr -- Bit 4 & DMA_CONFIG -- Bit 3 & '0' -- Bit 2 & idle -- Bit 1 & halted; -- Bit 0 -- Generate current descriptor and tail descriptor register for Scatter Gather Mode GEN_DESC_REG_FOR_SG : if C_INCLUDE_SG = 1 generate begin GEN_SG_CTL_REG : if C_ENABLE_MULTI_CHANNEL = 1 generate begin MM2S_SGCTL : 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 sg_cache_info <= "00000011"; --(others => '0'); elsif(axi2ip_wrce(SGCTL_INDEX) = '1' ) then sg_cache_info <= axi2ip_wrdata(11 downto 8) & axi2ip_wrdata(3 downto 0); else sg_cache_info <= sg_cache_info; end if; end if; end process MM2S_SGCTL; sg_ctl <= sg_cache_info; end generate GEN_SG_CTL_REG; GEN_SG_NO_CTL_REG : if C_ENABLE_MULTI_CHANNEL = 0 generate begin sg_ctl <= "00000011"; --(others => '0'); end generate GEN_SG_NO_CTL_REG; -- Signals not used for Scatter Gather Mode, only simple mode buffer_address_i <= (others => '0'); buffer_length_i <= (others => '0'); buffer_length_wren <= '0'; --------------------------------------------------------------------------- -- Current Descriptor LSB Register --------------------------------------------------------------------------- CURDESC_LSB_REGISTER : 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 curdesc_lsb_i <= (others => '0'); error_pointer_set <= '0'; -- Detected error has NOT register a desc pointer elsif(error_pointer_set = '0')then -- Scatter Gather Fetch Error if(sg_ftch_error = '1' or sg_updt_error = '1')then curdesc_lsb_i <= ftch_error_addr(C_S_AXI_LITE_DATA_WIDTH-1 downto 6); error_pointer_set <= '1'; -- Scatter Gather Update Error -- elsif(sg_updt_error = '1')then -- curdesc_lsb_i <= updt_error_addr(C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- error_pointer_set <= '1'; -- Commanded to update descriptor value - used for indicating -- current descriptor begin processed by dma controller elsif(update_curdesc = '1' and dmacr_i(DMACR_RS_BIT) = '1')then curdesc_lsb_i <= new_curdesc(C_S_AXI_LITE_DATA_WIDTH-1 downto 6); error_pointer_set <= '0'; -- CPU update of current descriptor pointer. CPU -- only allowed to update when engine is halted. elsif(axi2ip_wrce(CURDESC_LSB_INDEX) = '1' and dmasr_i(DMASR_HALTED_BIT) = '1')then curdesc_lsb_i <= axi2ip_wrdata(CURDESC_LOWER_MSB_BIT downto CURDESC_LOWER_LSB_BIT); -- & ZERO_VALUE(CURDESC_RESERVED_BIT5 -- downto CURDESC_RESERVED_BIT0); error_pointer_set <= '0'; end if; end if; end if; end process CURDESC_LSB_REGISTER; --------------------------------------------------------------------------- -- Tail Descriptor LSB Register --------------------------------------------------------------------------- TAILDESC_LSB_REGISTER : 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 taildesc_lsb_i <= (others => '0'); elsif(axi2ip_wrce(TAILDESC_LSB_INDEX) = '1')then taildesc_lsb_i <= axi2ip_wrdata(TAILDESC_LOWER_MSB_BIT downto TAILDESC_LOWER_LSB_BIT); -- & ZERO_VALUE(TAILDESC_RESERVED_BIT5 -- downto TAILDESC_RESERVED_BIT0); end if; end if; end process TAILDESC_LSB_REGISTER; --------------------------------------------------------------------------- -- Current Descriptor MSB Register --------------------------------------------------------------------------- -- Scatter Gather Interface configured for 64-Bit SG Addresses GEN_SG_ADDR_EQL64 :if C_M_AXI_SG_ADDR_WIDTH = 64 generate begin CURDESC_MSB_REGISTER : 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 curdesc_msb_i <= (others => '0'); elsif(error_pointer_set = '0')then -- Scatter Gather Fetch Error if(sg_ftch_error = '1')then curdesc_msb_i <= ftch_error_addr((C_M_AXI_SG_ADDR_WIDTH - C_S_AXI_LITE_DATA_WIDTH)-1 downto 0); -- Scatter Gather Update Error -- elsif(sg_updt_error = '1')then -- curdesc_msb_i <= updt_error_addr((C_M_AXI_SG_ADDR_WIDTH -- - C_S_AXI_LITE_DATA_WIDTH)-1 -- downto 0); -- Commanded to update descriptor value - used for indicating -- current descriptor begin processed by dma controller elsif(update_curdesc = '1' and dmacr_i(DMACR_RS_BIT) = '1')then curdesc_msb_i <= new_curdesc ((C_M_AXI_SG_ADDR_WIDTH - C_S_AXI_LITE_DATA_WIDTH)-1 downto 0); -- CPU update of current descriptor pointer. CPU -- only allowed to update when engine is halted. elsif(axi2ip_wrce(CURDESC_MSB_INDEX) = '1' and dmasr_i(DMASR_HALTED_BIT) = '1')then curdesc_msb_i <= axi2ip_wrdata; end if; end if; end if; end process CURDESC_MSB_REGISTER; --------------------------------------------------------------------------- -- Tail Descriptor MSB Register --------------------------------------------------------------------------- TAILDESC_MSB_REGISTER : 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 taildesc_msb_i <= (others => '0'); elsif(axi2ip_wrce(TAILDESC_MSB_INDEX) = '1')then taildesc_msb_i <= axi2ip_wrdata; end if; end if; end process TAILDESC_MSB_REGISTER; end generate GEN_SG_ADDR_EQL64; -- Scatter Gather Interface configured for 32-Bit SG Addresses GEN_SG_ADDR_EQL32 : if C_M_AXI_SG_ADDR_WIDTH = 32 generate begin curdesc_msb_i <= (others => '0'); taildesc_msb_i <= (others => '0'); end generate GEN_SG_ADDR_EQL32; -- Scatter Gather Interface configured for 32-Bit SG Addresses GEN_TAILUPDATE_EQL32 : if C_M_AXI_SG_ADDR_WIDTH = 32 generate begin TAILPNTR_UPDT_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 dmacr_i(DMACR_RS_BIT)='0')then tailpntr_updated_d1 <= '0'; elsif(axi2ip_wrce(TAILDESC_LSB_INDEX) = '1')then tailpntr_updated_d1 <= '1'; else tailpntr_updated_d1 <= '0'; end if; end if; end process TAILPNTR_UPDT_PROCESS; TAILPNTR_UPDT_PROCESS_DEL : 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 tailpntr_updated_d2 <= '0'; else tailpntr_updated_d2 <= tailpntr_updated_d1; end if; end if; end process TAILPNTR_UPDT_PROCESS_DEL; tailpntr_updated <= tailpntr_updated_d1 and (not tailpntr_updated_d2); end generate GEN_TAILUPDATE_EQL32; -- Scatter Gather Interface configured for 64-Bit SG Addresses GEN_TAILUPDATE_EQL64 : if C_M_AXI_SG_ADDR_WIDTH = 64 generate begin TAILPNTR_UPDT_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 dmacr_i(DMACR_RS_BIT)='0')then tailpntr_updated_d1 <= '0'; elsif(axi2ip_wrce(TAILDESC_MSB_INDEX) = '1')then tailpntr_updated_d1 <= '1'; else tailpntr_updated_d1 <= '0'; end if; end if; end process TAILPNTR_UPDT_PROCESS; TAILPNTR_UPDT_PROCESS_DEL : 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 tailpntr_updated_d2 <= '0'; else tailpntr_updated_d2 <= tailpntr_updated_d1; end if; end if; end process TAILPNTR_UPDT_PROCESS_DEL; tailpntr_updated <= tailpntr_updated_d1 and (not tailpntr_updated_d2); end generate GEN_TAILUPDATE_EQL64; end generate GEN_DESC_REG_FOR_SG; -- Generate Buffer Address and Length Register for Simple DMA Mode GEN_REG_FOR_SMPL : if C_INCLUDE_SG = 0 generate begin -- Signals not used for simple dma mode, only for sg mode curdesc_lsb_i <= (others => '0'); curdesc_msb_i <= (others => '0'); taildesc_lsb_i <= (others => '0'); taildesc_msb_i <= (others => '0'); tailpntr_updated <= '0'; error_pointer_set <= '0'; -- Buffer Address register. Used for Source Address (SA) if MM2S -- and used for Destination Address (DA) if S2MM BUFFER_ADDR_REGISTER : 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 buffer_address_i <= (others => '0'); elsif(axi2ip_wrce(BUFF_ADDRESS_INDEX) = '1')then buffer_address_i <= axi2ip_wrdata; end if; end if; end process BUFFER_ADDR_REGISTER; -- Buffer Length register. Used for number of bytes to transfer if MM2S -- and used for size of receive buffer is S2MM BUFFER_LNGTH_REGISTER : 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 buffer_length_i <= (others => '0'); -- Update with actual bytes received (Only for S2MM channel) -- elsif(bytes_received_wren = '1')then -- buffer_length_i <= bytes_received; elsif(axi2ip_wrce(BUFF_LENGTH_INDEX) = '1')then buffer_length_i <= axi2ip_wrdata(C_SG_LENGTH_WIDTH-1 downto 0); end if; end if; end process BUFFER_LNGTH_REGISTER; -- Buffer Length Write Enable control. Assertion of wren will -- begin a transfer if channel is Idle. BUFFER_LNGTH_WRITE : 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 buffer_length_wren <= '0'; -- Non-zero length value written elsif(axi2ip_wrce(BUFF_LENGTH_INDEX) = '1' and axi2ip_wrdata(C_SG_LENGTH_WIDTH-1 downto 0) /= ZERO_VALUE(C_SG_LENGTH_WIDTH-1 downto 0))then buffer_length_wren <= '1'; else buffer_length_wren <= '0'; end if; end if; end process BUFFER_LNGTH_WRITE; end generate GEN_REG_FOR_SMPL; end implementation;
gpl-3.0
58702ff2d443e44654bfd1af3cf1fc5a
0.428627
4.482574
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_sg_v4_1/0535f152/hdl/src/vhdl/axi_sg_fifo.vhd
4
24,358
-- ************************************************************************* -- -- (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; use lib_pkg_v1_0.lib_pkg.all; use lib_pkg_v1_0.lib_pkg.clog2; library lib_srl_fifo_v1_0; use lib_srl_fifo_v1_0.srl_fifo_f; library axi_sg_v4_1; use axi_sg_v4_1.axi_sg_sfifo_autord; use axi_sg_v4_1.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.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.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.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
8b2360220675c3eb64dba89b51fd141d
0.420149
4.44895
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/srmmu/mmuiface.vhd
1
8,132
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: mmuiface -- File: mmuiface.vhd -- Author: Konrad Eisele, Jiri Gaisler - Gaisler Research -- Description: MMU interface types ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; library gaisler; use gaisler.mmuconfig.all; library techmap; use techmap.gencomp.all; package mmuiface is type mmutlbcam_in_type is record mmctrl : mmctrl_type1; tagin : tlbcam_tfp; tagwrite : tlbcam_reg; trans_op : std_logic; flush_op : std_logic; write_op : std_logic; wb_op : std_logic; mmuen : std_logic; mset : std_logic; end record; type mmutlbcami_a is array (natural range <>) of mmutlbcam_in_type; type mmutlbcam_out_type is record pteout : std_logic_vector(31 downto 0); LVL : std_logic_vector(1 downto 0); -- level in pth hit : std_logic; ctx : std_logic_vector(M_CTX_SZ-1 downto 0); -- for diagnostic access valid : std_logic; -- for diagnostic access vaddr : std_logic_vector(31 downto 0); -- for diagnostic access NEEDSYNC : std_logic; WBNEEDSYNC : std_logic; end record; type mmutlbcamo_a is array (natural range <>) of mmutlbcam_out_type; -- mmu i/o type mmuidc_data_in_type is record data : std_logic_vector(31 downto 0); su : std_logic; read : std_logic; isid : mmu_idcache; wb_data : std_logic_vector(31 downto 0); end record; type mmuidc_data_out_type is record finish : std_logic; data : std_logic_vector(31 downto 0); cache : std_logic; accexc : std_logic; end record; constant mmuidco_zero : mmuidc_data_out_type := ('0', zero32, '0', '0'); type mmudc_in_type is record trans_op : std_logic; transdata : mmuidc_data_in_type; -- dcache extra signals flush_op : std_logic; diag_op : std_logic; wb_op : std_logic; fsread : std_logic; mmctrl1 : mmctrl_type1; testin : std_logic_vector(TESTIN_WIDTH-1 downto 0); end record; type mmudc_out_type is record grant : std_logic; transdata : mmuidc_data_out_type; -- dcache extra signals mmctrl2 : mmctrl_type2; -- writebuffer out wbtransdata : mmuidc_data_out_type; tlbmiss : std_logic; end record; type mmuic_in_type is record trans_op : std_logic; transdata : mmuidc_data_in_type; end record; type mmuic_out_type is record grant : std_logic; transdata : mmuidc_data_out_type; tlbmiss : std_logic; end record; constant mmudco_zero : mmudc_out_type := ('0', mmuidco_zero, mmctrl2_zero, mmuidco_zero, '0'); constant mmuico_zero : mmuic_out_type := ('0', mmuidco_zero, '0'); --#lrue i/o type mmulrue_in_type is record touch : std_logic; pos : std_logic_vector(M_ENT_MAX_LOG-1 downto 0); clear : std_logic; flush : std_logic; left : std_logic_vector(M_ENT_MAX_LOG-1 downto 0); fromleft : std_logic; right : std_logic_vector(M_ENT_MAX_LOG-1 downto 0); fromright : std_logic; end record; type mmulruei_a is array (natural range <>) of mmulrue_in_type; type mmulrue_out_type is record pos : std_logic_vector(M_ENT_MAX_LOG-1 downto 0); movetop : std_logic; end record; constant mmulrue_out_none : mmulrue_out_type := (zero32(M_ENT_MAX_LOG-1 downto 0), '0'); type mmulrueo_a is array (natural range <>) of mmulrue_out_type; --#lru i/o type mmulru_in_type is record touch : std_logic; touchmin : std_logic; flush : std_logic; pos : std_logic_vector(M_ENT_MAX_LOG-1 downto 0); mmctrl1 : mmctrl_type1; end record; type mmulru_out_type is record pos : std_logic_vector(M_ENT_MAX_LOG-1 downto 0); end record; --#mmu: tw i/o type memory_mm_in_type is record address : std_logic_vector(31 downto 0); data : std_logic_vector(31 downto 0); size : std_logic_vector(1 downto 0); burst : std_logic; read : std_logic; req : std_logic; lock : std_logic; end record; constant mci_zero : memory_mm_in_type := (X"00000000", X"00000000", "00", '0', '0', '0', '0'); type memory_mm_out_type is record data : std_logic_vector(31 downto 0); -- memory data ready : std_logic; -- cycle ready grant : std_logic; -- retry : std_logic; -- mexc : std_logic; -- memory exception werr : std_logic; -- memory write error cache : std_logic; -- cacheable data end record; type mmutw_in_type is record walk_op_ur : std_logic; areq_ur : std_logic; tlbmiss : std_logic; data : std_logic_vector(31 downto 0); adata : std_logic_vector(31 downto 0); aaddr : std_logic_vector(31 downto 0); end record; type mmutwi_a is array (natural range <>) of mmutw_in_type; type mmutw_out_type is record finish : std_logic; data : std_logic_vector(31 downto 0); addr : std_logic_vector(31 downto 0); lvl : std_logic_vector(1 downto 0); fault_mexc : std_logic; fault_trans : std_logic; fault_inv : std_logic; fault_lvl : std_logic_vector(1 downto 0); end record; type mmutwo_a is array (natural range <>) of mmutw_out_type; -- mmu tlb i/o type mmutlb_in_type is record flush_op : std_logic; wb_op : std_logic; trans_op : std_logic; transdata : mmuidc_data_in_type; s2valid : std_logic; mmctrl1 : mmctrl_type1; testin : std_logic_vector(TESTIN_WIDTH-1 downto 0); end record; type mmutlbi_a is array (natural range <>) of mmutlb_in_type; type mmutlbfault_out_type is record fault_pro : std_logic; fault_pri : std_logic; fault_access : std_logic; fault_mexc : std_logic; fault_trans : std_logic; fault_inv : std_logic; fault_lvl : std_logic_vector(1 downto 0); fault_su : std_logic; fault_read : std_logic; fault_isid : mmu_idcache; fault_addr : std_logic_vector(31 downto 0); end record; constant mmutlbfault_out_zero : mmutlbfault_out_type := ( fault_pro => '0', fault_pri => '0', fault_access => '0', fault_mexc => '0', fault_trans => '0', fault_inv => '0', fault_lvl => (others => '0'), fault_su => '0', fault_read => '0', fault_isid => id_icache, fault_addr => (others => '0')); type mmutlb_out_type is record transdata : mmuidc_data_out_type; fault : mmutlbfault_out_type; nexttrans : std_logic; s1finished : std_logic; -- writebuffer out wbtransdata : mmuidc_data_out_type; end record; type mmutlbo_a is array (natural range <>) of mmutlb_out_type; end;
gpl-2.0
caf25d613f3ad8970e67b3e4d9a8d66d
0.587063
3.408215
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep3sl150/testbench.vhd
1
13,139
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ -- Altera Stratix-III LEON3 Demonstration design test bench -- Copyright (C) 2007 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library cypress; use cypress.components.all; library hynix; use hynix.components.all; use work.debug.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 20; -- system clock period romwidth : integer := 32; -- rom data width (8/32) romdepth : integer := 23; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 20; -- ram address depth srambanks : integer := 1; -- number of ram banks dbits : integer := CFG_DDR2SP_DATAWIDTH ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents constant ct : integer := clkperiod/2; constant lresp : boolean := false; signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal Rst : std_logic := '0'; -- Reset signal clk : std_logic := '0'; signal clk125 : std_logic := '0'; signal address : std_logic_vector(25 downto 0); signal data : std_logic_vector(31 downto 0); signal romsn : std_ulogic; signal iosn : std_ulogic; signal oen : std_ulogic; signal writen : std_ulogic; signal dsuen, dsutx, dsurx, dsubren, dsuact : std_ulogic; signal dsurst : std_ulogic; signal error : std_logic; signal gpio : std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0); signal txd1, rxd1 : std_ulogic; -- PSRAM and FLASH control signal sram_advn : std_logic; signal sram_csn : std_logic; signal sram_wen : std_logic; signal sram_ben : std_logic_vector (0 to 3); signal sram_oen : std_ulogic; signal sram_clk : std_ulogic; signal sram_adscn : std_ulogic; signal sram_psn : std_ulogic; signal sram_adv_n : std_ulogic; signal sram_wait : std_logic_vector(1 downto 0); signal flash_clk, flash_cen, max_csn : std_logic; signal flash_advn, flash_oen, flash_resetn, flash_wen : std_logic; -- DDR2 memory signal ddr_clk : std_logic_vector(2 downto 0); signal ddr_clkb : std_logic_vector(2 downto 0); signal ddr_cke : std_logic_vector(1 downto 0); signal ddr_csb : std_logic_vector(1 downto 0); signal ddr_odt : std_logic_vector(1 downto 0); signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (8 downto 0); -- ddr dm signal ddr_dqsp : std_logic_vector (8 downto 0); -- ddr dqs signal ddr_dqsn : std_logic_vector (8 downto 0); -- ddr dqs signal ddr_rdqs : std_logic_vector (8 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (15 downto 0); -- ddr address signal ddr_ba : std_logic_vector (2 downto 0); -- ddr bank address signal ddr_dq : std_logic_vector (71 downto 0); -- ddr data signal ddr_dq2 : std_logic_vector (71 downto 0); -- ddr data --signal ddra_cke : std_logic; --signal ddra_csb : std_logic; --signal ddra_web : std_ulogic; -- ddr write enable --signal ddra_rasb : std_ulogic; -- ddr ras --signal ddra_casb : std_ulogic; -- ddr cas --signal ddra_ad : std_logic_vector (15 downto 0); -- ddr address --signal ddra_ba : std_logic_vector (2 downto 0); -- ddr bank address --signal ddrb_cke : std_logic; --signal ddrb_csb : std_logic; --signal ddrb_web : std_ulogic; -- ddr write enable --signal ddrb_rasb : std_ulogic; -- ddr ras --signal ddrb_casb : std_ulogic; -- ddr cas --signal ddrb_ad : std_logic_vector (15 downto 0); -- ddr address --signal ddrb_ba : std_logic_vector (2 downto 0); -- ddr bank address --signal ddrab_clk : std_logic_vector(1 downto 0); --signal ddrab_clkb : std_logic_vector(1 downto 0); --signal ddrab_odt : std_logic_vector(1 downto 0); --signal ddrab_dqsp : std_logic_vector(1 downto 0); -- ddr dqs --signal ddrab_dqsn : std_logic_vector(1 downto 0); -- ddr dqs --signal ddrab_dm : std_logic_vector(1 downto 0); -- ddr dm --signal ddrab_dq : std_logic_vector (15 downto 0);-- ddr data -- Ethernet signal phy_mii_data: std_logic; -- ethernet PHY interface signal phy_tx_clk : std_ulogic; signal phy_rx_clk : std_ulogic; signal phy_rx_data : std_logic_vector(7 downto 0); signal phy_dv : std_ulogic; signal phy_rx_er : std_ulogic; signal phy_col : std_ulogic; signal phy_crs : std_ulogic; signal phy_tx_data : std_logic_vector(7 downto 0); signal phy_tx_en : std_ulogic; signal phy_tx_er : std_ulogic; signal phy_mii_clk : std_ulogic; signal phy_rst_n : std_ulogic; signal phy_gtx_clk : std_ulogic; begin -- clock and reset clk <= not clk after ct * 1 ns; clk125 <= not clk125 after 4 * 1 ns; rst <= dsurst; dsubren <= '1'; rxd1 <= '1'; address(0) <= '0'; ddr_dq(71 downto dbits) <= (others => 'H'); ddr_dq2(71 downto dbits) <= (others => 'H'); ddr_dqsp(8 downto dbits/8) <= (others => 'H'); ddr_dqsn(8 downto dbits/8) <= (others => 'H'); ddr_rdqs(8 downto dbits/8) <= (others => 'H'); ddr_dm(8 downto dbits/8) <= (others => 'H'); d3 : entity work.leon3mp generic map (fabtech, memtech, padtech, clktech, ncpu, disas, dbguart, pclow, 50000, dbits) port map (rst, clk, clk125, error, dsubren, dsuact, -- rxd1, txd1, gpio, address(25 downto 1), data, open, sram_advn, sram_csn, sram_wen, sram_ben, sram_oen, sram_clk, sram_psn, sram_wait, flash_clk, flash_advn, flash_cen, flash_oen, flash_resetn, flash_wen, max_csn, iosn, ddr_clk, ddr_clkb, ddr_cke, ddr_csb, ddr_odt, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqsp, ddr_dqsn, ddr_ad, ddr_ba, ddr_dq, open, open, -- ddra_cke, ddra_csb, ddra_web, ddra_rasb, ddra_casb, ddra_ad(14 downto 0), ddra_ba, ddrb_cke, -- ddrb_csb, ddrb_web, ddrb_rasb, ddrb_casb, ddrb_ad(14 downto 0), ddrb_ba, ddrab_clk, ddrab_clkb, -- ddrab_odt, ddrab_dqsp, ddrab_dqsn, ddrab_dm, ddrab_dq, phy_gtx_clk, phy_mii_data, phy_tx_clk, phy_rx_clk, phy_rx_data, phy_dv, phy_rx_er, phy_col, phy_crs, phy_tx_data, phy_tx_en, phy_tx_er, phy_mii_clk, phy_rst_n ); ddr2delay : delay_wire generic map(data_width => dbits, delay_atob => 0.0, delay_btoa => 5.5) port map(a => ddr_dq(dbits-1 downto 0), b => ddr_dq2(dbits-1 downto 0)); ddr2mem : for i in 0 to dbits/16-1 generate u1 : HY5PS121621F generic map (TimingCheckFlag => true, PUSCheckFlag => false, index => (1 + 2*(CFG_DDR2SP_DATAWIDTH/64))-i, fname => sdramfile, bbits => CFG_DDR2SP_DATAWIDTH) PORT MAP( clk => ddr_clk(0), clkb => ddr_clkb(0), cke => ddr_cke(0), csb => ddr_csb(0), rasb => ddr_rasb, casb => ddr_casb, web => ddr_web, LDM => ddr_dm(i*2), UDM => ddr_dm(i*2+1), ba => ddr_ba(1 downto 0), addr => ddr_ad(12 downto 0), dq => ddr_dq2(i*16+15 downto i*16), LDQS => ddr_dqsp(i*2), LDQSB => ddr_dqsn(i*2), UDQS => ddr_dqsp(i*2+1), UDQSB => ddr_dqsn(i*2+1)); end generate; -- 16 bit prom prom0 : sram16 generic map (index => 4, abits => romdepth, fname => promfile) port map (address(romdepth downto 1), data(31 downto 16), gnd, gnd, flash_cen, flash_wen, flash_oen); -- -- 32 bit prom -- prom0 : for i in 0 to 3 generate -- sr0 : sram generic map (index => i, abits => romdepth, fname => promfile) -- port map (address(romdepth+1 downto 2), data(31-i*8 downto 24-i*8), flash_cen, -- flash_wen, flash_oen); -- end generate; sram0 : for i in 0 to (sramwidth/8)-1 generate sr0 : sram generic map (index => i, abits => sramdepth, fname => sramfile) port map (address(sramdepth+1 downto 2), data(31-i*8 downto 24-i*8), sram_csn, sram_wen, sram_oen); end generate; error <= 'H'; -- ERROR pull-up iuerr : process begin wait for 2500 ns; if to_x01(error) = '1' then wait on error; end if; assert (to_x01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; end process; data <= buskeep(data), (others => 'H') after 250 ns; test0 : grtestmod port map ( rst, clk, error, address(21 downto 2), data, iosn, sram_oen, sram_wen, open); dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; dsurst <= '0'; wait for 500 ns; dsurst <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#02#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#24#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#03#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#fc#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#2f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#6f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#11#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#00#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#04#, txp); txa(dsutx, 16#00#, 16#02#, 16#20#, 16#01#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#02#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#43#, 16#10#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#40#, 16#00#, 16#24#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#24#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#70#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#03#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end ;
gpl-2.0
bcaa8216be40b6dbd7d5285bdc1904d5
0.592511
3.019072
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/srmmu/mmutlbcam.vhd
1
9,515
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: mmutlbcam -- File: mmutlbcam.vhd -- Author: Konrad Eisele, Jiri Gaisler, Gaisler Research -- Description: MMU TLB logic ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.config_types.all; use grlib.config.all; use grlib.amba.all; use grlib.stdlib.all; library gaisler; use gaisler.mmuconfig.all; use gaisler.mmuiface.all; use gaisler.libmmu.all; entity mmutlbcam is generic ( tlb_type : integer range 0 to 3 := 1; mmupgsz : integer range 0 to 5 := 0 ); port ( rst : in std_logic; clk : in std_logic; tlbcami : in mmutlbcam_in_type; tlbcamo : out mmutlbcam_out_type ); end mmutlbcam; architecture rtl of mmutlbcam is constant M_TLB_FASTWRITE : integer range 0 to 3 := conv_integer(conv_std_logic_vector(tlb_type,2) and conv_std_logic_vector(2,2)); -- fast writebuffer type tlbcam_rtype is record btag : tlbcam_reg; end record; constant RESET_ALL : boolean := GRLIB_CONFIG_ARRAY(grlib_sync_reset_enable_all) = 1; constant RRES : tlbcam_rtype := (btag => tlbcam_reg_none); signal r,c : tlbcam_rtype; begin p0: process (rst, r, tlbcami) variable v : tlbcam_rtype; variable hm, hf : std_logic; variable h_i1, h_i2, h_i3, h_c : std_logic; variable h_l2, h_l3 : std_logic; variable h_su_cnt : std_logic; variable blvl : std_logic_vector(1 downto 0); variable bet : std_logic_vector(1 downto 0); variable bsu : std_logic; variable blvl_decode : std_logic_vector(3 downto 0); variable bet_decode : std_logic_vector(3 downto 0); variable ref, modified : std_logic; variable tlbcamo_pteout : std_logic_vector(31 downto 0); variable tlbcamo_LVL : std_logic_vector(1 downto 0); variable tlbcamo_NEEDSYNC : std_logic; variable tlbcamo_WBNEEDSYNC : std_logic; variable vaddr_r : std_logic_vector(31 downto 12); variable vaddr_i : std_logic_vector(31 downto 12); variable pagesize : integer range 0 to 3; begin v := r; --#init h_i1 := '0'; h_i2 := '0'; h_i3 := '0'; h_c := '0'; hm := '0'; pagesize := 0; hf := r.btag.VALID; blvl := r.btag.LVL; bet := r.btag.ET; bsu := r.btag.SU; bet_decode := decode(bet); blvl_decode := decode(blvl); ref := r.btag.R; modified := r.btag.M; tlbcamo_pteout := (others => '0'); tlbcamo_lvl := (others => '0'); vaddr_r := r.btag.I1 & r.btag.I2 & r.btag.I3; vaddr_i := tlbcami.tagin.I1 & tlbcami.tagin.I2 & tlbcami.tagin.I3; -- prepare tag comparision pagesize := MMU_getpagesize(mmupgsz,tlbcami.mmctrl); case pagesize is when 1 => -- 8k tag comparision [ 7 6 6 ] if (vaddr_r(P8K_VA_I1_U downto P8K_VA_I1_D) = vaddr_i(P8K_VA_I1_U downto P8K_VA_I1_D)) then h_i1 := '1'; else h_i1 := '0'; end if; if (vaddr_r(P8K_VA_I2_U downto P8K_VA_I2_D) = vaddr_i(P8K_VA_I2_U downto P8K_VA_I2_D)) then h_i2 := '1'; else h_i2 := '0'; end if; if (vaddr_r(P8K_VA_I3_U downto P8K_VA_I3_D) = vaddr_i(P8K_VA_I3_U downto P8K_VA_I3_D)) then h_i3 := '1'; else h_i3 := '0'; end if; if (r.btag.CTX = tlbcami.tagin.CTX) then h_c := '1'; else h_c := '0'; end if; when 2 => -- 16k tag comparision [ 6 6 6 ] if (vaddr_r(P16K_VA_I1_U downto P16K_VA_I1_D) = vaddr_i(P16K_VA_I1_U downto P16K_VA_I1_D)) then h_i1 := '1'; else h_i1 := '0'; end if; if (vaddr_r(P16K_VA_I2_U downto P16K_VA_I2_D) = vaddr_i(P16K_VA_I2_U downto P16K_VA_I2_D)) then h_i2 := '1'; else h_i2 := '0'; end if; if (vaddr_r(P16K_VA_I3_U downto P16K_VA_I3_D) = vaddr_i(P16K_VA_I3_U downto P16K_VA_I3_D)) then h_i3 := '1'; else h_i3 := '0'; end if; if (r.btag.CTX = tlbcami.tagin.CTX) then h_c := '1'; else h_c := '0'; end if; when 3 => -- 32k tag comparision [ 4 7 6 ] if (vaddr_r(P32K_VA_I1_U downto P32K_VA_I1_D) = vaddr_i(P32K_VA_I1_U downto P32K_VA_I1_D)) then h_i1 := '1'; else h_i1 := '0'; end if; if (vaddr_r(P32K_VA_I2_U downto P32K_VA_I2_D) = vaddr_i(P32K_VA_I2_U downto P32K_VA_I2_D)) then h_i2 := '1'; else h_i2 := '0'; end if; if (vaddr_r(P32K_VA_I3_U downto P32K_VA_I3_D) = vaddr_i(P32K_VA_I3_U downto P32K_VA_I3_D)) then h_i3 := '1'; else h_i3 := '0'; end if; if (r.btag.CTX = tlbcami.tagin.CTX) then h_c := '1'; else h_c := '0'; end if; when others => -- standard 4k tag comparision [ 8 6 6 ] if (r.btag.I1 = tlbcami.tagin.I1) then h_i1 := '1'; else h_i1 := '0'; end if; if (r.btag.I2 = tlbcami.tagin.I2) then h_i2 := '1'; else h_i2 := '0'; end if; if (r.btag.I3 = tlbcami.tagin.I3) then h_i3 := '1'; else h_i3 := '0'; end if; if (r.btag.CTX = tlbcami.tagin.CTX) then h_c := '1'; else h_c := '0'; end if; end case; -- #level 2 hit (segment) h_l2 := h_i1 and h_i2 ; -- #level 3 hit (page) h_l3 := h_i1 and h_i2 and h_i3; -- # context + su h_su_cnt := h_c or bsu; --# translation (match) op case blvl is when LVL_PAGE => hm := h_l3 and h_c and r.btag.VALID; when LVL_SEGMENT => hm := h_l2 and h_c and r.btag.VALID; when LVL_REGION => hm := h_i1 and h_c and r.btag.VALID; when LVL_CTX => hm := h_c and r.btag.VALID; when others => hm := 'X'; end case; --# translation: update ref/mod bit tlbcamo_NEEDSYNC := '0'; if (tlbcami.trans_op and hm ) = '1' then v.btag.R := '1'; v.btag.M := r.btag.M or tlbcami.tagin.M; tlbcamo_NEEDSYNC := (not r.btag.R) or (tlbcami.tagin.M and (not r.btag.M)); -- cam: ref/modified changed, write back synchronously end if; tlbcamo_WBNEEDSYNC := '0'; if ( hm ) = '1' then tlbcamo_WBNEEDSYNC := (not r.btag.R) or (tlbcami.tagin.M and (not r.btag.M)); -- cam: ref/modified changed, write back synchronously end if; --# flush operation -- tlbcam only stores PTEs, tlb does not store PTDs case tlbcami.tagin.TYP is when FPTY_PAGE => -- page hf := hf and h_su_cnt and h_l3 and (blvl_decode(0)); -- only level 3 (page) when FPTY_SEGMENT => -- segment hf := hf and h_su_cnt and h_l2 and (blvl_decode(0) or blvl_decode(1)); -- only level 2+3 (segment,page) when FPTY_REGION => -- region hf := hf and h_su_cnt and h_i1 and (not blvl_decode(3)); -- only level 1+2+3 (region,segment,page) when FPTY_CTX => -- context hf := hf and (h_c and (not bsu)); when FPTY_N => -- entire when others => hf := '0'; end case; --# flush: invalidate on flush hit --if (tlbcami.flush_op and hf ) = '1' then if (tlbcami.flush_op ) = '1' then v.btag.VALID := '0'; end if; --# write op if ( tlbcami.write_op = '1' ) then v.btag := tlbcami.tagwrite; end if; --# reset if ((not RESET_ALL) and (rst = '0')) or (tlbcami.mmuen = '0') then v.btag.VALID := RRES.btag.VALID; end if; tlbcamo_pteout(PTE_PPN_U downto PTE_PPN_D) := r.btag.PPN; tlbcamo_pteout(PTE_C) := r.btag.C; tlbcamo_pteout(PTE_M) := r.btag.M; tlbcamo_pteout(PTE_R) := r.btag.R; tlbcamo_pteout(PTE_ACC_U downto PTE_ACC_D) := r.btag.ACC; tlbcamo_pteout(PT_ET_U downto PT_ET_D) := r.btag.ET; tlbcamo_LVL(1 downto 0) := r.btag.LVL; --# drive signals tlbcamo.pteout <= tlbcamo_pteout; tlbcamo.LVL <= tlbcamo_LVL; --tlbcamo.hit <= (tlbcami.trans_op and hm) or (tlbcami.flush_op and hf); tlbcamo.hit <= (hm) or (tlbcami.flush_op and hf); tlbcamo.ctx <= r.btag.CTX; -- for diagnostic only tlbcamo.valid <= r.btag.VALID; -- for diagnostic only tlbcamo.vaddr <= r.btag.I1 & r.btag.I2 & r.btag.I3 & "000000000000"; -- for diagnostic only tlbcamo.NEEDSYNC <= tlbcamo_NEEDSYNC; tlbcamo.WBNEEDSYNC <= tlbcamo_WBNEEDSYNC; c <= v; end process p0; p1: process (clk) begin if rising_edge(clk) then r <= c; if RESET_ALL and (rst = '0') then r <= RRES; end if; end if; end process p1; end rtl;
gpl-2.0
a741b4d248acd357b9aac1dffb6643e5
0.559853
2.97158
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_p_src_rows_V_2_loc_channel1.vhd
2
4,684
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_p_src_rows_V_2_loc_channel1_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_p_src_rows_V_2_loc_channel1_shiftReg; architecture rtl of FIFO_image_filter_p_src_rows_V_2_loc_channel1_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_p_src_rows_V_2_loc_channel1 is generic ( MEM_STYLE : string := "shiftreg"; DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_p_src_rows_V_2_loc_channel1 is component FIFO_image_filter_p_src_rows_V_2_loc_channel1_shiftReg is generic ( DATA_WIDTH : integer := 12; ADDR_WIDTH : integer := 2; DEPTH : integer := 3); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_p_src_rows_V_2_loc_channel1_shiftReg : FIFO_image_filter_p_src_rows_V_2_loc_channel1_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
8f20c0dd9053f809a4f0516758947a99
0.541418
3.42899
false
false
false
false
capitanov/Stupid_watch
src/rtl/game_cores/ctrl_game_block.vhd
1
9,900
-------------------------------------------------------------------------------- -- -- Title : ctrl_game_block.vhd -- Design : Example -- Author : Kapitanov -- Company : InSys -- -- Version : 1.0 -------------------------------------------------------------------------------- -- -- Description : Main game block for minesweeper -- -- -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use work.ctrl_types_pkg.key_data; use work.ctrl_types_pkg.data8x8; use work.ctrl_types_pkg.data3x8; use work.ctrl_types_pkg.array8x8; use work.ctrl_comp_pkg.all; entity ctrl_game_block is generic( constant yend : std_logic_vector(4 downto 0); --! Y end area constant ystart : std_logic_vector(4 downto 0); --! Y start area constant xend : std_logic_vector(6 downto 0); --! X end area constant xstart : std_logic_vector(6 downto 0) --! X start area ); port( -- system signals: clk : in std_logic; --! clock reset : in std_logic; --! system reset -- keyboard: push_keys : in key_data; --! ps/2 keys -- vga XoY coordinates: display : in std_logic; --! display enable x_char : in std_logic_vector(9 downto 0); --! X line: 0:79 y_char : in std_logic_vector(8 downto 0); --! Y line: 0:29 -- out color scheme: rgb : out std_logic_vector(2 downto 0); --! RGB data leds : out std_logic_vector(8 downto 1) --! 8 LEDs ); end ctrl_game_block; architecture ctrl_game_block of ctrl_game_block is function conv8x8to64 (data_in : array8x8) return std_logic_vector is variable vector64 : std_logic_vector(63 downto 0); begin x_loop8: for jj in 0 to 7 loop y_loop8 :for ii in 0 to 7 loop vector64(ii+jj*8) := data_in(jj)(ii); end loop; end loop; return vector64; end conv8x8to64; component ctrl_8x16_rom is port( clk : in std_logic; -- clock addr : in std_logic_vector(10 downto 0); -- ROM address 2^11 data : out std_logic_vector(7 downto 0) -- ROM data 1 byte ); end component; type game_fsm is (WAIT_START, PLAY, CHECK, GAME_OVER, RST); signal game_status : game_fsm; signal addr_rnd : std_logic_vector(4 downto 0):="00000"; signal show_field, show_bad_msg, display_text: std_logic; signal x_in : std_logic_vector(6 downto 0); signal y_in : std_logic_vector(4 downto 0); signal x_inz : std_logic_vector(6 downto 0); signal x_inzz : std_logic_vector(6 downto 0); signal y_inz : std_logic_vector(4 downto 0); signal y_inzz : std_logic_vector(4 downto 0); signal cnt_yy : std_logic_vector(2 downto 0); signal cnt_xx : std_logic_vector(2 downto 0); signal comp_yy : std_logic_vector(6 downto 0); signal comp_xx : std_logic_vector(4 downto 0); signal rgb1 : std_logic_vector(2 downto 0):="000"; signal rgb2 : std_logic_vector(2 downto 0):="000"; signal rgb3 : std_logic_vector(2 downto 0):="000"; signal rgb4 : std_logic_vector(2 downto 0):="000"; signal rgb5 : std_logic_vector(2 downto 0):="000"; signal kw, ks, ka, kd : std_logic; signal kenter : std_logic; signal kspace : std_logic; signal ky, kn : std_logic; signal kesc : std_logic; signal data_box : std_logic_vector(7 downto 0); signal cnt_mines : std_logic_vector(6 downto 0); signal show_disp : array8x8; signal show_dispz : std_logic_vector(63 downto 0); signal win, lose, game : std_logic; signal cntg : std_logic; signal cnt_flash : std_logic_vector(23 downto 0); begin ---------------- SUMMARY RGB ON DISPLAY ---------------- rgb <= rgb1 or rgb2 or rgb3 or rgb4 or rgb5; ---------------- KEYBOARD ---------------- kw <= push_keys.WSAD(3) after 1 ns when rising_edge(clk); ks <= push_keys.WSAD(2) after 1 ns when rising_edge(clk); ka <= push_keys.WSAD(0) after 1 ns when rising_edge(clk); kd <= push_keys.WSAD(1) after 1 ns when rising_edge(clk); ky <= push_keys.ky after 1 ns when rising_edge(clk); kn <= push_keys.kn after 1 ns when rising_edge(clk); kspace <= push_keys.Space after 1 ns when rising_edge(clk); kenter <= push_keys.Enter after 1 ns when rising_edge(clk); kesc <= push_keys.Esc after 1 ns when rising_edge(clk); ---------------- LEDS ON DISPLAY ---------------- leds(1) <= kenter; leds(2) <= kw or ks or ka or kd; leds(3) <= ky or kn; leds(4) <= show_field; leds(5) <= display; leds(6) <= cnt_flash(23); ---------------- MOVING COUNTERS ---------------- pr_start: process(reset, clk) is begin if reset = '0' then cnt_xx <= "000"; cnt_yy <= "000"; elsif rising_edge(clk) then case game_status is when PLAY => if kw = '1' then cnt_yy <= cnt_yy - 1; elsif ks = '1' then cnt_yy <= cnt_yy + 1; else null; end if; if ka = '1' then cnt_xx <= cnt_xx + 1; elsif kd = '1' then cnt_xx <= cnt_xx - 1; else null; end if; when RST | GAME_OVER | WAIT_START => cnt_xx <= "000"; cnt_yy <= "000"; when others => null; end case; end if; end process; comp_yy <= "0000" & cnt_yy; comp_xx <= "00" & cnt_xx; ---------------- XoY COORDINATES ---------------- x_in <= x_char(9 downto 3); y_in <= y_char(8 downto 4); x_inz <= x_in after 1 ns when rising_edge(clk); y_inz <= y_in after 1 ns when rising_edge(clk); x_inzz <= x_inz after 1 ns when rising_edge(clk); y_inzz <= y_inz after 1 ns when rising_edge(clk); ---------------- GLOABAL FSM ---------------- pr_game_status: process(clk, reset) is begin if reset = '0' then game_status <= WAIT_START; show_field <= '0'; show_bad_msg <= '0'; addr_rnd <= (others => '0'); display_text <= '0'; win <= '0'; lose <= '0'; game <= '0'; cntg <= '0'; cnt_flash <= (others => '0'); elsif rising_edge(clk) then case game_status is when WAIT_START => display_text <= '1'; show_bad_msg <= '0'; win <= '0'; game <= '0'; lose <= '0'; cntg <= '0'; addr_rnd <= addr_rnd + '1'; -- UNCOMMENT LATER!! if kspace = '1' then game_status <= PLAY; show_field <= '1'; end if; when PLAY => cntg <= '1'; if kesc = '1' then game_status <= WAIT_START; else if cnt_mines = "111000" then show_bad_msg <= '0'; game_status <= GAME_OVER; else if kenter = '1' then game_status <= CHECK; else null; end if; end if; end if; when CHECK => if (x_inzz = (xstart + comp_xx)) and (y_inzz = (ystart + comp_yy)) then if data_box = x"0F" then show_bad_msg <= '1'; game_status <= GAME_OVER; else game_status <= PLAY; end if; end if; when GAME_OVER => cnt_flash <= cnt_flash + '1'; if show_bad_msg = '1' then win <= '0'; lose <= '1'; else win <= '1'; lose <= '0'; end if; game <= '1'; if ky = '1' then game_status <= WAIT_START; elsif kn = '1' then game_status <= RST; else null; end if; when RST => cntg <= '0'; game <= '0'; win <= '0'; lose <= '0'; show_field <= '0'; display_text <= '0'; show_bad_msg <= '0'; cnt_flash <= (others => '0'); addr_rnd <= (others => '0'); when others => null; end case; end if; end process; pr_display8x8: process(clk, reset) is begin if reset = '0' then show_disp <= (others=>(others=>'0')); cnt_mines <= (others => '0'); show_dispz <= (others => '0'); elsif rising_edge(clk) then case game_status is when PLAY => if kenter = '1' then show_disp(conv_integer(cnt_xx))(conv_integer(cnt_yy)) <= '1'; else null; end if; -- x_loop: for ii in 0 to 62 loop -- show_dispz(ii+1) <= show_dispz(ii); -- end loop; -- show_dispz(0) <= '0'; show_dispz(63 downto 0) <= show_dispz(62 downto 0) & '0'; if show_dispz(63) = '1' then cnt_mines <= cnt_mines + '1'; else null; end if; when CHECK => show_dispz <= conv8x8to64(show_disp); cnt_mines <= (others => '0'); when RST | GAME_OVER | WAIT_START => show_dispz <= (others => '0'); show_disp <= (others=>(others=>'0')); cnt_mines <= (others => '0'); when others => null; end case; end if; end process; ---------------- COMPONENTS MAPPING ---------------- x_check: cl_check generic map( yend => yend, ystart => ystart, xend => xend, xstart => xstart ) port map( clk => clk, reset => reset, cnt_yy => cnt_yy, cnt_xx => cnt_xx, display => show_field, x_char => x_char, y_char => y_char, rgb => rgb1 ); x_mines: cl_mines generic map( yend => yend, ystart => ystart, xend => xend, xstart => xstart ) port map( clk => clk, reset => reset, addr_rnd => addr_rnd, show_disp => show_disp, display => show_field, x_char => x_char, y_char => y_char, data_out => data_box, rgb => rgb2 ); x_square: cl_square generic map( yend => yend, ystart => ystart, xend => xend, xstart => xstart ) port map( clk => clk, reset => reset, show_disp => show_disp, display => show_field, x_char => x_char, y_char => y_char, rgb => rgb3 ); x_borders: cl_borders generic map( yend => yend, ystart => ystart, xend => xend, xstart => xstart ) port map( clk => clk, reset => reset, display => show_field, x_char => x_char, y_char => y_char, rgb => rgb4 ); x_text: cl_text generic map( yend => yend, ystart => ystart, xend => xend, xstart => xstart ) port map( clk => clk, reset => reset, addr_rnd => addr_rnd, display => display_text, cntgames => cntg, win => win, lose => lose, game => game, flash => cnt_flash(23 downto 21), x_char => x_char, y_char => y_char, rgb => rgb5 ); end ctrl_game_block;
mit
736bb29214ac9234caff72e74fd1caa0
0.548283
2.642114
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/ddr/ddr2spax_ahb.vhd
1
16,792
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ddr2spa_ahb -- File: ddr2spa_ahb.vhd -- Author: Magnus Hjorth - Aeroflex Gaisler -- Description: Asynch AHB interface for DDR memory controller -- Based on ddr2sp(16/32/64)a, generalized and expanded -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library grlib; use grlib.stdlib.all; use grlib.amba.all; use grlib.devices.all; library gaisler; use gaisler.ddrpkg.all; use gaisler.ddrintpkg.all; entity ddr2spax_ahb is generic ( hindex : integer := 0; haddr : integer := 0; hmask : integer := 16#f00#; ioaddr : integer := 16#000#; iomask : integer := 16#fff#; burstlen : integer := 8; nosync : integer := 0; ahbbits : integer := ahbdw; revision : integer := 0; devid : integer := GAISLER_DDR2SP; ddrbits : integer := 32; regarea : integer := 0 ); port ( rst : in std_ulogic; clk_ahb : in std_ulogic; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; request : out ddr_request_type; start_tog: out std_logic; response : in ddr_response_type; wbwaddr : out std_logic_vector(log2(burstlen) downto 0); wbwdata : out std_logic_vector(ahbbits-1 downto 0); wbwrite : out std_logic; wbwritebig: out std_logic; rbraddr : out std_logic_vector(log2(burstlen*32/ahbbits)-1 downto 0); rbrdata : in std_logic_vector(ahbbits-1 downto 0); hwidth : in std_logic; beid : in std_logic_vector(3 downto 0) ); end ddr2spax_ahb; architecture rtl of ddr2spax_ahb is constant CMD_PRE : std_logic_vector(2 downto 0) := "010"; constant CMD_REF : std_logic_vector(2 downto 0) := "100"; constant CMD_LMR : std_logic_vector(2 downto 0) := "110"; constant CMD_EMR : std_logic_vector(2 downto 0) := "111"; constant ramwt: integer := 0; constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, DEVID, 0, REVISION, 0), 4 => ahb_membar(haddr, '1', '1', hmask), 5 => ahb_iobar(ioaddr, iomask), others => zero32); function zerov(w: integer) return std_logic_vector is constant r: std_logic_vector(w-1 downto 0) := (others => '0'); begin return r; end zerov; constant l2blen: integer := log2(burstlen)+log2(32); constant l2ahbw: integer := log2(ahbbits); constant l2ddrw: integer := log2(2*ddrbits); -- Write buffer dimensions -- Write buffer is addressable down to 32-bit level on write (AHB) side. constant wbuf_wabits: integer := 1+l2blen-5; -- log2(burstlen); constant wbuf_wdbits: integer := ahbbits; -- Read buffer dimensions constant rbuf_rabits: integer := l2blen-l2ahbw; -- log2(burstlen*32/ahbbits); constant rbuf_rdbits: integer := ahbbits; type ahbstate is (asnormal,asw1,asw2,asww1,asww2,aswr,aswwx); type ahb_reg_type is record s : ahbstate; start_tog : std_logic; ramaddr : std_logic_vector(l2blen-4 downto 2); -- These are sent to the DDR layer req : ddr_request_type; -- Posted write following current request nreq : ddr_request_type; -- Read flow control rctr_lin : std_logic_vector(3 downto 0); endpos : std_logic_vector(7 downto log2(ddrbits/4)); block_read: std_logic_vector(1 downto 0); -- Current AHB control signals haddr : std_logic_vector(31 downto 0); haddr_nonseq: std_logic_vector(9 downto 0); hio : std_logic; hsize : std_logic_vector(2 downto 0); hwrite : std_logic; hburst0 : std_logic; -- AHB slave outputs so_hready : std_logic; -- From DDR layer resp1,resp2: ddr_response_type; end record; signal ar,nar : ahb_reg_type; begin ahbcomb : process(ahbsi,rst,ar,response,rbrdata) variable av: ahb_reg_type; variable va2d: ddr_request_type; variable so: ahb_slv_out_type; variable vdone: std_logic; variable vresp: ddr_response_type; variable bigsize,midsize,canburst: std_logic; variable inc_ramaddr: std_logic; variable row: std_logic_vector(14 downto 0); variable wbwa: std_logic_vector(wbuf_wabits-1 downto 0); variable wbwd: std_logic_vector(wbuf_wdbits-1 downto 0); variable wbw,wbwb: std_logic; variable rbra: std_logic_vector(rbuf_rabits-1 downto 0); variable ha0: std_logic_vector(31 downto 0); variable rend,nrend: std_logic_vector(7 downto log2(ddrbits/4)); variable datavalid, writedone: std_logic; variable rctr_gray: std_logic_vector(3 downto 0); variable tog_start: std_logic; variable regdata: std_logic_vector(31 downto 0); begin ha0 := ahbsi.haddr; ha0(31 downto 20) := ha0(31 downto 20) and not std_logic_vector(to_unsigned(hmask,12)); av := ar; so := (hready => ar.so_hready, hresp => HRESP_OKAY, hrdata => (others => '0'), hsplit => (others => '0'), hirq => (others => '0'), hconfig => hconfig, hindex => hindex); wbw := '0'; wbwb := '0'; wbwa := ar.start_tog & ar.ramaddr; wbwd := ahbreaddata(ahbsi.hwdata,ar.haddr(4 downto 2), std_logic_vector(to_unsigned(log2(ahbbits/8),3))); rbra := ar.ramaddr(l2blen-4 downto l2ahbw-3); -- Determine whether the current hsize is a big (ahbbits-width) access bigsize := '0'; if (ahbbits = 256 and ar.hsize(2)='1' and ar.hsize(0)='1') or (ahbbits = 128 and ar.hsize(2)='1') or (ahbbits = 64 and ar.hsize="011") then bigsize := '1'; end if; midsize := '0'; if ( (ahbbits = 256 and ((ar.hsize(2)='1' and ar.hsize(0)='0') or (ar.hsize(1 downto 0)="11"))) or (ahbbits = 128 and ar.hsize="011") ) then midsize := '1'; end if; -- Determine whether sequential burst is allowed after current access canburst := '0'; if (bigsize='1' and ar.haddr(l2blen-4 downto l2ahbw-3)/=(not zerov(l2blen-l2ahbw))) or (ar.hsize="010" and ar.haddr(l2blen-4 downto 2)/=(not zerov(l2blen-5))) then canburst := '1'; end if; -- if canburst='1' then -- print("ar.hsize=" & tost(ar.hsize) & "ar.haddr: " & tost(ar.haddr(l2blen-4 downto 2)) & " /= " & tost(not zerov(l2blen-5))); -- end if; if ar.hio='1' then canburst := '0'; end if; if ahbsi.hready='1' and ahbsi.hsel(hindex)='1' and ahbsi.htrans(1)='1' then av.haddr := ha0; av.ramaddr := ha0(log2(4*burstlen)-1 downto 2); av.hio := ahbsi.hmbsel(1); av.hsize := ahbsi.hsize; av.hwrite := ahbsi.hwrite; av.hburst0 := ahbsi.hburst(0); if ahbsi.htrans(0)='0' or canburst='0' then av.haddr_nonseq := ha0(9 downto 0); end if; end if; -- Synchronize from DDR domain av.resp1:=response; av.resp2:=ar.resp1; vresp := ar.resp2; if nosync /= 0 then vresp := response; end if; vdone := vresp.done_tog; -- Determine whether we can read more data in burst datavalid := '0'; writedone := '0'; if ar.start_tog=vdone then datavalid := '1'; writedone := '1'; end if; if ar.rctr_lin="0000" then rend:=ar.haddr(7 downto l2ddrw-3); else rend:=ar.endpos; end if; nrend := std_logic_vector(unsigned(rend)+1); rctr_gray := lin2gray(ar.rctr_lin); if ar.start_tog/=vdone and rctr_gray /= vresp.rctr_gray and ar.block_read(0)='0' then av.rctr_lin := std_logic_vector(unsigned(ar.rctr_lin)+1); av.endpos := nrend; rend := nrend; end if; if 2*ddrbits > ahbbits then if rend /= ar.haddr(7 downto log2(ddrbits/4)) then datavalid := '1'; end if; else if rend(7 downto log2(ahbbits/8)) /= ar.haddr(7 downto log2(ahbbits/8)) then datavalid := '1'; end if; if 2*ddrbits < ahbbits and ahbbits > 32 then if ar.hsize="010" or ar.hsize="001" or ar.hsize="000" then if rend(log2(ahbbits/8)-1 downto log2(ddrbits/4)) /= ar.haddr(log2(ahbbits/8)-1 downto log2(ddrbits/4)) then datavalid := '1'; end if; end if; end if; end if; if ar.block_read(1)='1' or (ar.start_tog/=vdone and ar.block_read(0)='1') then datavalid := '0'; writedone := '0'; end if; if ar.block_read(1)='1' and ar.start_tog/=vdone then av.block_read(1) := '0'; end if; if ar.block_read(1)='0' and vresp.rctr_gray="0000" then av.block_read(0) := '0'; end if; -- FSM inc_ramaddr := '0'; tog_start := '0'; case ar.s is when asnormal => -- Idle and memory read state if ahbsi.hready='1' and ahbsi.hsel(hindex)='1' and ahbsi.htrans(1)='1' then -- Pass on address immediately to request for read case av.req := (startaddr => ha0, endaddr => ha0(9 downto 0), hsize => ahbsi.hsize, hwrite => ahbsi.hwrite, hio => ahbsi.hmbsel(1), burst => ahbsi.hburst(0), maskdata => '0', maskcb => '0'); if ahbsi.hwrite='0' then if ahbsi.htrans(0)='0' or canburst='0' then av.so_hready := '0'; tog_start := '1'; elsif datavalid='1' then inc_ramaddr := '1'; else av.so_hready := '0'; -- grlib.testlib.print("Going to waitstate!"); end if; else av.s := asw1; end if; end if; if ar.so_hready='0' and datavalid='1' then av.so_hready := '1'; inc_ramaddr := '1'; end if; when asw1 => -- Transfer data for write request wbw := '1'; if bigsize='1' or midsize='1' then wbwb:='1'; end if; av.so_hready := '1'; av.req.endaddr := ar.haddr(9 downto 0); if ahbsi.hready='1' and ahbsi.hsel(hindex)='1' and ahbsi.htrans(1)='1' then if ahbsi.htrans(0)='0' or canburst='0' then if ahbsi.hwrite='1' then av.s := asww1; else av.so_hready := '0'; av.s := aswr; end if; tog_start := '1'; end if; else av.s := asw2; tog_start := '1'; end if; when asw2 => -- Write request ongoing av.so_hready := '1'; if ahbsi.hready='1' and ahbsi.hsel(hindex)='1' and ahbsi.htrans(1)='1' then if ahbsi.hwrite='1' then av.s := asww1; else av.so_hready := '0'; av.s := aswr; end if; elsif writedone='1' then av.s := asnormal; end if; when asww1 => -- Transfer data for second write while write request ongoing wbw := '1'; if bigsize='1' or midsize='1' then wbwb:='1'; end if; av.so_hready := '1'; av.nreq := (startaddr => ar.haddr(31 downto 10) & ar.haddr_nonseq(9 downto 0), endaddr => ar.haddr(9 downto 0), hsize => ar.hsize, hwrite => ar.hwrite, hio => ar.hio, burst => ar.hburst0, maskdata => '0', maskcb => '0'); if ahbsi.hready='1' and ahbsi.hsel(hindex)='1' and ahbsi.htrans(1)='1' then if ahbsi.htrans(0)='0' or canburst='0' then av.so_hready := '0'; av.s := aswwx; end if; else av.s := asww2; end if; when asww2 => -- Second write enqueued, wait for first write to finish -- Any new request here will cause HREADY to go low av.so_hready := '1'; if ahbsi.hready='1' and ahbsi.hsel(hindex)='1' and ahbsi.htrans(1)='1' then av.so_hready := '0'; av.s := aswwx; elsif writedone='1' then av.req := ar.nreq; tog_start := '1'; av.s := asw2; end if; when aswr => -- Read request following ongoing write request -- HREADY is low in this state av.so_hready := '0'; if writedone='1' then av.req := (startaddr => ar.haddr(31 downto 10) & ar.haddr_nonseq(9 downto 0), endaddr => ar.haddr(9 downto 0), hsize => ar.hsize, hwrite => ar.hwrite, hio => ar.hio, burst => ar.hburst0, maskdata => '0', maskcb => '0'); av.hwrite := '0'; tog_start := '1'; av.s := asnormal; end if; when aswwx => -- Write ongoing + write posted + another AHB request (read or write) -- Keep HREADY low av.so_hready := '0'; if writedone='1' then tog_start := '1'; av.req := ar.nreq; if ar.hwrite='1' then av.nreq := (startaddr => ar.haddr(31 downto 10) & ar.haddr_nonseq(9 downto 0), endaddr => ar.haddr(9 downto 0), hsize => ar.hsize, hwrite => ar.hwrite, hio => ar.hio, burst => ar.hburst0, maskdata => '0', maskcb => '0'); av.so_hready := '1'; av.s := asww1; else av.s := aswr; end if; end if; end case; if tog_start='1' and (regarea=0 or av.req.hio='0' or av.req.startaddr(5)='0') then av.start_tog := not ar.start_tog; av.rctr_lin := "0000"; if ar.start_tog /= vdone then av.block_read(1) := '1'; end if; av.block_read(0) := '1'; end if; if inc_ramaddr='1' then if bigsize='1' then av.ramaddr(log2(4*burstlen)-1 downto log2(ahbbits/8)) := std_logic_vector(unsigned(ar.ramaddr(log2(4*burstlen)-1 downto log2(ahbbits/8)))+1); else av.ramaddr(log2(4*burstlen)-1 downto 2) := std_logic_vector(unsigned(ar.ramaddr(log2(4*burstlen)-1 downto 2))+1); end if; end if; -- Used only if regarea /= 0 regdata := (others => '0'); regdata(18 downto 16) := std_logic_vector(to_unsigned(log2(ddrbits/8),3)); if hwidth/='0' then regdata(18 downto 16) := std_logic_vector(to_unsigned(log2(ddrbits/16),3)); end if; regdata(15 downto 12) := beid; -- If we are using AMBA-compliant data muxing, nothing needs to be done to -- the hrdata vector. Otherwise, we need to duplicate 32-bit lanes if regarea/=0 and ar.req.hio='1' and ar.req.startaddr(5)='1' then so.hrdata := ahbdrivedata(regdata); elsif CORE_ACDM /= 0 then so.hrdata := ahbdrivedata(rbrdata); else so.hrdata := ahbselectdata(ahbdrivedata(rbrdata),ar.haddr(4 downto 2),ar.hsize); end if; if rst='0' then av.s := asnormal; av.block_read := "00"; av.start_tog := '0'; av.so_hready := '1'; so.hready := '1'; so.hresp := HRESP_OKAY; end if; if l2blen-l2ddrw < 4 then av.rctr_lin(3 downto l2blen-l2ddrw) := (others => '0'); end if; nar <= av; request <= ar.req; start_tog <= ar.start_tog; ahbso <= so; wbwrite <= wbw; wbwritebig <= wbwb; wbwaddr <= wbwa; wbwdata <= wbwd; rbraddr <= rbra; end process; ahbregs : process(clk_ahb) begin if rising_edge(clk_ahb) then ar <= nar; end if; end process; end;
gpl-2.0
5a26d4dd59d90d71b5f4de59d4117279
0.541925
3.516649
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/median/ipi_proj/srcs/ip/util_flipflop_v1_0/utility/util_flipflop.vhd
5
8,850
------------------------------------------------------------------------------- -- $Id: util_flipflop.vhd,v 1.1 2006/09/20 09:36:32 rolandp Exp $ ------------------------------------------------------------------------------- -- util_flipflop.vhd - Entity and architecture -- -- *************************************************************************** -- ** Copyright(C) 2003 by Xilinx, Inc. All rights reserved. ** -- ** ** -- ** This text contains proprietary, confidential ** -- ** information of Xilinx, Inc. , is distributed by ** -- ** under license from Xilinx, Inc., and may be used, ** -- ** copied and/or disclosed only pursuant to the terms ** -- ** of a valid license agreement with Xilinx, Inc. ** -- ** ** -- ** Unmodified source code is guaranteed to place and route, ** -- ** function and run at speed according to the datasheet ** -- ** specification. Source code is provided "as-is", with no ** -- ** obligation on the part of Xilinx to provide support. ** -- ** ** -- ** Xilinx Hotline support of source code IP shall only include ** -- ** standard level Xilinx Hotline support, and will only address ** -- ** issues and questions related to the standard released Netlist ** -- ** version of the core (and thus indirectly, the original core source). ** -- ** ** -- ** The Xilinx Support Hotline does not have access to source ** -- ** code and therefore cannot answer specific questions related ** -- ** to source HDL. The Xilinx Support Hotline will only be able ** -- ** to confirm the problem in the Netlist version of the core. ** -- ** ** -- ** This copyright and support notice must be retained as part ** -- ** of this text at all times. ** -- *************************************************************************** -- -----------------------------------------------------Is there a way to tell which release -------------------------- -- Filename: util_flipflop.vhd -- -- Description: -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- -- Structure: -- util_flipflop.vhd -- ------------------------------------------------------------------------------- -- Author: goran -- Revision: $Revision: 1.1 $ -- Date: $Date: 2006/09/20 09:36:32 $ -- -- History: -- goran 2003-06-06 First Version -- ------------------------------------------------------------------------------- -- 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: "*_com" -- 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 unisim; use unisim.all; entity util_flipflop is generic ( C_SET_RST_HIGH : integer := 1; C_USE_RST : integer := 1; C_USE_SET : integer := 1; C_USE_CE : integer := 1; C_USE_ASYNCH : integer := 1; C_SIZE : integer := 8; C_INIT : string := "0" ); port ( Clk : in std_logic; Rst : in std_logic; Set : in std_logic; CE : in std_logic; D : in std_logic_vector(0 to C_SIZE-1); Q : out std_logic_vector(0 to C_SIZE-1) --Q_AND : out std_logic ); attribute SIGIS : string; attribute SIGIS of Clk : signal is "CLK"; end util_flipflop; architecture IMP of util_flipflop is component FDRSE is -- pragma translate_off generic( INIT : bit := '0' ); -- pragma translate_on port ( Q : out std_logic; C : in std_logic; CE : in std_logic; D : in std_logic; R : in std_logic; S : in std_logic); end component FDRSE; component FDCPE is -- pragma translate_off generic( INIT : bit := '0' ); -- pragma translate_on port ( Q : out std_logic; C : in std_logic; CE : in std_logic; D : in std_logic; CLR : in std_logic; PRE : in std_logic); end component FDCPE; function Get_Init(From : String; Index : Positive) return bit is begin if From'length = 1 then if From = "1" then return '1'; end if; elsif Index <= From'high and Index >= From'low then if From(Index) = '1' then return '1'; end if; end if; return '0'; end function Get_Init; function Bit2Str(constant val : bit) return string is begin if val = '1' then return "1"; else return "0"; end if; end function Bit2Str; signal ce_i : std_logic; signal rst_i : std_logic; signal set_i : std_logic; signal q_and_i : std_logic := '1'; signal q_i : std_logic_vector(0 to C_SIZE-1); begin assert not(C_SIZE > C_INIT'length and C_INIT'length /= 1) report "C_INIT string length does not match C_SIZE of util_flipflop" severity failure; Using_CE : if (C_USE_CE = 1) generate ce_i <= CE; end generate Using_CE; No_CE : if (C_USE_CE /= 1) generate ce_i <= '1'; end generate No_CE; Using_RST : if (C_USE_RST = 1) generate rst_i <= RST when C_SET_RST_HIGH = 1 else not RST; end generate Using_RST; No_Rst : if (C_USE_RST /= 1) generate rst_i <= '0'; end generate No_Rst; Using_SET : if (C_USE_SET = 1) generate set_i <= SET when C_SET_RST_HIGH = 1 else not SET; end generate Using_SET; No_Set : if (C_USE_SET /= 1) generate set_i <= '0'; end generate No_Set; Using_ASYNCH : if (C_USE_ASYNCH = 1) generate All_Bits : for I in 0 to C_SIZE-1 generate attribute INIT : string; attribute INIT of FDCPE_I1 : label is Bit2Str(Get_Init(C_INIT,I+1)); begin FDCPE_I1 : FDCPE -- pragma translate_off generic map ( INIT => Get_Init(C_INIT,I+1)) -- [bit] -- pragma translate_on port map ( Q => q_i(I), -- [out std_logic] C => Clk, -- [in std_logic] CE => ce_i, -- [in std_logic] D => D(I), -- [in std_logic] CLR => rst_i, -- [in std_logic] PRE => set_i); -- [in std_logic] --q_and_i <= q_and_i and q_i(i); end generate All_Bits; end generate Using_ASYNCH; Using_SYNCH : if (C_USE_ASYNCH /= 1) generate All_Bits : for I in 0 to C_SIZE-1 generate attribute INIT : string; attribute INIT of FDRSE_I1 : label is Bit2Str(Get_Init(C_INIT,I+1)); begin FDRSE_I1 : FDRSE -- pragma translate_off generic map ( INIT => Get_Init(C_INIT,I+1)) -- [bit] -- pragma translate_on port map ( Q => q_i(I), -- [out std_logic] C => Clk, -- [in std_logic] CE => ce_i, -- [in std_logic] D => D(I), -- [in std_logic] R => rst_i, -- [in std_logic] S => set_i); -- [in std_logic] -- q_and_i <= q_and_i and q_i(i); end generate All_Bits; end generate Using_SYNCH; Q <= q_i; -- Q_AND <= q_and_i; end IMP;
gpl-3.0
df5c676f179954de9f0a03db761044f1
0.434689
4.02822
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-terasic-de4/ddr2sim.vhd
1
10,024
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA use std.textio.all; library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.stdlib.all; use grlib.stdio.all; entity ddr2ctrl is port ( pll_ref_clk : in std_logic := '0'; -- pll_ref_clk.clk global_reset_n : in std_logic := '0'; -- global_reset.reset_n soft_reset_n : in std_logic := '0'; -- soft_reset.reset_n afi_clk : out std_logic; -- afi_clk.clk afi_half_clk : out std_logic; -- afi_half_clk.clk afi_reset_n : out std_logic; -- afi_reset.reset_n afi_reset_export_n : out std_logic; -- afi_reset_export.reset_n mem_a : out std_logic_vector(13 downto 0); -- memory.mem_a mem_ba : out std_logic_vector(2 downto 0); -- .mem_ba mem_ck : out std_logic_vector(1 downto 0); -- .mem_ck mem_ck_n : out std_logic_vector(1 downto 0); -- .mem_ck_n mem_cke : out std_logic_vector(0 downto 0); -- .mem_cke mem_cs_n : out std_logic_vector(0 downto 0); -- .mem_cs_n mem_dm : out std_logic_vector(7 downto 0); -- .mem_dm mem_ras_n : out std_logic_vector(0 downto 0); -- .mem_ras_n mem_cas_n : out std_logic_vector(0 downto 0); -- .mem_cas_n mem_we_n : out std_logic_vector(0 downto 0); -- .mem_we_n mem_dq : inout std_logic_vector(63 downto 0) := (others => '0'); -- .mem_dq mem_dqs : inout std_logic_vector(7 downto 0) := (others => '0'); -- .mem_dqs mem_dqs_n : inout std_logic_vector(7 downto 0) := (others => '0'); -- .mem_dqs_n mem_odt : out std_logic_vector(0 downto 0); -- .mem_odt avl_ready : out std_logic; -- avl.waitrequest_n avl_burstbegin : in std_logic := '0'; -- .beginbursttransfer avl_addr : in std_logic_vector(24 downto 0) := (others => '0'); -- .address avl_rdata_valid : out std_logic; -- .readdatavalid avl_rdata : out std_logic_vector(255 downto 0); -- .readdata avl_wdata : in std_logic_vector(255 downto 0) := (others => '0'); -- .writedata avl_be : in std_logic_vector(31 downto 0) := (others => '0'); -- .byteenable avl_read_req : in std_logic := '0'; -- .read avl_write_req : in std_logic := '0'; -- .write avl_size : in std_logic_vector(2 downto 0) := (others => '0'); -- .burstcount local_init_done : out std_logic; -- status.local_init_done local_cal_success : out std_logic; -- .local_cal_success local_cal_fail : out std_logic; -- .local_cal_fail oct_rdn : in std_logic := '0'; -- oct.rdn oct_rup : in std_logic := '0' -- .rup ); end ddr2ctrl; architecture sim of ddr2ctrl is signal lafi_clk, lafi_rst_n: std_ulogic; signal lafi_half_clk: std_ulogic; begin afi_clk <= lafi_clk; afi_half_clk <= lafi_half_clk; afi_reset_n <= lafi_rst_n; mem_a <= (others => '0'); mem_ba <= (others => '0'); mem_ck <= (others => '0'); mem_ck_n <= (others => '1'); mem_cke <= (others => '0'); mem_cs_n <= (others => '1'); mem_dm <= (others => '0'); mem_ras_n <= (others => '1'); mem_cas_n <= (others => '1'); mem_we_n <= (others => '1'); mem_dq <= (others => 'Z'); mem_dqs <= (others => 'Z'); mem_dqs_n <= (others => 'Z'); mem_odt <= (others => '0'); avl_ready <= '1'; local_init_done <= '1'; local_cal_success <= '1'; local_cal_fail <= '0'; -- 200 MHz clock clkproc: process begin lafi_clk <= '0'; lafi_half_clk <= '0'; loop wait for 2.5 ns; lafi_clk <= not lafi_clk; if lafi_clk='0' then lafi_half_clk <= not lafi_half_clk; end if; end loop; end process; rstproc: process begin lafi_rst_n <= '0'; wait for 10 ns; loop if global_reset_n='0' then lafi_rst_n <= '0'; wait until global_reset_n/='0'; wait until rising_edge(lafi_clk); end if; lafi_rst_n <= '1'; wait until global_reset_n='0'; end loop; end process; avlproc: process subtype BYTE is std_logic_vector(7 downto 0); type MEM is array(0 to ((2**20)-1)) of BYTE; variable MEMA: MEM; procedure load_srec is file TCF : text open read_mode is "ram.srec"; variable L1: line; variable CH: character; variable ai: integer; variable rectype: std_logic_vector(3 downto 0); variable recaddr: std_logic_vector(31 downto 0); variable reclen: std_logic_vector(7 downto 0); variable recdata: std_logic_vector(0 to 16*8-1); variable len: integer; begin L1:= new string'(""); --' while not endfile(TCF) loop readline(TCF,L1); if (L1'length /= 0) then --' while (not (L1'length=0)) and (L1(L1'left) = ' ') loop std.textio.read(L1,CH); end loop; if L1'length > 0 then --' read(L1, ch); if (ch = 'S') or (ch = 's') then hread(L1, rectype); hread(L1, reclen); len := conv_integer(reclen)-1; recaddr := (others => '0'); case rectype is when "0001" => hread(L1, recaddr(15 downto 0)); len := len-2; when "0010" => hread(L1, recaddr(23 downto 0)); len := len-3; when "0011" => hread(L1, recaddr); len := len-4; when others => next; end case; hread(L1, recdata(0 to 8*len-1)); recaddr(31 downto 20) := (others => '0'); ai := conv_integer(recaddr); -- print("Setting " & tost(len) & "bytes at " & tost(recaddr)); for i in 0 to len-1 loop MEMA(ai+i) := recdata((i*8) to (i*8+7)); end loop; end if; end if; end if; end loop; end load_srec; constant avldbits: integer := 256; variable outqueue: std_logic_vector(0 to 4*avldbits-1) := (others => 'X'); variable outqueue_valid: std_logic_vector(0 to 3) := (others => '0'); variable ai,p: integer; variable wbleft: integer := 0; begin load_srec; loop wait until rising_edge(lafi_clk); avl_rdata_valid <= outqueue_valid(0); avl_rdata <= outqueue(0 to avldbits-1); outqueue(0 to 3*avldbits-1) := outqueue(avldbits to 4*avldbits-1); outqueue(3*avldbits to 4*avldbits-1) := (others => 'X'); outqueue_valid := outqueue_valid(1 to 3) & '0'; if avl_burstbegin='1' then wbleft:=0; end if; if lafi_rst_n='0' then outqueue_valid := (others => '0'); elsif avl_read_req='1' then ai := conv_integer(avl_addr(16 downto 0)); p := 0; while outqueue_valid(p)='1' loop p:=p+1; end loop; for x in 0 to conv_integer(avl_size)-1 loop for y in 0 to avldbits/8-1 loop outqueue((p+x)*avldbits+y*8 to (p+x)*avldbits+y*8+7) := MEMA((ai+x)*avldbits/8+y); end loop; outqueue_valid(p+x) := '1'; end loop; elsif avl_write_req='1' then if wbleft=0 then wbleft := conv_integer(avl_size); ai := conv_integer(avl_addr(16 downto 0)); end if; for y in 0 to avldbits/8-1 loop if avl_be(avldbits/8-1-y)='1' then MEMA(ai*avldbits/8+y) := avl_wdata(avldbits-8*y-1 downto avldbits-8*y-8); end if; end loop; wbleft := wbleft-1; ai := ai+1; end if; end loop; end process; end;
gpl-2.0
fbf6bce91dcaf8b865bd7432641dde3f
0.460395
3.738903
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep3c25/testbench.vhd
1
10,532
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ -- Altera Cyclone-III LEON3 Demonstration design test bench -- Copyright (C) 2007 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library cypress; use cypress.components.all; use work.debug.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 20; -- system clock period romwidth : integer := 8; -- rom data width (8/32) romdepth : integer := 23; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 20; -- ram address depth srambanks : integer := 1 -- number of ram banks ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal clk : std_logic := '0'; signal clkout, pllref : std_ulogic; signal Rst : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal address : std_logic_vector(25 downto 0); signal data : std_logic_vector(31 downto 0); signal romsn : std_ulogic; signal iosn : std_ulogic; signal oen : std_ulogic; signal writen : std_ulogic; signal dsuen, dsutx, dsurx, dsubren, dsuact : std_ulogic; signal dsurst : std_ulogic; signal test : std_ulogic; signal error : std_logic; signal gpio : std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0); signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal clk2 : std_ulogic := '1'; signal ssram_cen : std_logic; signal ssram_wen : std_logic; signal ssram_bw : std_logic_vector (0 to 3); signal ssram_oen : std_ulogic; signal ssram_clk : std_ulogic; signal ssram_adscn : std_ulogic; signal ssram_adsp_n : std_ulogic; signal ssram_adv_n : std_ulogic; signal datazz : std_logic_vector(3 downto 0); -- ddr memory signal ddr_clk : std_logic; signal ddr_clkb : std_logic; signal ddr_clkin : std_logic; signal ddr_cke : std_logic; signal ddr_csb : std_logic; signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (1 downto 0); -- ddr dm signal ddr_dqs : std_logic_vector (1 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (12 downto 0); -- ddr address signal ddr_ba : std_logic_vector (1 downto 0); -- ddr bank address signal ddr_dq : std_logic_vector (15 downto 0); -- ddr data signal plllock : std_ulogic; signal txd1, rxd1 : std_ulogic; --signal txd2, rxd2 : std_ulogic; -- for smc lan chip signal eth_aen : std_ulogic; -- for smsc eth signal eth_readn : std_ulogic; -- for smsc eth signal eth_writen : std_ulogic; -- for smsc eth signal eth_nbe : std_logic_vector(3 downto 0); -- for smsc eth signal eth_datacsn : std_ulogic; constant lresp : boolean := false; signal sa : std_logic_vector(14 downto 0); signal sd : std_logic_vector(31 downto 0); -- ATA signals signal ata_rst : std_logic; signal ata_data : std_logic_vector(15 downto 0); signal ata_da : std_logic_vector(2 downto 0); signal ata_cs0 : std_logic; signal ata_cs1 : std_logic; signal ata_dior : std_logic; signal ata_diow : std_logic; signal ata_iordy : std_logic; signal ata_intrq : std_logic; signal ata_dmack : std_logic; signal cf_gnd_da : std_logic_vector(10 downto 3); signal cf_atasel : std_logic; signal cf_we : std_logic; signal cf_power : std_logic; signal cf_csel : std_logic; begin -- clock and reset clk <= not clk after ct * 1 ns; ddr_clkin <= not clk after ct * 1 ns; rst <= dsurst; dsubren <= '1'; rxd1 <= '1'; address(0) <= '0'; -- ddr_dqs <= (others => 'L'); d3 : entity work.leon3mp generic map (fabtech, memtech, padtech, clktech, ncpu, disas, dbguart, pclow ) port map (rst, clk, error, address(25 downto 1), data, romsn, oen, writen, open, ssram_cen, ssram_wen, ssram_bw, ssram_oen, ssram_clk, ssram_adscn, iosn, ddr_clk, ddr_clkb, ddr_cke, ddr_csb, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_ad, ddr_ba, ddr_dq, dsubren, dsuact, rxd1, txd1, gpio); ddr0 : mt46v16m16 generic map (index => -1, fname => sdramfile) port map( Dq => ddr_dq(15 downto 0), Dqs => ddr_dqs(1 downto 0), Addr => ddr_ad, Ba => ddr_ba, Clk => ddr_clk, Clk_n => ddr_clkb, Cke => ddr_cke, Cs_n => ddr_csb, Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, Dm => ddr_dm(1 downto 0)); datazz <= "HHHH"; ssram_adsp_n <= '1'; ssram_adv_n <= '1'; ssram0 : cy7c1380d generic map (fname => sramfile) port map( ioDq(35 downto 32) => datazz, ioDq(31 downto 0) => data, iAddr => address(20 downto 2), iMode => gnd, inGW => vcc, inBWE => ssram_wen, inADV => ssram_adv_n, inADSP => ssram_adsp_n, inADSC => ssram_adscn, iClk => ssram_clk, inBwa => ssram_bw(3), inBwb => ssram_bw(2), inBwc => ssram_bw(1), inBwd => ssram_bw(0), inOE => ssram_oen, inCE1 => ssram_cen, iCE2 => vcc, inCE3 => gnd, iZz => gnd); -- 16 bit prom prom0 : sram16 generic map (index => 4, abits => romdepth, fname => promfile) port map (address(romdepth downto 1), data(31 downto 16), gnd, gnd, romsn, writen, oen); error <= 'H'; -- ERROR pull-up iuerr : process begin wait for 2500 ns; if to_x01(error) = '1' then wait on error; end if; assert (to_x01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; end process; data <= buskeep(data), (others => 'H') after 250 ns; sd <= buskeep(sd), (others => 'H') after 250 ns; test0 : grtestmod port map ( rst, clk, error, address(21 downto 2), data, iosn, oen, writen, open); dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; dsurst <= '0'; wait for 500 ns; dsurst <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#02#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#24#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#03#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#fc#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#2f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#6f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#11#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#00#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#04#, txp); txa(dsutx, 16#00#, 16#02#, 16#20#, 16#01#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#02#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#43#, 16#10#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#40#, 16#00#, 16#24#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#24#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#70#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#03#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end ;
gpl-2.0
847c44ca96fda002c1518686e4be7e96
0.586593
3.052754
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-vc707/testbench.vhd
1
21,601
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library micron; use micron.all; library techmap; use techmap.gencomp.all; use work.debug.all; use work.config.all; entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; testahb : boolean := true; USE_MIG_INTERFACE_MODEL : boolean := false ); end; architecture behav of testbench is -- DDR3 Simulation parameters constant SIM_BYPASS_INIT_CAL : string := "FAST"; -- # = "OFF" - Complete memory init & -- calibration sequence -- # = "SKIP" - Not supported -- # = "FAST" - Complete memory init & use -- abbreviated calib sequence constant SIMULATION : string := "TRUE"; -- Should be TRUE during design simulations and -- FALSE during implementations constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal clk : std_logic := '0'; signal Rst : std_logic := '0'; signal address : std_logic_vector(25 downto 0); signal data : std_logic_vector(15 downto 0); signal button : std_logic_vector(3 downto 0) := "0000"; signal genio : std_logic_vector(59 downto 0); signal romsn : std_logic; signal oen : std_ulogic; signal writen : std_ulogic; signal adv : std_logic; signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal txd1 , rxd1 , dsurx : std_logic; signal txd2 , rxd2 , dsutx : std_logic; signal ctsn1 , rtsn1 , dsuctsn : std_ulogic; signal ctsn2 , rtsn2 , dsurtsn : std_ulogic; signal phy_mii_data : std_logic; signal phy_tx_clk : std_ulogic; signal phy_rx_clk : std_ulogic; signal phy_rx_data : std_logic_vector(7 downto 0); signal phy_dv : std_ulogic; signal phy_rx_er : std_ulogic; signal phy_col : std_ulogic; signal phy_crs : std_ulogic; signal phy_tx_data : std_logic_vector(7 downto 0); signal phy_tx_en : std_ulogic; signal phy_tx_er : std_ulogic; signal phy_mii_clk : std_ulogic; signal phy_rst_n : std_ulogic; signal phy_gtx_clk : std_ulogic; signal phy_mii_int_n : std_ulogic; signal clk27 : std_ulogic := '0'; signal clk200p : std_ulogic := '0'; signal clk200n : std_ulogic := '1'; signal clk33 : std_ulogic := '0'; signal clkethp : std_ulogic := '0'; signal clkethn : std_ulogic := '1'; signal txp1 : std_logic; signal txn : std_logic; signal rxp : std_logic := '1'; signal rxn : std_logic := '0'; signal iic_scl : std_ulogic; signal iic_sda : std_ulogic; signal ddc_scl : std_ulogic; signal ddc_sda : std_ulogic; signal dvi_iic_scl : std_logic; signal dvi_iic_sda : std_logic; signal tft_lcd_data : std_logic_vector(11 downto 0); signal tft_lcd_clk_p : std_ulogic; signal tft_lcd_clk_n : std_ulogic; signal tft_lcd_hsync : std_ulogic; signal tft_lcd_vsync : std_ulogic; signal tft_lcd_de : std_ulogic; signal tft_lcd_reset_b : std_ulogic; -- DDR3 memory signal ddr3_dq : std_logic_vector(63 downto 0); signal ddr3_dqs_p : std_logic_vector(7 downto 0); signal ddr3_dqs_n : std_logic_vector(7 downto 0); signal ddr3_addr : std_logic_vector(13 downto 0); signal ddr3_ba : std_logic_vector(2 downto 0); signal ddr3_ras_n : std_logic; signal ddr3_cas_n : std_logic; signal ddr3_we_n : std_logic; signal ddr3_reset_n : std_logic; signal ddr3_ck_p : std_logic_vector(0 downto 0); signal ddr3_ck_n : std_logic_vector(0 downto 0); signal ddr3_cke : std_logic_vector(0 downto 0); signal ddr3_cs_n : std_logic_vector(0 downto 0); signal ddr3_dm : std_logic_vector(7 downto 0); signal ddr3_odt : std_logic_vector(0 downto 0); -- SPI flash signal spi_sel_n : std_ulogic; signal spi_clk : std_ulogic; signal spi_mosi : std_ulogic; signal dsurst : std_ulogic; signal errorn : std_logic; signal switch : std_logic_vector(4 downto 0); -- I/O port signal led : std_logic_vector(6 downto 0); -- I/O port constant lresp : boolean := false; signal tdqs_n : std_logic; signal gmii_tx_clk : std_logic; signal gmii_rx_clk : std_logic; signal gmii_txd : std_logic_vector(7 downto 0); signal gmii_tx_en : std_logic; signal gmii_tx_er : std_logic; signal gmii_rxd : std_logic_vector(7 downto 0); signal gmii_rx_dv : std_logic; signal gmii_rx_er : std_logic; signal configuration_finished : boolean; signal speed_is_10_100 : std_logic; signal speed_is_100 : std_logic; signal usb_clkout : std_logic := '0'; signal usb_d : std_logic_vector(7 downto 0); signal usb_resetn : std_ulogic; signal usb_nxt : std_ulogic; signal usb_stp : std_ulogic; signal usb_dir : std_ulogic; -- GRUSB_DCL test signals signal ddelay : std_ulogic := '0'; signal dstart : std_ulogic := '0'; signal drw : std_ulogic; signal daddr : std_logic_vector(31 downto 0); signal dlen : std_logic_vector(14 downto 0); signal ddi : grusb_dcl_debug_data; signal ddone : std_ulogic; signal ddo : grusb_dcl_debug_data; signal phy_mdio : std_logic; signal phy_mdc : std_ulogic; component leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; testahb : boolean := false; SIM_BYPASS_INIT_CAL : string := "OFF"; SIMULATION : string := "FALSE"; USE_MIG_INTERFACE_MODEL : boolean := false; autonegotiation : integer := 1 ); port ( reset : in std_ulogic; clk200p : in std_ulogic; -- 200 MHz clock clk200n : in std_ulogic; -- 200 MHz clock address : out std_logic_vector(25 downto 0); data : inout std_logic_vector(15 downto 0); oen : out std_ulogic; writen : out std_ulogic; romsn : out std_logic; adv : out std_logic; ddr3_dq : inout std_logic_vector(63 downto 0); ddr3_dqs_p : inout std_logic_vector(7 downto 0); ddr3_dqs_n : inout std_logic_vector(7 downto 0); ddr3_addr : out std_logic_vector(13 downto 0); ddr3_ba : out std_logic_vector(2 downto 0); ddr3_ras_n : out std_logic; ddr3_cas_n : out std_logic; ddr3_we_n : out std_logic; ddr3_reset_n : out std_logic; ddr3_ck_p : out std_logic_vector(0 downto 0); ddr3_ck_n : out std_logic_vector(0 downto 0); ddr3_cke : out std_logic_vector(0 downto 0); ddr3_cs_n : out std_logic_vector(0 downto 0); ddr3_dm : out std_logic_vector(7 downto 0); ddr3_odt : out std_logic_vector(0 downto 0); dsurx : in std_ulogic; dsutx : out std_ulogic; dsuctsn : in std_ulogic; dsurtsn : out std_ulogic; button : in std_logic_vector(3 downto 0); switch : inout std_logic_vector(4 downto 0); led : out std_logic_vector(6 downto 0); iic_scl : inout std_ulogic; iic_sda : inout std_ulogic; usb_refclk_opt : in std_logic; usb_clkout : in std_logic; usb_d : inout std_logic_vector(7 downto 0); usb_nxt : in std_logic; usb_stp : out std_logic; usb_dir : in std_logic; usb_resetn : out std_ulogic; gtrefclk_p : in std_logic; gtrefclk_n : in std_logic; txp : out std_logic; txn : out std_logic; rxp : in std_logic; rxn : in std_logic; emdio : inout std_logic; emdc : out std_ulogic; eint : in std_ulogic; erst : out std_ulogic; can_txd : out std_logic_vector(0 to CFG_CAN_NUM-1); can_rxd : in std_logic_vector(0 to CFG_CAN_NUM-1); spi_data_out : in std_logic; spi_data_in : out std_ulogic; spi_data_cs_b : out std_ulogic; spi_clk : out std_ulogic ); end component; component ddr3_model generic( ADDR_BITS : integer := 14; BA_BITS : integer := 3; DM_BITS : integer := 1; DQ_BITS : integer := 8; DQS_BITS : integer := 1 ); port( rst_n : in std_logic; ck : in std_logic; ck_n : in std_logic; cke : in std_logic; cs_n : in std_logic; ras_n : in std_logic; cas_n : in std_logic; we_n : in std_logic; dm_tdqs : inout std_logic; ba : in std_logic_vector(2 downto 0); addr : in std_logic_vector(13 downto 0); dq : inout std_logic_vector(7 downto 0); dqs : inout std_logic; dqs_n : inout std_logic; tdqs_n : out std_logic_vector(0 to 0); odt : in std_logic ); end component; begin -- clock and reset clk200p <= not clk200p after 2.5 ns; clk200n <= not clk200n after 2.5 ns; clkethp <= not clkethp after 4 ns; clkethn <= not clkethp after 4 ns; rst <= not dsurst; rxd1 <= 'H'; ctsn1 <= '0'; rxd2 <= 'H'; ctsn2 <= '0'; button <= "0000"; switch(3 downto 0) <= "0000"; cpu : leon3mp generic map ( fabtech => fabtech, memtech => memtech, padtech => padtech, clktech => clktech, disas => disas, dbguart => dbguart, pclow => pclow, testahb => testahb, SIM_BYPASS_INIT_CAL => SIM_BYPASS_INIT_CAL, SIMULATION => SIMULATION, USE_MIG_INTERFACE_MODEL => USE_MIG_INTERFACE_MODEL, autonegotiation => 0 ) port map ( reset => rst, clk200p => clk200p, clk200n => clk200n, address => address, data => data, oen => oen, writen => writen, romsn => romsn, adv => adv, ddr3_dq => ddr3_dq, ddr3_dqs_p => ddr3_dqs_p, ddr3_dqs_n => ddr3_dqs_n, ddr3_addr => ddr3_addr, ddr3_ba => ddr3_ba, ddr3_ras_n => ddr3_ras_n, ddr3_cas_n => ddr3_cas_n, ddr3_we_n => ddr3_we_n, ddr3_reset_n => ddr3_reset_n, ddr3_ck_p => ddr3_ck_p, ddr3_ck_n => ddr3_ck_n, ddr3_cke => ddr3_cke, ddr3_cs_n => ddr3_cs_n, ddr3_dm => ddr3_dm, ddr3_odt => ddr3_odt, dsurx => dsurx, dsutx => dsutx, dsuctsn => dsuctsn, dsurtsn => dsurtsn, button => button, switch => switch, led => led, iic_scl => iic_scl, iic_sda => iic_sda, usb_refclk_opt => '0', usb_clkout => usb_clkout, usb_d => usb_d, usb_nxt => usb_nxt, usb_stp => usb_stp, usb_dir => usb_dir, usb_resetn => usb_resetn, gtrefclk_p => clkethp, gtrefclk_n => clkethn, txp => OPEN, txn => OPEN, rxp => '1', rxn => '1', emdio => phy_mdio, emdc => phy_mdc, eint => '0', erst => OPEN, can_txd => OPEN, can_rxd => "0", spi_data_out => '0', spi_data_in => OPEN, spi_data_cs_b => OPEN, spi_clk => OPEN ); phy0 : if (CFG_GRETH = 1) generate phy_mdio <= 'H'; p0: phy generic map (address => 7) port map(dsurst, phy_mdio, OPEN , OPEN , OPEN , OPEN , OPEN , OPEN , OPEN , "00000000", '0', '0', phy_mdc, clkethp); end generate; prom0 : for i in 0 to 1 generate sr0 : sram generic map (index => i+4, abits => 26, fname => promfile) port map (address(25 downto 0), data(15-i*8 downto 8-i*8), romsn, writen, oen); end generate; -- Memory Models instantiations gen_mem_model : if (USE_MIG_INTERFACE_MODEL /= true) generate ddr3mem : if (CFG_MIG_SERIES7 = 1) generate gen_mem: for i in 0 to 7 generate u1: ddr3_model generic map( ADDR_BITS => 14, BA_BITS => 3, DM_BITS => 1, DQ_BITS => 8, DQS_BITS => 1 ) port map ( rst_n => ddr3_reset_n, ck => ddr3_ck_p(0), ck_n => ddr3_ck_n(0), cke => ddr3_cke(0), cs_n => ddr3_cs_n(0), ras_n => ddr3_ras_n, cas_n => ddr3_cas_n, we_n => ddr3_we_n, dm_tdqs => ddr3_dm(i), ba => ddr3_ba, addr => ddr3_addr, dq => ddr3_dq((8*i+7) downto (8*i)), dqs => ddr3_dqs_p(i), dqs_n => ddr3_dqs_n(i), tdqs_n => open, odt => ddr3_odt(0) ); end generate gen_mem; end generate ddr3mem; end generate gen_mem_model; mig_mem_model : if (USE_MIG_INTERFACE_MODEL = true) generate ddr3_dq <= (others => 'Z'); ddr3_dqs_p <= (others => 'Z'); ddr3_dqs_n <= (others => 'Z'); end generate mig_mem_model; errorn <= led(1); errorn <= 'H'; -- ERROR pull-up usbtr: if (CFG_GRUSBHC = 1) generate u0: ulpi port map (usb_clkout, usb_d, usb_nxt, usb_stp, usb_dir, usb_resetn); end generate usbtr; usbdevsim: if (CFG_GRUSBDC = 1) generate u0: grusbdcsim generic map (functm => 0, keepclk => 1) port map (usb_resetn, usb_clkout, usb_d, usb_nxt, usb_stp, usb_dir); end generate usbdevsim; usb_dclsim: if (CFG_GRUSB_DCL = 1) generate u0: grusb_dclsim generic map (functm => 0, keepclk => 1) port map (usb_resetn, usb_clkout, usb_d, usb_nxt, usb_stp, usb_dir, ddelay, dstart, drw, daddr, dlen, ddi, ddone, ddo); usb_dcl_proc : process begin wait for 10 ns; Print("GRUSB_DCL test started"); wait until rising_edge(ddone); -- Write 128 bytes to memory daddr <= X"40000000"; dlen <= conv_std_logic_vector(32,15); for i in 0 to 127 loop ddi(i) <= conv_std_logic_vector(i+8,8); end loop; -- i grusb_dcl_write(usb_clkout, drw, dstart, ddone); -- Read back written data grusb_dcl_read(usb_clkout, drw, dstart, ddone); -- Compare data for i in 0 to 127 loop if ddo(i) /= ddi(i) then Print("ERROR: Data mismatch using GRUSB_DCL"); end if; end loop; Print("GRUSB_DCL test finished"); wait; end process; end generate usb_dclsim; iuerr : process begin wait for 210 us; -- This is for proper DDR3 behaviour durign init phase not needed durin simulation wait on led(3); -- DDR3 Memory Init ready wait for 5000 ns; if to_x01(errorn) = '1' then wait on errorn; end if; assert (to_x01(errorn) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; -- this should be a failure end process; data <= buskeep(data) after 5 ns; dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 320 * 1 ns; begin dsutx <= '1'; dsurst <= '0'; switch(4) <= '0'; wait for 2500 ns; wait for 210 us; -- This is for proper DDR3 behaviour durign init phase not needed durin simulation dsurst <= '1'; switch(4) <= '1'; if (USE_MIG_INTERFACE_MODEL /= true) then wait on led(3); -- Wait for DDR3 Memory Init ready end if; report "Start DSU transfer"; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- Reads from memory and DSU register to mimic GRMON during simulation l1 : loop txc(dsutx, 16#80#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#04#, txp); rxi(dsurx, w32, txp, lresp); --report "DSU read memory " & tost(w32); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); rxi(dsurx, w32, txp, lresp); --report "DSU Break and Single Step register" & tost(w32); end loop l1; wait; -- ** This is only kept for reference -- -- do test read and writes to DDR3 to check status -- Write txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#01#, 16#23#, 16#45#, 16#67#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#04#, txp); txa(dsutx, 16#89#, 16#AB#, 16#CD#, 16#EF#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#08#, txp); txa(dsutx, 16#08#, 16#19#, 16#2A#, 16#3B#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#0C#, txp); txa(dsutx, 16#4C#, 16#5D#, 16#6E#, 16#7F#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#04#, txp); rxi(dsurx, w32, txp, lresp); report "* Read " & tost(w32); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#08#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#0C#, txp); rxi(dsurx, w32, txp, lresp); wait; -- Register 0x90000000 (DSU Control Register) -- Data 0x0000202e (b0010 0000 0010 1110) -- [0] - Trace Enable -- [1] - Break On Error -- [2] - Break on IU watchpoint -- [3] - Break on s/w break points -- -- [4] - (Break on trap) -- [5] - Break on error traps -- [6] - Debug mode (Read mode only) -- [7] - DSUEN (read mode) -- -- [8] - DSUBRE (read mode) -- [9] - Processor mode error (clears error) -- [10] - processor halt (returns 1 if processor halted) -- [11] - power down mode (return 1 if processor in power down mode) txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#80#, 16#02#, txp); wait; txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#20#, 16#2e#, txp); wait for 25000 ns; txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#01#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#24#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0D#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#70#, 16#11#, 16#78#, txp); txa(dsutx, 16#91#, 16#00#, 16#00#, 16#0D#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#44#, txp); txa(dsutx, 16#00#, 16#00#, 16#20#, 16#00#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#44#, txp); wait; end; begin dsuctsn <= '0'; dsucfg(dsutx, dsurx); wait; end process; end ;
gpl-2.0
875aba403f577b531cdbed403f2daead
0.534836
3.307963
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/jtag/ahbjtag_bsd.vhd
1
3,337
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahbjtag -- File: ahbjtag.vhd -- Author: Edvin Catovic, Jiri Gaisler - Gaisler Research -- Description: JTAG communication link with AHB master interface ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.misc.all; use gaisler.libjtagcom.all; use gaisler.jtag.all; entity ahbjtag_bsd is generic ( tech : integer range 0 to NTECH := 0; hindex : integer := 0; nsync : integer range 1 to 2 := 1; ainst : integer range 0 to 255 := 2; dinst : integer range 0 to 255 := 3); port ( rst : in std_ulogic; clk : in std_ulogic; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type; asel : in std_ulogic; dsel : in std_ulogic; tck : in std_ulogic; regi : in std_ulogic; shift : in std_ulogic; rego : out std_ulogic ); end; architecture struct of ahbjtag_bsd is -- Set REREAD to 1 to include support for re-read operation when host reads -- out data register before jtagcom has completed the current AMBA access and -- returned to state 'shft'. constant REREAD : integer := 1; constant REVISION : integer := REREAD; signal dmai : ahb_dma_in_type; signal dmao : ahb_dma_out_type; signal ltapi : tap_in_type; signal ltapo : tap_out_type; signal trst: std_ulogic; begin ahbmst0 : ahbmst generic map (hindex => hindex, venid => VENDOR_GAISLER, devid => GAISLER_AHBJTAG, version => REVISION) port map (rst, clk, dmai, dmao, ahbi, ahbo); jtagcom0 : jtagcom generic map (isel => 1, nsync => nsync, ainst => ainst, dinst => dinst, reread => REREAD) port map (rst, clk, ltapo, ltapi, dmao, dmai, tck, trst); ltapo.asel <= asel; ltapo.dsel <= dsel; ltapo.tck <= tck; ltapo.tdi <= regi; ltapo.shift <= shift; ltapo.reset <= '0'; ltapo.inst <= (others => '0'); rego <= ltapi.tdo; trst <= '1'; -- pragma translate_off bootmsg : report_version generic map ("ahbjtag AHB Debug JTAG rev " & tost(REVISION)); -- pragma translate_on end;
gpl-2.0
cb73bb565a9c89924d5c7050c6c75ebb
0.609829
3.880233
false
false
false
false
Luisda199824/ProcesadorMonociclo
TB_ProgrammingCounter.vhd
1
1,418
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY TB_ProgrammingCounter IS END TB_ProgrammingCounter; ARCHITECTURE behavior OF TB_ProgrammingCounter IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT ProgrammingCounter PORT( clk : IN std_logic; rst : IN std_logic; dato : IN std_logic_vector(31 downto 0); PCOut : OUT std_logic_vector(31 downto 0) ); END COMPONENT; --Inputs signal clk : std_logic := '0'; signal rst : std_logic := '0'; signal dato : std_logic_vector(31 downto 0) := (others => '0'); --Outputs signal PCOut : std_logic_vector(31 downto 0); -- Clock period definitions constant clk_period : time := 20 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: ProgrammingCounter PORT MAP ( clk => clk, rst => rst, dato => dato, PCOut => PCOut ); -- Clock process definitions clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process begin dato <= x"000C0000"; rst <= '0'; wait for 40 ns; rst <= '1'; wait for 10 ns; rst <= '0'; dato <= x"A0000000"; wait for 10 ns; rst <= '1'; wait for 10 ns; wait; end process; END;
mit
f45172610d2b3ab9e0c1c301622a2030
0.596615
3.384248
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/pci/pci.vhd
1
18,918
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: pci -- File: pci.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Package with component and type declarations for PCI cores ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; library gaisler; package pci is type pci_in_type is record rst : std_ulogic; gnt : std_ulogic; idsel : std_ulogic; ad : std_logic_vector(31 downto 0); cbe : std_logic_vector(3 downto 0); frame : std_ulogic; irdy : std_ulogic; trdy : std_ulogic; devsel : std_ulogic; stop : std_ulogic; lock : std_ulogic; perr : std_ulogic; serr : std_ulogic; par : std_ulogic; host : std_ulogic; pci66 : std_ulogic; pme_status : std_ulogic; int : std_logic_vector(3 downto 0); -- D downto A end record; type pci_out_type is record aden : std_ulogic; vaden : std_logic_vector(31 downto 0); cbeen : std_logic_vector(3 downto 0); frameen : std_ulogic; irdyen : std_ulogic; trdyen : std_ulogic; devselen : std_ulogic; stopen : std_ulogic; ctrlen : std_ulogic; perren : std_ulogic; paren : std_ulogic; reqen : std_ulogic; locken : std_ulogic; serren : std_ulogic; inten : std_logic; vinten : std_logic_vector(3 downto 0); req : std_ulogic; ad : std_logic_vector(31 downto 0); cbe : std_logic_vector(3 downto 0); frame : std_ulogic; irdy : std_ulogic; trdy : std_ulogic; devsel : std_ulogic; stop : std_ulogic; perr : std_ulogic; serr : std_ulogic; par : std_ulogic; lock : std_ulogic; power_state : std_logic_vector(1 downto 0); pme_enable : std_ulogic; pme_clear : std_ulogic; int : std_logic; rst : std_ulogic; end record; constant pci_out_none : pci_out_type := ( aden => '1', vaden => (others => '1'), cbeen => (others => '1'), frameen => '1', irdyen => '1', trdyen => '1', devselen => '1', stopen => '1', ctrlen => '1', perren => '1', paren => '1', reqen => '1', locken => '1', serren => '1', inten => '1', vinten => (others => '1'), req => '1', ad => (others => '0'), cbe => (others => '1'), frame => '1', irdy => '1', trdy => '1', devsel => '1', stop => '1', perr => '1', serr => '1', par => '1', lock => '1', power_state => (others => '1'), pme_enable => '1',pme_clear => '1', int => '1', rst => '1'); component pci_target generic ( hindex : integer := 0; abits : integer := 21; device_id : integer := 0; -- PCI device ID vendor_id : integer := 0; -- PCI vendor ID nsync : integer range 1 to 2 := 1; -- 1 or 2 sync regs between clocks oepol : integer := 0 ); port( rst : in std_ulogic; clk : in std_ulogic; pciclk : in std_ulogic; pcii : in pci_in_type; pcio : out pci_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type ); end component; component pci_mt generic ( hmstndx : integer := 0; abits : integer := 21; device_id : integer := 0; -- PCI device ID vendor_id : integer := 0; -- PCI vendor ID master : integer := 1; -- Enable PCI Master hslvndx : integer := 0; haddr : integer := 16#F00#; hmask : integer := 16#F00#; ioaddr : integer := 16#000#; nsync : integer range 1 to 2 := 1; -- 1 or 2 sync regs between clocks oepol : integer := 0 ); port( rst : in std_logic; clk : in std_logic; pciclk : in std_logic; pcii : in pci_in_type; pcio : out pci_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type ); end component; component dmactrl generic ( hindex : integer := 0; slvindex : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; pirq : integer := 0; blength : integer := 4); port ( rst : in std_logic; clk : in std_logic; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbsi0 : in ahb_slv_in_type; ahbso0 : out ahb_slv_out_type; ahbsi1 : out ahb_slv_in_type; ahbso1 : in ahb_slv_out_type); end component; component pci_mtf generic ( memtech : integer := DEFMEMTECH; hmstndx : integer := 0; dmamst : integer := NAHBMST; readpref : integer := 0; abits : integer := 21; dmaabits : integer := 26; fifodepth : integer := 3; -- FIFO depth device_id : integer := 0; -- PCI device ID vendor_id : integer := 0; -- PCI vendor ID master : integer := 1; -- Enable PCI Master hslvndx : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; haddr : integer := 16#F00#; hmask : integer := 16#F00#; ioaddr : integer := 16#000#; irq : integer := 0; irqmask : integer := 0; nsync : integer range 1 to 2 := 2; -- 1 or 2 sync regs between clocks oepol : integer := 0; endian : integer := 0; class_code: integer := 16#0B4000#; rev : integer := 0; scanen : integer := 0; syncrst : integer := 0; hostrst : integer := 0); port( rst : in std_logic; clk : in std_logic; pciclk : in std_logic; pcii : in pci_in_type; pcio : out pci_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type ); end component; component pcitrace generic ( depth : integer range 6 to 12 := 8; iregs : integer := 1; memtech : integer := DEFMEMTECH; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#f00# ); port ( rst : in std_ulogic; clk : in std_ulogic; pciclk : in std_ulogic; pcii : in pci_in_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type ); end component; component pcipads generic ( padtech : integer := 0; noreset : integer := 0; oepol : integer := 0; host : integer := 1; int : integer := 0; no66 : integer := 0; onchipreqgnt : integer := 0; drivereset : integer := 0; constidsel : integer := 0; level : integer := pci33; voltage : integer := x33v ); port ( pci_rst : inout std_logic; pci_gnt : in std_ulogic; pci_idsel : in std_ulogic; pci_lock : inout std_ulogic; pci_ad : inout std_logic_vector(31 downto 0); pci_cbe : inout std_logic_vector(3 downto 0); pci_frame : inout std_logic; pci_irdy : inout std_logic; pci_trdy : inout std_logic; pci_devsel : inout std_logic; pci_stop : inout std_logic; pci_perr : inout std_logic; pci_par : inout std_logic; pci_req : inout std_logic; -- tristate pad but never read pci_serr : inout std_logic; -- open drain output pci_host : in std_ulogic; pci_66 : in std_ulogic; pcii : out pci_in_type; pcio : in pci_out_type; pci_int : inout std_logic_vector(3 downto 0) ); end component; component pcidma generic ( memtech : integer := DEFMEMTECH; dmstndx : integer := 0; dapbndx : integer := 0; dapbaddr : integer := 0; dapbmask : integer := 16#fff#; dapbirq : integer := 0; blength : integer := 16; mstndx : integer := 0; abits : integer := 21; dmaabits : integer := 26; fifodepth : integer := 3; -- FIFO depth device_id : integer := 0; -- PCI device ID vendor_id : integer := 0; -- PCI vendor ID slvndx : integer := 0; apbndx : integer := 0; apbaddr : integer := 0; apbmask : integer := 16#fff#; haddr : integer := 16#F00#; hmask : integer := 16#F00#; ioaddr : integer := 16#000#; nsync : integer range 1 to 2 := 2; -- 1 or 2 sync regs between clocks oepol : integer := 0; endian : integer := 0; -- 0 little, 1 big class_code: integer := 16#0B4000#; rev : integer := 0; irq : integer := 0; irqmask : integer := 0; scanen : integer := 0; hostrst : integer := 0; syncrst : integer := 0); port( rst : in std_logic; clk : in std_logic; pciclk : in std_logic; pcii : in pci_in_type; pcio : out pci_out_type; dapbo : out apb_slv_out_type; dahbmo : out ahb_mst_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type ); end component; type pci_ahb_dma_in_type is record address : std_logic_vector(31 downto 0); wdata : std_logic_vector(31 downto 0); start : std_ulogic; burst : std_ulogic; write : std_ulogic; busy : std_ulogic; irq : std_ulogic; size : std_logic_vector(1 downto 0); end record; type pci_ahb_dma_out_type is record start : std_ulogic; active : std_ulogic; ready : std_ulogic; retry : std_ulogic; mexc : std_ulogic; haddr : std_logic_vector(9 downto 0); rdata : std_logic_vector(31 downto 0); end record; component pciahbmst generic ( hindex : integer := 0; hirq : integer := 0; venid : integer := VENDOR_GAISLER; devid : integer := 0; version : integer := 0; chprot : integer := 3; incaddr : integer := 0); port ( rst : in std_ulogic; clk : in std_ulogic; dmai : in pci_ahb_dma_in_type; dmao : out pci_ahb_dma_out_type; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type ); end component; component pcif generic ( device_id : integer := 0; -- PCI device ID vendor_id : integer := 0; -- PCI vendor ID class : integer := 0; revision_id : integer := 0; aaddr_width : integer := 28; maddr_width : integer := 28; pcibars : integer := 1; ahbmasters : integer := 8; fifo_depth : integer := 3; ft : integer := 0; memtech : integer := 0; hmstndx : integer := 0; hslvndx : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; haddr : integer := 16#F00#; hmask : integer := 16#F00#); port( rst : in std_logic; pciclk : in std_logic; pcii : in pci_in_type; pcio : out pci_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type); --debug : out std_logic_vector(233 downto 0)); end component; component pcif_async generic ( device_id : integer := 0; -- PCI device ID vendor_id : integer := 0; -- PCI vendor ID class : integer := 0; revision_id : integer := 0; bar1 : integer := 20; bar2 : integer := 24; bar3 : integer := 0; bar4 : integer := 0; ahbmasters : integer := 28; fifo_depth : integer := 1; ft : integer := 0; nsync : integer := 2; irqctrl : integer := 0; host : integer := 0; memtech : integer := 0; hmstndx : integer := 0; hslvndx : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; haddr : integer := 16#F00#; hmask : integer := 16#F00#; ioaddr : integer := 16#000#; pirq : integer := 0; netlist : integer := 0; debugen : integer := 0; hostrst : integer := 0 ); port( rst : in std_logic; clk : in std_logic; pcirst : in std_logic; pciclk : in std_logic; pcii : in pci_in_type; pcio : out pci_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type--; --debug : out std_logic_vector(255 downto 0) ); end component; component grpci2 generic ( memtech : integer := DEFMEMTECH; tbmemtech : integer := DEFMEMTECH; oepol : integer := 0; hmindex : integer := 0; hdmindex : integer := 0; hsindex : integer := 0; haddr : integer := 0; hmask : integer := 0; ioaddr : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#FFF#; irq : integer := 0; irqmode : integer range 0 to 3 := 0; master : integer range 0 to 1 := 1; target : integer range 0 to 1 := 1; dma : integer range 0 to 1 := 1; tracebuffer : integer range 0 to 16384 := 0; confspace : integer range 0 to 1 := 1; vendorid : integer := 16#0000#; deviceid : integer := 16#0000#; classcode : integer := 16#000000#; revisionid : integer := 16#00#; cap_pointer : integer := 16#40#; ext_cap_pointer : integer := 16#00#; iobase : integer := 16#FFF#; extcfg : integer := 16#0000000#; bar0 : integer range 0 to 31 := 28; bar1 : integer range 0 to 31 := 0; bar2 : integer range 0 to 31 := 0; bar3 : integer range 0 to 31 := 0; bar4 : integer range 0 to 31 := 0; bar5 : integer range 0 to 31 := 0; bar0_map : integer := 16#000000#; bar1_map : integer := 16#000000#; bar2_map : integer := 16#000000#; bar3_map : integer := 16#000000#; bar4_map : integer := 16#000000#; bar5_map : integer := 16#000000#; bartype : integer range 0 to 65535 := 16#0000#; barminsize : integer range 5 to 31 := 12; fifo_depth : integer range 3 to 7 := 3; fifo_count : integer range 2 to 4 := 2; conv_endian : integer range 0 to 1 := 0; -- 1: little (PCI) <~> big (AHB), 0: big (PCI) <=> big (AHB) deviceirq : integer range 0 to 1 := 1; deviceirqmask : integer range 0 to 15 := 16#0#; hostirq : integer range 0 to 1 := 1; hostirqmask : integer range 0 to 15 := 16#0#; nsync : integer range 0 to 2 := 2; hostrst : integer range 0 to 2 := 0;-- 0: PCI reset is never driven, 1: PCI reset is driven from AHB reset if host, 2: PCI reset is always driven from AHB reset bypass : integer range 0 to 1 := 1; ft : integer range 0 to 1 := 0; scantest : integer range 0 to 1 := 0; debug : integer range 0 to 1 := 0; tbapben : integer range 0 to 1 := 0; tbpindex : integer := 0; tbpaddr : integer := 0; tbpmask : integer := 16#F00#; netlist : integer range 0 to 1 := 0; multifunc : integer range 0 to 1 := 0; -- Enables Multi-function support multiint : integer range 0 to 1 := 0; masters : integer := 16#FFFF#; mf1_deviceid : integer := 16#0000#; mf1_classcode : integer := 16#000000#; mf1_revisionid : integer := 16#00#; mf1_bar0 : integer range 0 to 31 := 0; mf1_bar1 : integer range 0 to 31 := 0; mf1_bar2 : integer range 0 to 31 := 0; mf1_bar3 : integer range 0 to 31 := 0; mf1_bar4 : integer range 0 to 31 := 0; mf1_bar5 : integer range 0 to 31 := 0; mf1_bartype : integer range 0 to 65535 := 16#0000#; mf1_bar0_map : integer := 16#000000#; mf1_bar1_map : integer := 16#000000#; mf1_bar2_map : integer := 16#000000#; mf1_bar3_map : integer := 16#000000#; mf1_bar4_map : integer := 16#000000#; mf1_bar5_map : integer := 16#000000#; mf1_cap_pointer : integer := 16#40#; mf1_ext_cap_pointer : integer := 16#00#; mf1_extcfg : integer := 16#0000000#; mf1_masters : integer := 16#0000#); port( rst : in std_logic; clk : in std_logic; pciclk : in std_logic; dirq : in std_logic_vector(3 downto 0); pcii : in pci_in_type; pcio : out pci_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; ahbdmo : out ahb_mst_out_type; ptarst : out std_logic; tbapbi : in apb_slv_in_type := apb_slv_in_none; tbapbo : out apb_slv_out_type; debugo : out std_logic_vector(debug*255 downto 0) ); end component; constant PCI_VENDOR_ESA : integer := 16#16E3#; constant PCI_VENDOR_GAISLER : integer := 16#1AC8#; constant PCI_VENDOR_AEROFLEX : integer := 16#1AD0#; end;
gpl-2.0
82472a04e41393a4e2dca642538239dc
0.526588
3.401294
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/amba/amba_tp.vhd
1
72,434
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --============================================================================-- -- Design unit : AMBA_TestPackage (Package and body declarations) -- -- File name : amba_tp.vhd -- -- Purpose : AMBA AHB and APB interface access procedures -- -- Library : {independent} -- -- Authors : Aeroflex Gaisler AB -- -- Contact : mailto:[email protected] -- http://www.aeroflex.com/gaisler -- -- Disclaimer : All information is provided "as is", there is no warranty that -- the information is correct or suitable for any purpose, -- neither implicit nor explicit. -------------------------------------------------------------------------------- -- Version Author Date Changes -- 0.1 SH 15 Mar 2002 New package -- 0.2 SH 17 Mar 2003 Updated most packages -- 0.3 SH 20 May 2003 Memory based on Integer elements -- 0.4 SH 1 Jul 2003 Name of package changed -- Compare function improved -- AHB 32 bit memory with preload added -- AHB initialisation added -- 0.5 SH 21 Jul 2003 AHB 32 memory with diagnostics added -- 0.6 SH 1 Nov 2003 APB read access data sample made earlier -- AHB 32 memory extended with byte/halfword -- 0.7 SH 25 Jan 2004 AHB read access data output corrected -- AHB 32 memory allows overlay addressing -- 1.7 SH 1 Oct 2004 Ported to GRLIB -- 1.8 SH 1 Jul 2005 Added configuration support for memories -- Modified all procedure declarations -- 1.9 SH 10 Nov 2005 AHB 32 responds with HREADY=0 when error -- 1.11 SH 27 Dec 2004 Split support added, using HSPLIT element -- Proper two-cycle error response implemented -- 1.12 SH 15 Feb 2006 Added bank select to AHB bus accesses -- 1.13 SH 1 May 2009 AHBQuite gave incorrect TP on error resps. -------------------------------------------------------------------------------- library Std; use Std.Standard.all; use Std.TextIO.all; library IEEE; use IEEE.Std_Logic_1164.all; library GRLIB; use GRLIB.AMBA.all; use GRLIB.StdLib.all; use GRLIB.StdIO.all; package AMBA_TestPackage is ----------------------------------------------------------------------------- -- AMBA APB write access ----------------------------------------------------------------------------- procedure APBInit( signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; constant InstancePath: in String := "APBInit"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := True); ----------------------------------------------------------------------------- -- AMBA APB write access ----------------------------------------------------------------------------- procedure APBWrite( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA APB read access ----------------------------------------------------------------------------- procedure APBQuiet( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA APB read access ----------------------------------------------------------------------------- procedure APBRead( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBRead"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA APB read access ----------------------------------------------------------------------------- procedure APBComp( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(31 downto 0); variable RxData: out Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- Initialise AMBA AHB interface ----------------------------------------------------------------------------- procedure AHBInit( signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; constant InstancePath: in String := "AHBInit"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := True); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure AHBWriteQuiet( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure AHBWrite( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure AHBQuiet( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure AHBRead( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBRead"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure AHBComp( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(31 downto 0); variable RxData: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0); ----------------------------------------------------------------------------- -- Diagnstics types for behavioural model of memory with AHB interface ----------------------------------------------------------------------------- type AHB_Diagnostics_In_Type is record HADDR: Std_Logic_Vector(31 downto 0); HWRITE: Std_ULogic; HWDATA: Std_Logic_Vector(31 downto 0); HRESP: Std_Logic_Vector(1 downto 0); -- response type HSPLIT: Std_Logic_Vector(NAHBMST-1 downto 0); -- split completion end record AHB_Diagnostics_In_Type; type AHB_Diagnostics_Out_Type is record HRDATA: Std_Logic_Vector(31 downto 0); end record AHB_Diagnostics_Out_Type; constant AHB_Diagnostics_Init: AHB_Diagnostics_In_Type := (X"00000000", '0', X"00000000", HRESP_OKAY, zero32(NAHBMST-1 downto 0)); ----------------------------------------------------------------------------- -- Behavioural model of memory with AHB interface, no wait states ----------------------------------------------------------------------------- procedure AHBMemory( constant gAWidth: in Positive := 15; -- address width constant gDWidth: in Positive := 8; -- data width signal HCLK: in Std_ULogic; signal HRESETn: in Std_ULogic; signal AHBIn: in AHB_Slv_In_Type; signal AHBOut: out AHB_Slv_Out_Type; constant InstancePath: in String := "AHBMemory"; constant ScreenOutput: in Boolean := False; constant HINDEX: in Integer := 0; constant HADDR: in Integer := 0; constant HMASK: in Integer := 16#FFF#); ----------------------------------------------------------------------------- -- Behavioural model of memory with AMBA AHB interface, no wait states ----------------------------------------------------------------------------- procedure AHBMemory32( constant gAWidth: in Positive := 18; -- address width signal HCLK: in Std_ULogic; signal HRESETn: in Std_ULogic; signal AHBIn: in AHB_Slv_In_Type; signal AHBOut: out AHB_Slv_Out_Type; constant InstancePath: in String := "AHBMemory32"; constant ScreenOutput: in Boolean := False; constant FileName: in String := ""; -- file name constant HINDEX: in Integer := 0; constant HADDR: in Integer := 0; constant HMASK: in Integer := 16#FFF#); ----------------------------------------------------------------------------- -- Behavioural model of memory with AHB interface, no wait states -- Supporting byte, halfword and word read/write accesses. -- Provices diagnostic support. ----------------------------------------------------------------------------- procedure AHBMemory32( constant gAWidth: in Positive := 18; -- address width signal HCLK: in Std_ULogic; signal HRESETn: in Std_ULogic; signal AHBIn: in AHB_Slv_In_Type; signal AHBOut: out AHB_Slv_Out_Type; signal AHBInDiag: in AHB_Diagnostics_In_Type; signal AHBOutDiag: out AHB_Diagnostics_Out_Type; constant InstancePath: in String := "AHBMemory32"; constant ScreenOutput: in Boolean := False; constant FileName: in String := ""; -- file name constant HINDEX: in Integer := 0; constant HADDR: in Integer := 0; constant HMASK: in Integer := 16#FFF#); ----------------------------------------------------------------------------- -- Routine for writig data directly to AHB memory ----------------------------------------------------------------------------- procedure WrAHBMem32( constant Addr: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False); ----------------------------------------------------------------------------- -- Routine for reading data directly from AHB memory ----------------------------------------------------------------------------- procedure RdAHBMem32( constant Addr: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False); ----------------------------------------------------------------------------- -- Routine for reading data directly from AHB memory ----------------------------------------------------------------------------- procedure RcAHBMem32( constant Addr: in Std_Logic_Vector(31 downto 0); constant Expected: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False); ----------------------------------------------------------------------------- -- Routine for generating a split ack from AHB memory ----------------------------------------------------------------------------- procedure SplitAHBMem32( constant Split: in Integer range 0 to NAHBMST-1; signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False); end AMBA_TestPackage; --============================================================================-- package body AMBA_TestPackage is ----------------------------------------------------------------------------- -- Compare function handling '-' ----------------------------------------------------------------------------- function Compare(O, C: in Std_Logic_Vector) return Boolean is variable T: Std_Logic_Vector(O'Range) := C; variable Result: Boolean; begin Result := True; for i in O'Range loop if not (O(i)=T(i) or T(i)='-' or T(i)='U') then Result := False; end if; end loop; return Result; end function Compare; ----------------------------------------------------------------------------- -- Synchronisation with respect to clock and with output offset ----------------------------------------------------------------------------- procedure Synchronise( signal Clk: in Std_ULogic; constant Offset: in Time := 5 ns) is begin wait until CLK = '1'; -- Synchronise wait for Offset; -- output offset delay end procedure Synchronise; ----------------------------------------------------------------------------- -- AMBA APB write access ----------------------------------------------------------------------------- procedure APBInit( signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; constant InstancePath: in String := "APBInit"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := True) is variable L: Line; begin if cBack2Back then Synchronise(PCLK); end if; APBIn.PSEL <= (others => '0'); APBIn.PENABLE <= '0'; APBIn.PADDR <= (others => '0'); APBIn.PWRITE <= '0'; APBIn.PWDATA <= (others => '0'); if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : APB initalised")); WriteLine(Output, L); end if; end procedure APBInit; ----------------------------------------------------------------------------- -- AMBA APB write access ----------------------------------------------------------------------------- procedure APBWrite( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0) is variable L: Line; begin -- do not Synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(PCLK); end if; APBIn.PSEL <= (others => '0'); APBIn.PSEL(PINDEX) <= '1'; -- first clock period APBIn.PENABLE <= '0'; APBIn.PADDR <= Address; APBIn.PWRITE <= '1'; APBIn.PWDATA <= Data; Synchronise(PCLK); -- second clock period APBIn.PENABLE <= '1'; if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : APB write access, address: ")); HWrite(L, Address); Write (L, String'(" : data: ")); HWrite(L, Data); WriteLine(Output, L); end if; Synchronise(PCLK); -- end of access APBIn.PSEL <= (others => '0'); APBIn.PENABLE <= '0'; APBIn.PADDR <= (others => '-'); APBIn.PWRITE <= '0'; APBIn.PWDATA <= (others => '-'); end procedure APBWrite; ----------------------------------------------------------------------------- -- AMBA APB read access ----------------------------------------------------------------------------- procedure APBQuiet( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0) is begin -- do not Synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(PCLK); end if; APBIn.PSEL <= (others => '0'); APBIn.PSEL(PINDEX) <= '1'; -- first clock period APBIn.PENABLE <= '0'; APBIn.PADDR <= Address; APBIn.PWRITE <= '0'; APBIn.PWDATA <= (others => '-'); Synchronise(PCLK); -- second clock period APBIn.PENABLE <= '1'; wait for 5 ns; Data := APBOut.PRDATA; Synchronise(PCLK); -- end of access APBIn.PSEL <= (others => '0'); APBIn.PENABLE <= '0'; APBIn.PADDR <= (others => '-'); end procedure APBQuiet; ----------------------------------------------------------------------------- -- AMBA APB read access ----------------------------------------------------------------------------- procedure APBRead( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBRead"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0) is variable L: Line; variable Temp: Std_Logic_Vector(31 downto 0); begin APBQuiet(Address, Temp, PCLK, APBIn, APBOut, TP, InstancePath, False, cBack2Back, PINDEX); Data := Temp; if ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : APB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Temp); WriteLine(Output, L); end if; end procedure APBRead; ----------------------------------------------------------------------------- -- AMBA APB read access ----------------------------------------------------------------------------- procedure APBComp( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(31 downto 0); variable RxData: out Std_Logic_Vector(31 downto 0); signal PCLK: in Std_ULogic; signal APBIn: out APB_Slv_In_Type; signal APBOut: in APB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "APBComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant PINDEX: in Integer := 0) is variable L: Line; variable Data: Std_Logic_Vector(31 downto 0); begin APBQuiet(Address, Data, PCLK, APBIn, APBOut, TP, InstancePath, False, cBack2Back, PINDEX); if not Compare(Data, CxData) then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Data); Write(L, String'(" : expected: ")); HWrite(L, CxData); Write(L, String'(" # Error #")); WriteLine(Output, L); TP := False; elsif ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Data); WriteLine(Output, L); end if; RxData := Data; end procedure APBComp; ----------------------------------------------------------------------------- -- Initialise AHB interface ----------------------------------------------------------------------------- procedure AHBInit( signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; constant InstancePath: in String := "AHBInit"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := True) is variable L: Line; begin if cBack2Back then Synchronise(HCLK); end if; AHBIn.HSEL <= (others => '0'); AHBIn.HADDR <= (others => '0'); AHBIn.HWRITE <= '0'; AHBIn.HTRANS <= HTRANS_IDLE; AHBIn.HSIZE <= HSIZE_WORD; AHBIn.HBURST <= HBURST_SINGLE; AHBIn.HWDATA <= (others => '-'); AHBIn.HPROT <= (others => '0'); AHBIn.HREADY <= '0'; AHBIn.HMASTER <= (others => '0'); AHBIn.HMASTLOCK <= '0'; AHBIn.HMBSEL <= (others => '0'); if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB initalised")); WriteLine(Output, L); end if; end procedure AHBInit; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure AHBWriteQuiet( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0) is variable L: Line; begin -- do not Synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(HCLK); -- first clock period end if; AHBIn.HSEL <= (others => '0'); AHBIn.HSEL(HINDEX)<= '1'; AHBIn.HADDR <= Address; AHBIn.HWRITE <= '1'; AHBIn.HTRANS <= HTRANS_NONSEQ; AHBIn.HSIZE <= HSIZE_WORD; AHBIn.HBURST <= HBURST_SINGLE; AHBIn.HWDATA <= (others => '-'); AHBIn.HPROT <= (others => '0'); AHBIn.HREADY <= '1'; AHBIn.HMASTER <= (others => '0'); AHBIn.HMASTLOCK <= '0'; AHBIn.HMBSEL <= (others => '0'); AHBIn.HMBSEL(HMBINDEX) <= '1'; Synchronise(HCLK); -- second clock period AHBIn.HSEL <= (others => '0'); AHBIn.HSEL(HINDEX)<= '1'; AHBIn.HADDR <= (others => '-'); AHBIn.HWRITE <= '0'; AHBIn.HTRANS <= HTRANS_IDLE; AHBIn.HWDATA <= ahbdrivedata(Data); AHBIn.HREADY <= AHBOut.HREADY; AHBIn.HMBSEL <= (others => '0'); AHBIn.HMBSEL(HMBINDEX) <= '1'; while AHBOut.HREADY='0' loop Synchronise(HCLK); end loop; if AHBOut.HRESP=HRESP_ERROR then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" ERROR response ")); WriteLine(Output, L); end if; TP := False; elsif AHBOut.HRESP=HRESP_RETRY then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" RETRY response ")); WriteLine(Output, L); end if; TP := False; elsif AHBOut.HRESP=HRESP_SPLIT then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" SPLIT response ")); WriteLine(Output, L); end if; TP := False; else end if; Synchronise(HCLK); -- end of access AHBIn.HSEL <= (others => '0'); AHBIn.HADDR <= (others => '-'); AHBIn.HWRITE <= '1'; AHBIn.HTRANS <= HTRANS_IDLE; AHBIn.HSIZE <= HSIZE_WORD; AHBIn.HBURST <= HBURST_SINGLE; AHBIn.HWDATA <= (others => '-'); AHBIn.HPROT <= (others => '0'); AHBIn.HREADY <= '1'; AHBIn.HMASTER <= (others => '0'); AHBIn.HMASTLOCK <= '0'; AHBIn.HMBSEL <= (others => '0'); end procedure AHBWriteQuiet; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure AHBWrite( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0) is variable OK: Boolean := True; variable L: Line; begin AHBWriteQuiet(Address, Data, HCLK, AHBIn, AHBOut, OK, InstancePath, False, cBack2Back, HINDEX, HMBINDEX); if ScreenOutput and OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" : data: ")); HWrite(L, Data); WriteLine(Output, L); elsif not OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); TP := False; end if; end procedure AHBWrite; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure AHBQuiet( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0) is variable L: Line; begin -- do not Synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(HCLK); end if; AHBIn.HSEL <= (others => '0'); AHBIn.HSEL(HINDEX)<= '1'; AHBIn.HADDR <= Address; AHBIn.HWRITE <= '0'; AHBIn.HTRANS <= HTRANS_NONSEQ; AHBIn.HSIZE <= HSIZE_WORD; AHBIn.HBURST <= HBURST_SINGLE; AHBIn.HWDATA <= (others => '-'); AHBIn.HPROT <= (others => '0'); AHBIn.HREADY <= '1'; AHBIn.HMASTER <= (others => '0'); AHBIn.HMASTLOCK <= '0'; AHBIn.HMBSEL <= (others => '0'); AHBIn.HMBSEL(HMBINDEX) <= '1'; Synchronise(HCLK); -- second clock period AHBIn.HSEL <= (others => '0'); AHBIn.HSEL(HINDEX)<= '1'; AHBIn.HADDR <= (others => '-'); AHBIn.HWRITE <= '0'; AHBIn.HTRANS <= HTRANS_IDLE; AHBIn.HWDATA <= (others => '-'); AHBIn.HREADY <= AHBOut.HREADY; AHBIn.HMBSEL <= (others => '0'); AHBIn.HMBSEL(HMBINDEX) <= '1'; while AHBOut.HREADY='0' loop Synchronise(HCLK); end loop; Data := AHBOut.HRDATA(31 downto 0); if AHBOut.HRESP=HRESP_ERROR then if ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" ERROR response ")); WriteLine(Output, L); end if; TP := False; elsif AHBOut.HRESP=HRESP_RETRY then if ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" RETRY response ")); WriteLine(Output, L); end if; TP := False; elsif AHBOut.HRESP=HRESP_SPLIT then if ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" SPLIT response ")); WriteLine(Output, L); end if; TP := False; else end if; Synchronise(HCLK); -- end of access AHBIn.HSEL <= (others => '0'); AHBIn.HADDR <= (others => '-'); AHBIn.HWRITE <= '0'; AHBIn.HTRANS <= HTRANS_IDLE; AHBIn.HSIZE <= HSIZE_WORD; AHBIn.HBURST <= HBURST_SINGLE; AHBIn.HWDATA <= (others => '-'); AHBIn.HPROT <= (others => '0'); AHBIn.HREADY <= '1'; AHBIn.HMASTER <= (others => '0'); AHBIn.HMASTLOCK <= '0'; AHBIn.HMBSEL <= (others => '0'); end procedure AHBQuiet; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure AHBRead( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBRead"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0) is variable OK: Boolean := True; variable L: Line; variable Temp: Std_Logic_Vector(31 downto 0); begin AHBQuiet(Address, Temp, HCLK, AHBIn, AHBOut, OK, InstancePath, False, cBack2Back, HINDEX, HMBINDEX); if ScreenOutput and OK then Data := Temp; Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Temp); WriteLine(Output, L); elsif OK then Data := Temp; else Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); Data := (others => '-'); TP := False; end if; end procedure AHBRead; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure AHBComp( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(31 downto 0); variable RxData: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBIn: out AHB_Slv_In_Type; signal AHBOut: in AHB_Slv_Out_Type; variable TP: inout Boolean; constant InstancePath: in String := "AHBComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant HINDEX: in Integer := 0; constant HMBINDEX: in Integer := 0) is variable OK: Boolean := True; variable L: Line; variable Data: Std_Logic_Vector(31 downto 0); variable Failed: Boolean; begin AHBQuiet(Address, Data, HCLK, AHBIn, AHBOut, OK, InstancePath, False, cBack2Back, HINDEX, HMBINDEX); if not OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); TP := False; RxData := (others => '-'); elsif not Compare(Data, CxData) then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Data); Write(L, String'(" : expected: ")); HWrite(L, CxData); Write(L, String'(" # Error #")); WriteLine(Output, L); TP := False; RxData := Data; elsif ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Data); WriteLine(Output, L); RxData := Data; else RxData := Data; end if; end procedure AHBComp; ----------------------------------------------------------------------------- -- Behavioural model of memory with AHB interface, no wait states ----------------------------------------------------------------------------- procedure AHBMemory( constant gAWidth: in Positive := 15; -- address width constant gDWidth: in Positive := 8; -- data width signal HCLK: in Std_ULogic; signal HRESETn: in Std_ULogic; signal AHBIn: in AHB_Slv_In_Type; signal AHBOut: out AHB_Slv_Out_Type; constant InstancePath: in String := "AHBMemory"; constant ScreenOutput: in Boolean := False; constant HINDEX: in Integer := 0; constant HADDR: in Integer := 0; constant HMASK: in Integer := 16#FFF#) is -- memory definition subtype ARange is Natural range 0 to 2**gAWidth-1; subtype DRange is Natural range 0 to gDWidth-1; type MType is array (ARange) of Integer; -- memory initialisation function Init return MType is variable r: MType; begin for i in ARange loop r(i) := -1; end loop; return r; end function Init; variable M: MType; variable A: Std_Logic_Vector(gAWidth-1 downto 0); variable D: Std_Logic_Vector(0 to gDWidth-1); variable W: Std_Logic; -- reset values procedure Reset is begin AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; AHBOut.HRDATA <= (others => '0'); W := '0'; end procedure Reset; -- plug&play configuration constant HCONFIG : ahb_config_type := ( 0 => ahb_device_reg (0, 0, 0, gAWidth, 0), 4 => ahb_membar(HADDR, '1', '1', HMASK), others => zero32); variable alow : std_logic_vector(1 downto 0); begin -- fixed AMBA AHB signals, etc. AHBOut.HSPLIT <= (others => '0'); AHBOut.HCONFIG <= HCONFIG; loop if HRESETn='0' then -- asynchronous reset Reset; elsif HCLK'Event and HCLK='1' then -- rising edge -- data phase if AHBIn.HREADY='1' then if W='1' then alow := A(1 downto 0); case alow is when "00" => D := AHBIn.HWDATA(31 downto 24); when "01" => D := AHBIn.HWDATA(23 downto 16); when "10" => D := AHBIn.HWDATA(15 downto 8); when others => D := AHBIn.HWDATA( 7 downto 0); end case; M(Conv_Integer(A)) := Conv_Integer(D); W := '0'; end if; end if; -- address phase if AHBIn.HSEL(HINDEX)='1' and AHBIn.HREADY='1' and AHBIn.HSIZE=HSIZE_BYTE and (AHBIn.HTRANS=HTRANS_SEQ or AHBIn.HTRANS=HTRANS_NONSEQ) and AHBIn.HMASTLOCK='0' then W := AHBIn.HWRITE; A := AHBIn.HADDR(gAWidth-1 downto 0); AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; D := Conv_Std_Logic_Vector( M(Conv_Integer(A)), D'Length); case alow is when "00" => AHBOut.HRDATA(31 downto 24) <= D; when "01" => AHBOut.HRDATA(23 downto 16) <= D; when "10" => AHBOut.HRDATA(15 downto 8) <= D; when others => AHBOut.HRDATA( 7 downto 0) <= D; end case; else w :='0'; AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; end if; end if; -- signal sensitivity wait on HCLK, HRESETn; end loop; end procedure AHBMemory; ----------------------------------------------------------------------------- -- Behavioural model of memory with AHB interface, no wait states ----------------------------------------------------------------------------- procedure AHBMemory32( constant gAWidth: in Positive := 18; -- address width signal HCLK: in Std_ULogic; signal HRESETn: in Std_ULogic; signal AHBIn: in AHB_Slv_In_Type; signal AHBOut: out AHB_Slv_Out_Type; constant InstancePath: in String := "AHBMemory32"; constant ScreenOutput: in Boolean := False; constant FileName: in String := ""; -- File name constant HINDEX: in Integer := 0; constant HADDR: in Integer := 0; constant HMASK: in Integer := 16#FFF#) is -- memory definition type MType is array (0 to 2**(gAWidth-2)-1) of Std_Logic_Vector(31 downto 0); -------------------------------------------------------------------------- -- Load memory contents -------------------------------------------------------------------------- -- ## Does not warn if there is insufficient data in a line. -- Address read from file is always byte oriented, always 32 bit wide -- For 16 and 32 bit wide data, each data word read from file must be on a -- single line and without white space between the characters. For 8 bit -- wide date, no restrictions apply. Files generated for 32 bit wide data -- can always be read by 16 or 8 bit memories. The byte/halfwrod address -- is incremented internally. -------------------------------------------------------------------------- -- ----------------------------------------------------------------------- -- -- PROM Initialisation Example -- ----------------------------------------------------------------------- -- -- Supports by 8, 16, 32 bit wide memories -- 00000000 00010203 -- 00000004 04050607 08090A0B -- 0000000C 0C0D0E0F -- -- -- Supported by 8, 16 bit wide memories -- 00000010 1011 1213 -- 00000014 1415 -- 00000016 1617 1819 1A1B 1C1D 1E1F 2021 -- 00000022 2223 2425 2627 2829 2A2B 2C2D 2E2F -- -- -- Supported by 8 bit wide memories -- 00000030 30 31 32 33 3435 3637 3839 3A3B 3C3D 3E3F -- 00000040 40 -- 00000041 41 -- 00000042 42 43 -- 00000044 4445 -- 00000046 46474849 -- 0000004A 4A4B 4C4D4E4F -------------------------------------------------------------------------- impure function Initialise( constant FileName: in String := ""; constant AWidth: in Natural; constant DWidth: in Natural) return MType is variable L: Line; variable Address: Std_Logic_Vector(31 downto 0); variable Data: Std_Logic_Vector(31 downto 0); variable Byte: Std_Logic_Vector( 7 downto 0); variable Addr: Natural range 0 to 2**AWidth-1; file ReadFile: Text; variable Test: Boolean; variable Result: MType; begin -- initialse all data to all zeros Result := (others => (others => 'U')); -- load contents from file only if a file name has been provided if FileName /= "" then File_Open(ReadFile, FileName, Read_Mode); -- read data from file while not EndFile(ReadFile) loop -- read line ReadLine(ReadFile, L); -- read address, always byte oriented, always 32 bit wide HRead(L, Address, Test); if Test then -- address read -- check whether byte address aligned with data width if Conv_Integer(Address) mod (DWidth/8) /= 0 then report "Unaligned data in memory initalisation file: " & FileName severity Failure; Test := False; else -- convert address -- adapt byte address to address corresponding to the data -- width of the memory Addr := (Conv_Integer(Address)/(DWidth/8)) mod (2**AWidth); end if; else -- comment detected null; end if; while Test loop -- read data HRead(L, Data(DWidth-1 downto 0), Test); if Test then -- initialize memory element Result(Addr) := Data(DWidth-1 downto 0); -- increment address, with the memory width Addr := (Addr + 1) mod (2**AWidth); end if; end loop; end loop; File_Close(ReadFile); end if; return Result; end function Initialise; -- memory contents variable M: MType := Initialise(FileName, gAWidth-2, 32); variable A: Std_Logic_Vector(gAWidth-1 downto 2); variable W: Std_Logic; -- reset values procedure Reset is begin AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; AHBOut.HRDATA <= (others => '0'); W := '0'; end procedure Reset; -- plug&play configuration constant HCONFIG : ahb_config_type := ( 0 => ahb_device_reg (0, 0, 0, gAWidth, 0), 4 => ahb_membar(HADDR, '1', '1', HMASK), others => zero32); begin -- fixed AMBA AHB signals, etc. AHBOut.HSPLIT <= (others => '0'); AHBOut.HCONFIG <= HCONFIG; loop if HRESETn='0' then -- asynchronous reset Reset; elsif HCLK'Event and HCLK='1' then -- rising edge -- data phase if AHBIn.HREADY='1' then if W='1' then M(Conv_Integer(A)) := AHBIn.HWDATA(31 downto 0); W := '0'; end if; end if; -- address phase if AHBIn.HSEL(HINDEX)='1' and AHBIn.HREADY='1' and AHBIn.HSIZE=HSIZE_WORD and (AHBIn.HTRANS=HTRANS_SEQ or AHBIn.HTRANS=HTRANS_NONSEQ) and AHBIn.HMASTLOCK='0' then W := AHBIn.HWRITE; A := AHBIn.HADDR(gAWidth-1 downto 2); AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; AHBOut.HRDATA <= ahbdrivedata(M(Conv_Integer(A))); else W :='0'; AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; end if; end if; -- signal sensitivity wait on HCLK, HRESETn; end loop; end procedure AHBMemory32; ----------------------------------------------------------------------------- -- Behavioural model of memory with AHB interface, no wait states -- Supporting byte, halfword and word read/write accesses. -- Provices diagnostic support. ----------------------------------------------------------------------------- procedure AHBMemory32( constant gAWidth: in Positive := 18; -- address width signal HCLK: in Std_ULogic; signal HRESETn: in Std_ULogic; signal AHBIn: in AHB_Slv_In_Type; signal AHBOut: out AHB_Slv_Out_Type; signal AHBInDiag: in AHB_Diagnostics_In_Type; signal AHBOutDiag: out AHB_Diagnostics_Out_Type; constant InstancePath: in String := "AHBMemory32"; constant ScreenOutput: in Boolean := False; constant FileName: in String := ""; -- File name constant HINDEX: in Integer := 0; constant HADDR: in Integer := 0; constant HMASK: in Integer := 16#FFF#) is -- memory definition type MType is array (0 to 2**(gAWidth-2)-1) of Std_Logic_Vector(31 downto 0); variable L: Line; constant Padding: Std_ULogic_Vector(1 to (4-((gAWidth-2) mod 4))) := (others => '0'); -------------------------------------------------------------------------- -- Load memory contents -------------------------------------------------------------------------- -- ## Does not warn if there is insufficient data in a line. -- Address read from file is always byte oriented, always 32 bit wide -- For 16 and 32 bit wide data, each data word read from file must be on a -- single line and without white space between the characters. For 8 bit -- wide date, no restrictions apply. Files generated for 32 bit wide data -- can always be read by 16 or 8 bit memories. The byte/halfwrod address -- is incremented internally. -------------------------------------------------------------------------- -- ----------------------------------------------------------------------- -- -- PROM Initialisation Example -- ----------------------------------------------------------------------- -- -- Supports by 8, 16, 32 bit wide memories -- 00000000 00010203 -- 00000004 04050607 08090A0B -- 0000000C 0C0D0E0F -- -- -- Supported by 8, 16 bit wide memories -- 00000010 1011 1213 -- 00000014 1415 -- 00000016 1617 1819 1A1B 1C1D 1E1F 2021 -- 00000022 2223 2425 2627 2829 2A2B 2C2D 2E2F -- -- -- Supported by 8 bit wide memories -- 00000030 30 31 32 33 3435 3637 3839 3A3B 3C3D 3E3F -- 00000040 40 -- 00000041 41 -- 00000042 42 43 -- 00000044 4445 -- 00000046 46474849 -- 0000004A 4A4B 4C4D4E4F -------------------------------------------------------------------------- impure function Initialise( constant FileName: in String := ""; constant AWidth: in Natural; constant DWidth: in Natural) return MType is variable L: Line; variable Address: Std_Logic_Vector(31 downto 0); variable Data: Std_Logic_Vector(31 downto 0); variable Byte: Std_Logic_Vector( 7 downto 0); variable Addr: Natural range 0 to 2**AWidth-1; file ReadFile: Text; variable Test: Boolean; variable Result: MType; begin -- initialse all data to all zeros Result := (others => (others => 'U')); -- load contents from file only if a file name has been provided if FileName /= "" then File_Open(ReadFile, FileName, Read_Mode); -- read data from file while not EndFile(ReadFile) loop -- read line ReadLine(ReadFile, L); -- read address, always byte oriented, always 32 bit wide HRead(L, Address, Test); if Test then -- address read -- check whether byte address aligned with data width if Conv_Integer(Address) mod (DWidth/8) /= 0 then report "Unaligned data in memory initalisation file: " & FileName severity Failure; Test := False; else -- convert address -- adapt byte address to address corresponding to the data -- width of the memory Addr := (Conv_Integer(Address)/(DWidth/8)) mod (2**AWidth); end if; else -- comment detected null; end if; while Test loop -- read data HRead(L, Data(DWidth-1 downto 0), Test); if Test then -- initialize memory element Result(Addr) := Data(DWidth-1 downto 0); -- increment address, with the memory width Addr := (Addr + 1) mod (2**AWidth); end if; end loop; end loop; File_Close(ReadFile); end if; return Result; end function Initialise; -- memory contents variable M: MType := Initialise(FileName, gAWidth-2, 32); variable A: Std_Logic_Vector(gAWidth-1 downto 2); variable B: Std_Logic_Vector(1 downto 0); variable W: Std_Logic; variable S: Std_Logic_Vector(2 downto 0); variable D: Std_Logic_Vector(31 downto 0); variable twocycle:Boolean := False; -- reset values procedure Reset is begin AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; AHBOut.HRDATA <= (others => '0'); W := '0'; twocycle := False; end procedure Reset; -- plug&play configuration constant HCONFIG : ahb_config_type := ( 0 => ahb_device_reg (0, 0, 0, gAWidth, 0), 4 => ahb_membar(HADDR, '1', '1', HMASK), others => zero32); begin -- fixed AMBA AHB signals, etc. AHBOut.HSPLIT <= (others => '0'); AHBOut.HCONFIG <= HCONFIG; loop if HRESETn='0' then -- asynchronous reset Reset; elsif HCLK'Event and HCLK='1' then -- rising edge -- data phase if AHBIn.HREADY='1' then if W='1' then -- read back memory D := M(Conv_Integer(A)); -- replace with new data if S="000" then -- byte if B(1 downto 0)="00" then D := AHBIn.HWDATA(31 downto 24) & D(23 downto 0); elsif B(1 downto 0)="01" then D := D(31 downto 24) & AHBIn.HWDATA(23 downto 16) & D(15 downto 0); elsif B(1 downto 0)="10" then D := D(31 downto 16) & AHBIn.HWDATA(15 downto 8) & D(7 downto 0); elsif B(1 downto 0)="11" then D := D(31 downto 8) & AHBIn.HWDATA(7 downto 0); end if; elsif S="001" then -- halfword if B(1 downto 0)="00" then D := AHBIn.HWDATA(31 downto 16) & D(15 downto 0); elsif B(1 downto 0)="10" then D := D(31 downto 16) & AHBIn.HWDATA(15 downto 0); end if; else D := AHBIn.HWDATA(31 downto 0); end if; -- write back memory M(Conv_Integer(A)) := D; W := '0'; -- comment if ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath & " Write acces to address :"); if Padding'Length > 0 and Padding'Length < 4 then HWrite(L, Std_Logic_Vector(Padding) & Std_Logic_Vector(A)); else HWrite(L, Std_Logic_Vector(A)); end if; Write(L, String'(" data :")); HWrite(L, D); Write(L, String'(" data :")); Write(L, To_BitVector(D)); Write(L, String'(" size :")); HWrite(L, "0" & S); WriteLine(Output, L); end if; end if; end if; -- address phase if AHBIn.HSEL(HINDEX)='1' and AHBIn.HREADY='1' and (AHBIn.HSIZE=HSIZE_BYTE or AHBIn.HSIZE=HSIZE_HWORD or AHBIn.HSIZE=HSIZE_WORD) and (AHBIn.HTRANS=HTRANS_SEQ or AHBIn.HTRANS=HTRANS_NONSEQ) and AHBIn.HMASTLOCK='0' then if AHBInDiag.HRESP=HRESP_OKAY then W := AHBIn.HWRITE; S := AHBIn.HSIZE; B := AHBIn.HADDR( 1 downto 0); A := AHBIn.HADDR(gAWidth-1 downto 2); AHBOut.HREADY <= '1'; AHBOut.HRESP <= HRESP_OKAY; AHBOut.HRDATA <= ahbdrivedata(M(Conv_Integer(A))); elsif AHBInDiag.HRESP=HRESP_RETRY then W :='0'; AHBOut.HREADY <= '0'; AHBOut.HRESP <= HRESP_RETRY; AHBOut.HRDATA <= (others => 'X'); twocycle := True; elsif AHBInDiag.HRESP=HRESP_SPLIT then W :='0'; AHBOut.HREADY <= '0'; AHBOut.HRESP <= HRESP_SPLIT; AHBOut.HRDATA <= (others => 'X'); twocycle := True; else W :='0'; AHBOut.HREADY <= '0'; AHBOut.HRESP <= HRESP_ERROR; AHBOut.HRDATA <= (others => 'X'); twocycle := True; end if; else W :='0'; AHBOut.HREADY <= '1'; if twocycle then twocycle := False; else AHBOut.HRESP <= HRESP_OKAY; end if; end if; end if; if HCLK'Event and HCLK='1' then -- rising edge -- diagnostics AHBOutDiag.HRData <= M((Conv_Integer(AHBInDiag.HAddr)/4) mod (2**(gAWidth-2))); if AHBInDiag.HWrite='1' then M((Conv_Integer(AHBInDiag.HAddr)/4) mod (2**(gAWidth-2))) := AHBInDiag.HWData; -- Print("Diagnostic write to memory, address: " & -- Integer'Image(Conv_Integer(AHBInDiag.HAddr)) & -- " data: " & -- Integer'Image(Conv_Integer(AHBInDiag.HWData))); end if; AHBOut.HSPLIT <= AHBInDiag.HSplit; end if; -- signal sensitivity wait on HCLK, HRESETn; end loop; end procedure AHBMemory32; ----------------------------------------------------------------------------- -- Routine for writig data directly to AHB memory ----------------------------------------------------------------------------- procedure WrAHBMem32( constant Addr: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False) is variable L: Line; begin Synchronise(HCLK); if Screen then Write(L, Now, Right, 15); Write(L, String'(" : WrAHBMem32: ")); HWrite(L, Std_Logic_Vector(Addr)); Write(L, String'(" : ")); HWrite(L, Std_Logic_Vector(Data)); if Comment /= "" then Write(L, " : " & Comment); end if; WriteLine(Output, L); end if; AHBInDiag.HAddr <= Addr; AHBInDiag.HWData <= Data; AHBInDiag.HWrite <= '1'; Synchronise(HCLK); AHBInDiag.HWrite <= '0'; end procedure WrAHBMem32; ----------------------------------------------------------------------------- -- Routine for reading data directly from AHB memory ----------------------------------------------------------------------------- procedure RdAHBMem32( constant Addr: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False) is variable L: Line; begin Synchronise(HCLK); AHBInDiag.HAddr <= Addr; AHBInDiag.HWrite <= '0'; Synchronise(HCLK); Data := AHBOutDiag.HRData; if Screen then Write(L, Now, Right, 15); Write(L, String'(" : RdAHBMem32: ")); HWrite(L, Std_Logic_Vector(Addr)); Write(L, String'(" : ")); HWrite(L, Std_Logic_Vector(AHBOutDiag.HRData)); if Comment /= "" then Write(L, " : " & Comment); end if; WriteLine(Output, L); end if; end procedure RdAHBMem32; ----------------------------------------------------------------------------- -- Routine for reading data directly from AHB memory ----------------------------------------------------------------------------- procedure RcAHBMem32( constant Addr: in Std_Logic_Vector(31 downto 0); constant Expected: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False) is variable Data: Std_Logic_Vector(31 downto 0); variable L: Line; begin Synchronise(HCLK); AHBInDiag.HAddr <= Addr; AHBInDiag.HWrite <= '0'; Synchronise(HCLK); Data := AHBOutDiag.HRData; if not Compare(Data, Expected) then Write(L, Now, Right, 15); Write(L, String'(" : RcAHBMem32: ")); HWrite(L, Std_Logic_Vector(Addr)); Write(L, String'(", value: ")); HWrite(L, Std_Logic_Vector(Data)); Write(L, String'(", expected: ")); HWrite(L, Std_Logic_Vector(Expected)); Write(L, String'(" # Error ")); if Comment /= "" then Write(L, " : " & Comment); end if; WriteLine(Output, L); TP := False; elsif Screen then Write(L, Now, Right, 15); Write(L, String'(" : RcAHBMem32: ")); HWrite(L, Std_Logic_Vector(Addr)); Write(L, String'(" : ")); HWrite(L, Std_Logic_Vector(Data)); Write(L, String'(" : ")); HWrite(L, Std_Logic_Vector(Expected)); if Comment /= "" then Write(L, " : " & Comment); end if; WriteLine(Output, L); end if; end procedure RcAHBMem32; ----------------------------------------------------------------------------- -- Routine for generating a split ack from AHB memory ----------------------------------------------------------------------------- procedure SplitAHBMem32( constant Split: in Integer range 0 to NAHBMST-1; signal HCLK: in Std_ULogic; signal AHBInDiag: out AHB_Diagnostics_In_Type; signal AHBOutDiag: in AHB_Diagnostics_Out_Type; variable TP: inout Boolean; constant Comment: in String := ""; constant Screen: in Boolean := False) is variable L: Line; begin Synchronise(HCLK); AHBInDiag.HSPLIT <= (others => '0'); AHBInDiag.HSPLIT(Split) <= '1'; Synchronise(HCLK); AHBInDiag.HSPLIT <= (others => '0'); if Screen then Write(L, Now, Right, 15); Write(L, String'(" : SplitAHBMem32: split acknowledge to master: ")); Write(L, Split); if Comment /= "" then Write(L, " : " & Comment); end if; WriteLine(Output, L); end if; end procedure SplitAHBMem32; end package body AMBA_TestPackage; --=========================================--
gpl-2.0
5047d1eea01b95b1ca9fa719239b5520
0.444667
4.828611
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-nexys3/leon3mp.vhd
1
19,317
------------------------------------------------------------------------------ -- LEON3 Demonstration design -- Copyright (C) 2013 Aeroflex Gaisler ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; use techmap.allclkgen.all; library gaisler; use gaisler.memctrl.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.spi.all; use gaisler.net.all; use gaisler.jtag.all; --pragma translate_off use gaisler.sim.all; --pragma translate_on library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW ); port ( clk : in std_ulogic; -- onBoard Cellular RAM, Numonyx StrataFlash and Numonyx Quad Flash MemOE : out std_ulogic; MemWR : out std_ulogic; RamAdv : out std_ulogic; RamCS : out std_ulogic; RamClk : out std_ulogic; RamCRE : out std_ulogic; RamLB : out std_ulogic; RamUB : out std_ulogic; RamWait : out std_ulogic; FlashRp : out std_ulogic; FlashCS : out std_ulogic; QuadSpiFlashCS : out std_ulogic; QuadSpiFlashSck : out std_ulogic; QuadSpiFlashDB : inout std_logic_vector(0 downto 0); address : out std_logic_vector(25 downto 0); data : inout std_logic_vector(15 downto 0); -- 7 segment display --seg : out std_logic_vector(7 downto 0); --an : out std_logic_vector(3 downto 0); -- LEDs led : out std_logic_vector(7 downto 0); -- Switches sw : in std_logic_vector(7 downto 0); -- Buttons btn : in std_logic_vector(4 downto 0); -- reset on btn0 -- VGA Connector --vgaRed : out std_logic_vector(2 downto 0); --vgaGreen : out std_logic_vector(2 downto 0); --vgaBlue : out std_logic_vector(2 downto 1); --Hsync : out std_ulogic; --Vsync : out std_ulogic; -- 12 pin connectors --ja : inout std_logic_vector(7 downto 0); --jb : inout std_logic_vector(7 downto 0); --jc : inout std_logic_vector(7 downto 0); --jd : inout std_logic_vector(7 downto 0); -- SMSC ethernet PHY PhyRstn : out std_ulogic; PhyCrs : in std_ulogic; PhyCol : in std_ulogic; PhyClk25Mhz : out std_ulogic; PhyTxd : out std_logic_vector(3 downto 0); PhyTxEn : out std_ulogic; PhyTxClk : in std_ulogic; PhyTxEr : out std_ulogic; PhyRxd : in std_logic_vector(3 downto 0); PhyRxDv : in std_ulogic; PhyRxEr : in std_ulogic; PhyRxClk : in std_ulogic; PhyMdc : out std_ulogic; PhyMdio : inout std_logic; -- Pic USB-HID interface --PS2KeyboardData : inout std_logic; --PS2KeyboardClk : inout std_logic; --PS2MouseData : inout std_logic; --PS2MouseClk : inout std_logic; --PicGpio : out std_logic_vector(1 downto 0); -- USB-RS232 interface RsRx : in std_logic; RsTx : out std_logic ); end; architecture rtl of leon3mp is signal vcc : std_logic; signal gnd : std_logic; signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, dui : uart_in_type; signal u1o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal ethi : eth_in_type; signal etho : eth_out_type; signal gpti : gptimer_in_type; signal spii : spi_in_type; signal spio : spi_out_type; signal slvsel : std_logic_vector(CFG_SPICTRL_SLVS-1 downto 0); signal spmi : spimctrl_in_type; signal spmo : spimctrl_out_type; signal clkm, rstn, clkml : std_ulogic; signal tck, tms, tdi, tdo : std_ulogic; signal rstraw : std_logic; signal lock : std_logic; -- RS232 APB Uart signal rxd1 : std_logic; signal txd1 : std_logic; attribute keep : boolean; attribute syn_keep : boolean; attribute syn_preserve : boolean; attribute syn_keep of lock : signal is true; attribute syn_keep of clkml : signal is true; attribute syn_keep of clkm : signal is true; attribute syn_preserve of clkml : signal is true; attribute syn_preserve of clkm : signal is true; attribute keep of lock : signal is true; attribute keep of clkml : signal is true; attribute keep of clkm : signal is true; constant BOARD_FREQ : integer := 100000; -- CLK input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= '1'; gnd <= '0'; led(7 downto 4) <= (others =>'0'); -- unused leds off cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; rst0 : rstgen generic map (acthigh => 1) port map (btn(0), clkm, lock, rstn, rstraw); lock <= cgo.clklock; -- clock generator clkgen0 : clkgen generic map (fabtech, CFG_CLKMUL, CFG_CLKDIV, 0, 0, 0, 0, 0, BOARD_FREQ, 0) port map (clk, gnd, clkm, open, open, open, open, cgi, cgo, open, open, open); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => 1, nahbm => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- -- LEON3 processor leon3gen : if CFG_LEON3 = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3s generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; led(3) <= not dbgo(0).error; led(2) <= not dsuo.active; -- LEON3 Debug Support Unit dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsui.enable <= '1'; end generate; end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; -- Debug UART dcomgen : if CFG_AHB_UART = 1 generate dcom0 : ahbuart generic map (hindex => CFG_NCPU, pindex => 4, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(4), ahbmi, ahbmo(CFG_NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (RsRx, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (RsTx, duo.txd); led(0) <= not dui.rxd; led(1) <= not duo.txd; end generate; nouah : if CFG_AHB_UART = 0 generate apbo(4) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : mctrl generic map (hindex => 5, pindex => 0, paddr => 0, iomask => 0, ram8 => CFG_MCTRL_RAM8BIT, ram16 => CFG_MCTRL_RAM16BIT,srbanks=>1) port map (rstn, clkm, memi, memo, ahbsi, ahbso(5), apbi, apbo(0), wpo, open); end generate; memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "01"; mg0 : if (CFG_MCTRL_LEON2 = 0) generate apbo(0) <= apb_none; ahbso(5) <= ahbs_none; memo.bdrive(0) <= '1'; end generate; mgpads : if (CFG_MCTRL_LEON2 /= 0) generate addr_pad : outpadv generic map (tech => padtech, width => 26) port map (address, memo.address(26 downto 1)); oen_pad : outpad generic map (tech => padtech) port map (MemOE, memo.oen); cs_pad : outpad generic map (tech => padtech) port map (RamCS, memo.ramsn(0)); lb_pad : outpad generic map (tech => padtech) port map (RamLB, memo.mben(0)); ub_pad : outpad generic map (tech => padtech) port map (RamUB, memo.mben(1)); wri_pad : outpad generic map (tech => padtech) port map (MemWR, memo.writen); fce_pad : outpad generic map (tech => padtech) port map (FlashCS, memo.romsn(0)); frp_pad : outpad generic map (tech => padtech) port map (FlashRp, memo.writen); end generate; bdr : iopadv generic map (tech => padtech, width => 8) port map (data(7 downto 0), memo.data(23 downto 16), memo.bdrive(1), memi.data(23 downto 16)); bdr2 : iopadv generic map (tech => padtech, width => 8) port map (data(15 downto 8), memo.data(31 downto 24), memo.bdrive(0), memi.data(31 downto 24)); RamCRE <= '0'; RamClk <= '0'; RamAdv <= '0'; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- -- APB Bridge apb0 : apbctrl generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo); -- Interrupt controller irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; -- Time Unit gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; -- Console UART. ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; -- The USB UART is curently mapped to ahbuart. -- serrx_pad : inpad generic map (tech => padtech) port map (RsRx, rxd1); -- sertx_pad : outpad generic map (tech => padtech) port map (RsTx, txd1); -- led(0) <= not rxd1; -- led(1) <= not txd1; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; nospi: if CFG_SPICTRL_ENABLE = 0 and CFG_SPIMCTRL = 0 generate apbo(7) <= apb_none; end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : grethm generic map(hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, pindex => 15, paddr => 15, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, phyrstadr => 7, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL, giga => CFG_GRETH1G) port map(rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), apbi => apbi, apbo => apbo(15), ethi => ethi, etho => etho); PhyRstn<=rstn; end generate; ethpads : if (CFG_GRETH = 1) generate -- eth pads emdio_pad : iopad generic map (tech => padtech) port map (PhyMdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : clkpad generic map (tech => padtech, arch => 2) port map (PhyTxClk, ethi.tx_clk); erxc_pad : clkpad generic map (tech => padtech, arch => 2) port map (PhyRxClk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (PhyRxd, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (PhyRxDv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (PhyRxEr, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (PhyCol, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (PhyCrs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (PhyTxd, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map (PhyTxEn, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (PhyTxEr, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (PhyMdc, etho.mdc); end generate; ----------------------------------------------------------------------- --- AHB ROM ---------------------------------------------------------- ----------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(6) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ahbramgen : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 3, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map (rstn, clkm, ahbsi, ahbso(3)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(3) <= ahbs_none; end generate; ----------------------------------------------------------------------- -- Test report module, only used for simulation ---------------------- ----------------------------------------------------------------------- --pragma translate_off test0 : ahbrep generic map (hindex => 4, haddr => 16#200#) port map (rstn, clkm, ahbsi, ahbso(4)); --pragma translate_on ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- nam1 : for i in (CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH+1) to NAHBMST-1 generate ahbmo(i) <= ahbm_none; end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Demonstration design for Digilent NEXYS 3 board", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end rtl;
gpl-2.0
e40b4fcce3721ae6b6f6a845641308ef
0.524409
3.90716
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/grgpreg.vhd
1
4,665
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: grgpreg -- File: grgpreg.vhd -- Author: Kristoffer Glembo - Aeroflex Gaisler -- Description: General purpose register ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library gaisler; use gaisler.misc.all; --pragma translate_off use std.textio.all; --pragma translate_on entity grgpreg is generic ( pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; nbits : integer range 1 to 64 := 16; rstval : integer := 0; rstval2 : integer := 0; extrst : integer := 0 ); port ( rst : in std_ulogic; clk : in std_ulogic; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; gprego : out std_logic_vector(nbits-1 downto 0); resval : in std_logic_vector(nbits-1 downto 0) := (others => '0') ); end; architecture rtl of grgpreg is constant REVISION : integer := 0; constant pconfig : apb_config_type := ( 0 => ahb_device_reg (VENDOR_GAISLER, GAISLER_GPREG, 0, REVISION, 0), 1 => apb_iobar(paddr, pmask)); type registers is record reg : std_logic_vector(nbits-1 downto 0); end record; signal r, rin : registers; begin comb : process(rst, r, apbi, resval) variable readdata : std_logic_vector(31 downto 0); variable v : registers; begin v := r; -- read register readdata := (others => '0'); case apbi.paddr(4 downto 2) is when "000" => if nbits > 32 then readdata := r.reg(31 downto 0); else readdata(nbits-1 downto 0) := r.reg; end if; when "001" => if nbits > 32 then readdata(nbits-33 downto 0) := r.reg(nbits-1 downto 32); end if; when others => end case; -- write registers if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then case apbi.paddr(4 downto 2) is when "000" => if nbits > 32 then v.reg(31 downto 0) := apbi.pwdata; else v.reg := apbi.pwdata(nbits-1 downto 0); end if; when "001" => if nbits > 32 then v.reg(nbits-1 downto 32) := apbi.pwdata(nbits-33 downto 0); end if; when others => end case; end if; if rst = '0' then if extrst = 0 then v.reg := conv_std_logic_vector(rstval, nbits); if nbits > 32 then v.reg(nbits-1 downto 32) := conv_std_logic_vector(rstval2, nbits-32); end if; else v.reg := resval; end if; end if; rin <= v; apbo.prdata <= readdata; -- drive apb read bus end process; gprego <= r.reg; apbo.pirq <= (others => '0'); apbo.pindex <= pindex; apbo.pconfig <= pconfig; -- registers regs : process(clk) begin if rising_edge(clk) then r <= rin; end if; end process; -- boot message -- pragma translate_off bootmsg : report_version generic map ("grgpreg" & tost(pindex) & ": " & tost(nbits) & "-bit GPREG Unit rev " & tost(REVISION)); -- pragma translate_on end;
gpl-2.0
1ba3d57977262db35cb21634304f4e5e
0.524973
4.060052
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/explosion/example_design/explosion_prod.vhd
1
9,926
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7.1 Core - Top-level wrapper -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006-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: explosion_prod.vhd -- -- Description: -- This is the top-level BMG wrapper (over BMG core). -- -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: August 31, 2005 - First Release -------------------------------------------------------------------------------- -- -- Configured Core Parameter Values: -- (Refer to the SIM Parameters table in the datasheet for more information on -- the these parameters.) -- C_FAMILY : artix7 -- C_XDEVICEFAMILY : artix7 -- C_INTERFACE_TYPE : 0 -- C_ENABLE_32BIT_ADDRESS : 0 -- C_AXI_TYPE : 1 -- C_AXI_SLAVE_TYPE : 0 -- C_AXI_ID_WIDTH : 4 -- C_MEM_TYPE : 3 -- C_BYTE_SIZE : 9 -- C_ALGORITHM : 1 -- C_PRIM_TYPE : 1 -- C_LOAD_INIT_FILE : 1 -- C_INIT_FILE_NAME : explosion.mif -- C_USE_DEFAULT_DATA : 0 -- C_DEFAULT_DATA : 0 -- C_RST_TYPE : SYNC -- C_HAS_RSTA : 0 -- C_RST_PRIORITY_A : CE -- C_RSTRAM_A : 0 -- C_INITA_VAL : 0 -- C_HAS_ENA : 0 -- C_HAS_REGCEA : 0 -- C_USE_BYTE_WEA : 0 -- C_WEA_WIDTH : 1 -- C_WRITE_MODE_A : WRITE_FIRST -- C_WRITE_WIDTH_A : 12 -- C_READ_WIDTH_A : 12 -- C_WRITE_DEPTH_A : 50400 -- C_READ_DEPTH_A : 50400 -- C_ADDRA_WIDTH : 16 -- C_HAS_RSTB : 0 -- C_RST_PRIORITY_B : CE -- C_RSTRAM_B : 0 -- C_INITB_VAL : 0 -- C_HAS_ENB : 0 -- C_HAS_REGCEB : 0 -- C_USE_BYTE_WEB : 0 -- C_WEB_WIDTH : 1 -- C_WRITE_MODE_B : WRITE_FIRST -- C_WRITE_WIDTH_B : 12 -- C_READ_WIDTH_B : 12 -- C_WRITE_DEPTH_B : 50400 -- C_READ_DEPTH_B : 50400 -- C_ADDRB_WIDTH : 16 -- 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_HAS_SOFTECC_INPUT_REGS_A : 0 -- C_HAS_SOFTECC_OUTPUT_REGS_B : 0 -- C_MUX_PIPELINE_STAGES : 0 -- C_USE_ECC : 0 -- C_USE_SOFTECC : 0 -- C_HAS_INJECTERR : 0 -- C_SIM_COLLISION_CHECK : ALL -- C_COMMON_CLK : 0 -- C_DISABLE_WARN_BHV_COLL : 0 -- C_DISABLE_WARN_BHV_RANGE : 0 -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; LIBRARY UNISIM; USE UNISIM.VCOMPONENTS.ALL; -------------------------------------------------------------------------------- -- Entity Declaration -------------------------------------------------------------------------------- ENTITY explosion_prod IS PORT ( --Port A CLKA : IN STD_LOGIC; RSTA : IN STD_LOGIC; --opt port ENA : IN STD_LOGIC; --optional port REGCEA : IN STD_LOGIC; --optional port WEA : IN STD_LOGIC_VECTOR(0 DOWNTO 0); ADDRA : IN STD_LOGIC_VECTOR(15 DOWNTO 0); DINA : IN STD_LOGIC_VECTOR(11 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); --Port B CLKB : IN STD_LOGIC; RSTB : IN STD_LOGIC; --opt port ENB : IN STD_LOGIC; --optional port REGCEB : IN STD_LOGIC; --optional port WEB : IN STD_LOGIC_VECTOR(0 DOWNTO 0); ADDRB : IN STD_LOGIC_VECTOR(15 DOWNTO 0); DINB : IN STD_LOGIC_VECTOR(11 DOWNTO 0); DOUTB : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); --ECC INJECTSBITERR : IN STD_LOGIC; --optional port INJECTDBITERR : IN STD_LOGIC; --optional port SBITERR : OUT STD_LOGIC; --optional port DBITERR : OUT STD_LOGIC; --optional port RDADDRECC : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); --optional port -- AXI BMG Input and Output Port Declarations -- AXI Global Signals S_ACLK : IN STD_LOGIC; S_AXI_AWID : IN STD_LOGIC_VECTOR(3 DOWNTO 0); S_AXI_AWADDR : IN STD_LOGIC_VECTOR(31 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_AWVALID : IN STD_LOGIC; S_AXI_AWREADY : OUT STD_LOGIC; S_AXI_WDATA : IN STD_LOGIC_VECTOR(11 DOWNTO 0); S_AXI_WSTRB : IN STD_LOGIC_VECTOR(0 DOWNTO 0); S_AXI_WLAST : IN STD_LOGIC; S_AXI_WVALID : IN STD_LOGIC; S_AXI_WREADY : OUT STD_LOGIC; S_AXI_BID : OUT STD_LOGIC_VECTOR(3 DOWNTO 0):= (OTHERS => '0'); S_AXI_BRESP : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); S_AXI_BVALID : OUT STD_LOGIC; S_AXI_BREADY : IN STD_LOGIC; -- AXI Full/Lite Slave Read (Write side) S_AXI_ARID : IN STD_LOGIC_VECTOR(3 DOWNTO 0); S_AXI_ARADDR : IN STD_LOGIC_VECTOR(31 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_ARVALID : IN STD_LOGIC; S_AXI_ARREADY : OUT STD_LOGIC; S_AXI_RID : OUT STD_LOGIC_VECTOR(3 DOWNTO 0):= (OTHERS => '0'); S_AXI_RDATA : OUT STD_LOGIC_VECTOR(11 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 Full/Lite Sideband Signals S_AXI_INJECTSBITERR : IN STD_LOGIC; S_AXI_INJECTDBITERR : IN STD_LOGIC; S_AXI_SBITERR : OUT STD_LOGIC; S_AXI_DBITERR : OUT STD_LOGIC; S_AXI_RDADDRECC : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); S_ARESETN : IN STD_LOGIC ); END explosion_prod; ARCHITECTURE xilinx OF explosion_prod IS COMPONENT explosion_exdes IS PORT ( --Port A ADDRA : IN STD_LOGIC_VECTOR(15 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END COMPONENT; BEGIN bmg0 : explosion_exdes PORT MAP ( --Port A ADDRA => ADDRA, DOUTA => DOUTA, CLKA => CLKA ); END xilinx;
mit
3b0d542ef8671b025a2ee5741c3fe6c9
0.495769
3.842818
false
false
false
false
zxcmehran/FPGADisplay-ipcore
hdl/vhdl/Main.vhd
1
7,201
-- -- -- FPGA Display Handler IP Core By Mehran Ahadi (http://mehran.ahadi.me) -- This IP allows you to draw shapes and print texts on VGA screen. -- Copyright (C) 2015-2016 Mehran Ahadi -- This work is released under MIT License. -- -- Display Component Main Fille -- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity MainComponent is Generic ( w_pixels: integer; w_fp: integer; w_synch: integer; w_bp: integer; w_syncval: std_logic; h_pixels: integer; h_fp: integer; h_synch: integer; h_bp: integer; h_syncval: std_logic; display_clk_m: integer; display_clk_d: integer ); Port ( CLK: in STD_LOGIC; R : out STD_LOGIC_VECTOR(7 downto 0); G : out STD_LOGIC_VECTOR(7 downto 0); B : out STD_LOGIC_VECTOR(7 downto 0); PIXEL_CLK : out STD_LOGIC; COMP_SYNCH : out STD_LOGIC; OUT_BLANK_Z : out STD_LOGIC; HSYNC : out STD_LOGIC; VSYNC : out STD_LOGIC; MEMCLK: in std_logic; MEMDIN: in std_logic_vector (0 to 0); MEMDOUT: out std_logic_vector (0 to 0); MEMADDR: in std_logic_vector(19 downto 0); MEMWE: in std_logic ); end MainComponent; architecture Behavioral of MainComponent is -- ## Define Components -- DisplayOut component DisplayOut Generic ( w_pixels: integer; w_fp: integer; w_synch: integer; w_bp: integer; w_syncval: std_logic; h_pixels: integer; h_fp: integer; h_synch: integer; h_bp: integer; h_syncval: std_logic ); Port ( PIXEL_CLK :in STD_LOGIC; COMP_SYNCH : out STD_LOGIC; OUT_BLANK_Z : out STD_LOGIC; HSYNC : out STD_LOGIC; VSYNC : out STD_LOGIC; R : out STD_LOGIC_VECTOR(7 downto 0); G : out STD_LOGIC_VECTOR(7 downto 0); B : out STD_LOGIC_VECTOR(7 downto 0); MEMORY_ADDRESS: OUT std_logic_VECTOR(19 downto 0); MEMORY_OUT: IN std_logic_VECTOR(0 downto 0) ); end component; -- ClockMaker component ClockMaker is generic ( multiplier : integer; divider : integer ); port ( CLKIN_IN : in std_logic; RST_IN : in std_logic; CLKFX_OUT : out std_logic; CLKIN_IBUFG_OUT : out std_logic; LOCKED_OUT : out std_logic ); end component; -- Dual Port Memory component DisplayMemoryDual port ( addra: IN std_logic_VECTOR(19 downto 0); addrb: IN std_logic_VECTOR(19 downto 0); clka: IN std_logic; clkb: IN std_logic; dina: IN std_logic_VECTOR(0 downto 0); dinb: IN std_logic_VECTOR(0 downto 0); douta: OUT std_logic_VECTOR(0 downto 0); doutb: OUT std_logic_VECTOR(0 downto 0); wea: IN std_logic; web: IN std_logic ); end component; -- ## Define Signals signal displayClockSignal : std_logic; signal displayClockReset : std_logic; signal displayClockBuffer : std_logic; signal displayClockLocked : std_logic; signal memoryReadAddress: std_logic_VECTOR(19 downto 0); signal memoryOut: std_logic_VECTOR(0 downto 0); -- ## Define Constants -- 640x480@60hz -- constant displayClockDivider: integer := 8; -- constant displayClockMultiplier: integer := 2; -- -- constant displayWidthPixels: integer := 640; -- constant displayWidthFP: integer := 16; -- constant displayWidthSynch: integer := 96; -- constant displayWidthBP: integer := 48; -- constant displayWidthSyncVal: std_logic := '0'; -- -- constant displayHeightPixels: integer := 480; ---- constant displayHeightFP: integer := 10; ---- constant displayHeightSynch: integer := 2; ---- constant displayHeightBP: integer := 33; -- constant displayHeightFP: integer := 9; -- constant displayHeightSynch: integer := 2; -- constant displayHeightBP: integer := 29; -- constant displayHeightSyncVal: std_logic := '0'; -- 800x600@60hz -- constant displayClockDivider: integer := 10; -- constant displayClockMultiplier: integer := 4; -- -- constant displayWidthPixels: integer := 800; -- constant displayWidthFP: integer := 40; -- constant displayWidthSynch: integer := 128; -- constant displayWidthBP: integer := 88; -- constant displayWidthSyncVal: std_logic := '1'; -- -- constant displayHeightPixels: integer := 600; -- constant displayHeightFP: integer := 1; -- constant displayHeightSynch: integer := 4; -- constant displayHeightBP: integer := 23; -- constant displayHeightSyncVal: std_logic := '1'; -- 1024*768@60hz -- constant displayClockDivider: integer := 20; -- constant displayClockMultiplier: integer := 13; -- -- constant displayWidthPixels: integer := 1024; -- constant displayWidthFP: integer := 24; -- constant displayWidthSynch: integer := 136; -- constant displayWidthBP: integer := 160; -- constant displayWidthSyncVal: std_logic := '0'; -- -- constant displayHeightPixels: integer := 768; -- constant displayHeightFP: integer := 3; -- constant displayHeightSynch: integer := 6; -- constant displayHeightBP: integer := 29; -- constant displayHeightSyncVal: std_logic := '0'; constant displayClockDivider: integer := display_clk_d; constant displayClockMultiplier: integer := display_clk_m; constant displayWidthPixels: integer := w_pixels; constant displayWidthFP: integer := w_fp; constant displayWidthSynch: integer := w_synch; constant displayWidthBP: integer := w_bp; constant displayWidthSyncVal: std_logic := w_syncval; constant displayHeightPixels: integer := h_pixels; constant displayHeightFP: integer := h_fp; constant displayHeightSynch: integer := h_synch; constant displayHeightBP: integer := h_bp; constant displayHeightSyncVal: std_logic := h_syncval; begin -- ## Connecting Components together PIXEL_CLK <= displayClockSignal; -- ClockMaker displayClock: ClockMaker generic map ( DIVIDER => displayClockDivider, MULTIPLIER => displayClockMultiplier ) port map ( CLKIN_IN => CLK, RST_IN => displayClockReset, CLKFX_OUT => displayClockSignal, CLKIN_IBUFG_OUT => displayClockBuffer, LOCKED_OUT => displayClockLocked ); -- DisplayOut display: DisplayOut generic map ( w_pixels => displayWidthPixels, w_fp => displayWidthFP, w_synch => displayWidthSynch, w_bp => displayWidthBP, w_syncval => displayWidthSyncVal, h_pixels => displayHeightPixels, h_fp => displayHeightFP, h_synch => displayHeightSynch, h_bp => displayHeightBP, h_syncval => displayHeightSyncVal ) port map ( PIXEL_CLK => displayClockSignal, COMP_SYNCH => COMP_SYNCH, OUT_BLANK_Z => OUT_BLANK_Z, HSYNC => HSYNC, VSYNC => VSYNC, R => R, G => G, B => B, MEMORY_ADDRESS => memoryReadAddress, MEMORY_OUT => memoryOut ); -- Display Memory memory: DisplayMemoryDual port map ( clka => MEMCLK, dina => MEMDIN, douta => MEMDOUT, addra => MEMADDR, wea => MEMWE, clkb => displayClockSignal, addrb => memoryReadAddress, doutb => memoryOut, dinb => "0", web => '0' ); end Behavioral;
mit
17ad2b51678ec1ccc94234d09a2a5e73
0.663936
2.839511
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/median/prj/solution1/syn/vhdl/FIFO_image_filter_img_1_data_stream_2_V.vhd
4
4,629
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_img_1_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_img_1_data_stream_2_V_shiftReg; architecture rtl of FIFO_image_filter_img_1_data_stream_2_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_img_1_data_stream_2_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_img_1_data_stream_2_V is component FIFO_image_filter_img_1_data_stream_2_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_img_1_data_stream_2_V_shiftReg : FIFO_image_filter_img_1_data_stream_2_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
d2e557602549a8ee18881c2d10523b9e
0.537697
3.449329
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/amba/dma2ahb_tp.vhd
1
67,479
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --============================================================================-- -- Design unit : DMA2AHB_TestPackage (package declaration) -- -- File name : dma2ahb_tp.vhd -- -- Purpose : Interface package for AMBA AHB master interface with DMA input -- -- Reference : AMBA(TM) Specification (Rev 2.0), ARM IHI 0011A, -- 13th May 1999, issue A, first release, ARM Limited -- The document can be retrieved from http://www.arm.com -- AMBA is a trademark of ARM Limited. -- ARM is a registered trademark of ARM Limited. -- -- Note : Naming convention according to AMBA(TM) Specification: -- Signal names are in upper case, except for the following: -- A lower case 'n' in the name indicates that the signal -- is active low. -- Constant names are in upper case. -- The least significant bit of an array is located to the right, -- carrying the index number zero. -- -- Limitations : See DMA2AHB VHDL core -- -- Library : {independent} -- -- Authors : Aeroflex Gaisler AB -- -- Contact : mailto:[email protected] -- http://www.gaisler.com -- -- Disclaimer : All information is provided "as is", there is no warranty that -- the information is correct or suitable for any purpose, -- neither implicit nor explicit. -- -------------------------------------------------------------------------------- -- Version Author Date Changes -- -- 1.4 SH 1 Jul 2005 New package -- 1.5 SH 1 Sep 2005 New library TOPNET -- 1.6 SH 20 Sep 2005 Added transparent HSIZE support -- 1.8 SH 10 Nov 2005 Updated DMA2AHB interface usage -- 1.9 SH 4 Jan 2006 Burst routines added -- Fault reporting priority and timing improved -- 1.9.1 SH 12 Jan 2006 Correct DmaComp8 -- 1.9.2 SH ## ### #### Corrected compare to allow pull-up -- Adjusted printouts -- 1.9.3 JA 14 Dec 2007 Support for halfword and byte bursts -- 1.9.4 MI 4 Aug 2008 Support for Lock -- 1.9.5 SH 4 Mar 2011 Modifed burst accesses to mimic real hw -------------------------------------------------------------------------------- library IEEE; use IEEE.Std_Logic_1164.all; use IEEE.Numeric_Std.all; library Std; use Std.Standard.all; use Std.TextIO.all; library GRLIB; use GRLIB.AMBA.all; use GRLIB.STDIO.all; use GRLIB.DMA2AHB_Package.all; use GRLIB.STDLIB.all; package DMA2AHB_TestPackage is ----------------------------------------------------------------------------- -- Vector of words ----------------------------------------------------------------------------- type Data_Vector is array (Natural range <> ) of Std_Logic_Vector(32-1 downto 0); ----------------------------------------------------------------------------- -- Constants for comparison ----------------------------------------------------------------------------- constant DontCare32: Std_Logic_Vector(31 downto 0) := (others => '-'); constant DontCare24: Std_Logic_Vector(23 downto 0) := (others => '-'); constant DontCare16: Std_Logic_Vector(15 downto 0) := (others => '-'); constant DontCare8: Std_Logic_Vector( 7 downto 0) := (others => '-'); ---------------------------------------------------------------------------- -- Constant for calculating burst lengths ---------------------------------------------------------------------------- constant WordSize: integer := 32; ----------------------------------------------------------------------------- -- Initialize AHB interface ----------------------------------------------------------------------------- procedure DMAInit( signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; constant InstancePath: in String := "DMAInit"; constant ScreenOutput: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteQuiet( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWrite( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuiet( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMARead( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAComp( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(31 downto 0); variable RxData: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWrite16( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuiet16( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMARead16( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead16"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAComp16( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(15 downto 0); variable RxData: out Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWrite8( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuiet8( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMARead8( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead8"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAComp8( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector( 7 downto 0); variable RxData: out Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteQuietBurst( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteBurst( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuietBurst( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAReadBurst( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False); ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMACompBurst( constant Address: in Std_Logic_Vector(31 downto 0); variable CxData: in Data_Vector; variable RxData: out Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False); end package DMA2AHB_TestPackage; package body DMA2AHB_TestPackage is ----------------------------------------------------------------------------- -- Compare function handling '-' ----------------------------------------------------------------------------- function Compare(O, C: in Std_Logic_Vector) return Boolean is variable T: Std_Logic_Vector(O'Range) := C; variable Result: Boolean; begin Result := True; for i in O'Range loop if not (To_X01(O(i))=T(i) or T(i)='-' or T(i)='U') then Result := False; end if; end loop; return Result; end function Compare; ----------------------------------------------------------------------------- -- Function declarations ----------------------------------------------------------------------------- function Conv_Std_Logic_Vector( constant i: Integer; w: Integer) return Std_Logic_Vector is variable tmp: Std_Logic_Vector(w-1 downto 0); begin tmp := Std_Logic_Vector(To_UnSigned(i, w)); return(tmp); end; ----------------------------------------------------------------------------- -- Function declarations ----------------------------------------------------------------------------- function Conv_Integer( constant i: Std_Logic_Vector) return Integer is variable tmp: Integer; begin tmp := To_Integer(UnSigned(i)); return(tmp); end; ----------------------------------------------------------------------------- -- Synchronisation with respect to clock and with output offset ----------------------------------------------------------------------------- procedure Synchronise( signal Clock: in Std_ULogic; constant Offset: in Time := 5 ns; constant Enable: in Boolean := True) is begin if Enable then wait until Clock = '1'; -- synchronise if Offset > 0 ns then wait for Offset; -- output offset delay end if; end if; end procedure Synchronise; ----------------------------------------------------------------------------- -- Initialize AHB interface ----------------------------------------------------------------------------- procedure DMAInit( signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; constant InstancePath: in String := "DMAInit"; constant ScreenOutput: in Boolean := False) is variable L: Line; begin Synchronise(HCLK); dmai.Reset <= '0'; dmai.Address <= (others => '0'); dmai.Request <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Store <= '0'; dmai.Data <= (others => '0'); dmai.Size <= "10"; dmai.Lock <= '0'; if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB initalised")); WriteLine(Output, L); end if; end procedure DMAInit; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteQuiet( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False) is variable L: Line; begin -- do not synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(HCLK); end if; dmai.Reset <= '0'; dmai.Address <= Address; dmai.Request <= '1'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Store <= '1'; dmai.Data <= Data; if Size=32 then dmai.Size <= HSIZE32; elsif Size=16 then dmai.Size <= HSIZE16; elsif Size=8 then dmai.Size <= HSIZE8; else report "Unsupported data width" severity Failure; end if; if Lock then dmai.Lock <= '1'; else dmai.Lock <= '0'; end if; wait for 1 ns; if dmao.Grant='0' then while dmao.Grant='0' loop Synchronise(HCLK, 0 ns); end loop; else Synchronise(HCLK); end if; dmai.Reset <= '0'; dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Data <= Data; loop Synchronise(HCLK); while dmao.Ready='0' and dmao.Retry='0' and dmao.Fault='0' loop Synchronise(HCLK); end loop; if dmao.Fault='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" ERROR reponse ")); WriteLine(Output, L); end if; TP := False; dmai.Reset <= '0'; dmai.Address <= (others => '0'); dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); dmai.Lock <= '0'; Synchronise(HCLK); Synchronise(HCLK); exit; elsif dmao.Ready='1' then dmai.Reset <= '0'; dmai.Address <= (others => '0'); dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); dmai.Lock <= '0'; exit; end if; if dmao.Retry='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" RETRY/SPLIT reponse ")); WriteLine(Output, L); end if; end if; end loop; end procedure DMAWriteQuiet; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWrite( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False) is variable OK: Boolean := True; variable L: Line; begin DMAWriteQuiet(Address, Data, HCLK, dmai, dmao, OK, InstancePath, True, cBack2Back, Size, Lock); if ScreenOutput and OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" : data: ")); HWrite(L, Data); WriteLine(Output, L); elsif not OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); TP := False; end if; end procedure DMAWrite; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuiet( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False) is variable L: Line; begin -- do not Synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(HCLK); end if; dmai.Reset <= '0'; dmai.Address <= Address; dmai.Request <= '1'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Store <= '0'; dmai.Data <= (others => '0'); if Size=32 then dmai.Size <= HSIZE32; elsif Size=16 then dmai.Size <= HSIZE16; elsif Size=8 then dmai.Size <= HSIZE8; else report "Unsupported data width" severity Failure; end if; if Lock then dmai.Lock <= '1'; else dmai.Lock <= '0'; end if; wait for 1 ns; if dmao.Grant='0' then while dmao.Grant='0' loop Synchronise(HCLK, 0 ns); end loop; else Synchronise(HCLK); end if; dmai.Reset <= '0'; dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); loop Synchronise(HCLK); while dmao.Ready='0' and dmao.Retry='0' and dmao.Fault='0' loop Synchronise(HCLK); end loop; if dmao.Fault='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" ERROR reponse ")); WriteLine(Output, L); end if; TP := False; dmai.Reset <= '0'; dmai.Address <= (others => '0'); dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); Data := (others => 'X'); Synchronise(HCLK); Synchronise(HCLK); exit; elsif dmao.Ready='1' then Data := dmao.Data; dmai.Address <= (others => '0'); dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); exit; end if; if dmao.Retry='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" RETRY/SPLIT reponse ")); WriteLine(Output, L); end if; end if; end loop; end procedure DMAQuiet; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMARead( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False) is variable OK: Boolean := True; variable L: Line; variable Temp: Std_Logic_Vector(31 downto 0); begin DMAQuiet(Address, Temp, HCLK, dmai, dmao, OK, InstancePath, True, cBack2Back, Size, Lock); if ScreenOutput and OK then Data := Temp; Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : data: ")); HWrite(L, Temp); WriteLine(Output, L); elsif OK then Data := Temp; else Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); Data := (others => '-'); TP := False; end if; end procedure DMARead; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAComp( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(31 downto 0); variable RxData: out Std_Logic_Vector(31 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Lock: in Boolean := False) is variable OK: Boolean := True; variable L: Line; variable Data: Std_Logic_Vector(31 downto 0); begin DMAQuiet(Address, Data, HCLK, dmai, dmao, OK, InstancePath, True, cBack2Back, Size, Lock); if not OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); TP := False; RxData := (others => '-'); elsif not Compare(Data, CxData) then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : data: ")); HWrite(L, Data); Write (L, String'(" : expected: ")); HWrite(L, CxData); Write (L, String'(" # Error #")); WriteLine(Output, L); TP := False; RxData := Data; elsif ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write(L, String'(" : data: ")); HWrite(L, Data); WriteLine(Output, L); RxData := Data; else RxData := Data; end if; end procedure DMAComp; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteQuiet16( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is begin DMAWriteQuiet(Address, Data & Data, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 16, Lock); end procedure DMAWriteQuiet16; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWrite16( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is begin DMAWrite(Address, Data & Data, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 16, Lock); end procedure DMAWrite16; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuiet16( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is variable Tmp: Std_Logic_Vector(31 downto 0); begin DMAQuiet(Address, Tmp, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 16, Lock); if Address(1)='0' then Data := Tmp(31 downto 16); else Data := Tmp(15 downto 0); end if; end procedure DMAQuiet16; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMARead16( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead16"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is variable Tmp: Std_Logic_Vector(31 downto 0); begin DMARead(Address, Tmp, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 16, Lock); if Address(1)='0' then Data := Tmp(31 downto 16); else Data := Tmp(15 downto 0); end if; end procedure DMARead16; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAComp16( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector(15 downto 0); variable RxData: out Std_Logic_Vector(15 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp16"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is variable TmpRx: Std_Logic_Vector(31 downto 0); variable TmpCx: Std_Logic_Vector(31 downto 0); begin if Address(1)='0' then TmpCx := CxData & "----------------"; else TmpCx := "----------------" & CxData; end if; DMAComp(Address, TmpCx, TmpRx, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 16, Lock); if Address(1)='0' then RxData := TmpRx(31 downto 16); else RxData := TmpRx(15 downto 0); end if; end procedure DMAComp16; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteQuiet8( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is begin DMAWriteQuiet(Address, Data & Data & Data & Data, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 8, Lock); end procedure DMAWriteQuiet8; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWrite8( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is begin DMAWrite(Address, Data & Data & Data & Data, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 8, Lock); end procedure DMAWrite8; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuiet8( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is variable Tmp: Std_Logic_Vector(31 downto 0); begin DMAQuiet(Address, Tmp, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 8, Lock); if Address(1 downto 0)="00" then Data := Tmp(31 downto 24); elsif Address(1 downto 0)="01" then Data := Tmp(23 downto 16); elsif Address(1 downto 0)="10" then Data := Tmp(15 downto 8); else Data := Tmp( 7 downto 0); end if; end procedure DMAQuiet8; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMARead8( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead8"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is variable Tmp: Std_Logic_Vector(31 downto 0); begin DMARead(Address, Tmp, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 8, Lock); if Address(1 downto 0)="00" then Data := Tmp(31 downto 24); elsif Address(1 downto 0)="01" then Data := Tmp(23 downto 16); elsif Address(1 downto 0)="10" then Data := Tmp(15 downto 8); else Data := Tmp( 7 downto 0); end if; end procedure DMARead8; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAComp8( constant Address: in Std_Logic_Vector(31 downto 0); constant CxData: in Std_Logic_Vector( 7 downto 0); variable RxData: out Std_Logic_Vector( 7 downto 0); signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp8"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Lock: in Boolean := False) is variable TmpRx: Std_Logic_Vector(31 downto 0); variable TmpCx: Std_Logic_Vector(31 downto 0); begin if Address(1 downto 0)="00" then TmpCx := CxData & "--------" & "--------" & "--------"; elsif Address(1 downto 0)="01" then TmpCx := "--------" & CxData & "--------" & "--------"; elsif Address(1 downto 0)="10" then TmpCx := "--------" & "--------" & CxData & "--------"; else TmpCx := "--------" & "--------" & "--------" & CxData; end if; DMAComp(Address, TmpCx, TmpRx, HCLK, dmai, dmao, TP, InstancePath, ScreenOutput, cBack2Back, 8, Lock); if Address(1 downto 0)="00" then RxData := TmpRx(31 downto 24); elsif Address(1 downto 0)="01" then RxData := TmpRx(23 downto 16); elsif Address(1 downto 0)="10" then RxData := TmpRx(15 downto 8); else RxData := TmpRx( 7 downto 0); end if; end procedure DMAComp8; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteQuietBurst( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False) is variable L: Line; constant Count: Integer := Data'Length*WordSize/Size; variable GCount: Integer := Data'Length*WordSize/Size; variable DCount: Integer := 1; begin -- do not synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(HCLK); end if; dmai.Reset <= '0'; dmai.Address <= Address; dmai.Data <= (others => '0'); dmai.Request <= '1'; dmai.Store <= '1'; if Count > 1 then dmai.Burst <= '1'; else dmai.Burst <= '0'; end if; if Beat=1 then dmai.Beat <= HINCR; elsif Beat=4 then dmai.Beat <= HINCR4; elsif Beat=8 then dmai.Beat <= HINCR8; elsif Beat=16 then dmai.Beat <= HINCR16; else report "Unsupported beat" severity Failure; end if; if Size=32 then dmai.Size <= HSIZE32; elsif Size=16 then dmai.Size <= HSIZE16; elsif Size=8 then dmai.Size <= HSIZE8; else report "Unsupported data width" severity Failure; end if; if Lock then dmai.Lock <= '1'; else dmai.Lock <= '0'; end if; -- wait for first grant, indicating start of accesses Synchronise(HCLK, 0 ns); if dmao.Grant='0' then while dmao.Grant='0' loop Synchronise(HCLK, 0 ns); end loop; end if; GCount := GCount-1; -- first data if Size=32 then dmai.Data <= Data(0); elsif Size=16 then dmai.Data <= Data(0)(31 downto 16) & Data(0)(31 downto 16); elsif Size=8 then dmai.Data <= Data(0)(31 downto 24) & Data(0)(31 downto 24) & Data(0)(31 downto 24) & Data(0)(31 downto 24); end if; loop -- remove request when all grants received if dmao.Grant='1' then if GCount=0 then dmai.Reset <= '0'; dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; else GCount := GCount-1; end if; end if; Synchronise(HCLK, 0 ns); while dmao.Grant='0' and dmao.Ready='0' and dmao.OKAY='0' and dmao.Retry='0' and dmao.Fault='0' loop Synchronise(HCLK, 0 ns); end loop; if dmao.Fault='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+(DCount-1)*Beat*Size/8, 32)); Write (L, String'(" ERROR response ")); WriteLine(Output, L); end if; TP := False; dmai.Reset <= '0'; dmai.Address <= (others => '0'); dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); Synchronise(HCLK, 0 ns); Synchronise(HCLK, 0 ns); exit; elsif dmao.OKAY='1' then -- for each OKAY, provide new data if DCount=Count then dmai.Address <= (others => '0'); dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); Synchronise(HCLK, 0 ns); while dmao.Ready='0' loop Synchronise(HCLK, 0 ns); end loop; if GCount/=0 then report "DMAWriteQuietBurst: Too few grants received!" severity Failure; end if; exit; else if Size=32 then dmai.Data <= Data(DCount); elsif Size=16 then dmai.Data <= Data(DCount/2)((31-16*(DCount mod 2)) downto (16-(16*(DCount mod 2)))) & Data(DCount/2)((31-16*(DCount mod 2)) downto (16-(16*(DCount mod 2)))); elsif Size=8 then dmai.Data <= Data(DCount/4)((31-8*(DCount mod 4)) downto (24-(8*(DCount mod 4)))) & Data(DCount/4)((31-8*(DCount mod 4)) downto (24-(8*(DCount mod 4)))) & Data(DCount/4)((31-8*(DCount mod 4)) downto (24-(8*(DCount mod 4)))) & Data(DCount/4)((31-8*(DCount mod 4)) downto (24-(8*(DCount mod 4)))); end if; DCount := DCount+1; end if; end if; if dmao.Retry='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+(DCount-1)*Beat*Size/8, 32)); Write (L, String'(" RETRY/SPLIT response ")); WriteLine(Output, L); end if; end if; end loop; end procedure DMAWriteQuietBurst; ----------------------------------------------------------------------------- -- AMBA AHB write access ----------------------------------------------------------------------------- procedure DMAWriteBurst( constant Address: in Std_Logic_Vector(31 downto 0); constant Data: in Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAWrite"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False) is variable OK: Boolean := True; variable L: Line; begin DMAWriteQuietBurst(Address, Data, HCLK, dmai, dmao, OK, InstancePath, ScreenOutput, cBack2Back, Size, Beat, Lock); if ScreenOutput and OK then for i in 0 to Data'Length-1 loop Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+i*Beat*Size/8, 32)); Write (L, String'(" : data: ")); HWrite(L, Data(i)); WriteLine(Output, L); end loop; elsif not OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB write access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); TP := False; end if; end procedure DMAWriteBurst; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAQuietBurst( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAQuiet"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False) is variable L: Line; constant Count: Integer := Data'Length*WordSize/Size; variable GCount: Integer := Data'Length*WordSize/Size; variable DCount: Integer := 1; variable DataPart: Integer := 0; begin -- do not synchronise when a back-to-back access is requested if not cBack2Back then Synchronise(HCLK); end if; dmai.Reset <= '0'; dmai.Address <= Address; dmai.Data <= (others => '0'); dmai.Request <= '1'; dmai.Store <= '0'; if Count > 1 then dmai.Burst <= '1'; else dmai.Burst <= '0'; end if; if Beat=1 then dmai.Beat <= HINCR; elsif Beat=4 then dmai.Beat <= HINCR4; elsif Beat=8 then dmai.Beat <= HINCR8; elsif Beat=16 then dmai.Beat <= HINCR16; else report "Unsupported beat" severity Failure; end if; if Size=32 then dmai.Size <= HSIZE32; elsif Size=16 then dmai.Size <= HSIZE16; if Address(1 downto 0) = "00" then DataPart := 0; else DataPart := 1; end if; elsif Size=8 then dmai.Size <= HSIZE8; if Address(1 downto 0) = "00" then DataPart := 0; elsif Address(1 downto 0) = "01" then DataPart := 1; elsif Address(1 downto 0) = "10" then DataPart := 2; else DataPart := 3; end if; else report "Unsupported data width" severity Failure; end if; if Lock then dmai.Lock <= '1'; else dmai.Lock <= '0'; end if; -- wait for first grant, indicating start of accesses Synchronise(HCLK, 0 ns); if dmao.Grant='0' then while dmao.Grant='0' loop Synchronise(HCLK, 0 ns); end loop; end if; GCount := GCount-1; loop -- remove request when all grants received if dmao.Grant='1' then if GCount=0 then dmai.Reset <= '0'; dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; else GCount := GCount-1; end if; end if; Synchronise(HCLK, 0 ns); while dmao.Grant='0' and dmao.Ready='0' and dmao.Retry='0' and dmao.Fault='0' loop Synchronise(HCLK, 0 ns); end loop; if dmao.Fault='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+(DCount-1)*Beat*Size/8, 32)); Write (L, String'(" ERROR response")); WriteLine(Output, L); end if; TP := False; dmai.Reset <= '0'; dmai.Address <= (others => '0'); dmai.Data <= (others => '0'); dmai.Request <= '0'; dmai.Store <= '0'; dmai.Burst <= '0'; dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); Synchronise(HCLK); Synchronise(HCLK); exit; elsif dmao.Ready='1' then -- for each READY, store data if Size=32 then Data(DCount-1) := dmao.Data; elsif Size=16 then Data((DCount-1)/2)((31-16*((DCount-1) mod 2)) downto (16-(16*((DCount-1) mod 2)))) := dmao.Data((31-16*DataPart) downto (16-16*DataPart)); DataPart := (DataPart + 1) mod 2; elsif Size=8 then Data((DCount-1)/4)((31-8*((DCount-1) mod 4)) downto (24-(8*((DCount-1) mod 4)))) := dmao.Data((31-8*DataPart) downto (24-8*DataPart)); DataPart := (DataPart + 1) mod 4; end if; if DCount=Count then dmai.Address <= (others => '0'); dmai.Beat <= (others => '0'); dmai.Size <= (others => '0'); if GCount/=0 then report "DMAQuietBurst: Too few grants received!" severity Failure; end if; exit; else DCount := DCount+1; end if; end if; if dmao.Retry='1' then if ScreenOutput then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+(DCount-1)*Beat*Size/8, 32)); Write (L, String'(" RETRY/SPLIT response ")); WriteLine(Output, L); end if; end if; end loop; end procedure DMAQuietBurst; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMAReadBurst( constant Address: in Std_Logic_Vector(31 downto 0); variable Data: out Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMARead"; constant ScreenOutput: in Boolean := True; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False) is variable OK: Boolean := True; variable L: Line; variable Temp: Data_Vector(0 to Data'Length-1); begin DMAQuietBurst(Address, Temp, HCLK, dmai, dmao, OK, InstancePath, ScreenOutput, cBack2Back, Size, Beat, Lock); if ScreenOutput and OK then Data := Temp; for i in 0 to Data'Length-1 loop Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+i*Beat*Size/8, 32)); Write (L, String'(" : data: ")); HWrite(L, Temp(i)); WriteLine(Output, L); end loop; elsif OK then Data := Temp; else Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); Temp := (others => (others => '-')); Data := Temp; TP := False; end if; end procedure DMAReadBurst; ----------------------------------------------------------------------------- -- AMBA AHB read access ----------------------------------------------------------------------------- procedure DMACompBurst( constant Address: in Std_Logic_Vector(31 downto 0); variable CxData: in Data_Vector; variable RxData: out Data_Vector; signal HCLK: in Std_ULogic; signal dmai: out dma_in_type; signal dmao: in dma_out_type; variable TP: inout Boolean; constant InstancePath: in String := "DMAComp"; constant ScreenOutput: in Boolean := False; constant cBack2Back: in Boolean := False; constant Size: in Integer := 32; constant Beat: in Integer := 1; constant Lock: in Boolean := False) is variable OK: Boolean := True; variable L: Line; variable Data: Data_Vector(0 to CxData'Length-1); begin DMAQuietBurst(Address, Data, HCLK, dmai, dmao, OK, InstancePath, ScreenOutput, cBack2Back, Size, Beat, Lock); if not OK then Write (L, Now, Right, 15); Write (L, " : " & InstancePath); Write (L, String'(" : AHB read access, address: ")); HWrite(L, Address); Write (L, String'(" : ## Failed ##")); WriteLine(Output, L); TP := False; Data := (others => (others => '-')); RxData := Data; else for i in 0 to Data'Length-1 loop if not Compare(Data(i), CxData(i)) then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+i*Beat*Size/8, 32)); Write(L, String'(" : data: ")); HWrite(L, Data(i)); Write(L, String'(" : expected: ")); HWrite(L, CxData(i)); Write(L, String'(" # Error #")); WriteLine(Output, L); TP := False; elsif ScreenOutput then Write(L, Now, Right, 15); Write(L, " : " & InstancePath); Write(L, String'(" : AHB read access, address: ")); HWrite(L, Conv_Std_Logic_Vector(Conv_Integer(Address)+i*Beat*Size/8, 32)); Write(L, String'(" : data: ")); HWrite(L, Data(i)); WriteLine(Output, L); end if; end loop; RxData := Data; end if; end procedure DMACompBurst; end package body DMA2AHB_TestPackage; --======================================--
gpl-2.0
94687e0c875f394fce2798a32869d168
0.447176
4.716173
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/misc/ahbstat.vhd
1
4,316
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- library ieee; library grlib; library gaisler; use ieee.std_logic_1164.all; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; use gaisler.misc.all; entity ahbstat is generic( pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#FFF#; pirq : integer := 0; nftslv : integer range 1 to NAHBSLV - 1 := 3); port( rst : in std_ulogic; clk : in std_ulogic; ahbmi : in ahb_mst_in_type; ahbsi : in ahb_slv_in_type; stati : in ahbstat_in_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type ); end entity; architecture rtl of ahbstat is type reg_type is record addr : std_logic_vector(31 downto 0); --failing address hsize : std_logic_vector(2 downto 0); --ahb signals for failing op. hmaster : std_logic_vector(3 downto 0); hwrite : std_ulogic; hresp : std_logic_vector(1 downto 0); newerr : std_ulogic; --new error detected cerror : std_ulogic; --correctable error detected pirq : std_ulogic; end record; signal r, rin : reg_type; constant VERSION : integer := 0; constant pconfig : apb_config_type := ( 0 => ahb_device_reg (VENDOR_GAISLER, GAISLER_AHBSTAT, 0, VERSION, pirq), 1 => apb_iobar(paddr, pmask)); begin comb : process(rst, ahbmi, ahbsi, stati, apbi, r) is variable v : reg_type; variable prdata : std_logic_vector(31 downto 0); variable vpirq : std_logic_vector(NAHBIRQ - 1 downto 0); variable ce : std_ulogic; --correctable error begin v := r; vpirq := (others => '0'); prdata := (others => '0'); v.pirq := '0'; ce := orv(stati.cerror(0 to nftslv-1)); case apbi.paddr(2) is when '0' => --status values prdata(2 downto 0) := r.hsize; prdata(6 downto 3) := r.hmaster; prdata(7) := r.hwrite; prdata(8) := r.newerr; prdata(9) := r.cerror; when others => --failing address prdata := r.addr; end case; --writes. data is written in setup cycle so that r.newerr is updated --when hready = '1' if (apbi.psel(pindex) and not apbi.penable and apbi.pwrite) = '1' then case apbi.paddr(2) is when '0' => v.newerr := apbi.pwdata(8); v.cerror := apbi.pwdata(9); when others => null; end case; end if; v.hresp := ahbmi.hresp; if (ahbsi.hready = '1') and (r.newerr = '0') then if (r.hresp = HRESP_ERROR) or (ce = '1') then v.newerr := '1'; v.cerror := ce; else v.addr := ahbsi.haddr; v.hsize := ahbsi.hsize; v.hmaster := ahbsi.hmaster; v.hwrite := ahbsi.hwrite; end if; end if; --irq generation v.pirq := v.newerr and not r.newerr; vpirq(pirq) := r.pirq; --reset if rst = '0' then v.newerr := '0'; v.cerror := '0'; end if; rin <= v; apbo.prdata <= prdata; apbo.pirq <= vpirq; end process; apbo.pconfig <= pconfig; apbo.pindex <= pindex; regs : process(clk) is begin if rising_edge(clk) then r <= rin; end if; end process; -- boot message -- pragma translate_off bootmsg : report_version generic map ("ahbstat" & tost(pindex) & ": AHB status unit rev " & tost(VERSION) & ", irq " & tost(pirq)); -- pragma translate_on end architecture;
gpl-2.0
7913957f4a564910176caa1368d8d501
0.598703
3.523265
false
false
false
false
Luisda199824/ProcesadorMonociclo
TB_WindowsManager.vhd
1
1,771
LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY TB_WindowsManager IS END TB_WindowsManager; ARCHITECTURE behavior OF TB_WindowsManager IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT WindowsManager PORT( rs1 : IN std_logic_vector(4 downto 0); rs2 : IN std_logic_vector(4 downto 0); rd : IN std_logic_vector(4 downto 0); cwp : IN std_logic; op3 : IN std_logic_vector(5 downto 0); op : IN std_logic_vector(1 downto 0); nrs1 : OUT std_logic_vector(5 downto 0); nrs2 : OUT std_logic_vector(5 downto 0); ncwp : OUT std_logic; nrd : OUT std_logic_vector(5 downto 0) ); END COMPONENT; --Inputs signal rs1 : std_logic_vector(4 downto 0) := (others => '0'); signal rs2 : std_logic_vector(4 downto 0) := (others => '0'); signal rd : std_logic_vector(4 downto 0) := (others => '0'); signal cwp : std_logic := '0'; signal op3 : std_logic_vector(5 downto 0) := (others => '0'); signal op : std_logic_vector(1 downto 0) := (others => '0'); --Outputs signal nrs1 : std_logic_vector(5 downto 0); signal nrs2 : std_logic_vector(5 downto 0); signal ncwp : std_logic; signal nrd : std_logic_vector(5 downto 0); BEGIN -- Instantiate the Unit Under Test (UUT) uut: WindowsManager PORT MAP ( rs1 => rs1, rs2 => rs2, rd => rd, cwp => cwp, op3 => op3, op => op, nrs1 => nrs1, nrs2 => nrs2, ncwp => ncwp, nrd => nrd ); stim_proc: process begin rs1 <= "00000"; rs2 <= "00000"; rd <= "00000"; cwp <= '0'; op3 <= "000000"; op <= "00"; wait; end process; END;
mit
4584bdc1b6a5cd11d1ed674cb9fda92f
0.549972
3.328947
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-minimal/testbench.vhd
1
3,966
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library hynix; use hynix.components.all; use work.debug.all; use work.config.all; library hynix; use hynix.components.all; entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; clkperiod : integer := 10 -- system clock period ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sdramfile : string := "ram.srec"; -- sdram contents constant ct : integer := clkperiod/2; signal clk : std_logic := '0'; signal rst : std_logic := '0'; signal rstn : std_logic; signal error : std_logic; -- PROM flash signal address : std_logic_vector(26 downto 0):=(others =>'0'); signal data : std_logic_vector(31 downto 0); signal RamCE : std_logic; signal oen : std_ulogic; signal writen : std_ulogic; -- Debug support unit signal dsubre : std_ulogic; -- AHB Uart signal dsurx : std_ulogic; signal dsutx : std_ulogic; -- APB Uart signal urxd : std_ulogic; signal utxd : std_ulogic; -- Output signals for LEDs signal led : std_logic_vector(15 downto 0); begin -- clock and reset clk <= not clk after ct * 1 ns; rst <= '1', '0' after 100 ns; rstn <= not rst; dsubre <= '0'; urxd <= 'H'; d3 : entity work.leon3mp generic map (fabtech, memtech, padtech, clktech) port map ( clk => clk, btnCpuResetn => rstn, -- PROM address => address(22 downto 0), data => data(31 downto 16), RamOE => oen, RamWE => writen, RamCE => RamCE, -- AHB Uart RsRx => dsurx, RsTx => dsutx, -- Output signals for LEDs led => led ); sram0 : sram generic map (index => 4, abits => 24, fname => sdramfile) port map (address(23 downto 0), data(31 downto 24), RamCE, writen, oen); sram1 : sram generic map (index => 5, abits => 24, fname => sdramfile) port map (address(23 downto 0), data(23 downto 16), RamCE, writen, oen); led(3) <= 'L'; -- ERROR pull-down error <= not led(3); iuerr : process begin wait for 5 us; assert (to_X01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure; end process; data <= buskeep(data) after 5 ns; end;
gpl-2.0
edd756f6146015d2e2086e9b27d357ec
0.579677
4.010111
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_p_src_data_stream_1_V.vhd
2
4,629
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_p_src_data_stream_1_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_p_src_data_stream_1_V_shiftReg; architecture rtl of FIFO_image_filter_p_src_data_stream_1_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_p_src_data_stream_1_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_p_src_data_stream_1_V is component FIFO_image_filter_p_src_data_stream_1_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_p_src_data_stream_1_V_shiftReg : FIFO_image_filter_p_src_data_stream_1_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
c96a3c60eaf28cc4c6dddedfe8508778
0.537697
3.449329
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/netcard/netcard.vhd
1
10,799
----------------------------------------------------------------------------- -- Ethernet/PCI bridge Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; library techmap; use techmap.gencomp.all; use grlib.stdlib.all; library gaisler; use gaisler.uart.all; use gaisler.misc.all; use gaisler.pci.all; use gaisler.net.all; use gaisler.jtag.all; use work.config.all; entity netcard is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH ); port ( resetn : in std_ulogic; clk : in std_ulogic; dsutx : out std_ulogic; -- DSU tx data dsurx : in std_ulogic; -- DSU rx data emdio : inout std_logic; etx_clk : in std_logic; erx_clk : in std_logic; erxd : in std_logic_vector(3 downto 0); erx_dv : in std_logic; erx_er : in std_logic; erx_col : in std_logic; erx_crs : in std_logic; etxd : out std_logic_vector(3 downto 0); etx_en : out std_logic; etx_er : out std_logic; emdc : out std_logic; pci_rst : inout std_ulogic; -- PCI bus pci_clk : in std_ulogic; pci_gnt : in std_ulogic; pci_idsel : in std_ulogic; pci_lock : inout std_ulogic; pci_ad : inout std_logic_vector(31 downto 0); pci_cbe : inout std_logic_vector(3 downto 0); pci_frame : inout std_ulogic; pci_irdy : inout std_ulogic; pci_trdy : inout std_ulogic; pci_devsel : inout std_ulogic; pci_stop : inout std_ulogic; pci_perr : inout std_ulogic; pci_par : inout std_ulogic; pci_req : inout std_ulogic; pci_serr : inout std_ulogic; pci_irq : out std_ulogic; pci_host : in std_ulogic; pci_66 : in std_ulogic ); end; architecture rtl of netcard is signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, pciclk : std_ulogic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal dui : uart_in_type; signal duo : uart_out_type; signal pcii : pci_in_type; signal pcio : pci_out_type; signal ethi : eth_in_type; signal etho : eth_out_type; signal tck, tms, tdi, tdo : std_ulogic; signal irqn, lclk, gnd : std_logic; constant blength : integer := 12; constant fifodepth : integer := 8; constant maxahb : integer := CFG_AHB_UART+ CFG_GRETH+CFG_AHB_JTAG+log2x(CFG_PCI); begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- gnd <= '0'; cgi.pllctrl <= "00"; cgi.pllrst <= resetn; cgi.pllref <= '0'; clkgen0 : clkgen -- clock generator generic map (clktech, CFG_CLKMUL, CFG_CLKDIV, 0, 0, CFG_PCI, CFG_PCIDLL, CFG_PCISYSCLK) port map (lclk, pci_clk, clkm, open, open, open, pciclk, cgi, cgo); clk_pad : clkpad generic map (tech => padtech) port map (clk, lclk); rst0 : rstgen -- reset generator port map (resetn, clkm, cgo.clklock, rstn); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (nahbm => maxahb, nahbs => 4, ioen => 0) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e0 : greth generic map(hindex => log2x(CFG_PCI), pindex => 0, paddr => 11, pirq => 11, memtech => memtech) port map( rst => rstn, clk => clk, ahbmi => ahbmi, ahbmo => ahbmo(log2x(CFG_PCI)), apbi => apbi, apbo => apbo(0), ethi => ethi, etho => etho); emdio_pad : iopad generic map (tech => padtech) port map (emdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : clkpad generic map (tech => padtech, arch => 1) port map (etx_clk, ethi.tx_clk); erxc_pad : clkpad generic map (tech => padtech, arch => 1) port map (erx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (erxd, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (erx_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (erx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (erx_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (erx_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (etxd, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map ( etx_en, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (etx_er, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (emdc, etho.mdc); end generate; irqn <= ahbso(3).hirq(11); irq_pad : odpad generic map (tech => padtech, level => pci33) port map (pci_irq, irqn); ---------------------------------------------------------------------- --- AHB/APB Bridge ------------------------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 0, haddr => 16#800#) port map (rstn, clkm, ahbsi, ahbso(0), apbi, apbo ); ---------------------------------------------------------------------- --- AHB RAM -------------------------------------------------------- ---------------------------------------------------------------------- ram0 : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 2, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map ( rstn, clkm, ahbsi, ahbso(2)); end generate; ----------------------------------------------------------------------- --- PCI ------------------------------------------------------------ ----------------------------------------------------------------------- pp : if CFG_PCI /= 0 generate pci_gr0 : if CFG_PCI = 1 generate -- simple target-only pci0 : pci_target generic map (hindex => 0, device_id => 16#0210#, vendor_id => 16#16E3#) port map (rstn, clkm, pciclk, pcii, pcio, ahbmi, ahbmo(0)); end generate; pci_mtf0 : if CFG_PCI = 2 generate -- master/target with fifo pci0 : pci_mtf generic map (memtech => memtech, hmstndx => 0, fifodepth => 6, device_id => 16#0210#, vendor_id => 16#16E3#, hslvndx => 1, pindex => 6, paddr => 2, haddr => 16#E00#, ioaddr => 16#400#, nsync => 2) port map (rstn, clkm, pciclk, pcii, pcio, apbi, apbo(6), ahbmi, ahbmo(0), ahbsi, ahbso(1)); end generate; pci_dma : if CFG_PCI = 3 generate -- master/target with fifo and DMA dma : pcidma generic map (memtech => memtech, dmstndx => 1, dapbndx => 5, dapbaddr => 5, blength => blength, mstndx => 0, fifodepth => log2(fifodepth), device_id => CFG_PCIDID, vendor_id => CFG_PCIVID, slvndx => 4, apbndx => 4, apbaddr => 4, haddr => 16#E00#, ioaddr => 16#800#, nsync => 1) port map (rstn, clkm, pciclk, pcii, pcio, apbo(5), ahbmo(1), apbi, apbo(4), ahbmi, ahbmo(0), ahbsi, ahbso(4)); end generate; pci_trc0 : if CFG_PCITBUFEN /= 0 generate -- PCI trace buffer pt0 : pcitrace generic map (memtech => memtech, pindex => 3, paddr => 16#100#, pmask => 16#f00#) port map ( rstn, clkm, pciclk, pcii, apbi, apbo(3)); end generate; pcipads0 : pcipads generic map (padtech) port map ( pci_rst, pci_gnt, pci_idsel, pci_lock, pci_ad, pci_cbe, pci_frame, pci_irdy, pci_trdy, pci_devsel, pci_stop, pci_perr, pci_par, pci_req, pci_serr, pci_host, pci_66, pcii, pcio ); end generate; ---------------------------------------------------------------------- --- Optional DSU UARTs ---------------------------------------------- ---------------------------------------------------------------------- dcomgen : if CFG_AHB_UART = 1 generate dcom0: ahbuart -- Debug UART generic map (hindex => log2x(CFG_PCI)+CFG_GRETH, pindex => 1, paddr => 1) port map (rstn, clkm, dui, duo, apbi, apbo(1), ahbmi, ahbmo(log2x(CFG_PCI)+CFG_GRETH)); dsurx_pad : inpad generic map (tech => padtech) port map (dsurx, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (dsutx, duo.txd); end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => log2x(CFG_PCI)+CFG_GRETH+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(log2x(CFG_PCI)+CFG_GRETH+CFG_AHB_UART), open, open, open, open, open, open, open, gnd); end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "Ethernet/PCI Network Card Demonstration design", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
3c885f5a5387049b225c329e0ed74166
0.530142
3.783812
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/tech/umc18/components/umc_simprims.vhd
1
17,431
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: umc_simprims -- File: umc_simprims.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Simple UMC 0.18 simulation models ------------------------------------------------------------------------------ -- pragma translate_off -- input pad library ieee; use ieee.std_logic_1164.all; entity ICMT3V is port( A : in std_logic; Z : out std_logic); end ; architecture behav of ICMT3V is begin Z <= to_X01(A) after 1 ns; end; -- input pad with pull-up library ieee; use ieee.std_logic_1164.all; entity ICMT3VPU is port( A : in std_logic; Z : out std_logic); end ; architecture behav of ICMT3VPU is begin Z <= to_X01(A) after 1 ns; --A <= 'H'; end; -- input pad with pull-down library ieee; use ieee.std_logic_1164.all; entity ICMT3VPD is port( A : in std_logic; Z : out std_logic); end ; architecture behav of ICMT3VPD is begin Z <= to_X01(A) after 1 ns; --A <= 'L'; end; -- schmitt input pad library ieee; use ieee.std_logic_1164.all; entity ISTRT3V is port( A : in std_logic; Z : out std_logic); end ; architecture behav of ISTRT3V is begin Z <= to_X01(A) after 1 ns; end; -- output pads library ieee; use ieee.std_logic_1164.all; entity OCM3V4 is port( Z : out std_logic; A : in std_logic); end; architecture behav of OCM3V4 is begin Z <= to_X01(A) after 3 ns; end; library ieee; use ieee.std_logic_1164.all; entity OCM3V12 is port( Z : out std_logic; A : in std_logic); end; architecture behav of OCM3V12 is begin Z <= to_X01(A) after 2 ns; end; library ieee; use ieee.std_logic_1164.all; entity OCM3V24 is port( Z : out std_logic; A : in std_logic); end; architecture behav of OCM3V24 is begin Z <= to_X01(A) after 1 ns; end; -- tri-state output pads library ieee; use ieee.std_logic_1164.all; entity OCMTR4 is port( EN : in std_logic; A : in std_logic; Z : out std_logic); end; architecture behav of OCMTR4 is begin Z <= to_X01(A) after 3 ns when to_X01(en) = '1' else 'Z' after 3 ns when to_X01(en) = '0' else 'X' after 3 ns; end; library ieee; use ieee.std_logic_1164.all; entity OCMTR12 is port( EN : in std_logic; A : in std_logic; Z : out std_logic); end; architecture behav of OCMTR12 is begin Z <= to_X01(A) after 2 ns when to_X01(en) = '1' else 'Z' after 2 ns when to_X01(en) = '0' else 'X' after 2 ns; end; library ieee; use ieee.std_logic_1164.all; entity OCMTR24 is port( EN : in std_logic; A : in std_logic; Z : out std_logic); end; architecture behav of OCMTR24 is begin Z <= to_X01(A) after 1 ns when to_X01(en) = '1' else 'Z' after 1 ns when to_X01(en) = '0' else 'X' after 1 ns; end; -- bidirectional pads library ieee; use ieee.std_logic_1164.all; entity BICM3V4 is port( IO : inout std_logic; EN : in std_logic; A : in std_logic; Z : out std_logic); end; architecture behav of BICM3V4 is begin IO <= to_X01(A) after 3 ns when to_X01(en) = '1' else 'Z' after 3 ns when to_X01(en) = '0' else 'X' after 3 ns; Z <= to_X01(IO) after 1 ns; end; library ieee; use ieee.std_logic_1164.all; entity BICM3V12 is port( IO : inout std_logic; EN : in std_logic; A : in std_logic; Z : out std_logic); end; architecture behav of BICM3V12 is begin IO <= to_X01(A) after 2 ns when to_X01(en) = '1' else 'Z' after 2 ns when to_X01(en) = '0' else 'X' after 2 ns; Z <= to_X01(IO) after 1 ns; end; library ieee; use ieee.std_logic_1164.all; entity BICM3V24 is port( IO : inout std_logic; EN : in std_logic; A : in std_logic; Z : out std_logic); end; architecture behav of BICM3V24 is begin IO <= to_X01(A) after 1 ns when to_X01(en) = '1' else 'Z' after 1 ns when to_X01(en) = '0' else 'X' after 1 ns; Z <= to_X01(IO) after 1 ns; end; library ieee; use ieee.std_logic_1164.all; entity LVDS_Receiver is port( A, AN : in std_logic; Z : out std_logic); end; architecture struct of LVDS_Receiver is signal yn : std_ulogic := '0'; begin yn <= to_X01(A) after 1 ns when to_x01(A xor AN) = '1' else yn after 1 ns; Z <= yn; end; library ieee; use ieee.std_logic_1164.all; entity LVDS_Driver is port (A, Vref, HI : in std_logic; Z, ZN : out std_logic ); end; architecture struct of LVDS_Driver is begin Z <= A after 1 ns; ZN <= not A after 1 ns; end; library ieee; use ieee.std_logic_1164.all; entity LVDS_Biasmodule is port ( RefR : in std_logic; Vref, HI : out std_logic); end; architecture struct of LVDS_Biasmodule is begin end; -- single-port memory library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.stdlib.all; entity UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end; architecture behav of UMC_SIM_SRAM is subtype memword is std_logic_vector(dbits-1 downto 0); type mem_type is array (0 to 2**abits-1) of memword; signal qint : memword; begin m : process(clk) variable mem : mem_type; begin if rising_edge(clk) then qint <= (others => 'X'); if to_X01(wen) = '0' then mem(conv_integer(a)) := data; elsif to_X01(wen) = '1' then qint <= mem(conv_integer(a)); end if; end if; end process; q <= qint when to_X01(oen) = '0' else (others => 'Z') when to_X01(oen) = '1' else (others => 'X'); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_2048wx32b is port ( a : in std_logic_vector(10 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_2048wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (11, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_1024wx32b is port ( a : in std_logic_vector(9 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_1024wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (10, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_512wx32b is port ( a : in std_logic_vector(8 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_512wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (9, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_256wx32b is port ( a : in std_logic_vector(7 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_256wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (8, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_128wx32b is port ( a : in std_logic_vector(6 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_128wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (7, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_64wx32b is port ( a : in std_logic_vector(5 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_64wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (6, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_32wx32b is port ( a : in std_logic_vector(4 downto 0); data : in std_logic_vector(31 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(31 downto 0); clk : in std_logic ); end; architecture behav of SRAM_32wx32b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (5, 32) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_2048wx40b is port ( a : in std_logic_vector(10 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_2048wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (11, 40) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_1024wx40b is port ( a : in std_logic_vector(9 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_1024wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (10, 40) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_512wx40b is port ( a : in std_logic_vector(8 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_512wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (9, 40) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_256wx40b is port ( a : in std_logic_vector(7 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_256wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (8, 40) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_128wx40b is port ( a : in std_logic_vector(6 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_128wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (7, 40) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_64wx40b is port ( a : in std_logic_vector(5 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_64wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (6, 40) port map (a, data, csn, wen, oen, q, clk); end; library ieee; use ieee.std_logic_1164.all; entity SRAM_32wx40b is port ( a : in std_logic_vector(4 downto 0); data : in std_logic_vector(39 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(39 downto 0); clk : in std_logic ); end; architecture behav of SRAM_32wx40b is component UMC_SIM_SRAM is generic (abits, dbits : integer := 8); port ( a : in std_logic_vector(abits-1 downto 0); data : in std_logic_vector(dbits-1 downto 0); csn : in std_logic; wen : in std_logic; oen : in std_logic; q : out std_logic_vector(dbits-1 downto 0); clk : in std_logic ); end component; begin m : UMC_SIM_SRAM generic map (5, 40) port map (a, data, csn, wen, oen, q, clk); end; -- pragma translate_on
gpl-2.0
94a155e1a9399af2fbd3a21d3743860b
0.632379
2.730848
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-avnet-eval-xc4vlx25/leon3mp.vhd
1
21,840
------------------------------------------------------------------------------ -- LEON3 Demonstration design -- Copyright (C) 2006 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; use techmap.allclkgen.all; library gaisler; use gaisler.memctrl.all; use gaisler.ddrpkg.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.net.all; use gaisler.jtag.all; library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; ddrfreq : integer := 100000 -- frequency of ddr clock in kHz ); port ( resetn : in std_ulogic; resoutn : out std_logic; clk_100mhz : in std_ulogic; errorn : out std_ulogic; -- prom interface address : out std_logic_vector(21 downto 0); data : inout std_logic_vector(15 downto 0); romsn : out std_ulogic; oen : out std_ulogic; writen : out std_ulogic; romrstn : out std_ulogic; -- pragma translate_off iosn : out std_ulogic; testdata : inout std_logic_vector(15 downto 0); -- pragma translate_on -- ddr memory ddr_clk0 : out std_logic; ddr_clk0b : out std_logic; ddr_clk_fb_out : out std_logic; ddr_clk_fb : in std_logic; ddr_cke0 : out std_logic; ddr_cs0b : out std_logic; ddr_web : out std_ulogic; -- ddr write enable ddr_rasb : out std_ulogic; -- ddr ras ddr_casb : out std_ulogic; -- ddr cas ddr_dm : out std_logic_vector (1 downto 0); -- ddr dm ddr_dqs : inout std_logic_vector (1 downto 0); -- ddr dqs ddr_ad : out std_logic_vector (12 downto 0); -- ddr address ddr_ba : out std_logic_vector (1 downto 0); -- ddr bank address ddr_dq : inout std_logic_vector (15 downto 0); -- ddr data -- debug support unit dsuen : in std_ulogic; dsubre : in std_ulogic; dsuact : out std_ulogic; -- UART for serial DCL/console I/O serrx : in std_ulogic; sertx : out std_ulogic; rtsn : out std_ulogic; ctsn : in std_ulogic; led_rx : out std_ulogic; led_tx : out std_ulogic; -- ethernet signals emdio : inout std_logic; -- ethernet PHY interface etx_clk : in std_ulogic; erx_clk : in std_ulogic; erxd : in std_logic_vector(3 downto 0); erx_dv : in std_ulogic; erx_er : in std_ulogic; erx_col : in std_ulogic; erx_crs : in std_ulogic; etxd : out std_logic_vector(3 downto 0); etx_en : out std_ulogic; etx_er : out std_ulogic; emdc : out std_ulogic; erstn : out std_ulogic; -- OLED display signals disp_dcn : out std_ulogic; disp_csn : out std_ulogic; disp_rdn : out std_ulogic; disp_wrn : out std_ulogic; disp_d : inout std_logic_vector(7 downto 0) ); end; architecture rtl of leon3mp is constant blength : integer := 12; constant fifodepth : integer := 8; signal vcc, gnd : std_logic_vector(4 downto 0); signal memi : memory_in_type; signal memo : memory_out_type; signal wpo : wprot_out_type; signal sdi : sdctrl_in_type; signal sdo : sdctrl_out_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal lclk : std_ulogic; signal ddrclk, ddrrst, ddrclkfb : std_ulogic; signal clkm, rstn, clkml, clk2x : std_ulogic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, dui : uart_in_type; signal u1o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal ethi, ethi1, ethi2 : eth_in_type; signal etho, etho1, etho2 : eth_out_type; signal gpti : gptimer_in_type; signal tck, tms, tdi, tdo : std_ulogic; -- signal dsubre : std_logic; signal duart, ldsuen : std_logic; signal rsertx, rserrx, rdsuen : std_logic; signal rstraw : std_logic; signal rstneg : std_logic; signal rxd1 : std_logic; signal txd1 : std_logic; signal lock : std_logic; signal ddr_clk : std_logic_vector(2 downto 0); signal ddr_clkb : std_logic_vector(2 downto 0); signal ddr_cke : std_logic_vector(1 downto 0); signal ddr_csb : std_logic_vector(1 downto 0); signal ddr_adl : std_logic_vector(13 downto 0); -- ddr address attribute keep : boolean; attribute syn_keep : boolean; attribute syn_preserve : boolean; attribute syn_keep of lock : signal is true; attribute syn_keep of clkml : signal is true; attribute syn_preserve of clkml : signal is true; attribute keep of lock : signal is true; attribute keep of clkml : signal is true; attribute keep of clkm : signal is true; constant BOARD_FREQ : integer := 100000; -- input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz begin romrstn <= rstn; ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= (others => '1'); gnd <= (others => '0'); cgi.pllctrl <= "00"; cgi.pllrst <= rstraw; rstneg <= not resetn; rst0 : rstgen port map (rstneg, clkm, lock, rstn, rstraw); clk_pad : clkpad generic map (tech => padtech) port map (clk_100mhz, lclk); clkgen0 : clkgen -- clock generator generic map (clktech, CFG_CLKMUL, CFG_CLKDIV, 0, 1, 0, 0, 0, BOARD_FREQ, 0) port map (lclk, gnd(0), clkm, open, open, open, open, cgi, cgo); ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => 1, nahbm => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH+1, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- leon3gen : if CFG_LEON3 = 1 generate cpu : for i in 0 to CFG_NCPU-1 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; error_pad : odpad generic map (tech => padtech) port map (errorn, dbgo(0).error); dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); -- dsuen_pad : inpad generic map (tech => padtech) port map (dsuen, dsui.enable); dsui.enable <= '1'; dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsuact_pad : outpad generic map (tech => padtech) port map (dsuact, dsuo.active); end generate; end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_UART = 1 generate dcom0 : ahbuart -- Debug UART generic map (hindex => CFG_NCPU, pindex => 4, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(4), ahbmi, ahbmo(CFG_NCPU)); end generate; nouah : if CFG_AHB_UART = 0 generate apbo(4) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => CFG_NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(CFG_NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd(0)); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 : mctrl generic map (hindex => 5, pindex => 0, paddr => 0, srbanks => 1, ramaddr => 16#600#, rammask => 16#F00#, ram16 => 1 ) port map (rstn, clkm, memi, memo, ahbsi, ahbso(5), apbi, apbo(0), wpo, open); end generate; memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "01"; mg0 : if (CFG_MCTRL_LEON2 = 0) generate apbo(0) <= apb_none; ahbso(0) <= ahbs_none; roms_pad : outpad generic map (tech => padtech) port map (romsn, vcc(0)); end generate; mgpads : if (CFG_MCTRL_LEON2 /= 0) generate addr_pad : outpadv generic map (width => 22, tech => padtech) port map (address, memo.address(22 downto 1)); roms_pad : outpad generic map (tech => padtech) port map (romsn, memo.romsn(0)); oen_pad : outpad generic map (tech => padtech) port map (oen, memo.oen); wri_pad : outpad generic map (tech => padtech) port map (writen, memo.writen); -- pragma translate_off iosn_pad : outpad generic map (tech => padtech) port map (iosn, memo.iosn); tbdr : for i in 0 to 1 generate data_pad : iopadv generic map (tech => padtech, width => 8) port map (testdata(15-i*8 downto 8-i*8), memo.data(15-i*8 downto 8-i*8), memo.bdrive(i+2), memi.data(15-i*8 downto 8-i*8)); end generate; -- pragma translate_on bdr : for i in 0 to 1 generate data_pad : iopadv generic map (tech => padtech, width => 8) port map (data(15-i*8 downto 8-i*8), memo.data(31-i*8 downto 24-i*8), memo.bdrive(i), memi.data(31-i*8 downto 24-i*8)); end generate; end generate; ---------------------------------------------------------------------- --- DDR memory controller ------------------------------------------- ---------------------------------------------------------------------- ddrsp0 : if (CFG_DDRSP /= 0) generate ddrc : ddrspa generic map ( fabtech => virtex4, memtech => memtech, hindex => 4, haddr => 16#400#, hmask => 16#F00#, ioaddr => 1, pwron => CFG_DDRSP_INIT, MHz => BOARD_FREQ/1000, rskew => -95 -- pragma translate_off * 0 -- disable clock skew during simulation -- pragma translate_on , clkmul => CFG_DDRSP_FREQ/5, clkdiv => 20, col => CFG_DDRSP_COL, Mbyte => CFG_DDRSP_SIZE, ahbfreq => CPU_FREQ/1000, ddrbits => 16) port map ( rstneg, rstn, lclk, clkm, lock, clkml, clkml, ahbsi, ahbso(4), ddr_clk, ddr_clkb, ddr_clk_fb_out, ddr_clk_fb, ddr_cke, ddr_csb, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_adl, ddr_ba, ddr_dq); ddr_clk0 <= ddr_clk(0); ddr_clk0b <= ddr_clkb(0); ddr_cke0 <= ddr_cke(0); ddr_cs0b <= ddr_csb(0); ddr_ad <= ddr_adl(12 downto 0); end generate; noddr : if (CFG_DDRSP = 0) generate lock <= '1'; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GR GPIO unit grgpio0: grgpio generic map( pindex => 11, paddr => 11, imask => CFG_GRGPIO_IMASK, nbits => 12 --CFG_GRGPIO_WIDTH ) port map( rstn, clkm, apbi, apbo(11), gpioi, gpioo); disp_csn_pad : outpad generic map (tech => padtech) port map (disp_csn, gpioo.dout(8)); disp_dcn_pad : outpad generic map (tech => padtech) port map (disp_dcn, gpioo.dout(9)); disp_rdn_pad : outpad generic map (tech => padtech) port map (disp_rdn, gpioo.dout(10)); disp_wrn_pad : outpad generic map (tech => padtech) port map (disp_wrn, gpioo.dout(11)); disp_d_pads : for i in 0 to 7 generate pio_pad : iopad generic map (tech => padtech) port map (disp_d(i), gpioo.dout(i), gpioo.oen(i), gpioi.din(i)); end generate; end generate; ----------------------------------------------------------------------- --- ETHERNET --------------------------------------------------------- ----------------------------------------------------------------------- eth0 : if CFG_GRETH = 1 generate -- Gaisler ethernet MAC e1 : grethm generic map(hindex => CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG, pindex => 15, paddr => 15, pirq => 12, memtech => memtech, mdcscaler => CPU_FREQ/1000, enable_mdio => 1, fifosize => CFG_ETH_FIFO, nsync => 1, edcl => CFG_DSU_ETH, edclbufsz => CFG_ETH_BUF, macaddrh => CFG_ETH_ENM, macaddrl => CFG_ETH_ENL, ipaddrh => CFG_ETH_IPM, ipaddrl => CFG_ETH_IPL, phyrstadr => 3, giga => CFG_GRETH1G) port map( rst => rstn, clk => clkm, ahbmi => ahbmi, ahbmo => ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG), apbi => apbi, apbo => apbo(15), ethi => ethi, etho => etho); emdio_pad : iopad generic map (tech => padtech) port map (emdio, etho.mdio_o, etho.mdio_oe, ethi.mdio_i); etxc_pad : inpad generic map (tech => padtech) port map (etx_clk, ethi.tx_clk); erxc_pad : inpad generic map (tech => padtech) port map (erx_clk, ethi.rx_clk); erxd_pad : inpadv generic map (tech => padtech, width => 4) port map (erxd, ethi.rxd(3 downto 0)); erxdv_pad : inpad generic map (tech => padtech) port map (erx_dv, ethi.rx_dv); erxer_pad : inpad generic map (tech => padtech) port map (erx_er, ethi.rx_er); erxco_pad : inpad generic map (tech => padtech) port map (erx_col, ethi.rx_col); erxcr_pad : inpad generic map (tech => padtech) port map (erx_crs, ethi.rx_crs); etxd_pad : outpadv generic map (tech => padtech, width => 4) port map (etxd, etho.txd(3 downto 0)); etxen_pad : outpad generic map (tech => padtech) port map (etx_en, etho.tx_en); etxer_pad : outpad generic map (tech => padtech) port map (etx_er, etho.tx_er); emdc_pad : outpad generic map (tech => padtech) port map (emdc, etho.mdc); erstn_pad : outpad generic map (tech => padtech) port map (erstn, rstn); end generate; ----------------------------------------------------------------------- --- AHB DMA ---------------------------------------------------------- ----------------------------------------------------------------------- -- dma0 : ahbdma -- generic map (hindex => CFG_NCPU+CFG_AHB_UART+CFG_GRETH, -- pindex => 12, paddr => 12, dbuf => 32) -- port map (rstn, clkm, apbi, apbo(12), ahbmi, -- ahbmo(CFG_NCPU+CFG_AHB_UART+CFG_GRETH)); -- -- at0 : ahbtrace -- generic map ( hindex => 7, ioaddr => 16#200#, iomask => 16#E00#, -- tech => memtech, irq => 0, kbytes => 8) -- port map ( rstn, clkm, ahbmi, ahbsi, ahbso(7)); ----------------------------------------------------------------------- --- AHB ROM ---------------------------------------------------------- ----------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(6) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ahbramgen : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 3, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ) port map (rstn, clkm, ahbsi, ahbso(3)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(3) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- nam1 : for i in (CFG_NCPU+CFG_AHB_UART+CFG_AHB_JTAG+CFG_GRETH+1) to NAHBMST-1 generate ahbmo(i) <= ahbm_none; end generate; -- nap0 : for i in 9 to NAPBSLV-1-CFG_GRETH generate apbo(i) <= apb_none; end generate; -- nah0 : for i in 8 to NAHBSLV-1 generate ahbso(i) <= ahbs_none; end generate; resoutn <= rstn; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 MP Demonstration design for Avnet Virtex4 Eval board", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on -- use switch 1 to multiplex DSU UART and UART1 dsuen_pad : inpad generic map (tech => padtech) port map (dsuen, ldsuen); duart <= rdsuen when CFG_AHB_UART /= 0 else '0'; rxd1 <= txd1 when duart = '1' else rserrx; rsertx <= duo.txd when duart = '1' else txd1; dui.rxd <= rserrx when duart = '1' else '1'; led_rx <= not rserrx; p1 : process(clkm) begin if rising_edge(clkm) then sertx <= rsertx; rserrx <= serrx; rdsuen <= ldsuen; rtsn <= '0'; led_tx <= not rsertx; end if; end process; end rtl;
gpl-2.0
997db8eadf56b71961f53b714ef7ec2b
0.538004
3.739726
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_cdma_v4_1/25515467/hdl/src/vhdl/axi_cdma_pulse_gen.vhd
1
15,300
------------------------------------------------------------------------------- -- axi_cdma_pulse_gen.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_cdma_pulse_gen.vhd -- -- Description: -- This file is the design for a parameterizable pulse width generator. -- The input Sig_In is either Positive Edge or Negative detected -- which triggers a pulse generator. Allowed pulse widths are 1 to -- 64 input clock periods. -- -- -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Library declarations library IEEE; use IEEE.std_logic_1164.all; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library lib_cdc_v1_0; library axi_cdma_v4_1; use axi_cdma_v4_1.axi_cdma_pkg.all; ------------------------------------------------------------------------------ entity axi_cdma_pulse_gen is generic ( C_INCLUDE_SYNCHRO : Integer range 0 to 1 := 0; -- 0 = Do not include synchronizer registers -- 1 = Include synchronizer registers C_POS_EDGE_TRIG : Integer range 0 to 1 := 1; -- 0 = Negative Edge Triggered Pulse -- 1 = Positive Edge Triggered Pulse C_PULSE_WIDTH_CLKS : integer range 1 to 64 := 4 -- Desired Output Pulse width (in Clk_In periods) ); port ( -- Input synchronization clock Clk_In : In std_logic; -- Module reset (active high) Rst_In : In std_logic; -- Input trigger signal Sig_in : In std_logic; -- Output pulse Pulse_Out : Out std_logic ); end entity axi_cdma_pulse_gen; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_cdma_pulse_gen is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ATTRIBUTE async_reg : STRING; ------------------------------------------------------------------------------- -- Functions Declarations ------------------------------------------------------------------------------- -- none ------------------------------------------------------------------------------- -- Constant Declarations ------------------------------------------------------------------------------- Constant ADJUSTED_CLKs : integer := C_PULSE_WIDTH_CLKS+1; ------------------------------------------------------------------------------- -- Internal Signal Declaration ------------------------------------------------------------------------------- -- System module reset interconnect signals signal sig_pulse_out : std_logic; signal sig_to_edge_detect_reg : std_logic; signal sig_pulse_trigger : std_logic; signal sig_shift_reg : std_logic_vector(0 to ADJUSTED_CLKs-1); -- Addition of synchronizer front-end signal sig_synchro_reg1_cdc_tig : std_logic; signal sig_synchro_reg2 : std_logic; signal sig_to_edge_detect : std_logic; -- ATTRIBUTE async_reg OF sig_synchro_reg1_cdc_tig : SIGNAL IS "true"; -- ATTRIBUTE async_reg OF sig_synchro_reg2 : SIGNAL IS "true"; ------------------------------------------------------------------------------- begin -- architecture body -- Output Port assignments Pulse_Out <= sig_pulse_out ; ------------------------------------------------------------ -- If Generate -- -- Label: OMIT_SYNCHRO_REGS -- -- If Generate Description: -- This IfGen omits the implementation of a double register -- synchronizer on the input signal. -- ------------------------------------------------------------ OMIT_SYNCHRO_REGS : if (C_INCLUDE_SYNCHRO = 0) generate begin sig_to_edge_detect <= Sig_In; end generate OMIT_SYNCHRO_REGS; ------------------------------------------------------------ -- If Generate -- -- Label: INCLUDE_SYNCHRO_REGS -- -- If Generate Description: -- This IfGen includes the implementation of a double -- register synchronizer on the input signal. -- ------------------------------------------------------------ INCLUDE_SYNCHRO_REGS : if (C_INCLUDE_SYNCHRO = 1) generate begin sig_to_edge_detect <= sig_synchro_reg2; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: DO_SYNCHRO_REGS -- -- Process Description: -- -- ------------------------------------------------------------- DO_SYNCHRO_REGS : entity lib_cdc_v1_0.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 => Sig_In, prmry_vect_in => (others => '0'), scndry_aclk => Clk_In, scndry_resetn => '0', scndry_out => sig_synchro_reg2, scndry_vect_out => open ); -- DO_SYNCHRO_REGS : process (Clk_In) -- begin -- if (Clk_In'event and Clk_In = '1') then -- if (Rst_In = '1') then -- sig_synchro_reg1_cdc_tig <= '0'; -- sig_synchro_reg2 <= '0'; -- else -- sig_synchro_reg1_cdc_tig <= Sig_In; -- sig_synchro_reg2 <= sig_synchro_reg1_cdc_tig; -- end if; -- end if; -- end process DO_SYNCHRO_REGS; end generate INCLUDE_SYNCHRO_REGS; ------------------------------------------------------------ -- If Generate -- -- Label: POSITIVE_EDGE_TRIGGER -- -- If Generate Description: -- Generate Pulse trigger from Positive edge detection on -- the input signal -- -- ------------------------------------------------------------ POSITIVE_EDGE_TRIGGER : if (C_POS_EDGE_TRIG = 1) generate begin -- Do positive edge detection on input signal, This becomes -- the trigger for generating the output pulse. sig_pulse_trigger <= sig_to_edge_detect and not(sig_to_edge_detect_reg); end generate POSITIVE_EDGE_TRIGGER; ------------------------------------------------------------ -- If Generate -- -- Label: NEGATIVE_EDGE_TRIGGER -- -- If Generate Description: -- Generate Pulse trigger from negative edge detection on -- the input signal -- -- ------------------------------------------------------------ NEGATIVE_EDGE_TRIGGER : if (C_POS_EDGE_TRIG = 0) generate begin -- Do negative edge detection on input signal, This becomes -- the trigger for generating the output pulse. sig_pulse_trigger <= not(sig_to_edge_detect) and sig_to_edge_detect_reg; end generate NEGATIVE_EDGE_TRIGGER; ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: REG_SIG_IN -- -- Process Description: -- This process registers the input signal for use in the -- edge detection logic. -- ------------------------------------------------------------- REG_SIG_IN : process (Clk_In) begin if (Clk_In'event and Clk_In = '1') then if (Rst_In = '1') then sig_to_edge_detect_reg <= '0'; else sig_to_edge_detect_reg <= sig_to_edge_detect; end if; end if; end process REG_SIG_IN; ------------------------------------------------------------ -- If Generate -- -- Label: DO_SINGLE_CLK_PULSE -- -- If Generate Description: -- -- Handles single clock pulse width case -- ------------------------------------------------------------ DO_SINGLE_CLK_PULSE : if (C_PULSE_WIDTH_CLKS = 1) generate begin sig_shift_reg <= (others => '0'); -- house keeping ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: REG_SINGLE_PULSE -- -- Process Description: -- This process registers a single pulse case. -- ------------------------------------------------------------- REG_SINGLE_PULSE : process (Clk_In) begin if (Clk_In'event and Clk_In = '1') then if (Rst_In = '1') then sig_pulse_out <= '0'; else sig_pulse_out <= sig_pulse_trigger; end if; end if; end process REG_SINGLE_PULSE; end generate DO_SINGLE_CLK_PULSE; ------------------------------------------------------------ -- If Generate -- -- Label: DO_MULTI_CLK_PULSE -- -- If Generate Description: -- -- Handles Multi clock pulse width case -- ------------------------------------------------------------ DO_MULTI_CLK_PULSE : if (C_PULSE_WIDTH_CLKS >= 2) generate begin ----------------------------------------------------------------------------- -- Implement the Shift register logic ----------------------------------------------------------------------------- -- The output pulse is ripped from the final stage of the shift register sig_pulse_out <= sig_shift_reg(ADJUSTED_CLKs-1); -- Tie the shift register input stage to 0 sig_shift_reg(0) <= '0'; ------------------------------------------------------------ -- For Generate -- -- Label: DO_SHIF_REG -- -- For Generate Description: -- This For Gen implements a parameterizable shift -- register for the pulse generator. The trigger presets -- all of the register segments and then zeros are shifted -- into the pipe until all stages are cleared. The resulting -- pulse out is equal to the number of stages in the shift -- register. -- -- -- ------------------------------------------------------------ DO_SHIF_REG : for reg_index in 1 to ADJUSTED_CLKs-1 generate begin ------------------------------------------------------------- -- Synchronous Process with Sync Reset -- -- Label: DO_SHIFT_REG_SEGMENT -- -- Process Description: -- This process implements a single register segment of -- of the pulse generator shift register. -- ------------------------------------------------------------- DO_SHIFT_REG_SEGMENT : process (Clk_In) begin if (Clk_In'event and Clk_In = '1') then if (Rst_In = '1') then -- Clear the reg sig_shift_reg(reg_index) <= '0'; elsif (sig_pulse_trigger = '1') then -- preset the reg sig_shift_reg(reg_index) <= '1'; else -- shift stuff through sig_shift_reg(reg_index) <= sig_shift_reg(reg_index-1); end if; end if; end process DO_SHIFT_REG_SEGMENT; end generate DO_SHIF_REG; ----------------------------------------------------------------------------- -- End of Shift register logic ----------------------------------------------------------------------------- end generate DO_MULTI_CLK_PULSE; end architecture implementation;
gpl-3.0
7f3769700a30466c5f3859547d295fab
0.443007
5.275862
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_sg_v4_1/0535f152/hdl/src/vhdl/axi_sg_updt_q_mngr.vhd
3
39,575
-- ************************************************************************* -- -- (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_updt_q_mngr.vhd -- Description: This entity is the descriptor update queue manager -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_misc.all; library axi_sg_v4_1; use axi_sg_v4_1.axi_sg_pkg.all; library lib_pkg_v1_0; use lib_pkg_v1_0.lib_pkg.all; ------------------------------------------------------------------------------- entity axi_sg_updt_q_mngr 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_M_AXI_SG_DATA_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Data Width for Scatter Gather R/W Port C_S_AXIS_UPDPTR_TDATA_WIDTH : integer range 32 to 32 := 32; -- 32 Update Status Bits C_S_AXIS_UPDSTS_TDATA_WIDTH : integer range 33 to 33 := 33; -- 1 IOC bit + 32 Update Status Bits C_SG_UPDT_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_WORDS_TO_UPDATE : integer range 1 to 16 := 8; -- Number of words to update C_SG_CH2_WORDS_TO_UPDATE : integer range 1 to 16 := 8; -- Number of words to update 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_AXIS_IS_ASYNC : integer range 0 to 1 := 0; -- Channel 1 is async to sg_aclk -- 0 = Synchronous to SG ACLK -- 1 = Asynchronous to SG ACLK C_FAMILY : string := "virtex7" -- Device family used for proper BRAM selection ); port ( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk : in std_logic ; -- m_axi_sg_aresetn : in std_logic ; -- -- --***********************************-- -- --** Channel 1 Control **-- -- --***********************************-- -- ch1_updt_curdesc_wren : out std_logic ; -- ch1_updt_curdesc : out std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- ch1_updt_active : in std_logic ; -- ch1_updt_queue_empty : out std_logic ; -- ch1_updt_ioc : out std_logic ; -- ch1_updt_ioc_irq_set : in std_logic ; -- -- ch1_dma_interr : out std_logic ; -- ch1_dma_slverr : out std_logic ; -- ch1_dma_decerr : out std_logic ; -- ch1_dma_interr_set : in std_logic ; -- ch1_dma_slverr_set : in std_logic ; -- ch1_dma_decerr_set : in std_logic ; -- -- --***********************************-- -- --** Channel 2 Control **-- -- --***********************************-- -- ch2_updt_active : in std_logic ; -- -- ch2_updt_curdesc_wren : out std_logic ; -- -- ch2_updt_curdesc : out std_logic_vector -- -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- ch2_updt_queue_empty : out std_logic ; -- ch2_updt_ioc : out std_logic ; -- ch2_updt_ioc_irq_set : in std_logic ; -- -- ch2_dma_interr : out std_logic ; -- ch2_dma_slverr : out std_logic ; -- ch2_dma_decerr : out std_logic ; -- ch2_dma_interr_set : in std_logic ; -- ch2_dma_slverr_set : in std_logic ; -- ch2_dma_decerr_set : in std_logic ; -- -- --***********************************-- -- --** Channel 1 Update Interface In **-- -- --***********************************-- -- s_axis_ch1_updt_aclk : in std_logic ; -- -- Update Pointer Stream -- s_axis_ch1_updtptr_tdata : in std_logic_vector -- (C_S_AXIS_UPDPTR_TDATA_WIDTH-1 downto 0); -- s_axis_ch1_updtptr_tvalid : in std_logic ; -- s_axis_ch1_updtptr_tready : out std_logic ; -- s_axis_ch1_updtptr_tlast : in std_logic ; -- -- -- Update Status Stream -- s_axis_ch1_updtsts_tdata : in std_logic_vector -- (C_S_AXIS_UPDSTS_TDATA_WIDTH-1 downto 0); -- s_axis_ch1_updtsts_tvalid : in std_logic ; -- s_axis_ch1_updtsts_tready : out std_logic ; -- s_axis_ch1_updtsts_tlast : in std_logic ; -- -- --***********************************-- -- --** Channel 2 Update Interface In **-- -- --***********************************-- -- s_axis_ch2_updt_aclk : in std_logic ; -- -- Update Pointer Stream -- s_axis_ch2_updtptr_tdata : in std_logic_vector -- (C_S_AXIS_UPDPTR_TDATA_WIDTH-1 downto 0); -- s_axis_ch2_updtptr_tvalid : in std_logic ; -- s_axis_ch2_updtptr_tready : out std_logic ; -- s_axis_ch2_updtptr_tlast : in std_logic ; -- -- -- Update Status Stream -- s_axis_ch2_updtsts_tdata : in std_logic_vector -- (C_S_AXIS_UPDSTS_TDATA_WIDTH-1 downto 0); -- s_axis_ch2_updtsts_tvalid : in std_logic ; -- s_axis_ch2_updtsts_tready : out std_logic ; -- s_axis_ch2_updtsts_tlast : in std_logic ; -- -- --***************************************-- -- --** Update Interface to AXI DataMover **-- -- --***************************************-- -- -- S2MM Stream Out To DataMover -- s_axis_s2mm_tdata : out std_logic_vector -- (C_M_AXI_SG_DATA_WIDTH-1 downto 0) ; -- s_axis_s2mm_tlast : out std_logic ; -- s_axis_s2mm_tvalid : out std_logic ; -- s_axis_s2mm_tready : in std_logic -- ); end axi_sg_updt_q_mngr; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_sg_updt_q_mngr is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- signal m_axis_ch1_updt_tdata : std_logic_vector(C_M_AXI_SG_DATA_WIDTH-1 downto 0) := (others => '0'); signal m_axis_ch1_updt_tlast : std_logic := '0'; signal m_axis_ch1_updt_tvalid : std_logic := '0'; signal m_axis_ch1_updt_tready : std_logic := '0'; signal m_axis_ch2_updt_tdata : std_logic_vector(C_M_AXI_SG_DATA_WIDTH-1 downto 0) := (others => '0'); signal m_axis_ch2_updt_tlast : std_logic := '0'; signal m_axis_ch2_updt_tvalid : std_logic := '0'; signal m_axis_ch2_updt_tready : std_logic := '0'; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin --***************************************************************************** --** CHANNEL 1 ** --***************************************************************************** ------------------------------------------------------------------------------- -- If Channel 1 is enabled then instantiate descriptor update logic. ------------------------------------------------------------------------------- -- If Descriptor Update queueing enabled then instantiate Queue Logic GEN_QUEUE : if C_SG_UPDT_DESC2QUEUE /= 0 generate begin ------------------------------------------------------------------------------- I_UPDT_DESC_QUEUE : entity axi_sg_v4_1.axi_sg_updt_queue generic map( C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXIS_UPDT_DATA_WIDTH => C_M_AXI_SG_DATA_WIDTH , C_S_AXIS_UPDPTR_TDATA_WIDTH => C_S_AXIS_UPDPTR_TDATA_WIDTH , C_S_AXIS_UPDSTS_TDATA_WIDTH => C_S_AXIS_UPDSTS_TDATA_WIDTH , C_SG_UPDT_DESC2QUEUE => C_SG_UPDT_DESC2QUEUE , C_SG_WORDS_TO_UPDATE => C_SG_CH1_WORDS_TO_UPDATE , C_SG2_WORDS_TO_UPDATE => C_SG_CH2_WORDS_TO_UPDATE , C_AXIS_IS_ASYNC => C_AXIS_IS_ASYNC , C_INCLUDE_MM2S => C_INCLUDE_CH1 , C_INCLUDE_S2MM => C_INCLUDE_CH2 , C_FAMILY => C_FAMILY ) port map( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk => m_axi_sg_aclk , m_axi_sg_aresetn => m_axi_sg_aresetn , s_axis_updt_aclk => s_axis_ch1_updt_aclk , --********************************-- --** Control and Status **-- --********************************-- updt_curdesc_wren => ch1_updt_curdesc_wren , updt_curdesc => ch1_updt_curdesc , updt_active => ch1_updt_active , updt_queue_empty => ch1_updt_queue_empty , updt_ioc => ch1_updt_ioc , updt_ioc_irq_set => ch1_updt_ioc_irq_set , dma_interr => ch1_dma_interr , dma_slverr => ch1_dma_slverr , dma_decerr => ch1_dma_decerr , dma_interr_set => ch1_dma_interr_set , dma_slverr_set => ch1_dma_slverr_set , dma_decerr_set => ch1_dma_decerr_set , -- updt2_curdesc_wren => ch2_updt_curdesc_wren , -- updt2_curdesc => ch2_updt_curdesc , updt2_active => ch2_updt_active , updt2_queue_empty => ch2_updt_queue_empty , updt2_ioc => ch2_updt_ioc , updt2_ioc_irq_set => ch2_updt_ioc_irq_set , dma2_interr => ch2_dma_interr , dma2_slverr => ch2_dma_slverr , dma2_decerr => ch2_dma_decerr , dma2_interr_set => ch2_dma_interr_set , dma2_slverr_set => ch2_dma_slverr_set , dma2_decerr_set => ch2_dma_decerr_set , --********************************-- --** Update Interfaces In **-- --********************************-- -- Update Pointer Stream s_axis_updtptr_tdata => s_axis_ch1_updtptr_tdata , s_axis_updtptr_tvalid => s_axis_ch1_updtptr_tvalid , s_axis_updtptr_tready => s_axis_ch1_updtptr_tready , s_axis_updtptr_tlast => s_axis_ch1_updtptr_tlast , -- Update Status Stream s_axis_updtsts_tdata => s_axis_ch1_updtsts_tdata , s_axis_updtsts_tvalid => s_axis_ch1_updtsts_tvalid , s_axis_updtsts_tready => s_axis_ch1_updtsts_tready , s_axis_updtsts_tlast => s_axis_ch1_updtsts_tlast , -- Update Pointer Stream s_axis2_updtptr_tdata => s_axis_ch2_updtptr_tdata , s_axis2_updtptr_tvalid => s_axis_ch2_updtptr_tvalid , s_axis2_updtptr_tready => s_axis_ch2_updtptr_tready , s_axis2_updtptr_tlast => s_axis_ch2_updtptr_tlast , -- Update Status Stream s_axis2_updtsts_tdata => s_axis_ch2_updtsts_tdata , s_axis2_updtsts_tvalid => s_axis_ch2_updtsts_tvalid , s_axis2_updtsts_tready => s_axis_ch2_updtsts_tready , s_axis2_updtsts_tlast => s_axis_ch2_updtsts_tlast , --********************************-- --** Update Interfaces Out **-- --********************************-- -- S2MM Stream Out To DataMover m_axis_updt_tdata => s_axis_s2mm_tdata, --m_axis_ch1_updt_tdata , m_axis_updt_tlast => s_axis_s2mm_tlast, --m_axis_ch1_updt_tlast , m_axis_updt_tvalid => s_axis_s2mm_tvalid, --m_axis_ch1_updt_tvalid , m_axis_updt_tready => s_axis_s2mm_tready --m_axis_ch1_updt_tready , -- m_axis2_updt_tdata => m_axis_ch2_updt_tdata , -- m_axis2_updt_tlast => m_axis_ch2_updt_tlast , -- m_axis2_updt_tvalid => m_axis_ch2_updt_tvalid , -- m_axis2_updt_tready => m_axis_ch2_updt_tready ); end generate GEN_QUEUE; --***************************************************************************** --** CHANNEL 1 - NO DESCRIPTOR QUEUE ** --***************************************************************************** -- No update queue enabled, therefore map internal stream logic -- directly to channel port. GEN_NO_QUEUE : if C_SG_UPDT_DESC2QUEUE = 0 generate begin I_NO_UPDT_DESC_QUEUE : entity axi_sg_v4_1.axi_sg_updt_noqueue generic map( C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXIS_UPDT_DATA_WIDTH => C_M_AXI_SG_DATA_WIDTH , C_S_AXIS_UPDPTR_TDATA_WIDTH => C_S_AXIS_UPDPTR_TDATA_WIDTH , C_S_AXIS_UPDSTS_TDATA_WIDTH => C_S_AXIS_UPDSTS_TDATA_WIDTH ) port map( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk => m_axi_sg_aclk , m_axi_sg_aresetn => m_axi_sg_aresetn , --********************************-- --** Control and Status **-- --********************************-- updt_curdesc_wren => ch1_updt_curdesc_wren , updt_curdesc => ch1_updt_curdesc , updt_active => ch1_updt_active , updt_queue_empty => ch1_updt_queue_empty , updt_ioc => ch1_updt_ioc , updt_ioc_irq_set => ch1_updt_ioc_irq_set , dma_interr => ch1_dma_interr , dma_slverr => ch1_dma_slverr , dma_decerr => ch1_dma_decerr , dma_interr_set => ch1_dma_interr_set , dma_slverr_set => ch1_dma_slverr_set , dma_decerr_set => ch1_dma_decerr_set , updt2_active => ch2_updt_active , updt2_queue_empty => ch2_updt_queue_empty , updt2_ioc => ch2_updt_ioc , updt2_ioc_irq_set => ch2_updt_ioc_irq_set , dma2_interr => ch2_dma_interr , dma2_slverr => ch2_dma_slverr , dma2_decerr => ch2_dma_decerr , dma2_interr_set => ch2_dma_interr_set , dma2_slverr_set => ch2_dma_slverr_set , dma2_decerr_set => ch2_dma_decerr_set , --********************************-- --** Update Interfaces In **-- --********************************-- -- Update Pointer Stream s_axis_updtptr_tdata => s_axis_ch1_updtptr_tdata , s_axis_updtptr_tvalid => s_axis_ch1_updtptr_tvalid , s_axis_updtptr_tready => s_axis_ch1_updtptr_tready , s_axis_updtptr_tlast => s_axis_ch1_updtptr_tlast , -- Update Status Stream s_axis_updtsts_tdata => s_axis_ch1_updtsts_tdata , s_axis_updtsts_tvalid => s_axis_ch1_updtsts_tvalid , s_axis_updtsts_tready => s_axis_ch1_updtsts_tready , s_axis_updtsts_tlast => s_axis_ch1_updtsts_tlast , -- Update Pointer Stream s_axis2_updtptr_tdata => s_axis_ch2_updtptr_tdata , s_axis2_updtptr_tvalid => s_axis_ch2_updtptr_tvalid , s_axis2_updtptr_tready => s_axis_ch2_updtptr_tready , s_axis2_updtptr_tlast => s_axis_ch2_updtptr_tlast , -- Update Status Stream s_axis2_updtsts_tdata => s_axis_ch2_updtsts_tdata , s_axis2_updtsts_tvalid => s_axis_ch2_updtsts_tvalid , s_axis2_updtsts_tready => s_axis_ch2_updtsts_tready , s_axis2_updtsts_tlast => s_axis_ch2_updtsts_tlast , --********************************-- --** Update Interfaces Out **-- --********************************-- -- S2MM Stream Out To DataMover m_axis_updt_tdata => s_axis_s2mm_tdata, --m_axis_ch1_updt_tdata , m_axis_updt_tlast => s_axis_s2mm_tlast, --m_axis_ch1_updt_tlast , m_axis_updt_tvalid => s_axis_s2mm_tvalid, --m_axis_ch1_updt_tvalid , m_axis_updt_tready => s_axis_s2mm_tready --m_axis_ch1_updt_tready , -- m_axis_updt_tdata => m_axis_ch1_updt_tdata , -- m_axis_updt_tlast => m_axis_ch1_updt_tlast , -- m_axis_updt_tvalid => m_axis_ch1_updt_tvalid , -- m_axis_updt_tready => m_axis_ch1_updt_tready , -- S2MM Stream Out To DataMover -- m_axis2_updt_tdata => m_axis_ch2_updt_tdata , -- m_axis2_updt_tlast => m_axis_ch2_updt_tlast , -- m_axis2_updt_tvalid => m_axis_ch2_updt_tvalid , -- m_axis2_updt_tready => m_axis_ch2_updt_tready ); end generate GEN_NO_QUEUE; -- Channel 1 NOT included therefore tie ch1 outputs off --GEN_NO_CH1_UPDATE_Q_IF : if C_INCLUDE_CH1 = 0 generate --begin -- ch1_updt_curdesc_wren <= '0'; -- ch1_updt_curdesc <= (others => '0'); -- ch1_updt_queue_empty <= '1'; -- ch1_updt_ioc <= '0'; -- ch1_dma_interr <= '0'; -- ch1_dma_slverr <= '0'; -- ch1_dma_decerr <= '0'; -- m_axis_ch1_updt_tdata <= (others => '0'); -- m_axis_ch1_updt_tlast <= '0'; -- m_axis_ch1_updt_tvalid <= '0'; -- s_axis_ch1_updtptr_tready <= '0'; -- s_axis_ch1_updtsts_tready <= '0'; --end generate GEN_NO_CH1_UPDATE_Q_IF; --***************************************************************************** --** CHANNEL 2 ** --***************************************************************************** ------------------------------------------------------------------------------- -- If Channel 2 is enabled then instantiate descriptor update logic. ------------------------------------------------------------------------------- --GEN_CH2_UPDATE_Q_IF : if C_INCLUDE_CH2 = 1 generate -- --begin -- -- --************************************************************************* -- --** CHANNEL 2 - DESCRIPTOR QUEUE ** -- --************************************************************************* -- -- If Descriptor Update queueing enabled then instantiate Queue Logic -- GEN_CH2_QUEUE : if C_SG_UPDT_DESC2QUEUE /= 0 generate -- begin -- --------------------------------------------------------------------------- -- I_CH2_UPDT_DESC_QUEUE : entity axi_sg_v4_1.axi_sg_updt_queue -- generic map( -- C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , -- C_M_AXIS_UPDT_DATA_WIDTH => C_M_AXI_SG_DATA_WIDTH , -- C_S_AXIS_UPDPTR_TDATA_WIDTH => C_S_AXIS_UPDPTR_TDATA_WIDTH , -- C_S_AXIS_UPDSTS_TDATA_WIDTH => C_S_AXIS_UPDSTS_TDATA_WIDTH , -- C_SG_UPDT_DESC2QUEUE => C_SG_UPDT_DESC2QUEUE , -- C_SG_WORDS_TO_UPDATE => C_SG_CH2_WORDS_TO_UPDATE , -- C_FAMILY => C_FAMILY -- ) -- port map( -- --------------------------------------------------------------- -- -- AXI Scatter Gather Interface -- --------------------------------------------------------------- -- m_axi_sg_aclk => m_axi_sg_aclk , -- m_axi_sg_aresetn => m_axi_sg_aresetn , -- s_axis_updt_aclk => s_axis_ch2_updt_aclk , -- -- --********************************-- -- --** Control and Status **-- -- --********************************-- -- updt_curdesc_wren => ch2_updt_curdesc_wren , -- updt_curdesc => ch2_updt_curdesc , -- updt_active => ch2_updt_active , -- updt_queue_empty => ch2_updt_queue_empty , -- updt_ioc => ch2_updt_ioc , -- updt_ioc_irq_set => ch2_updt_ioc_irq_set , -- -- dma_interr => ch2_dma_interr , -- dma_slverr => ch2_dma_slverr , -- dma_decerr => ch2_dma_decerr , -- dma_interr_set => ch2_dma_interr_set , -- dma_slverr_set => ch2_dma_slverr_set , -- dma_decerr_set => ch2_dma_decerr_set , -- -- --********************************-- -- --** Update Interfaces In **-- -- --********************************-- -- -- Update Pointer Stream -- s_axis_updtptr_tdata => s_axis_ch2_updtptr_tdata , -- s_axis_updtptr_tvalid => s_axis_ch2_updtptr_tvalid , -- s_axis_updtptr_tready => s_axis_ch2_updtptr_tready , -- s_axis_updtptr_tlast => s_axis_ch2_updtptr_tlast , -- -- -- Update Status Stream -- s_axis_updtsts_tdata => s_axis_ch2_updtsts_tdata , -- s_axis_updtsts_tvalid => s_axis_ch2_updtsts_tvalid , -- s_axis_updtsts_tready => s_axis_ch2_updtsts_tready , -- s_axis_updtsts_tlast => s_axis_ch2_updtsts_tlast , -- -- --********************************-- -- --** Update Interfaces Out **-- -- --********************************-- -- -- S2MM Stream Out To DataMover -- m_axis_updt_tdata => m_axis_ch2_updt_tdata , -- m_axis_updt_tlast => m_axis_ch2_updt_tlast , -- m_axis_updt_tvalid => m_axis_ch2_updt_tvalid , -- m_axis_updt_tready => m_axis_ch2_updt_tready -- ); -- -- end generate GEN_CH2_QUEUE; -- -- -- --***************************************************************************** -- --** CHANNEL 2 - NO DESCRIPTOR QUEUE ** -- --***************************************************************************** -- -- -- No update queue enabled, therefore map internal stream logic -- -- directly to channel port. -- GEN_CH2_NO_QUEUE : if C_SG_UPDT_DESC2QUEUE = 0 generate -- I_NO_CH2_UPDT_DESC_QUEUE : entity axi_sg_v4_1.axi_sg_updt_noqueue -- generic map( -- C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , -- C_M_AXIS_UPDT_DATA_WIDTH => C_M_AXI_SG_DATA_WIDTH , -- C_S_AXIS_UPDPTR_TDATA_WIDTH => C_S_AXIS_UPDPTR_TDATA_WIDTH , -- C_S_AXIS_UPDSTS_TDATA_WIDTH => C_S_AXIS_UPDSTS_TDATA_WIDTH -- ) -- port map( -- --------------------------------------------------------------- -- -- AXI Scatter Gather Interface -- --------------------------------------------------------------- -- m_axi_sg_aclk => m_axi_sg_aclk , -- m_axi_sg_aresetn => m_axi_sg_aresetn , -- -- --********************************-- -- --** Control and Status **-- -- --********************************-- -- updt_curdesc_wren => ch2_updt_curdesc_wren , -- updt_curdesc => ch2_updt_curdesc , -- updt_active => ch2_updt_active , -- updt_queue_empty => ch2_updt_queue_empty , -- updt_ioc => ch2_updt_ioc , -- updt_ioc_irq_set => ch2_updt_ioc_irq_set , -- -- dma_interr => ch2_dma_interr , -- dma_slverr => ch2_dma_slverr , -- dma_decerr => ch2_dma_decerr , -- dma_interr_set => ch2_dma_interr_set , -- dma_slverr_set => ch2_dma_slverr_set , -- dma_decerr_set => ch2_dma_decerr_set , -- -- --********************************-- -- --** Update Interfaces In **-- -- --********************************-- -- -- Update Pointer Stream -- s_axis_updtptr_tdata => s_axis_ch2_updtptr_tdata , -- s_axis_updtptr_tvalid => s_axis_ch2_updtptr_tvalid , -- s_axis_updtptr_tready => s_axis_ch2_updtptr_tready , -- s_axis_updtptr_tlast => s_axis_ch2_updtptr_tlast , -- -- -- Update Status Stream -- s_axis_updtsts_tdata => s_axis_ch2_updtsts_tdata , -- s_axis_updtsts_tvalid => s_axis_ch2_updtsts_tvalid , -- s_axis_updtsts_tready => s_axis_ch2_updtsts_tready , -- s_axis_updtsts_tlast => s_axis_ch2_updtsts_tlast , -- -- --********************************-- -- --** Update Interfaces Out **-- -- --********************************-- -- -- S2MM Stream Out To DataMover -- m_axis_updt_tdata => m_axis_ch2_updt_tdata , -- m_axis_updt_tlast => m_axis_ch2_updt_tlast , -- m_axis_updt_tvalid => m_axis_ch2_updt_tvalid , -- m_axis_updt_tready => m_axis_ch2_updt_tready -- ); -- -- end generate GEN_CH2_NO_QUEUE; -- --end generate GEN_CH2_UPDATE_Q_IF; -- ---- Channel 2 NOT included therefore tie ch2 outputs off --GEN_NO_CH2_UPDATE_Q_IF : if C_INCLUDE_CH2 = 0 generate --begin -- ch2_updt_curdesc_wren <= '0'; -- ch2_updt_curdesc <= (others => '0'); -- ch2_updt_queue_empty <= '1'; -- -- ch2_updt_ioc <= '0'; -- ch2_dma_interr <= '0'; -- ch2_dma_slverr <= '0'; -- ch2_dma_decerr <= '0'; -- -- m_axis_ch2_updt_tdata <= (others => '0'); -- m_axis_ch2_updt_tlast <= '0'; -- m_axis_ch2_updt_tvalid <= '0'; -- -- s_axis_ch2_updtptr_tready <= '0'; -- s_axis_ch2_updtsts_tready <= '0'; -- --end generate GEN_NO_CH2_UPDATE_Q_IF; ------------------------------------------------------------------------------- -- MUX For DataMover ------------------------------------------------------------------------------- --TO_DATAMVR_MUX : process(ch1_updt_active, -- ch2_updt_active, -- m_axis_ch1_updt_tdata, -- m_axis_ch1_updt_tlast, -- m_axis_ch1_updt_tvalid, -- m_axis_ch2_updt_tdata, -- m_axis_ch2_updt_tlast, -- m_axis_ch2_updt_tvalid) -- begin -- if(ch1_updt_active = '1')then -- s_axis_s2mm_tdata <= m_axis_ch1_updt_tdata; -- s_axis_s2mm_tlast <= m_axis_ch1_updt_tlast; -- s_axis_s2mm_tvalid <= m_axis_ch1_updt_tvalid; -- elsif(ch2_updt_active = '1')then -- s_axis_s2mm_tdata <= m_axis_ch2_updt_tdata; -- s_axis_s2mm_tlast <= m_axis_ch2_updt_tlast; -- s_axis_s2mm_tvalid <= m_axis_ch2_updt_tvalid; -- else -- s_axis_s2mm_tdata <= (others => '0'); -- s_axis_s2mm_tlast <= '0'; -- s_axis_s2mm_tvalid <= '0'; -- end if; -- end process TO_DATAMVR_MUX; -- --m_axis_ch1_updt_tready <= s_axis_s2mm_tready; --m_axis_ch2_updt_tready <= s_axis_s2mm_tready; -- end implementation;
gpl-3.0
b8c24c7769c4c02be1e2a2e243f0099e
0.352192
4.670168
false
false
false
false
zxcmehran/FPGADisplay-ipcore
hdl/vhdl/user_logic.vhd
1
19,082
-- -- -- FPGA Display Handler IP Core By Mehran Ahadi (http://mehran.ahadi.me) -- This IP allows you to draw shapes and print texts on VGA screen. -- Copyright (C) 2015-2016 Mehran Ahadi -- This work is released under MIT License. -- -- IP Logic File -- ------------------------------------------------------------------------------ -- user_logic.vhd - entity/architecture pair ------------------------------------------------------------------------------ -- -- *************************************************************************** -- ** Copyright (c) 1995-2008 Xilinx, Inc. All rights reserved. ** -- ** ** -- ** Xilinx, Inc. ** -- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" ** -- ** AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND ** -- ** SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, ** -- ** OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, ** -- ** APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION ** -- ** THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, ** -- ** AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE ** -- ** FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY ** -- ** WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE ** -- ** IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR ** -- ** REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF ** -- ** INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ** -- ** FOR A PARTICULAR PURPOSE. ** -- ** ** -- *************************************************************************** -- ------------------------------------------------------------------------------ -- Filename: user_logic.vhd -- Version: 1.00.a -- Description: User logic. -- Date: Mon Aug 08 23:53:04 2016 (by Create and Import Peripheral Wizard) -- VHDL Standard: VHDL'93 ------------------------------------------------------------------------------ -- 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: "*_com" -- 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>" ------------------------------------------------------------------------------ -- DO NOT EDIT BELOW THIS LINE -------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; library proc_common_v2_00_a; use proc_common_v2_00_a.proc_common_pkg.all; -- DO NOT EDIT ABOVE THIS LINE -------------------- --USER libraries added here ------------------------------------------------------------------------------ -- Entity section ------------------------------------------------------------------------------ -- Definition of Generics: -- C_SLV_AWIDTH -- Slave interface address bus width -- C_SLV_DWIDTH -- Slave interface data bus width -- C_NUM_REG -- Number of software accessible registers -- C_NUM_MEM -- Number of memory spaces -- -- Definition of Ports: -- Bus2IP_Clk -- Bus to IP clock -- Bus2IP_Reset -- Bus to IP reset -- Bus2IP_Addr -- Bus to IP address bus -- Bus2IP_CS -- Bus to IP chip select for user logic memory selection -- Bus2IP_RNW -- Bus to IP read/not write -- Bus2IP_Data -- Bus to IP data bus -- Bus2IP_BE -- Bus to IP byte enables -- Bus2IP_RdCE -- Bus to IP read chip enable -- Bus2IP_WrCE -- Bus to IP write chip enable -- IP2Bus_Data -- IP to Bus data bus -- IP2Bus_RdAck -- IP to Bus read transfer acknowledgement -- IP2Bus_WrAck -- IP to Bus write transfer acknowledgement -- IP2Bus_Error -- IP to Bus error response ------------------------------------------------------------------------------ entity user_logic is generic ( -- ADD USER GENERICS BELOW THIS LINE --------------- w_pixels: integer; w_fp: integer; w_synch: integer; w_bp: integer; w_syncval: std_logic; h_pixels: integer; h_fp: integer; h_synch: integer; h_bp: integer; h_syncval: std_logic; display_clk_m: integer; display_clk_d: integer; -- ADD USER GENERICS ABOVE THIS LINE --------------- -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol parameters, do not add to or delete C_SLV_AWIDTH : integer := 32; C_SLV_DWIDTH : integer := 32; C_NUM_REG : integer := 2; C_NUM_MEM : integer := 1 -- DO NOT EDIT ABOVE THIS LINE --------------------- ); port ( -- ADD USER PORTS BELOW THIS LINE ------------------ CLK: in STD_LOGIC; R : out STD_LOGIC_VECTOR(7 downto 0); G : out STD_LOGIC_VECTOR(7 downto 0); B : out STD_LOGIC_VECTOR(7 downto 0); PIXEL_CLK : out STD_LOGIC; COMP_SYNCH : out STD_LOGIC; OUT_BLANK_Z : out STD_LOGIC; HSYNC : out STD_LOGIC; VSYNC : out STD_LOGIC; -- ADD USER PORTS ABOVE THIS LINE ------------------ -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol ports, do not add to or delete Bus2IP_Clk : in std_logic; Bus2IP_Reset : in std_logic; Bus2IP_Addr : in std_logic_vector(0 to C_SLV_AWIDTH-1); Bus2IP_CS : in std_logic_vector(0 to C_NUM_MEM-1); Bus2IP_RNW : in std_logic; Bus2IP_Data : in std_logic_vector(0 to C_SLV_DWIDTH-1); Bus2IP_BE : in std_logic_vector(0 to C_SLV_DWIDTH/8-1); Bus2IP_RdCE : in std_logic_vector(0 to C_NUM_REG-1); Bus2IP_WrCE : in std_logic_vector(0 to C_NUM_REG-1); IP2Bus_Data : out std_logic_vector(0 to C_SLV_DWIDTH-1); IP2Bus_RdAck : out std_logic; IP2Bus_WrAck : out std_logic; IP2Bus_Error : out std_logic -- DO NOT EDIT ABOVE THIS LINE --------------------- ); attribute SIGIS : string; attribute SIGIS of Bus2IP_Clk : signal is "CLK"; attribute SIGIS of Bus2IP_Reset : signal is "RST"; end entity user_logic; ------------------------------------------------------------------------------ -- Architecture section ------------------------------------------------------------------------------ architecture IMP of user_logic is --USER signal declarations added here, as needed for user logic component MainComponent Generic ( w_pixels: integer; w_fp: integer; w_synch: integer; w_bp: integer; w_syncval: std_logic; h_pixels: integer; h_fp: integer; h_synch: integer; h_bp: integer; h_syncval: std_logic; display_clk_m: integer; display_clk_d: integer ); Port ( CLK: in STD_LOGIC; R : out STD_LOGIC_VECTOR(7 downto 0); G : out STD_LOGIC_VECTOR(7 downto 0); B : out STD_LOGIC_VECTOR(7 downto 0); PIXEL_CLK : out STD_LOGIC; COMP_SYNCH : out STD_LOGIC; OUT_BLANK_Z : out STD_LOGIC; HSYNC : out STD_LOGIC; VSYNC : out STD_LOGIC; MEMCLK: in std_logic; MEMDIN: in std_logic_vector (0 to 0); MEMDOUT: out std_logic_vector (0 to 0); MEMADDR: in std_logic_vector(19 downto 0); MEMWE: in std_logic ); end component; ------------------------------------------ -- Signals for user logic slave model s/w accessible register example ------------------------------------------ signal slv_reg0 : std_logic_vector(0 to C_SLV_DWIDTH-1); signal slv_reg1 : std_logic_vector(0 to C_SLV_DWIDTH-1); signal slv_reg_write_sel : std_logic_vector(0 to 1); signal slv_reg_read_sel : std_logic_vector(0 to 1); signal slv_ip2bus_data : std_logic_vector(0 to C_SLV_DWIDTH-1); signal slv_read_ack : std_logic; signal slv_write_ack : std_logic; ------------------------------------------ -- Signals for user logic memory space example ------------------------------------------ type BYTE_RAM_TYPE is array (0 to 255) of std_logic_vector(0 to 7); type DO_TYPE is array (0 to C_NUM_MEM-1) of std_logic_vector(0 to C_SLV_DWIDTH-1); signal mem_data_out : DO_TYPE; signal mem_address : std_logic_vector(0 to 7); signal mem_select : std_logic_vector(0 to 0); signal mem_read_enable : std_logic; signal mem_read_enable_dly1 : std_logic; signal mem_read_req : std_logic; signal mem_ip2bus_data : std_logic_vector(0 to C_SLV_DWIDTH-1); signal mem_read_ack_dly1 : std_logic; signal mem_read_ack : std_logic; signal mem_write_ack : std_logic; signal MEMCLK: std_logic; signal MEMDIN: std_logic_vector(0 to 0); signal MEMDOUT: std_logic_vector(0 to 0); signal MEMADDR: std_logic_vector(19 downto 0); signal MEMWE: std_logic; begin --USER logic implementation added here -- Initialize display main component mainHandle: MainComponent Generic map ( w_pixels =>w_pixels, w_fp =>w_fp, w_synch =>w_synch, w_bp =>w_bp, w_syncval =>w_syncval, h_pixels =>h_pixels, h_fp =>h_fp, h_synch =>h_synch, h_bp =>h_bp, h_syncval =>h_syncval, display_clk_m =>display_clk_m, display_clk_d =>display_clk_d ) Port map ( CLK => CLK, R => R, G => G, B => B, PIXEL_CLK => PIXEL_CLK, COMP_SYNCH => COMP_SYNCH, OUT_BLANK_Z => OUT_BLANK_Z, HSYNC => HSYNC, VSYNC => VSYNC, MEMCLK => MEMCLK, MEMDIN => MEMDIN, MEMDOUT => MEMDOUT, MEMADDR => MEMADDR, MEMWE => MEMWE ); ------------------------------------------ -- Example code to read/write user logic slave model s/w accessible registers -- -- Note: -- The example code presented here is to show you one way of reading/writing -- software accessible registers implemented in the user logic slave model. -- Each bit of the Bus2IP_WrCE/Bus2IP_RdCE signals is configured to correspond -- to one software accessible register by the top level template. For example, -- if you have four 32 bit software accessible registers in the user logic, -- you are basically operating on the following memory mapped registers: -- -- Bus2IP_WrCE/Bus2IP_RdCE Memory Mapped Register -- "1000" C_BASEADDR + 0x0 -- "0100" C_BASEADDR + 0x4 -- "0010" C_BASEADDR + 0x8 -- "0001" C_BASEADDR + 0xC -- ------------------------------------------ slv_reg_write_sel <= Bus2IP_WrCE(0 to 1); slv_reg_read_sel <= Bus2IP_RdCE(0 to 1); slv_write_ack <= Bus2IP_WrCE(0) or Bus2IP_WrCE(1); slv_read_ack <= Bus2IP_RdCE(0) or Bus2IP_RdCE(1); -- implement slave model software accessible register(s) SLAVE_REG_WRITE_PROC : process( Bus2IP_Clk ) is begin if Bus2IP_Clk'event and Bus2IP_Clk = '1' then if Bus2IP_Reset = '1' then slv_reg0 <= (others => '0'); slv_reg1 <= (others => '0'); else case slv_reg_write_sel is when "10" => for byte_index in 0 to (C_SLV_DWIDTH/8)-1 loop if ( Bus2IP_BE(byte_index) = '1' ) then slv_reg0(byte_index*8 to byte_index*8+7) <= Bus2IP_Data(byte_index*8 to byte_index*8+7); end if; end loop; when "01" => for byte_index in 0 to (C_SLV_DWIDTH/8)-1 loop if ( Bus2IP_BE(byte_index) = '1' ) then slv_reg1(byte_index*8 to byte_index*8+7) <= Bus2IP_Data(byte_index*8 to byte_index*8+7); end if; end loop; when others => null; end case; end if; end if; end process SLAVE_REG_WRITE_PROC; -- implement slave model software accessible register(s) read mux SLAVE_REG_READ_PROC : process( slv_reg_read_sel, slv_reg0, slv_reg1 ) is begin case slv_reg_read_sel is when "10" => slv_ip2bus_data <= slv_reg0; when "01" => slv_ip2bus_data <= slv_reg1; when others => slv_ip2bus_data <= (others => '0'); end case; end process SLAVE_REG_READ_PROC; ------------------------------------------ -- Example code to access user logic memory region -- -- Note: -- The example code presented here is to show you one way of using -- the user logic memory space features. The Bus2IP_Addr, Bus2IP_CS, -- and Bus2IP_RNW IPIC signals are dedicated to these user logic -- memory spaces. Each user logic memory space has its own address -- range and is allocated one bit on the Bus2IP_CS signal to indicated -- selection of that memory space. Typically these user logic memory -- spaces are used to implement memory controller type cores, but it -- can also be used in cores that need to access additional address space -- (non C_BASEADDR based), s.t. bridges. This code snippet infers -- 1 256x32-bit (byte accessible) single-port Block RAM by XST. ------------------------------------------ -- mem_select <= Bus2IP_CS; -- mem_read_enable <= ( Bus2IP_CS(0) ) and Bus2IP_RNW; -- mem_read_ack <= mem_read_ack_dly1; -- mem_write_ack <= ( Bus2IP_CS(0) ) and not(Bus2IP_RNW); -- mem_address <= Bus2IP_Addr(C_SLV_AWIDTH-10 to C_SLV_AWIDTH-3); -- -- -- implement single clock wide read request -- mem_read_req <= mem_read_enable and not(mem_read_enable_dly1); -- BRAM_RD_REQ_PROC : process( Bus2IP_Clk ) is -- begin -- -- if ( Bus2IP_Clk'event and Bus2IP_Clk = '1' ) then -- if ( Bus2IP_Reset = '1' ) then -- mem_read_enable_dly1 <= '0'; -- else -- mem_read_enable_dly1 <= mem_read_enable; -- end if; -- end if; -- -- end process BRAM_RD_REQ_PROC; -- -- -- this process generates the read acknowledge 1 clock after read enable -- -- is presented to the BRAM block. The BRAM block has a 1 clock delay -- -- from read enable to data out. -- BRAM_RD_ACK_PROC : process( Bus2IP_Clk ) is -- begin -- -- if ( Bus2IP_Clk'event and Bus2IP_Clk = '1' ) then -- if ( Bus2IP_Reset = '1' ) then -- mem_read_ack_dly1 <= '0'; -- else -- mem_read_ack_dly1 <= mem_read_req; -- end if; -- end if; -- -- end process BRAM_RD_ACK_PROC; -- implement Block RAM(s) -- BRAM_GEN : for i in 0 to C_NUM_MEM-1 generate -- constant NUM_BYTE_LANES : integer := (C_SLV_DWIDTH+7)/8; -- begin -- BYTE_BRAM_GEN : for byte_index in 0 to ((C_SLV_DWIDTH+7)/8)-1 generate -- signal ram : BYTE_RAM_TYPE; -- signal write_enable : std_logic; -- signal data_in : std_logic_vector(0 to 7); -- signal data_out : std_logic_vector(0 to 7); -- signal read_address : std_logic_vector(0 to 7); -- begin -- -- write_enable <= not(Bus2IP_RNW) and -- Bus2IP_CS(0) and -- Bus2IP_BE(byte_index); -- -- data_in <= Bus2IP_Data(byte_index*8 to byte_index*8+7); -- mem_data_out(0)(byte_index*8 to byte_index*8+7) <= data_out; -- -- BYTE_RAM_PROC : process( Bus2IP_Clk ) is -- begin -- -- if ( Bus2IP_Clk'event and Bus2IP_Clk = '1' ) then -- if ( write_enable = '1' ) then -- ram(CONV_INTEGER(mem_address)) <= data_in; -- end if; -- read_address <= mem_address; -- end if; -- -- end process BYTE_RAM_PROC; -- -- data_out <= ram(CONV_INTEGER(read_address)); -- -- end generate BYTE_BRAM_GEN; -- ---- end generate BRAM_GEN; -- -- -- implement Block RAM read mux -- MEM_IP2BUS_DATA_PROC : process( mem_data_out, mem_select ) is -- begin -- -- case mem_select is -- when "1" => mem_ip2bus_data <= mem_data_out(0); -- when others => mem_ip2bus_data <= (others => '0'); -- end case; -- -- end process MEM_IP2BUS_DATA_PROC; -- Commented BRAM block generated by XPS custom peripheral wizard -- Connecting second port of Display Memory to PLB Bus. -- Translate address bits order ADDR_TRANSLATE: for i in 0 to 19 generate MEMADDR(i) <= Bus2IP_Addr (31-i); -- Connect 31 to 0, ..., 12 to 19 end generate; MEMCLK <= Bus2IP_Clk; mem_read_enable <= Bus2IP_RNW and Bus2IP_CS(0) and (Bus2IP_BE(0) or Bus2IP_BE(1) or Bus2IP_BE(2) or Bus2IP_BE(3) ); -- Used to delay read acknowledgement signal for 1 clock, to let memory loading the data. process (Bus2IP_Clk) is begin if ( Bus2IP_Clk'event and Bus2IP_Clk = '1') then mem_read_ack <= '0'; if mem_read_enable = '1' then if (mem_read_ack_dly1 = '0') then mem_read_ack_dly1 <= '1'; else mem_read_ack <= '1'; mem_read_ack_dly1 <= '0'; end if; end if; end if; end process; mem_write_ack <= not(Bus2IP_RNW) and Bus2IP_CS(0) and (Bus2IP_BE(0) or Bus2IP_BE(1) or Bus2IP_BE(2) or Bus2IP_BE(3) ); MEMWE <= mem_write_ack; MEMDIN(0) <= Bus2IP_Data(31); -- PLB Bus is 32 bits wide. We're going to use 8 bit selections. -- Thus, we assign every 8 bit to our disired value to get rid of Bus2IP_BE signal. mem_ip2bus_data(7) <= MEMDOUT(0); mem_ip2bus_data(15) <= MEMDOUT(0); mem_ip2bus_data(23) <= MEMDOUT(0); mem_ip2bus_data(31) <= MEMDOUT(0); ------------------------------------------ -- Example code to drive IP to Bus signals ------------------------------------------ IP2Bus_Data <= slv_ip2bus_data when slv_read_ack = '1' else mem_ip2bus_data when mem_read_ack = '1' else (others => '0'); IP2Bus_WrAck <= slv_write_ack or mem_write_ack; IP2Bus_RdAck <= slv_read_ack or mem_read_ack; IP2Bus_Error <= '0'; end IMP;
mit
438a563dcc9de69d25f77617c86d36e9
0.519442
3.523915
false
false
false
false
borti4938/sd2snes
verilog/sd2snes_sdd1/Test_Main.vhd
2
52,401
---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 18.03.2018 22:42:12 -- Design Name: -- Module Name: Test_FIFO_Input - Behavioral -- Project Name: -- Target Devices: -- Tool Versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.math_real.all; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values use IEEE.NUMERIC_STD.ALL; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; -- Uncomment the following library declaration if instantiating -- any Xilinx leaf cells in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Test_Main is -- Port ( ); end Test_Main; architecture Behavioral of Test_Main is --constant SD2SNES_PERIOD : time := 10.416 ns; constant SD2SNES_PERIOD : time := 41.666 ns; constant CLK_PERIOD : time := 46.56 ns; constant PHI2_PERIOD : time := 6*CLK_PERIOD; constant tBAS : time := 33 ns; constant tADS : time := 30 ns; constant tMDS : time := 30 ns; constant tLATCH : time := 25 ns; constant tDECODER : time := 25 ns; constant ROM_tACCESS : time := 70 ns; COMPONENT main Port( --input clock CLKIN : in STD_LOGIC; -- SNES signals SNES_ADDR_IN : in STD_LOGIC_VECTOR(23 downto 0); SNES_READ_IN : in STD_LOGIC; SNES_WRITE_IN : in STD_LOGIC; SNES_ROMSEL_IN : in STD_LOGIC; SNES_DATA : inout STD_LOGIC_VECTOR(7 downto 0); SNES_CPU_CLK_IN : in STD_LOGIC; SNES_REFRESH : in STD_LOGIC; SNES_IRQ : out STD_LOGIC; SNES_DATABUS_OE : out STD_LOGIC; SNES_DATABUS_DIR : out STD_LOGIC; SNES_SYSCLK : in STD_LOGIC; SNES_PA_IN : in STD_LOGIC_VECTOR(7 downto 0); SNES_PARD_IN : in STD_LOGIC; SNES_PAWR_IN : in STD_LOGIC; -- SRAM signals -- Bus 1: PSRAM, 128Mbit, 16bit, 70ns ROM_DATA : inout STD_LOGIC_VECTOR(15 downto 0); ROM_ADDR : out STD_LOGIC_VECTOR(22 downto 0); ROM_CE : out STD_LOGIC; ROM_OE : out STD_LOGIC; ROM_WE : out STD_LOGIC; ROM_BHE : out STD_LOGIC; ROM_BLE : out STD_LOGIC; -- Bus 2: SRAM, 4Mbit, 8bit, 45ns -> NOT USED; Backup RAM mapped to $E0:0000 in PSRAM RAM_DATA : inout STD_LOGIC_VECTOR(7 downto 0); RAM_ADDR : out STD_LOGIC_VECTOR(18 downto 0); RAM_CE : out STD_LOGIC; RAM_OE : out STD_LOGIC; RAM_WE : out STD_LOGIC; -- MCU signals SPI_MOSI : in STD_LOGIC; SPI_MISO : inout STD_LOGIC; SPI_SS : in STD_LOGIC; SPI_SCK : inout STD_LOGIC; MCU_OVR : in STD_LOGIC; MCU_RDY : out STD_LOGIC; DAC_MCLK : out STD_LOGIC; DAC_LRCK : out STD_LOGIC; DAC_SDOUT : out STD_LOGIC; -- SD signals SD_DAT : in STD_LOGIC_VECTOR(3 downto 0); SD_CMD : inout STD_LOGIC; SD_CLK : inout STD_LOGIC; p113_out : out STD_LOGIC); END COMPONENT; type bit_vector_file is file of bit_vector; type bytes_file is file of integer; file comp_data : bit_vector_file; file descomp_data : bytes_file; shared variable Size : integer := 0; --type ROM_Array_t is array(2097151 downto 0) of STD_LOGIC_VECTOR(15 downto 0); type ROM_Array_t is array(65535 downto 0) of STD_LOGIC_VECTOR(15 downto 0); signal MaskROM_0 : ROM_Array_t := (others => (others => '0')); --signal MaskROM_1 : ROM_Array_t := (others => (others => '0')); signal SD2SNES_CLK : STD_LOGIC := '0'; signal MCLK : STD_LOGIC := '0'; signal CPU_CLK : STD_LOGIC := '0'; signal RESET : STD_LOGIC := '0'; signal SRAM_CS : STD_LOGIC := '1'; signal SRAM_DATA : STD_LOGIC_VECTOR(7 downto 0); signal SRAM_ADDR : STD_LOGIC_VECTOR(18 downto 0); signal SRAM_OE : STD_LOGIC; signal SRAM_WE : STD_LOGIC; signal ROM_OE : STD_LOGIC := '1'; signal ROM_CS : STD_LOGIC := '1'; signal ROM_ADDR : STD_LOGIC_VECTOR(22 downto 0) := (others => '0'); signal ROM_DATA : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); signal ROM_WE : STD_LOGIC; signal ROM_BHE : STD_LOGIC; signal ROM_BLE : STD_LOGIC; signal SNES_RD : STD_LOGIC := '1'; signal SNES_WR : STD_LOGIC := '1'; signal SNES_ADDR : STD_LOGIC_VECTOR(23 downto 0) := (others => '0'); signal SNES_DATA : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal SNES_IRQ : STD_LOGIC; signal SNES_DATABUS_OE : STD_LOGIC; signal SNES_DATABUS_DIR : STD_LOGIC; signal SNES_ROMSEL : STD_LOGIC; signal CPU_RD_CYCLE : STD_LOGIC := '0'; signal CPU_WR_CYCLE : STD_LOGIC := '0'; signal CPU_ADDR : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); signal CPU_BANK : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal CPU_DATA : STD_LOGIC_VECTOR(7 downto 0) := (others => 'Z'); signal CPU_VDA : STD_LOGIC := '0'; signal CPU_VPA : STD_LOGIC := '0'; signal ROM_Data_tready : STD_LOGIC := '0'; signal ROM_Data_tvalid : STD_LOGIC := '0'; signal ROM_Data_tdata : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); signal DMA_Data_tvalid_Pipe : STD_LOGIC_VECTOR(1 downto 0) := "00"; signal DMA_Data_tvalid : STD_LOGIC := '0'; signal DMA_Data_dword : STD_LOGIC_VECTOR(31 downto 0) := (others => '0'); signal Instruction_Addr : STD_LOGIC_VECTOR(23 downto 0) := (others => '0'); signal Compressed_Addr : STD_LOGIC_VECTOR(23 downto 0) := (others => '0'); signal Compressed_Size : STD_LOGIC_VECTOR(15 downto 0) := (others => '0'); signal Start_Decompression : STD_LOGIC := '0'; signal End_Decompression : STD_LOGIC := '0'; begin uut : main Port map(CLKIN => SD2SNES_CLK, -- SNES signals SNES_ADDR_IN => SNES_ADDR, SNES_READ_IN => SNES_RD, SNES_WRITE_IN => SNES_WR, SNES_ROMSEL_IN => SNES_ROMSEL, SNES_DATA => SNES_DATA, SNES_CPU_CLK_IN => CPU_CLK, SNES_REFRESH => '0', SNES_IRQ => SNES_IRQ, SNES_DATABUS_OE => SNES_DATABUS_OE, SNES_DATABUS_DIR => SNES_DATABUS_DIR, SNES_SYSCLK => MCLK, SNES_PA_IN => X"00", SNES_PARD_IN => '1', SNES_PAWR_IN => '1', -- SRAM signals -- Bus 1: PSRAM, 128Mbit, 16bit, 70ns ROM_DATA => ROM_DATA, ROM_ADDR => ROM_ADDR, ROM_CE => ROM_CS, ROM_OE => ROM_OE, ROM_WE => ROM_WE, ROM_BHE => ROM_BHE, ROM_BLE => ROM_BLE, -- Bus 2: SRAM, 4Mbit, 8bit, 45ns -> NOT USED; Backup RAM mapped to $E0:0000 in PSRAM RAM_DATA => SRAM_DATA, RAM_ADDR => SRAM_ADDR, RAM_CE => SRAM_CS, RAM_OE => SRAM_OE, RAM_WE => SRAM_WE, -- MCU signals SPI_MOSI => '0', SPI_MISO => open, SPI_SS => '1', SPI_SCK => open, MCU_OVR => '0', MCU_RDY => open, DAC_MCLK => open, DAC_LRCK => open, DAC_SDOUT => open, -- SD signals SD_DAT => X"0", SD_CMD => open, SD_CLK => open, p113_out => open ); Process(SNES_ADDR) Begin if( SNES_ADDR(23 downto 16) = X"7E" OR SNES_ADDR(23 downto 16) = X"7F" ) then SNES_ROMSEL <= '1'; elsif( SNES_ADDR >= X"000000" AND SNES_ADDR < X"400000" AND SNES_ADDR(15) = '0' ) then SNES_ROMSEL <= '1'; elsif( SNES_ADDR >= X"800000" AND SNES_ADDR < X"C00000" AND SNES_ADDR(15) = '0' ) then SNES_ROMSEL <= '1'; else SNES_ROMSEL <= '0'; end if; End Process; Process variable next_vector : bit_vector (0 downto 0); variable actual_len : natural; Begin --Size := 4194304; --file_open(comp_data, "StarOcean.smc", READ_MODE); --Size := 3072; --file_open(comp_data, "sdd1_chunk_0000.bin", READ_MODE); Size := 4034; file_open(comp_data, "sdd1_chunk_1100.bin", READ_MODE); file_open(descomp_data, "StarOcean_main.smc", WRITE_MODE); -- read full ROM from file to memory for i in 0 to (Size/2)-1 loop -- read word from file if not endfile(comp_data) then read(comp_data, next_vector, actual_len); if actual_len > next_vector'length then report "vector too long"; else MaskROM_0(i)(15 downto 8) <= conv_std_logic_vector(bit'pos(next_vector(0)),8); end if; read(comp_data, next_vector, actual_len); if actual_len > next_vector'length then report "vector too long"; else MaskROM_0(i)(7 downto 0) <= conv_std_logic_vector(bit'pos(next_vector(0)),8); end if; end if; wait for 1ps; end loop; -- for i in 0 to 1048575 loop -- -- read word from file -- if not endfile(comp_data) then -- read(comp_data, next_vector, actual_len); -- if actual_len > next_vector'length then -- report "vector too long"; -- else -- MaskROM_1(i)(7 downto 0) <= conv_std_logic_vector(bit'pos(next_vector(0)),8); -- end if; -- read(comp_data, next_vector, actual_len); -- if actual_len > next_vector'length then -- report "vector too long"; -- else -- MaskROM_1(i)(15 downto 8) <= conv_std_logic_vector(bit'pos(next_vector(0)),8); -- end if; -- end if; -- wait for 1 ps; -- end loop; -- begin reset RESET <= '0'; wait for 1 us; RESET <= '1'; wait until falling_edge(MCLK); wait for 100 ns; wait until falling_edge(CPU_CLK); wait for (PHI2_PERIOD-CLK_PERIOD/2); -- decompress from $DBA078, size $0C00, code $C0238E Instruction_Addr <= X"C0238E"; --Compressed_Addr <= X"DBA078"; Compressed_Addr <= X"C00000"; Compressed_Size <= conv_std_logic_Vector(16384, 16); Start_Decompression <= '1'; wait until (End_Decompression = '1'); Start_Decompression <= '0'; --assert false report "NONE. End of simulation." severity failure; wait; End Process; -- process to generate instructions to SDD1 core from real ROM Process variable Instruction_Addr_i : STD_LOGIC_VECTOR(23 downto 0); Begin wait until (Start_Decompression = '1'); End_Decompression <= '0'; Instruction_Addr_i := Instruction_Addr; -- STA $4800 = $01 -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 SNES_ADDR <= X"004800"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004800"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004800"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004800"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004800"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004800"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- STX $4302 = $A078 Instruction_Addr_i := Instruction_Addr_i+3; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 SNES_ADDR <= X"004302"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004302"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004302"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004302"; SNES_DATA <= Compressed_Addr(7 downto 0); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004302"; SNES_DATA <= Compressed_Addr(7 downto 0); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004302"; SNES_DATA <= Compressed_Addr(7 downto 0); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- PHI2 CYCLE 4 SNES_ADDR <= X"004303"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004303"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004303"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004303"; SNES_DATA <= Compressed_Addr(15 downto 8); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004303"; SNES_DATA <= Compressed_Addr(15 downto 8); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004303"; SNES_DATA <= Compressed_Addr(15 downto 8); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- STA $4304 = $DB Instruction_Addr_i := Instruction_Addr_i+3; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 SNES_ADDR <= X"004304"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004304"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004304"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004304"; SNES_DATA <= Compressed_Addr(23 downto 16); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004304"; SNES_DATA <= Compressed_Addr(23 downto 16); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004304"; SNES_DATA <= Compressed_Addr(23 downto 16); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- STX $4305 = $0C00 Instruction_Addr_i := Instruction_Addr_i+3; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 SNES_ADDR <= X"004305"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004305"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004305"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004305"; SNES_DATA <= Compressed_Size(7 downto 0); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004305"; SNES_DATA <= Compressed_Size(7 downto 0); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004305"; SNES_DATA <= Compressed_Size(7 downto 0); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- PHI2 CYCLE 4 SNES_ADDR <= X"004306"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004306"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004306"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004306"; SNES_DATA <= Compressed_Size(15 downto 8); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004306"; SNES_DATA <= Compressed_Size(15 downto 8); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004306"; SNES_DATA <= Compressed_Size(15 downto 8); SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- STA $4801 = $01 Instruction_Addr_i := Instruction_Addr_i+3; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 SNES_ADDR <= X"004801"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004801"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004801"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"004801"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004801"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"004801"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- PHA Instruction_Addr_i := Instruction_Addr_i+3; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 (IO) SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 (SLOW) SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- PLA Instruction_Addr_i := Instruction_Addr_i+1; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 (IO) SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 (IO) SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 (SLOW) SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"0001F0"; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- STA $420B = $01 Instruction_Addr_i := Instruction_Addr_i+1; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 1 SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 2 SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i+2; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- PHI2 CYCLE 3 SNES_ADDR <= X"00420B"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00420B"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00420B"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00420B"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"00420B"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); SNES_ADDR <= X"00420B"; SNES_DATA <= X"01"; SNES_RD <= '1'; SNES_WR <= '0'; wait until falling_edge(MCLK); -- STZ $4800 = $00 Instruction_Addr_i := Instruction_Addr_i+3; -- PHI2 CYCLE 0 SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Instruction_Addr_i; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- DMA pre-sync (0 to 7 cycles) SNES_ADDR <= Instruction_Addr_i+1; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- DMA setup (8 cycles) SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= X"00FFFF"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); -- DMA transfer for i in 1 to conv_integer(Compressed_Size) loop DMA_Data_tvalid <= '0'; SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; wait until falling_edge(MCLK); SNES_ADDR <= Compressed_Addr; SNES_DATA <= (others => 'Z'); SNES_RD <= '0'; SNES_WR <= '1'; DMA_Data_tvalid <= '1'; wait until falling_edge(MCLK); end loop; SNES_ADDR <= X"C00000"; SNES_DATA <= (others => 'Z'); SNES_RD <= '1'; SNES_WR <= '1'; DMA_Data_tvalid <= '0'; End_Decompression <= '1'; wait until (Start_Decompression = '0'); End Process; -- read from MaskROM process( ROM_OE, ROM_CS, ROM_ADDR, ROM_BHE, ROM_BLE ) Begin if( ROM_CS = '0' AND ROM_OE = '0' ) then if( ROM_BHE = '0' ) then ROM_DATA(15 downto 8) <= MaskROM_0(conv_integer(ROM_ADDR))(15 downto 8) after ROM_tACCESS; else ROM_DATA(15 downto 8) <= (others => 'Z') after 15 ns; end if; if( ROM_BLE = '0' ) then ROM_DATA(7 downto 0) <= MaskROM_0(conv_integer(ROM_ADDR))(7 downto 0) after ROM_tACCESS; else ROM_DATA(7 downto 0) <= (others => 'Z') after 15 ns; end if; else ROM_DATA <= (others => 'Z') after 15 ns; end if; End Process; -- output data file process( MCLK ) variable valor : integer; variable DMA_Data_Idx : integer := 0; begin if rising_edge( MCLK ) then if( DMA_Data_tvalid = '1' ) then if( DMA_Data_Idx = 3 ) then -- write word to disk valor := conv_integer(SNES_DATA & DMA_Data_dword(31 downto 8)); write(descomp_data, valor); DMA_Data_Idx := 0; else DMA_Data_dword <= SNES_DATA & DMA_Data_dword(31 downto 8); DMA_Data_Idx := DMA_Data_Idx + 1; end if; end if; end if; end process; -- clock generator Process Begin MCLK <= '0'; wait for CLK_PERIOD/2; MCLK <= '1'; wait for CLK_PERIOD/2; End Process; Process Begin CPU_CLK <= '1'; wait for PHI2_PERIOD/2; CPU_CLK <= '0'; wait for PHI2_PERIOD/2; End Process; Process Begin wait for 3ns; loop SD2SNES_CLK <= '1'; wait for SD2SNES_PERIOD/2; SD2SNES_CLK <= '0'; wait for SD2SNES_PERIOD/2; end loop; End Process; end Behavioral;
gpl-2.0
b602e7e8739573bf0f79da9c36eb3c03
0.472854
2.67393
false
false
false
false
Fairyland0902/BlockyRoads
src/BlockyRoads/ipcore_dir/explosion/simulation/explosion_synth.vhd
1
6,838
-------------------------------------------------------------------------------- -- -- BLK MEM GEN v7_3 Core - Synthesizable Testbench -- -------------------------------------------------------------------------------- -- -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved. -- -- This file contains confidential and proprietary information -- of Xilinx, Inc. and is protected under U.S. and -- international copyright and other intellectual property -- laws. -- -- DISCLAIMER -- This disclaimer is not a license and does not grant any -- rights to the materials distributed herewith. Except as -- otherwise provided in a valid license issued to you by -- Xilinx, and to the maximum extent permitted by applicable -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and -- (2) Xilinx shall not be liable (whether in contract or tort, -- including negligence, or under any other theory of -- liability) for any loss or damage of any kind or nature -- related to, arising under or in connection with these -- materials, including for any direct, or any indirect, -- special, incidental, or consequential loss or damage -- (including loss of data, profits, goodwill, or any type of -- loss or damage suffered as a result of any action brought -- by a third party) even if such damage or loss was -- reasonably foreseeable or Xilinx had been advised of the -- possibility of the same. -- -- CRITICAL APPLICATIONS -- Xilinx products are not designed or intended to be fail- -- safe, or for use in any application requiring fail-safe -- performance, such as life-support or safety devices or -- systems, Class III medical devices, nuclear facilities, -- applications related to the deployment of airbags, or any -- other applications that could lead to death, personal -- injury, or severe property or environmental damage -- (individually and collectively, "Critical -- Applications"). Customer assumes the sole risk and -- liability of any use of Xilinx products in Critical -- Applications, subject only to applicable laws and -- regulations governing limitations on product liability. -- -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS -- PART OF THIS FILE AT ALL TIMES. -------------------------------------------------------------------------------- -- -- Filename: explosion_synth.vhd -- -- Description: -- Synthesizable Testbench -------------------------------------------------------------------------------- -- Author: IP Solutions Division -- -- History: Sep 12, 2011 - First Release -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- -- Library Declarations -------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_MISC.ALL; LIBRARY STD; USE STD.TEXTIO.ALL; --LIBRARY unisim; --USE unisim.vcomponents.ALL; LIBRARY work; USE work.ALL; USE work.BMG_TB_PKG.ALL; ENTITY explosion_synth IS GENERIC ( C_ROM_SYNTH : INTEGER := 1 ); PORT( CLK_IN : IN STD_LOGIC; RESET_IN : IN STD_LOGIC; STATUS : OUT STD_LOGIC_VECTOR(8 DOWNTO 0) := (OTHERS => '0') --ERROR STATUS OUT OF FPGA ); END ENTITY; ARCHITECTURE explosion_synth_ARCH OF explosion_synth IS COMPONENT explosion_exdes PORT ( --Inputs - Port A ADDRA : IN STD_LOGIC_VECTOR(15 DOWNTO 0); DOUTA : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); CLKA : IN STD_LOGIC ); END COMPONENT; SIGNAL CLKA: STD_LOGIC := '0'; SIGNAL RSTA: STD_LOGIC := '0'; SIGNAL ADDRA: STD_LOGIC_VECTOR(15 DOWNTO 0) := (OTHERS => '0'); SIGNAL ADDRA_R: STD_LOGIC_VECTOR(15 DOWNTO 0) := (OTHERS => '0'); SIGNAL DOUTA: STD_LOGIC_VECTOR(11 DOWNTO 0); SIGNAL CHECKER_EN : STD_LOGIC:='0'; SIGNAL CHECKER_EN_R : STD_LOGIC:='0'; SIGNAL STIMULUS_FLOW : STD_LOGIC_VECTOR(22 DOWNTO 0) := (OTHERS =>'0'); SIGNAL clk_in_i: STD_LOGIC; SIGNAL RESET_SYNC_R1 : STD_LOGIC:='1'; SIGNAL RESET_SYNC_R2 : STD_LOGIC:='1'; SIGNAL RESET_SYNC_R3 : STD_LOGIC:='1'; SIGNAL ITER_R0 : STD_LOGIC := '0'; SIGNAL ITER_R1 : STD_LOGIC := '0'; SIGNAL ITER_R2 : STD_LOGIC := '0'; SIGNAL ISSUE_FLAG : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); SIGNAL ISSUE_FLAG_STATUS : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); BEGIN -- clk_buf: bufg -- PORT map( -- i => CLK_IN, -- o => clk_in_i -- ); clk_in_i <= CLK_IN; CLKA <= clk_in_i; RSTA <= RESET_SYNC_R3 AFTER 50 ns; PROCESS(clk_in_i) BEGIN IF(RISING_EDGE(clk_in_i)) THEN RESET_SYNC_R1 <= RESET_IN; RESET_SYNC_R2 <= RESET_SYNC_R1; RESET_SYNC_R3 <= RESET_SYNC_R2; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ISSUE_FLAG_STATUS<= (OTHERS => '0'); ELSE ISSUE_FLAG_STATUS <= ISSUE_FLAG_STATUS OR ISSUE_FLAG; END IF; END IF; END PROCESS; STATUS(7 DOWNTO 0) <= ISSUE_FLAG_STATUS; BMG_STIM_GEN_INST:ENTITY work.BMG_STIM_GEN GENERIC MAP( C_ROM_SYNTH => C_ROM_SYNTH ) PORT MAP( CLK => clk_in_i, RST => RSTA, ADDRA => ADDRA, DATA_IN => DOUTA, STATUS => ISSUE_FLAG(0) ); PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN STATUS(8) <= '0'; iter_r2 <= '0'; iter_r1 <= '0'; iter_r0 <= '0'; ELSE STATUS(8) <= iter_r2; iter_r2 <= iter_r1; iter_r1 <= iter_r0; iter_r0 <= STIMULUS_FLOW(8); END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN STIMULUS_FLOW <= (OTHERS => '0'); ELSIF(ADDRA(0)='1') THEN STIMULUS_FLOW <= STIMULUS_FLOW+1; END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ELSE END IF; END IF; END PROCESS; PROCESS(CLKA) BEGIN IF(RISING_EDGE(CLKA)) THEN IF(RESET_SYNC_R3='1') THEN ADDRA_R <= (OTHERS=> '0') AFTER 50 ns; ELSE ADDRA_R <= ADDRA AFTER 50 ns; END IF; END IF; END PROCESS; BMG_PORT: explosion_exdes PORT MAP ( --Port A ADDRA => ADDRA_R, DOUTA => DOUTA, CLKA => CLKA ); END ARCHITECTURE;
mit
1c6200a46dbb3317342a24737e39136f
0.581164
3.824385
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/leon3v3/leon3s.vhd
1
6,420
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: leon3s -- File: leon3s.vhd -- Author: Jan Andersson, Aeroflex Gaisler -- Description: Top-level LEON3 component ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.leon3.all; entity leon3s is generic ( hindex : integer := 0; fabtech : integer range 0 to NTECH := DEFFABTECH; memtech : integer range 0 to NTECH := DEFMEMTECH; nwindows : integer range 2 to 32 := 8; dsu : integer range 0 to 1 := 0; fpu : integer range 0 to 31 := 0; v8 : integer range 0 to 63 := 0; cp : integer range 0 to 1 := 0; mac : integer range 0 to 1 := 0; pclow : integer range 0 to 2 := 2; notag : integer range 0 to 1 := 0; nwp : integer range 0 to 4 := 0; icen : integer range 0 to 1 := 0; irepl : integer range 0 to 3 := 2; isets : integer range 1 to 4 := 1; ilinesize : integer range 4 to 8 := 4; isetsize : integer range 1 to 256 := 1; isetlock : integer range 0 to 1 := 0; dcen : integer range 0 to 1 := 0; drepl : integer range 0 to 3 := 2; dsets : integer range 1 to 4 := 1; dlinesize : integer range 4 to 8 := 4; dsetsize : integer range 1 to 256 := 1; dsetlock : integer range 0 to 1 := 0; dsnoop : integer range 0 to 6 := 0; ilram : integer range 0 to 1 := 0; ilramsize : integer range 1 to 512 := 1; ilramstart : integer range 0 to 255 := 16#8e#; dlram : integer range 0 to 1 := 0; dlramsize : integer range 1 to 512 := 1; dlramstart : integer range 0 to 255 := 16#8f#; mmuen : integer range 0 to 1 := 0; itlbnum : integer range 2 to 64 := 8; dtlbnum : integer range 2 to 64 := 8; tlb_type : integer range 0 to 3 := 1; tlb_rep : integer range 0 to 1 := 0; lddel : integer range 1 to 2 := 2; disas : integer range 0 to 2 := 0; tbuf : integer range 0 to 64 := 0; pwd : integer range 0 to 2 := 2; svt : integer range 0 to 1 := 1; rstaddr : integer := 0; smp : integer range 0 to 15 := 0; cached : integer := 0; scantest : integer := 0; mmupgsz : integer range 0 to 5 := 0; bp : integer := 1 ); port ( clk : in std_ulogic; rstn : in std_ulogic; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : in ahb_slv_out_vector; irqi : in l3_irq_in_type; irqo : out l3_irq_out_type; dbgi : in l3_debug_in_type; dbgo : out l3_debug_out_type ); end; architecture rtl of leon3s is signal gnd, vcc : std_logic; signal fpuo : grfpu_out_type; begin gnd <= '0'; vcc <= '1'; fpuo <= grfpu_out_none; leon3x0 : leon3x generic map ( hindex => hindex, fabtech => fabtech, memtech => memtech, nwindows => nwindows, dsu => dsu, fpu => fpu, v8 => v8, cp => cp, mac => mac, pclow => pclow, notag => notag, nwp => nwp, icen => icen, irepl => irepl, isets => isets, ilinesize => ilinesize, isetsize => isetsize, isetlock => isetlock, dcen => dcen, drepl => drepl, dsets => dsets, dlinesize => dlinesize, dsetsize => dsetsize, dsetlock => dsetlock, dsnoop => dsnoop, ilram => ilram, ilramsize => ilramsize, ilramstart => ilramstart, dlram => dlram, dlramsize => dlramsize, dlramstart => dlramstart, mmuen => mmuen, itlbnum => itlbnum, dtlbnum => dtlbnum, tlb_type => tlb_type, tlb_rep => tlb_rep, lddel => lddel, disas => disas, tbuf => tbuf, pwd => pwd, svt => svt, rstaddr => rstaddr, smp => smp, iuft => 0, fpft => 0, cmft => 0, iuinj => 0, ceinj => 0, cached => cached, clk2x => 0, netlist => 0, scantest => scantest, mmupgsz => mmupgsz, bp => bp) port map ( clk => gnd, gclk2 => clk, gfclk2 => clk, clk2 => clk, rstn => rstn, ahbi => ahbi, ahbo => ahbo, ahbsi => ahbsi, ahbso => ahbso, irqi => irqi, irqo => irqo, dbgi => dbgi, dbgo => dbgo, fpui => open, fpuo => fpuo, clken => vcc); end;
gpl-2.0
831dfa62cba1a04307f4fa35d1c3b6e1
0.465576
3.965411
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_dma_v7_1/2a047f91/hdl/src/vhdl/axi_dma.vhd
2
125,729
-- (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.vhd -- Description: This entity is the top level entity for the AXI DMA 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; use axi_dma_v7_1.axi_dma_pkg.all; library axi_sg_v4_1; use axi_sg_v4_1.all; library axi_datamover_v5_1; use axi_datamover_v5_1.all; library lib_pkg_v1_0; use lib_pkg_v1_0.lib_pkg.max2; ------------------------------------------------------------------------------- entity axi_dma is generic( C_S_AXI_LITE_ADDR_WIDTH : integer range 2 to 32 := 10; -- Address width of the AXI Lite Interface C_S_AXI_LITE_DATA_WIDTH : integer range 32 to 32 := 32; -- Data width of the AXI Lite Interface C_DLYTMR_RESOLUTION : integer range 1 to 100000 := 125; -- Interrupt Delay Timer resolution in usec 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 - Any one of the 4 clock inputs is not -- synchronous to the other ----------------------------------------------------------------------- -- Scatter Gather Parameters ----------------------------------------------------------------------- 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_DESC_QUEUE : integer range 0 to 1 := 0; -- Include or Exclude Scatter Gather Descriptor Queuing -- 0 = Exclude SG Descriptor Queuing -- 1 = Include SG Descriptor Queuing 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_SG_USE_STSAPP_LENGTH : integer range 0 to 1 := 1; -- Enable or Disable use of Status Stream Rx Length. Only valid -- if C_SG_INCLUDE_STSCNTRL_STRM = 1 -- 0 = Don't use Rx Length -- 1 = Use Rx Length C_SG_LENGTH_WIDTH : integer range 8 to 23 := 14; -- Descriptor Buffer Length, Transferred Bytes, and Status Stream -- Rx Length Width. Indicates the least significant valid bits of -- descriptor buffer length, transferred bytes, or Rx Length value -- in the status word coincident with tlast. C_M_AXI_SG_ADDR_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Address Width for Scatter Gather R/W Port C_M_AXI_SG_DATA_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Data Width for Scatter Gather R/W Port C_M_AXIS_MM2S_CNTRL_TDATA_WIDTH : integer range 32 to 32 := 32; -- Master AXI Control Stream Data Width C_S_AXIS_S2MM_STS_TDATA_WIDTH : integer range 32 to 32 := 32; -- Slave AXI Status Stream Data Width ----------------------------------------------------------------------- -- Memory Map to Stream (MM2S) Parameters ----------------------------------------------------------------------- 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_MM2S_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_MM2S_DRE : integer range 0 to 1 := 0; -- Include or exclude MM2S data realignment engine (DRE) -- 0 = Exclude MM2S DRE -- 1 = Include MM2S DRE C_MM2S_BURST_SIZE : integer range 2 to 256 := 16; -- Maximum burst size per burst request on MM2S Read Port C_M_AXI_MM2S_ADDR_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Address Width for MM2S Read Port C_M_AXI_MM2S_DATA_WIDTH : integer range 32 to 1024 := 32; -- Master AXI Memory Map Data Width for MM2S Read Port C_M_AXIS_MM2S_TDATA_WIDTH : integer range 8 to 1024 := 32; -- Master AXI Stream Data Width for MM2S Channel ----------------------------------------------------------------------- -- Stream to Memory Map (S2MM) Parameters ----------------------------------------------------------------------- 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_S2MM_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_INCLUDE_S2MM_DRE : integer range 0 to 1 := 0; -- Include or exclude S2MM data realignment engine (DRE) -- 0 = Exclude S2MM DRE -- 1 = Include S2MM DRE C_S2MM_BURST_SIZE : integer range 2 to 256 := 16; -- Maximum burst size per burst request on S2MM Write Port C_M_AXI_S2MM_ADDR_WIDTH : integer range 32 to 32 := 32; -- Master AXI Memory Map Address Width for S2MM Write Port C_M_AXI_S2MM_DATA_WIDTH : integer range 32 to 1024 := 32; -- Master AXI Memory Map Data Width for MM2SS2MMWrite Port C_S_AXIS_S2MM_TDATA_WIDTH : integer range 8 to 1024 := 32; -- Slave AXI Stream Data Width for S2MM Channel C_ENABLE_MULTI_CHANNEL : integer range 0 to 1 := 0; -- Enable CACHE support, primarily for MCDMA C_NUM_S2MM_CHANNELS : integer range 1 to 16 := 1; -- Number of S2MM channels, primarily for MCDMA C_NUM_MM2S_CHANNELS : integer range 1 to 16 := 1; -- Number of MM2S channels, primarily for MCDMA C_FAMILY : string := "virtex7"; C_MICRO_DMA : integer range 0 to 1 := 0; -- Target FPGA Device Family C_INSTANCE : string := "axi_dma" ); port ( s_axi_lite_aclk : in std_logic := '0' ; -- m_axi_sg_aclk : in std_logic := '0' ; -- m_axi_mm2s_aclk : in std_logic := '0' ; -- m_axi_s2mm_aclk : in std_logic := '0' ; -- ----------------------------------------------------------------------- -- Primary Clock CDMA ----------------------------------------------------------------------- axi_resetn : in std_logic := '0' ; -- -- ----------------------------------------------------------------------- -- -- AXI Lite Control Interface -- ----------------------------------------------------------------------- -- -- AXI Lite Write Address Channel -- s_axi_lite_awvalid : in std_logic := '0' ; -- s_axi_lite_awready : out std_logic ; -- -- s_axi_lite_awaddr : in std_logic_vector -- -- (C_S_AXI_LITE_ADDR_WIDTH-1 downto 0) := (others => '0'); -- s_axi_lite_awaddr : in std_logic_vector -- (9 downto 0) := (others => '0'); -- -- -- AXI Lite Write Data Channel -- s_axi_lite_wvalid : in std_logic := '0' ; -- s_axi_lite_wready : out std_logic ; -- s_axi_lite_wdata : in std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); -- -- -- AXI Lite Write Response Channel -- s_axi_lite_bresp : out std_logic_vector(1 downto 0) ; -- s_axi_lite_bvalid : out std_logic ; -- s_axi_lite_bready : in std_logic := '0' ; -- -- -- AXI Lite Read Address Channel -- s_axi_lite_arvalid : in std_logic := '0' ; -- s_axi_lite_arready : out std_logic ; -- -- s_axi_lite_araddr : in std_logic_vector -- -- (C_S_AXI_LITE_ADDR_WIDTH-1 downto 0) := (others => '0'); -- s_axi_lite_araddr : in std_logic_vector -- (9 downto 0) := (others => '0'); -- s_axi_lite_rvalid : out std_logic ; -- s_axi_lite_rready : in std_logic := '0' ; -- s_axi_lite_rdata : out std_logic_vector -- (C_S_AXI_LITE_DATA_WIDTH-1 downto 0); -- s_axi_lite_rresp : out std_logic_vector(1 downto 0) ; -- -- ----------------------------------------------------------------------- -- -- AXI Scatter Gather Interface -- ----------------------------------------------------------------------- -- -- Scatter Gather Write Address Channel -- m_axi_sg_awaddr : out std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- m_axi_sg_awlen : out std_logic_vector(7 downto 0) ; -- m_axi_sg_awsize : out std_logic_vector(2 downto 0) ; -- m_axi_sg_awburst : out std_logic_vector(1 downto 0) ; -- m_axi_sg_awprot : out std_logic_vector(2 downto 0) ; -- m_axi_sg_awcache : out std_logic_vector(3 downto 0) ; -- m_axi_sg_awuser : out std_logic_vector(3 downto 0) ; -- m_axi_sg_awvalid : out std_logic ; -- m_axi_sg_awready : in std_logic := '0' ; -- -- -- Scatter Gather Write Data Channel -- m_axi_sg_wdata : out std_logic_vector -- (C_M_AXI_SG_DATA_WIDTH-1 downto 0) ; -- m_axi_sg_wstrb : out std_logic_vector -- ((C_M_AXI_SG_DATA_WIDTH/8)-1 downto 0); -- m_axi_sg_wlast : out std_logic ; -- m_axi_sg_wvalid : out std_logic ; -- m_axi_sg_wready : in std_logic := '0' ; -- -- -- Scatter Gather Write Response Channel -- m_axi_sg_bresp : in std_logic_vector(1 downto 0) := "00" ; -- m_axi_sg_bvalid : in std_logic := '0' ; -- m_axi_sg_bready : out std_logic ; -- -- -- Scatter Gather Read Address Channel -- m_axi_sg_araddr : out std_logic_vector -- (C_M_AXI_SG_ADDR_WIDTH-1 downto 0) ; -- m_axi_sg_arlen : out std_logic_vector(7 downto 0) ; -- m_axi_sg_arsize : out std_logic_vector(2 downto 0) ; -- m_axi_sg_arburst : out std_logic_vector(1 downto 0) ; -- m_axi_sg_arprot : out std_logic_vector(2 downto 0) ; -- m_axi_sg_arcache : out std_logic_vector(3 downto 0) ; -- m_axi_sg_aruser : out std_logic_vector(3 downto 0) ; -- m_axi_sg_arvalid : out std_logic ; -- m_axi_sg_arready : in std_logic := '0' ; -- -- -- Memory Map to Stream Scatter Gather Read Data Channel -- m_axi_sg_rdata : in std_logic_vector -- (C_M_AXI_SG_DATA_WIDTH-1 downto 0) := (others => '0'); -- m_axi_sg_rresp : in std_logic_vector(1 downto 0) := "00"; -- m_axi_sg_rlast : in std_logic := '0'; -- m_axi_sg_rvalid : in std_logic := '0'; -- m_axi_sg_rready : out std_logic ; -- -- -- ----------------------------------------------------------------------- -- -- AXI MM2S Channel -- ----------------------------------------------------------------------- -- -- Memory Map To Stream Read Address Channel -- m_axi_mm2s_araddr : out std_logic_vector -- (C_M_AXI_MM2S_ADDR_WIDTH-1 downto 0); -- m_axi_mm2s_arlen : out std_logic_vector(7 downto 0) ; -- m_axi_mm2s_arsize : out std_logic_vector(2 downto 0) ; -- m_axi_mm2s_arburst : out std_logic_vector(1 downto 0) ; -- m_axi_mm2s_arprot : out std_logic_vector(2 downto 0) ; -- m_axi_mm2s_arcache : out std_logic_vector(3 downto 0) ; -- m_axi_mm2s_aruser : out std_logic_vector(3 downto 0) ; -- m_axi_mm2s_arvalid : out std_logic ; -- m_axi_mm2s_arready : in std_logic := '0'; -- -- -- Memory Map to Stream Read Data Channel -- m_axi_mm2s_rdata : in std_logic_vector -- (C_M_AXI_MM2S_DATA_WIDTH-1 downto 0) := (others => '0'); -- m_axi_mm2s_rresp : in std_logic_vector(1 downto 0) := "00"; -- m_axi_mm2s_rlast : in std_logic := '0'; -- m_axi_mm2s_rvalid : in std_logic := '0'; -- m_axi_mm2s_rready : out std_logic ; -- -- -- Memory Map to Stream Stream Interface -- mm2s_prmry_reset_out_n : out std_logic ; -- CR573702 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_tvalid : out std_logic ; -- m_axis_mm2s_tready : in std_logic := '0'; -- m_axis_mm2s_tlast : out std_logic ; -- m_axis_mm2s_tuser : out std_logic_vector (3 downto 0) ; -- m_axis_mm2s_tid : out std_logic_vector (4 downto 0) ; -- m_axis_mm2s_tdest : out std_logic_vector (4 downto 0) ; -- -- -- Memory Map to Stream Control Stream Interface -- mm2s_cntrl_reset_out_n : out std_logic ; -- CR573702 m_axis_mm2s_cntrl_tdata : out std_logic_vector -- (C_M_AXIS_MM2S_CNTRL_TDATA_WIDTH-1 downto 0); -- m_axis_mm2s_cntrl_tkeep : out std_logic_vector -- ((C_M_AXIS_MM2S_CNTRL_TDATA_WIDTH/8)-1 downto 0); -- m_axis_mm2s_cntrl_tvalid : out std_logic ; -- m_axis_mm2s_cntrl_tready : in std_logic := '0'; -- m_axis_mm2s_cntrl_tlast : out std_logic ; -- -- -- ----------------------------------------------------------------------- -- -- AXI S2MM Channel -- ----------------------------------------------------------------------- -- -- Stream to Memory Map Write Address Channel -- m_axi_s2mm_awaddr : out std_logic_vector -- (C_M_AXI_S2MM_ADDR_WIDTH-1 downto 0); -- m_axi_s2mm_awlen : out std_logic_vector(7 downto 0) ; -- m_axi_s2mm_awsize : out std_logic_vector(2 downto 0) ; -- m_axi_s2mm_awburst : out std_logic_vector(1 downto 0) ; -- m_axi_s2mm_awprot : out std_logic_vector(2 downto 0) ; -- m_axi_s2mm_awcache : out std_logic_vector(3 downto 0) ; -- m_axi_s2mm_awuser : out std_logic_vector(3 downto 0) ; -- m_axi_s2mm_awvalid : out std_logic ; -- m_axi_s2mm_awready : in std_logic := '0'; -- -- -- Stream to Memory Map Write Data Channel -- 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 := '0'; -- -- -- Stream to Memory Map Write Response Channel -- m_axi_s2mm_bresp : in std_logic_vector(1 downto 0) := "00"; -- m_axi_s2mm_bvalid : in std_logic := '0'; -- m_axi_s2mm_bready : out std_logic ; -- -- -- Stream to Memory Map Steam Interface -- s2mm_prmry_reset_out_n : out std_logic ; -- CR573702 s_axis_s2mm_tdata : in std_logic_vector -- (C_S_AXIS_S2MM_TDATA_WIDTH-1 downto 0) := (others => '0'); -- s_axis_s2mm_tkeep : in std_logic_vector -- ((C_S_AXIS_S2MM_TDATA_WIDTH/8)-1 downto 0) := (others => '1'); -- s_axis_s2mm_tvalid : in std_logic := '0'; -- s_axis_s2mm_tready : out std_logic ; -- s_axis_s2mm_tlast : in std_logic := '0'; -- s_axis_s2mm_tuser : in std_logic_vector (3 downto 0) := "0000" ; -- s_axis_s2mm_tid : in std_logic_vector (4 downto 0) := "00000" ; -- s_axis_s2mm_tdest : in std_logic_vector (4 downto 0) := "00000" ; -- -- -- Stream to Memory Map Status Steam Interface -- s2mm_sts_reset_out_n : out std_logic ; -- CR573702 s_axis_s2mm_sts_tdata : in std_logic_vector -- (C_S_AXIS_S2MM_STS_TDATA_WIDTH-1 downto 0) := (others => '0'); -- s_axis_s2mm_sts_tkeep : in std_logic_vector -- ((C_S_AXIS_S2MM_STS_TDATA_WIDTH/8)-1 downto 0) := (others => '1'); -- s_axis_s2mm_sts_tvalid : in std_logic := '0'; -- s_axis_s2mm_sts_tready : out std_logic ; -- s_axis_s2mm_sts_tlast : in std_logic := '0'; -- -- -- MM2S and S2MM Channel Interrupts -- mm2s_introut : out std_logic ; -- s2mm_introut : out std_logic ; -- axi_dma_tstvec : out std_logic_vector(31 downto 0) -- ----------------------------------------------------------------------- -- Test Support for Xilinx internal use ----------------------------------------------------------------------- ); end axi_dma; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_dma is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; -- The FREQ are needed only for ASYNC mode, for SYNC mode these are irrelevant -- For Async, mm2s or s2mm >= sg >= lite constant C_S_AXI_LITE_ACLK_FREQ_HZ : integer := 100000000; -- AXI Lite clock frequency in hertz constant C_M_AXI_MM2S_ACLK_FREQ_HZ : integer := 100000000; -- AXI MM2S clock frequency in hertz constant C_M_AXI_S2MM_ACLK_FREQ_HZ : integer := 100000000; -- AXI S2MM clock frequency in hertz constant C_M_AXI_SG_ACLK_FREQ_HZ : integer := 100000000; -- Scatter Gather clock frequency in hertz ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------- -- Function -- -- Function Name: funct_get_max -- -- Function Description: -- Returns the greater of two integers. -- ------------------------------------------------------------------- function funct_get_string (value_in_1 : integer) return string is Variable max_value : string (1 to 5) := "00000"; begin If (value_in_1 = 1) Then -- coverage off max_value := "11100"; -- coverage on else max_value := "11111"; End if; Return (max_value); end function funct_get_string; -- ------------------------------------------------------------------- -- -- -- -- ------------------------------------------------------------------- -- -- Function -- -- -- -- Function Name: funct_rnd2pwr_of_2 -- -- -- -- Function Description: -- -- Rounds the input value up to the nearest power of 2 between -- -- 128 and 8192. -- -- -- ------------------------------------------------------------------- -- function funct_rnd2pwr_of_2 (input_value : integer) return integer is -- -- Variable temp_pwr2 : Integer := 128; -- -- begin -- -- if (input_value <= 128) then -- -- temp_pwr2 := 128; -- -- elsif (input_value <= 256) then -- -- temp_pwr2 := 256; -- -- elsif (input_value <= 512) then -- -- temp_pwr2 := 512; -- -- elsif (input_value <= 1024) then -- -- temp_pwr2 := 1024; -- -- elsif (input_value <= 2048) then -- -- temp_pwr2 := 2048; -- -- elsif (input_value <= 4096) then -- -- temp_pwr2 := 4096; -- -- else -- -- temp_pwr2 := 8192; -- -- end if; -- -- -- Return (temp_pwr2); -- -- end function funct_rnd2pwr_of_2; -- ------------------------------------------------------------------- -- -- -- -- -- ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- Constant SOFT_RST_TIME_CLKS : integer := 8; -- Specifies the time of the soft reset assertion in -- m_axi_aclk clock periods. constant skid_enable : string := (funct_get_string(0)); -- Calculates the minimum needed depth of the CDMA Store and Forward FIFO -- Constant PIPEDEPTH_BURST_LEN_PROD : integer := -- (funct_get_max(4, 4)+2) -- * C_M_AXI_MAX_BURST_LEN; -- -- -- Assigns the depth of the CDMA Store and Forward FIFO to the nearest -- -- power of 2 -- Constant SF_FIFO_DEPTH : integer range 128 to 8192 := -- funct_rnd2pwr_of_2(PIPEDEPTH_BURST_LEN_PROD); -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- Scatter Gather Engine Configuration -- Number of Fetch Descriptors to Queue constant MCDMA : integer := (1 - C_ENABLE_MULTI_CHANNEL); constant DESC_QUEUE : integer := (1*MCDMA); constant STSCNTRL_ENABLE : integer := (C_SG_INCLUDE_STSCNTRL_STRM*MCDMA); constant APPLENGTH_ENABLE : integer := (C_SG_USE_STSAPP_LENGTH*MCDMA); constant C_SG_LENGTH_WIDTH_INT : integer := (C_SG_LENGTH_WIDTH*MCDMA + 23*C_ENABLE_MULTI_CHANNEL); -- Comment the foll 2 line to disable queuing for McDMA and uncomment the 3rd and 4th lines --constant SG_FTCH_DESC2QUEUE : integer := ((DESC_QUEUE * 4)*MCDMA + (2*C_ENABLE_MULTI_CHANNEL)) * C_SG_INCLUDE_DESC_QUEUE; -- Number of Update Descriptors to Queue --constant SG_UPDT_DESC2QUEUE : integer := ((DESC_QUEUE * 4)*MCDMA + (2*C_ENABLE_MULTI_CHANNEL)) * C_SG_INCLUDE_DESC_QUEUE; constant SG_FTCH_DESC2QUEUE : integer := ((DESC_QUEUE * 4)*MCDMA + (2*C_ENABLE_MULTI_CHANNEL)) * DESC_QUEUE; -- Number of Update Descriptors to Queue constant SG_UPDT_DESC2QUEUE : integer := ((DESC_QUEUE * 4)*MCDMA + (2*C_ENABLE_MULTI_CHANNEL)) * DESC_QUEUE; -- Number of fetch words per descriptor for channel 1 (MM2S) constant SG_CH1_WORDS_TO_FETCH : integer := 8 + (5 * STSCNTRL_ENABLE); -- Number of fetch words per descriptor for channel 2 (S2MM) constant SG_CH2_WORDS_TO_FETCH : integer := 8; -- Only need to fetch 1st 8wrds for s2mm -- Number of update words per descriptor for channel 1 (MM2S) constant SG_CH1_WORDS_TO_UPDATE : integer := 1; -- Only status needs update for mm2s -- Number of update words per descriptor for channel 2 (S2MM) constant SG_CH2_WORDS_TO_UPDATE : integer := 1 + (5 * STSCNTRL_ENABLE); -- First word offset (referenced to descriptor beginning) to update for channel 1 (MM2S) constant SG_CH1_FIRST_UPDATE_WORD : integer := 7; -- status word in descriptor -- First word offset (referenced to descriptor beginning) to update for channel 2 (MM2S) constant SG_CH2_FIRST_UPDATE_WORD : integer := 7; -- status word in descriptor -- Enable stale descriptor check for channel 1 constant SG_CH1_ENBL_STALE_ERROR : integer := 1; -- Enable stale descriptor check for channel 2 constant SG_CH2_ENBL_STALE_ERROR : integer := 1; -- Width of descriptor fetch bus constant M_AXIS_SG_TDATA_WIDTH : integer := 32; -- Width of descriptor update pointer bus constant S_AXIS_UPDPTR_TDATA_WIDTH : integer := 32; -- Width of descriptor update status bus constant S_AXIS_UPDSTS_TDATA_WIDTH : integer := 33; -- IOC (1 bit) & DescStatus (32 bits) -- Include SG Descriptor Updates constant INCLUDE_DESC_UPDATE : integer := 1; -- Include SG Interrupt Logic constant INCLUDE_INTRPT : integer := 1; -- Include SG Delay Interrupt constant INCLUDE_DLYTMR : integer := 1; -- Primary DataMover Configuration -- DataMover Command / Status FIFO Depth -- Note :Set maximum to the number of update descriptors to queue, to prevent lock up do to -- update data fifo full before --constant DM_CMDSTS_FIFO_DEPTH : integer := 1*C_ENABLE_MULTI_CHANNEL + (max2(1,SG_UPDT_DESC2QUEUE))*MCDMA; constant DM_CMDSTS_FIFO_DEPTH : integer := max2(1,SG_UPDT_DESC2QUEUE); constant DM_CMDSTS_FIFO_DEPTH_1 : integer := ((1-C_PRMRY_IS_ACLK_ASYNC)+C_PRMRY_IS_ACLK_ASYNC*DM_CMDSTS_FIFO_DEPTH); -- DataMover Include Status FIFO constant DM_INCLUDE_STS_FIFO : integer := 1; -- Enable indeterminate BTT on datamover when stscntrl stream not included or -- when use status app rx length is not enable or when in Simple DMA mode. constant DM_SUPPORT_INDET_BTT : integer := 1 - (STSCNTRL_ENABLE * APPLENGTH_ENABLE * C_INCLUDE_SG) - C_MICRO_DMA; -- Indterminate BTT Mode additional status vector width constant INDETBTT_ADDED_STS_WIDTH : integer := 24; -- Base status vector width constant BASE_STATUS_WIDTH : integer := 8; -- DataMover status width - is based on mode of operation constant DM_STATUS_WIDTH : integer := BASE_STATUS_WIDTH + (DM_SUPPORT_INDET_BTT * INDETBTT_ADDED_STS_WIDTH); -- DataMover outstanding address request fifo depth constant DM_ADDR_PIPE_DEPTH : integer := 1; -- AXI DataMover Full mode value constant AXI_FULL_MODE : integer := 1; -- AXI DataMover mode for MM2S Channel (0 if channel not included) constant MM2S_AXI_FULL_MODE : integer := (C_INCLUDE_MM2S) * AXI_FULL_MODE + C_MICRO_DMA*C_INCLUDE_MM2S; -- AXI DataMover mode for S2MM Channel (0 if channel not included) constant S2MM_AXI_FULL_MODE : integer := (C_INCLUDE_S2MM) * AXI_FULL_MODE + C_MICRO_DMA*C_INCLUDE_S2MM; -- Minimum value required for length width based on burst size and stream dwidth -- If user sets c_sg_length_width too small based on setting of burst size and -- dwidth then this will reset the width to a larger mimimum requirement. constant DM_BTT_LENGTH_WIDTH : integer := max2((required_btt_width(C_M_AXIS_MM2S_TDATA_WIDTH, C_MM2S_BURST_SIZE, C_SG_LENGTH_WIDTH_INT)*C_INCLUDE_MM2S), (required_btt_width(C_S_AXIS_S2MM_TDATA_WIDTH, C_S2MM_BURST_SIZE, C_SG_LENGTH_WIDTH_INT)*C_INCLUDE_S2MM)); -- Enable store and forward on datamover if data widths are mismatched (allows upsizers -- to be instantiated) or when enabled by user. constant DM_MM2S_INCLUDE_SF : integer := enable_snf(C_INCLUDE_MM2S_SF, C_M_AXI_MM2S_DATA_WIDTH, C_M_AXIS_MM2S_TDATA_WIDTH); -- Enable store and forward on datamover if data widths are mismatched (allows upsizers -- to be instantiated) or when enabled by user. constant DM_S2MM_INCLUDE_SF : integer := enable_snf(C_INCLUDE_S2MM_SF, C_M_AXI_S2MM_DATA_WIDTH, C_S_AXIS_S2MM_TDATA_WIDTH); -- Always allow datamover address requests constant ALWAYS_ALLOW : std_logic := '1'; -- Return correct freq_hz parameter depending on if sg engine is included constant M_AXI_SG_ACLK_FREQ_HZ :integer := hertz_prmtr_select(C_INCLUDE_SG, C_S_AXI_LITE_ACLK_FREQ_HZ, C_M_AXI_SG_ACLK_FREQ_HZ); -- Scatter / Gather is always configure for synchronous operation for AXI DMA constant SG_IS_SYNCHRONOUS : integer := 0; ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- signal axi_lite_aclk : std_logic := '1'; signal axi_sg_aclk : std_logic := '1'; signal m_axi_sg_aresetn : std_logic := '1'; -- SG Reset on sg aclk domain (Soft/Hard) signal dm_m_axi_sg_aresetn : std_logic := '1'; -- SG Reset on sg aclk domain (Soft/Hard) (Raw) signal m_axi_mm2s_aresetn : std_logic := '1'; -- MM2S Channel Reset on s2mm aclk domain (Soft/Hard)(Raw) signal m_axi_s2mm_aresetn : std_logic := '1'; -- S2MM Channel Reset on s2mm aclk domain (Soft/Hard)(Raw) signal mm2s_scndry_resetn : std_logic := '1'; -- MM2S Channel Reset on sg aclk domain (Soft/Hard) signal s2mm_scndry_resetn : std_logic := '1'; -- S2MM Channel Reset on sg aclk domain (Soft/Hard) signal mm2s_prmry_resetn : std_logic := '1'; -- MM2S Channel Reset on s2mm aclk domain (Soft/Hard) signal s2mm_prmry_resetn : std_logic := '1'; -- S2MM Channel Reset on s2mm aclk domain (Soft/Hard) signal axi_lite_reset_n : std_logic := '1'; -- AXI Lite Interface Reset (Hard Only) signal m_axi_sg_hrdresetn : std_logic := '1'; -- AXI Lite Interface Reset on SG clock domain (Hard Only) signal dm_mm2s_scndry_resetn : std_logic := '1'; -- MM2S Channel Reset on sg domain (Soft/Hard)(Raw) signal dm_s2mm_scndry_resetn : std_logic := '1'; -- S2MM Channel Reset on sg domain (Soft/Hard)(Raw) -- Register Module Signals signal mm2s_halted_clr : std_logic := '0'; signal mm2s_halted_set : std_logic := '0'; signal mm2s_idle_set : std_logic := '0'; signal mm2s_idle_clr : std_logic := '0'; signal mm2s_dma_interr_set : std_logic := '0'; signal mm2s_dma_slverr_set : std_logic := '0'; signal mm2s_dma_decerr_set : std_logic := '0'; signal mm2s_ioc_irq_set : std_logic := '0'; signal mm2s_dly_irq_set : std_logic := '0'; signal mm2s_irqdelay_status : std_logic_vector(7 downto 0) := (others => '0'); signal mm2s_irqthresh_status : std_logic_vector(7 downto 0) := (others => '0'); signal mm2s_new_curdesc_wren : std_logic := '0'; signal mm2s_new_curdesc : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal mm2s_tailpntr_updated : std_logic := '0'; signal mm2s_dmacr : std_logic_vector(C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal mm2s_dmasr : std_logic_vector(C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal mm2s_curdesc : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal mm2s_taildesc : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal mm2s_sa : std_logic_vector(C_M_AXI_MM2S_ADDR_WIDTH-1 downto 0) := (others => '0'); signal mm2s_length : std_logic_vector(C_SG_LENGTH_WIDTH_INT-1 downto 0) := (others => '0'); signal mm2s_length_wren : std_logic := '0'; signal mm2s_smpl_interr_set : std_logic := '0'; signal mm2s_smpl_slverr_set : std_logic := '0'; signal mm2s_smpl_decerr_set : std_logic := '0'; signal mm2s_smpl_done : std_logic := '0'; signal mm2s_packet_sof : std_logic := '0'; signal mm2s_packet_eof : std_logic := '0'; signal mm2s_all_idle : std_logic := '0'; signal mm2s_error : std_logic := '0'; signal mm2s_dlyirq_dsble : std_logic := '0'; -- CR605888 signal s2mm_halted_clr : std_logic := '0'; signal s2mm_halted_set : std_logic := '0'; signal s2mm_idle_set : std_logic := '0'; signal s2mm_idle_clr : std_logic := '0'; signal s2mm_dma_interr_set : std_logic := '0'; signal s2mm_dma_slverr_set : std_logic := '0'; signal s2mm_dma_decerr_set : std_logic := '0'; signal s2mm_ioc_irq_set : std_logic := '0'; signal s2mm_dly_irq_set : std_logic := '0'; signal s2mm_irqdelay_status : std_logic_vector(7 downto 0) := (others => '0'); signal s2mm_irqthresh_status : std_logic_vector(7 downto 0) := (others => '0'); signal s2mm_new_curdesc_wren : std_logic := '0'; signal s2mm_new_curdesc : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal s2mm_tailpntr_updated : std_logic := '0'; signal s2mm_dmacr : std_logic_vector(C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal s2mm_dmasr : std_logic_vector(C_S_AXI_LITE_DATA_WIDTH-1 downto 0) := (others => '0'); signal s2mm_curdesc : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal s2mm_taildesc : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal s2mm_da : std_logic_vector(C_M_AXI_S2MM_ADDR_WIDTH-1 downto 0) := (others => '0'); signal s2mm_length : std_logic_vector(C_SG_LENGTH_WIDTH_INT-1 downto 0) := (others => '0'); signal s2mm_length_wren : std_logic := '0'; signal s2mm_bytes_rcvd : std_logic_vector(C_SG_LENGTH_WIDTH_INT-1 downto 0) := (others => '0'); signal s2mm_bytes_rcvd_wren : std_logic := '0'; signal s2mm_smpl_interr_set : std_logic := '0'; signal s2mm_smpl_slverr_set : std_logic := '0'; signal s2mm_smpl_decerr_set : std_logic := '0'; signal s2mm_smpl_done : std_logic := '0'; signal s2mm_packet_sof : std_logic := '0'; signal s2mm_packet_eof : std_logic := '0'; signal s2mm_all_idle : std_logic := '0'; signal s2mm_error : std_logic := '0'; signal s2mm_dlyirq_dsble : std_logic := '0'; -- CR605888 signal mm2s_stop : std_logic := '0'; signal s2mm_stop : std_logic := '0'; signal ftch_error : std_logic := '0'; signal ftch_error_addr : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); signal updt_error : std_logic := '0'; signal updt_error_addr : std_logic_vector(C_M_AXI_SG_ADDR_WIDTH-1 downto 0) := (others => '0'); --********************************* -- MM2S Signals --********************************* -- MM2S DMA Controller Signals signal mm2s_desc_flush : std_logic := '0'; signal mm2s_ftch_idle : std_logic := '0'; signal mm2s_updt_idle : std_logic := '0'; signal mm2s_updt_ioc_irq_set : std_logic := '0'; signal mm2s_irqthresh_wren : std_logic := '0'; signal mm2s_irqdelay_wren : std_logic := '0'; signal mm2s_irqthresh_rstdsbl : std_logic := '0'; -- CR572013 -- SG MM2S Descriptor Fetch AXI Stream IN signal m_axis_mm2s_ftch_tdata_new : std_logic_vector(96 downto 0) := (others => '0'); signal m_axis_mm2s_ftch_tdata_mcdma_new : std_logic_vector(63 downto 0) := (others => '0'); signal m_axis_mm2s_ftch_tvalid_new : std_logic := '0'; signal m_axis_mm2s_ftch_tdata : std_logic_vector(M_AXIS_SG_TDATA_WIDTH-1 downto 0) := (others => '0'); signal m_axis_mm2s_ftch_tvalid : std_logic := '0'; signal m_axis_mm2s_ftch_tready : std_logic := '0'; signal m_axis_mm2s_ftch_tlast : std_logic := '0'; -- SG MM2S Descriptor Update AXI Stream Out signal s_axis_mm2s_updtptr_tdata : std_logic_vector(S_AXIS_UPDPTR_TDATA_WIDTH-1 downto 0) := (others => '0'); signal s_axis_mm2s_updtptr_tvalid : std_logic := '0'; signal s_axis_mm2s_updtptr_tready : std_logic := '0'; signal s_axis_mm2s_updtptr_tlast : std_logic := '0'; signal s_axis_mm2s_updtsts_tdata : std_logic_vector(S_AXIS_UPDSTS_TDATA_WIDTH-1 downto 0) := (others => '0'); signal s_axis_mm2s_updtsts_tvalid : std_logic := '0'; signal s_axis_mm2s_updtsts_tready : std_logic := '0'; signal s_axis_mm2s_updtsts_tlast : std_logic := '0'; -- DataMover MM2S Command Stream Signals signal s_axis_mm2s_cmd_tvalid_split : std_logic := '0'; signal s_axis_mm2s_cmd_tready_split : std_logic := '0'; signal s_axis_mm2s_cmd_tdata_split : std_logic_vector ((2*C_M_AXI_MM2S_ADDR_WIDTH+CMD_BASE_WIDTH+46)-1 downto 0) := (others => '0'); signal s_axis_s2mm_cmd_tvalid_split : std_logic := '0'; signal s_axis_s2mm_cmd_tready_split : std_logic := '0'; signal s_axis_s2mm_cmd_tdata_split : std_logic_vector ((2*C_M_AXI_MM2S_ADDR_WIDTH+CMD_BASE_WIDTH+46)-1 downto 0) := (others => '0'); signal s_axis_mm2s_cmd_tvalid : std_logic := '0'; signal s_axis_mm2s_cmd_tready : std_logic := '0'; signal s_axis_mm2s_cmd_tdata : std_logic_vector ((C_M_AXI_MM2S_ADDR_WIDTH+CMD_BASE_WIDTH+(8*C_ENABLE_MULTI_CHANNEL))-1 downto 0) := (others => '0'); -- DataMover MM2S Status Stream Signals signal m_axis_mm2s_sts_tvalid : std_logic := '0'; signal m_axis_mm2s_sts_tvalid_int : std_logic := '0'; signal m_axis_mm2s_sts_tready : std_logic := '0'; signal m_axis_mm2s_sts_tdata : std_logic_vector(7 downto 0) := (others => '0'); signal m_axis_mm2s_sts_tdata_int : std_logic_vector(7 downto 0) := (others => '0'); signal m_axis_mm2s_sts_tkeep : std_logic_vector(0 downto 0) := (others => '0'); signal mm2s_err : std_logic := '0'; signal mm2s_halt : std_logic := '0'; signal mm2s_halt_cmplt : std_logic := '0'; -- S2MM DMA Controller Signals signal s2mm_desc_flush : std_logic := '0'; signal s2mm_ftch_idle : std_logic := '0'; signal s2mm_updt_idle : std_logic := '0'; signal s2mm_updt_ioc_irq_set : std_logic := '0'; signal s2mm_irqthresh_wren : std_logic := '0'; signal s2mm_irqdelay_wren : std_logic := '0'; signal s2mm_irqthresh_rstdsbl : std_logic := '0'; -- CR572013 -- SG S2MM Descriptor Fetch AXI Stream IN signal m_axis_s2mm_ftch_tdata_new : std_logic_vector(96 downto 0) := (others => '0'); signal m_axis_s2mm_ftch_tdata_mcdma_new : std_logic_vector(63 downto 0) := (others => '0'); signal m_axis_s2mm_ftch_tdata_mcdma_nxt : std_logic_vector(31 downto 0) := (others => '0'); signal m_axis_s2mm_ftch_tvalid_new : std_logic := '0'; signal m_axis_ftch2_desc_available, m_axis_ftch1_desc_available : std_logic; signal m_axis_s2mm_ftch_tdata : std_logic_vector(M_AXIS_SG_TDATA_WIDTH-1 downto 0) := (others => '0'); signal m_axis_s2mm_ftch_tvalid : std_logic := '0'; signal m_axis_s2mm_ftch_tready : std_logic := '0'; signal m_axis_s2mm_ftch_tlast : std_logic := '0'; signal mm2s_axis_info : std_logic_vector(13 downto 0) := (others => '0'); -- SG S2MM Descriptor Update AXI Stream Out signal s_axis_s2mm_updtptr_tdata : std_logic_vector(S_AXIS_UPDPTR_TDATA_WIDTH-1 downto 0) := (others => '0'); signal s_axis_s2mm_updtptr_tvalid : std_logic := '0'; signal s_axis_s2mm_updtptr_tready : std_logic := '0'; signal s_axis_s2mm_updtptr_tlast : std_logic := '0'; signal s_axis_s2mm_updtsts_tdata : std_logic_vector(S_AXIS_UPDSTS_TDATA_WIDTH-1 downto 0) := (others => '0'); signal s_axis_s2mm_updtsts_tvalid : std_logic := '0'; signal s_axis_s2mm_updtsts_tready : std_logic := '0'; signal s_axis_s2mm_updtsts_tlast : std_logic := '0'; -- DataMover S2MM Command Stream Signals signal s_axis_s2mm_cmd_tvalid : std_logic := '0'; signal s_axis_s2mm_cmd_tready : std_logic := '0'; signal s_axis_s2mm_cmd_tdata : std_logic_vector ((C_M_AXI_S2MM_ADDR_WIDTH+CMD_BASE_WIDTH+(8*C_ENABLE_MULTI_CHANNEL))-1 downto 0) := (others => '0'); -- DataMover S2MM Status Stream Signals signal m_axis_s2mm_sts_tvalid : std_logic := '0'; signal m_axis_s2mm_sts_tvalid_int : std_logic := '0'; signal m_axis_s2mm_sts_tready : std_logic := '0'; signal m_axis_s2mm_sts_tdata : std_logic_vector(DM_STATUS_WIDTH - 1 downto 0) := (others => '0'); signal m_axis_s2mm_sts_tdata_int : std_logic_vector(DM_STATUS_WIDTH - 1 downto 0) := (others => '0'); signal m_axis_s2mm_sts_tkeep : std_logic_vector((DM_STATUS_WIDTH/8)-1 downto 0) := (others => '0'); signal s2mm_err : std_logic := '0'; signal s2mm_halt : std_logic := '0'; signal s2mm_halt_cmplt : std_logic := '0'; -- Error Status Control signal mm2s_ftch_interr_set : std_logic := '0'; signal mm2s_ftch_slverr_set : std_logic := '0'; signal mm2s_ftch_decerr_set : std_logic := '0'; signal mm2s_updt_interr_set : std_logic := '0'; signal mm2s_updt_slverr_set : std_logic := '0'; signal mm2s_updt_decerr_set : std_logic := '0'; signal mm2s_ftch_err_early : std_logic := '0'; signal mm2s_ftch_stale_desc : std_logic := '0'; signal s2mm_updt_interr_set : std_logic := '0'; signal s2mm_updt_slverr_set : std_logic := '0'; signal s2mm_updt_decerr_set : std_logic := '0'; signal s2mm_ftch_interr_set : std_logic := '0'; signal s2mm_ftch_slverr_set : std_logic := '0'; signal s2mm_ftch_decerr_set : std_logic := '0'; signal s2mm_ftch_err_early : std_logic := '0'; signal s2mm_ftch_stale_desc : std_logic := '0'; signal soft_reset_clr : std_logic := '0'; signal soft_reset : std_logic := '0'; signal s_axis_s2mm_tready_i : std_logic := '0'; signal s_axis_s2mm_tready_int : std_logic := '0'; signal m_axis_mm2s_tlast_i : std_logic := '0'; signal m_axis_mm2s_tlast_i_user : std_logic := '0'; signal m_axis_mm2s_tvalid_i : std_logic := '0'; signal sg_ctl : std_logic_vector (7 downto 0); signal s_axis_s2mm_tvalid_int : std_logic; signal s_axis_s2mm_tlast_int : std_logic; signal tdest_out_int : std_logic_vector (6 downto 0); signal same_tdest : std_logic; signal s2mm_eof_s2mm : std_logic; signal ch2_update_active : std_logic; signal s2mm_desc_info_in : std_logic_vector (13 downto 0); signal m_axis_mm2s_tlast_i_mcdma : std_logic; signal s2mm_run_stop_del : std_logic; signal s2mm_desc_flush_del : std_logic; signal s2mm_tvalid_latch : std_logic; signal s2mm_tvalid_latch_del : std_logic; signal clock_splt : std_logic; signal clock_splt_s2mm : std_logic; signal updt_cmpt : std_logic; signal cmpt_updt : std_logic_vector (1 downto 0); signal reset1, reset2 : std_logic; signal mm2s_cntrl_strm_stop : std_logic; signal bd_eq : std_logic; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin -- AXI DMA Test Vector (For Xilinx Internal Use Only) axi_dma_tstvec(31 downto 6) <= (others => '0'); axi_dma_tstvec(5) <= s2mm_updt_ioc_irq_set; axi_dma_tstvec(4) <= mm2s_updt_ioc_irq_set; axi_dma_tstvec(3) <= s2mm_packet_eof; axi_dma_tstvec(2) <= s2mm_packet_sof; axi_dma_tstvec(1) <= mm2s_packet_eof; axi_dma_tstvec(0) <= mm2s_packet_sof; -- Primary MM2S Stream outputs (used internally to gen eof and sof for -- interrupt coalescing m_axis_mm2s_tlast <= m_axis_mm2s_tlast_i; m_axis_mm2s_tvalid <= m_axis_mm2s_tvalid_i; -- Primary S2MM Stream output (used internally to gen eof and sof for -- interrupt coalescing s_axis_s2mm_tready <= s_axis_s2mm_tready_i; GEN_INCLUDE_SG : if C_INCLUDE_SG = 1 generate axi_lite_aclk <= s_axi_lite_aclk; axi_sg_aclk <= m_axi_sg_aclk; end generate GEN_INCLUDE_SG; GEN_EXCLUDE_SG : if C_INCLUDE_SG = 0 generate axi_lite_aclk <= s_axi_lite_aclk; axi_sg_aclk <= s_axi_lite_aclk; end generate GEN_EXCLUDE_SG; ------------------------------------------------------------------------------- -- AXI DMA Reset Module ------------------------------------------------------------------------------- I_RST_MODULE : entity axi_dma_v7_1.axi_dma_rst_module generic map( C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_M_AXI_MM2S_ACLK_FREQ_HZ => C_M_AXI_MM2S_ACLK_FREQ_HZ , C_M_AXI_S2MM_ACLK_FREQ_HZ => C_M_AXI_S2MM_ACLK_FREQ_HZ , C_M_AXI_SG_ACLK_FREQ_HZ => M_AXI_SG_ACLK_FREQ_HZ , C_SG_INCLUDE_STSCNTRL_STRM => STSCNTRL_ENABLE , C_INCLUDE_SG => C_INCLUDE_SG ) port map( -- Clock Sources s_axi_lite_aclk => axi_lite_aclk , m_axi_sg_aclk => axi_sg_aclk , m_axi_mm2s_aclk => m_axi_mm2s_aclk , m_axi_s2mm_aclk => m_axi_s2mm_aclk , ----------------------------------------------------------------------- -- Hard Reset ----------------------------------------------------------------------- axi_resetn => axi_resetn , ----------------------------------------------------------------------- -- Soft Reset ----------------------------------------------------------------------- soft_reset => soft_reset , soft_reset_clr => soft_reset_clr , mm2s_stop => mm2s_stop , mm2s_all_idle => mm2s_all_idle , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , s2mm_stop => s2mm_stop , s2mm_all_idle => s2mm_all_idle , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , ----------------------------------------------------------------------- -- MM2S Distributed Reset Out (m_axi_mm2s_aclk) ----------------------------------------------------------------------- dm_mm2s_prmry_resetn => m_axi_mm2s_aresetn , -- AXI DataMover Primary Reset (Raw) dm_mm2s_scndry_resetn => dm_mm2s_scndry_resetn , -- AXI DataMover Secondary Reset (Raw) mm2s_prmry_reset_out_n => mm2s_prmry_reset_out_n , -- AXI Stream Primary Reset Outputs mm2s_cntrl_reset_out_n => mm2s_cntrl_reset_out_n , -- AXI Stream Control Reset Outputs mm2s_scndry_resetn => mm2s_scndry_resetn , -- AXI Secondary Reset mm2s_prmry_resetn => mm2s_prmry_resetn , -- AXI Primary Reset ----------------------------------------------------------------------- -- S2MM Distributed Reset Out (m_axi_s2mm_aclk) ----------------------------------------------------------------------- dm_s2mm_prmry_resetn => m_axi_s2mm_aresetn , -- AXI DataMover Primary Reset (Raw) dm_s2mm_scndry_resetn => dm_s2mm_scndry_resetn , -- AXI DataMover Secondary Reset (Raw) s2mm_prmry_reset_out_n => s2mm_prmry_reset_out_n , -- AXI Stream Primary Reset Outputs s2mm_sts_reset_out_n => s2mm_sts_reset_out_n , -- AXI Stream Control Reset Outputs s2mm_scndry_resetn => s2mm_scndry_resetn , -- AXI Secondary Reset s2mm_prmry_resetn => s2mm_prmry_resetn , -- AXI Primary Reset ----------------------------------------------------------------------- -- Scatter Gather Distributed Reset Out (m_axi_sg_aclk) ----------------------------------------------------------------------- m_axi_sg_aresetn => m_axi_sg_aresetn , -- AXI Scatter Gather Reset Out dm_m_axi_sg_aresetn => dm_m_axi_sg_aresetn , -- AXI Scatter Gather Datamover Reset Out ----------------------------------------------------------------------- -- Hard Reset Out (s_axi_lite_aclk) ----------------------------------------------------------------------- m_axi_sg_hrdresetn => m_axi_sg_hrdresetn , -- AXI Lite Ingerface (sg aclk) (Hard Only) s_axi_lite_resetn => axi_lite_reset_n -- AXI Lite Interface reset (Hard Only) ); ------------------------------------------------------------------------------- -- AXI DMA Register Module ------------------------------------------------------------------------------- I_AXI_DMA_REG_MODULE : entity axi_dma_v7_1.axi_dma_reg_module generic map( C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_INCLUDE_SG => C_INCLUDE_SG , C_SG_LENGTH_WIDTH => C_SG_LENGTH_WIDTH_INT , C_AXI_LITE_IS_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_S_AXI_LITE_ADDR_WIDTH => C_S_AXI_LITE_ADDR_WIDTH , C_S_AXI_LITE_DATA_WIDTH => C_S_AXI_LITE_DATA_WIDTH , C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXI_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH , C_NUM_S2MM_CHANNELS => C_NUM_S2MM_CHANNELS , C_M_AXI_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH , C_MICRO_DMA => C_MICRO_DMA , C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL ) port map( ----------------------------------------------------------------------- -- AXI Lite Control Interface ----------------------------------------------------------------------- s_axi_lite_aclk => axi_lite_aclk , axi_lite_reset_n => axi_lite_reset_n , m_axi_sg_aclk => axi_sg_aclk , m_axi_sg_aresetn => m_axi_sg_aresetn , m_axi_sg_hrdresetn => m_axi_sg_hrdresetn , -- AXI Lite Write Address Channel s_axi_lite_awvalid => s_axi_lite_awvalid , s_axi_lite_awready => s_axi_lite_awready , s_axi_lite_awaddr => s_axi_lite_awaddr , -- AXI Lite Write Data Channel s_axi_lite_wvalid => s_axi_lite_wvalid , s_axi_lite_wready => s_axi_lite_wready , s_axi_lite_wdata => s_axi_lite_wdata , -- AXI Lite Write Response Channel s_axi_lite_bresp => s_axi_lite_bresp , s_axi_lite_bvalid => s_axi_lite_bvalid , s_axi_lite_bready => s_axi_lite_bready , -- AXI Lite Read Address Channel s_axi_lite_arvalid => s_axi_lite_arvalid , s_axi_lite_arready => s_axi_lite_arready , s_axi_lite_araddr => s_axi_lite_araddr , s_axi_lite_rvalid => s_axi_lite_rvalid , s_axi_lite_rready => s_axi_lite_rready , s_axi_lite_rdata => s_axi_lite_rdata , s_axi_lite_rresp => s_axi_lite_rresp , -- MM2S DMASR Status mm2s_stop => mm2s_stop , mm2s_halted_clr => mm2s_halted_clr , mm2s_halted_set => mm2s_halted_set , mm2s_idle_set => mm2s_idle_set , mm2s_idle_clr => mm2s_idle_clr , mm2s_dma_interr_set => mm2s_dma_interr_set , mm2s_dma_slverr_set => mm2s_dma_slverr_set , mm2s_dma_decerr_set => mm2s_dma_decerr_set , mm2s_ioc_irq_set => mm2s_ioc_irq_set , mm2s_dly_irq_set => mm2s_dly_irq_set , mm2s_irqthresh_wren => mm2s_irqthresh_wren , mm2s_irqdelay_wren => mm2s_irqdelay_wren , mm2s_irqthresh_rstdsbl => mm2s_irqthresh_rstdsbl , -- CR572013 mm2s_irqdelay_status => mm2s_irqdelay_status , mm2s_irqthresh_status => mm2s_irqthresh_status , mm2s_dlyirq_dsble => mm2s_dlyirq_dsble , -- CR605888 mm2s_ftch_interr_set => mm2s_ftch_interr_set , mm2s_ftch_slverr_set => mm2s_ftch_slverr_set , mm2s_ftch_decerr_set => mm2s_ftch_decerr_set , mm2s_updt_interr_set => mm2s_updt_interr_set , mm2s_updt_slverr_set => mm2s_updt_slverr_set , mm2s_updt_decerr_set => mm2s_updt_decerr_set , -- MM2S CURDESC Update mm2s_new_curdesc_wren => mm2s_new_curdesc_wren , mm2s_new_curdesc => mm2s_new_curdesc , -- MM2S TAILDESC Update mm2s_tailpntr_updated => mm2s_tailpntr_updated , -- MM2S Registers mm2s_dmacr => mm2s_dmacr , mm2s_dmasr => mm2s_dmasr , mm2s_curdesc => mm2s_curdesc , mm2s_taildesc => mm2s_taildesc , mm2s_sa => mm2s_sa , mm2s_length => mm2s_length , mm2s_length_wren => mm2s_length_wren , s2mm_sof => s2mm_packet_sof , s2mm_eof => s2mm_packet_eof , -- S2MM DMASR Status s2mm_stop => s2mm_stop , s2mm_halted_clr => s2mm_halted_clr , s2mm_halted_set => s2mm_halted_set , s2mm_idle_set => s2mm_idle_set , s2mm_idle_clr => s2mm_idle_clr , s2mm_dma_interr_set => s2mm_dma_interr_set , s2mm_dma_slverr_set => s2mm_dma_slverr_set , s2mm_dma_decerr_set => s2mm_dma_decerr_set , s2mm_ioc_irq_set => s2mm_ioc_irq_set , s2mm_dly_irq_set => s2mm_dly_irq_set , s2mm_irqthresh_wren => s2mm_irqthresh_wren , s2mm_irqdelay_wren => s2mm_irqdelay_wren , s2mm_irqthresh_rstdsbl => s2mm_irqthresh_rstdsbl , -- CR572013 s2mm_irqdelay_status => s2mm_irqdelay_status , s2mm_irqthresh_status => s2mm_irqthresh_status , s2mm_dlyirq_dsble => s2mm_dlyirq_dsble , -- CR605888 s2mm_ftch_interr_set => s2mm_ftch_interr_set , s2mm_ftch_slverr_set => s2mm_ftch_slverr_set , s2mm_ftch_decerr_set => s2mm_ftch_decerr_set , s2mm_updt_interr_set => s2mm_updt_interr_set , s2mm_updt_slverr_set => s2mm_updt_slverr_set , s2mm_updt_decerr_set => s2mm_updt_decerr_set , -- MM2S CURDESC Update s2mm_new_curdesc_wren => s2mm_new_curdesc_wren , s2mm_new_curdesc => s2mm_new_curdesc , s2mm_tvalid => s_axis_s2mm_tvalid , s2mm_tvalid_latch => s2mm_tvalid_latch , s2mm_tvalid_latch_del => s2mm_tvalid_latch_del , -- MM2S TAILDESC Update s2mm_tailpntr_updated => s2mm_tailpntr_updated , -- S2MM Registers s2mm_dmacr => s2mm_dmacr , s2mm_dmasr => s2mm_dmasr , s2mm_curdesc => s2mm_curdesc , s2mm_taildesc => s2mm_taildesc , s2mm_da => s2mm_da , s2mm_length => s2mm_length , s2mm_length_wren => s2mm_length_wren , s2mm_bytes_rcvd => s2mm_bytes_rcvd , s2mm_bytes_rcvd_wren => s2mm_bytes_rcvd_wren , tdest_in => tdest_out_int, --s_axis_s2mm_tdest , same_tdest_in => same_tdest, sg_ctl => sg_ctl , -- Soft reset and clear soft_reset => soft_reset , soft_reset_clr => soft_reset_clr , -- Fetch/Update error addresses ftch_error_addr => ftch_error_addr , updt_error_addr => updt_error_addr , -- DMA Interrupt Outputs mm2s_introut => mm2s_introut , s2mm_introut => s2mm_introut , bd_eq => bd_eq ); ------------------------------------------------------------------------------- -- Scatter Gather Mode (C_INCLUDE_SG = 1) ------------------------------------------------------------------------------- GEN_SG_ENGINE : if C_INCLUDE_SG = 1 generate begin -- reset1 <= dm_m_axi_sg_aresetn and s2mm_tvalid_latch; -- reset2 <= m_axi_sg_aresetn and s2mm_tvalid_latch; s2mm_run_stop_del <= s2mm_tvalid_latch_del and s2mm_dmacr(DMACR_RS_BIT); -- s2mm_run_stop_del <= (not (updt_cmpt)) and s2mm_dmacr(DMACR_RS_BIT); s2mm_desc_flush_del <= s2mm_desc_flush or (not s2mm_tvalid_latch); -- Scatter Gather Engine I_SG_ENGINE : entity axi_sg_v4_1.axi_sg generic map( C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXI_SG_DATA_WIDTH => C_M_AXI_SG_DATA_WIDTH , C_M_AXIS_SG_TDATA_WIDTH => M_AXIS_SG_TDATA_WIDTH , C_S_AXIS_UPDPTR_TDATA_WIDTH => S_AXIS_UPDPTR_TDATA_WIDTH , C_S_AXIS_UPDSTS_TDATA_WIDTH => S_AXIS_UPDSTS_TDATA_WIDTH , C_SG_FTCH_DESC2QUEUE => SG_FTCH_DESC2QUEUE , C_SG_UPDT_DESC2QUEUE => SG_UPDT_DESC2QUEUE , C_SG_CH1_WORDS_TO_FETCH => SG_CH1_WORDS_TO_FETCH , C_SG_CH1_WORDS_TO_UPDATE => SG_CH1_WORDS_TO_UPDATE , C_SG_CH1_FIRST_UPDATE_WORD => SG_CH1_FIRST_UPDATE_WORD , C_SG_CH1_ENBL_STALE_ERROR => SG_CH1_ENBL_STALE_ERROR , C_SG_CH2_WORDS_TO_FETCH => SG_CH2_WORDS_TO_FETCH , C_SG_CH2_WORDS_TO_UPDATE => SG_CH2_WORDS_TO_UPDATE , C_SG_CH2_FIRST_UPDATE_WORD => SG_CH2_FIRST_UPDATE_WORD , C_SG_CH2_ENBL_STALE_ERROR => SG_CH2_ENBL_STALE_ERROR , C_AXIS_IS_ASYNC => SG_IS_SYNCHRONOUS , C_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_INCLUDE_CH1 => C_INCLUDE_MM2S , C_INCLUDE_CH2 => C_INCLUDE_S2MM , C_INCLUDE_DESC_UPDATE => INCLUDE_DESC_UPDATE , C_INCLUDE_INTRPT => INCLUDE_INTRPT , C_INCLUDE_DLYTMR => INCLUDE_DLYTMR , C_DLYTMR_RESOLUTION => C_DLYTMR_RESOLUTION , C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL , C_ENABLE_EXTRA_FIELD => STSCNTRL_ENABLE , C_NUM_S2MM_CHANNELS => C_NUM_S2MM_CHANNELS , C_NUM_MM2S_CHANNELS => C_NUM_MM2S_CHANNELS , C_FAMILY => C_FAMILY ) port map( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk => axi_sg_aclk , m_axi_mm2s_aclk => m_axi_mm2s_aclk , m_axi_sg_aresetn => m_axi_sg_aresetn , dm_resetn => dm_m_axi_sg_aresetn , p_reset_n => mm2s_prmry_resetn , -- Scatter Gather Write Address Channel m_axi_sg_awaddr => m_axi_sg_awaddr , m_axi_sg_awlen => m_axi_sg_awlen , m_axi_sg_awsize => m_axi_sg_awsize , m_axi_sg_awburst => m_axi_sg_awburst , m_axi_sg_awprot => m_axi_sg_awprot , m_axi_sg_awcache => m_axi_sg_awcache , m_axi_sg_awuser => m_axi_sg_awuser , m_axi_sg_awvalid => m_axi_sg_awvalid , m_axi_sg_awready => m_axi_sg_awready , -- Scatter Gather Write Data Channel m_axi_sg_wdata => m_axi_sg_wdata , m_axi_sg_wstrb => m_axi_sg_wstrb , m_axi_sg_wlast => m_axi_sg_wlast , m_axi_sg_wvalid => m_axi_sg_wvalid , m_axi_sg_wready => m_axi_sg_wready , -- Scatter Gather Write Response Channel m_axi_sg_bresp => m_axi_sg_bresp , m_axi_sg_bvalid => m_axi_sg_bvalid , m_axi_sg_bready => m_axi_sg_bready , -- Scatter Gather Read Address Channel m_axi_sg_araddr => m_axi_sg_araddr , m_axi_sg_arlen => m_axi_sg_arlen , m_axi_sg_arsize => m_axi_sg_arsize , m_axi_sg_arburst => m_axi_sg_arburst , m_axi_sg_arprot => m_axi_sg_arprot , m_axi_sg_arcache => m_axi_sg_arcache , m_axi_sg_aruser => m_axi_sg_aruser , m_axi_sg_arvalid => m_axi_sg_arvalid , m_axi_sg_arready => m_axi_sg_arready , -- Memory Map to Stream Scatter Gather Read Data Channel m_axi_sg_rdata => m_axi_sg_rdata , m_axi_sg_rresp => m_axi_sg_rresp , m_axi_sg_rlast => m_axi_sg_rlast , m_axi_sg_rvalid => m_axi_sg_rvalid , m_axi_sg_rready => m_axi_sg_rready , sg_ctl => sg_ctl , -- Channel 1 Control and Status ch1_run_stop => mm2s_dmacr(DMACR_RS_BIT) , ch1_cyclic => mm2s_dmacr(CYCLIC_BIT) , ch1_desc_flush => mm2s_desc_flush , ch1_cntrl_strm_stop => mm2s_cntrl_strm_stop , ch1_ftch_idle => mm2s_ftch_idle , ch1_ftch_interr_set => mm2s_ftch_interr_set , ch1_ftch_slverr_set => mm2s_ftch_slverr_set , ch1_ftch_decerr_set => mm2s_ftch_decerr_set , ch1_ftch_err_early => mm2s_ftch_err_early , ch1_ftch_stale_desc => mm2s_ftch_stale_desc , ch1_updt_idle => mm2s_updt_idle , ch1_updt_ioc_irq_set => mm2s_updt_ioc_irq_set , ch1_updt_interr_set => mm2s_updt_interr_set , ch1_updt_slverr_set => mm2s_updt_slverr_set , ch1_updt_decerr_set => mm2s_updt_decerr_set , ch1_dma_interr_set => mm2s_dma_interr_set , ch1_dma_slverr_set => mm2s_dma_slverr_set , ch1_dma_decerr_set => mm2s_dma_decerr_set , ch1_tailpntr_enabled => mm2s_dmacr(DMACR_TAILPEN_BIT) , ch1_taildesc_wren => mm2s_tailpntr_updated , ch1_taildesc => mm2s_taildesc , ch1_curdesc => mm2s_curdesc , -- Channel 1 Interrupt Coalescing Signals --ch1_dlyirq_dsble => mm2s_dmasr(DMASR_DLYIRQ_BIT) , -- CR605888 ch1_dlyirq_dsble => mm2s_dlyirq_dsble , -- CR605888 ch1_irqthresh_rstdsbl => mm2s_irqthresh_rstdsbl , -- CR572013 ch1_irqdelay_wren => mm2s_irqdelay_wren , ch1_irqdelay => mm2s_dmacr(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT), ch1_irqthresh_wren => mm2s_irqthresh_wren , ch1_irqthresh => mm2s_dmacr(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT), ch1_packet_sof => mm2s_packet_sof , ch1_packet_eof => mm2s_packet_eof , ch1_ioc_irq_set => mm2s_ioc_irq_set , ch1_dly_irq_set => mm2s_dly_irq_set , ch1_irqdelay_status => mm2s_irqdelay_status , ch1_irqthresh_status => mm2s_irqthresh_status , -- Channel 1 AXI Fetch Stream Out m_axis_ch1_ftch_aclk => axi_sg_aclk , m_axis_ch1_ftch_tdata => m_axis_mm2s_ftch_tdata , m_axis_ch1_ftch_tvalid => m_axis_mm2s_ftch_tvalid , m_axis_ch1_ftch_tready => m_axis_mm2s_ftch_tready , m_axis_ch1_ftch_tlast => m_axis_mm2s_ftch_tlast , m_axis_ch1_ftch_tdata_new => m_axis_mm2s_ftch_tdata_new , m_axis_ch1_ftch_tdata_mcdma_new => m_axis_mm2s_ftch_tdata_mcdma_new , m_axis_ch1_ftch_tvalid_new => m_axis_mm2s_ftch_tvalid_new , m_axis_ftch1_desc_available => m_axis_ftch1_desc_available, -- Channel 1 AXI Update Stream In s_axis_ch1_updt_aclk => axi_sg_aclk , s_axis_ch1_updtptr_tdata => s_axis_mm2s_updtptr_tdata , s_axis_ch1_updtptr_tvalid => s_axis_mm2s_updtptr_tvalid , s_axis_ch1_updtptr_tready => s_axis_mm2s_updtptr_tready , s_axis_ch1_updtptr_tlast => s_axis_mm2s_updtptr_tlast , s_axis_ch1_updtsts_tdata => s_axis_mm2s_updtsts_tdata , s_axis_ch1_updtsts_tvalid => s_axis_mm2s_updtsts_tvalid , s_axis_ch1_updtsts_tready => s_axis_mm2s_updtsts_tready , s_axis_ch1_updtsts_tlast => s_axis_mm2s_updtsts_tlast , -- Channel 2 Control and Status ch2_run_stop => s2mm_run_stop_del , --s2mm_dmacr(DMACR_RS_BIT) , ch2_cyclic => s2mm_dmacr(CYCLIC_BIT) , ch2_desc_flush => s2mm_desc_flush_del, --s2mm_desc_flush , ch2_ftch_idle => s2mm_ftch_idle , ch2_ftch_interr_set => s2mm_ftch_interr_set , ch2_ftch_slverr_set => s2mm_ftch_slverr_set , ch2_ftch_decerr_set => s2mm_ftch_decerr_set , ch2_ftch_err_early => s2mm_ftch_err_early , ch2_ftch_stale_desc => s2mm_ftch_stale_desc , ch2_updt_idle => s2mm_updt_idle , ch2_updt_ioc_irq_set => s2mm_updt_ioc_irq_set , -- For TestVector ch2_updt_interr_set => s2mm_updt_interr_set , ch2_updt_slverr_set => s2mm_updt_slverr_set , ch2_updt_decerr_set => s2mm_updt_decerr_set , ch2_dma_interr_set => s2mm_dma_interr_set , ch2_dma_slverr_set => s2mm_dma_slverr_set , ch2_dma_decerr_set => s2mm_dma_decerr_set , ch2_tailpntr_enabled => s2mm_dmacr(DMACR_TAILPEN_BIT) , ch2_taildesc_wren => s2mm_tailpntr_updated , ch2_taildesc => s2mm_taildesc , ch2_curdesc => s2mm_curdesc , -- Channel 2 Interrupt Coalescing Signals --ch2_dlyirq_dsble => s2mm_dmasr(DMASR_DLYIRQ_BIT) , -- CR605888 ch2_dlyirq_dsble => s2mm_dlyirq_dsble , -- CR605888 ch2_irqthresh_rstdsbl => s2mm_irqthresh_rstdsbl , -- CR572013 ch2_irqdelay_wren => s2mm_irqdelay_wren , ch2_irqdelay => s2mm_dmacr(DMACR_IRQDELAY_MSB_BIT downto DMACR_IRQDELAY_LSB_BIT), ch2_irqthresh_wren => s2mm_irqthresh_wren , ch2_irqthresh => s2mm_dmacr(DMACR_IRQTHRESH_MSB_BIT downto DMACR_IRQTHRESH_LSB_BIT), ch2_packet_sof => s2mm_packet_sof , ch2_packet_eof => s2mm_packet_eof , ch2_ioc_irq_set => s2mm_ioc_irq_set , ch2_dly_irq_set => s2mm_dly_irq_set , ch2_irqdelay_status => s2mm_irqdelay_status , ch2_irqthresh_status => s2mm_irqthresh_status , ch2_update_active => ch2_update_active , -- Channel 2 AXI Fetch Stream Out m_axis_ch2_ftch_aclk => axi_sg_aclk , m_axis_ch2_ftch_tdata => m_axis_s2mm_ftch_tdata , m_axis_ch2_ftch_tvalid => m_axis_s2mm_ftch_tvalid , m_axis_ch2_ftch_tready => m_axis_s2mm_ftch_tready , m_axis_ch2_ftch_tlast => m_axis_s2mm_ftch_tlast , m_axis_ch2_ftch_tdata_new => m_axis_s2mm_ftch_tdata_new , m_axis_ch2_ftch_tdata_mcdma_new => m_axis_s2mm_ftch_tdata_mcdma_new , m_axis_ch2_ftch_tdata_mcdma_nxt => m_axis_s2mm_ftch_tdata_mcdma_nxt , m_axis_ch2_ftch_tvalid_new => m_axis_s2mm_ftch_tvalid_new , m_axis_ftch2_desc_available => m_axis_ftch2_desc_available, -- Channel 2 AXI Update Stream In s_axis_ch2_updt_aclk => axi_sg_aclk , s_axis_ch2_updtptr_tdata => s_axis_s2mm_updtptr_tdata , s_axis_ch2_updtptr_tvalid => s_axis_s2mm_updtptr_tvalid , s_axis_ch2_updtptr_tready => s_axis_s2mm_updtptr_tready , s_axis_ch2_updtptr_tlast => s_axis_s2mm_updtptr_tlast , s_axis_ch2_updtsts_tdata => s_axis_s2mm_updtsts_tdata , s_axis_ch2_updtsts_tvalid => s_axis_s2mm_updtsts_tvalid , s_axis_ch2_updtsts_tready => s_axis_s2mm_updtsts_tready , s_axis_ch2_updtsts_tlast => s_axis_s2mm_updtsts_tlast , -- Error addresses ftch_error => ftch_error , ftch_error_addr => ftch_error_addr , updt_error => updt_error , updt_error_addr => updt_error_addr , m_axis_mm2s_cntrl_tdata => m_axis_mm2s_cntrl_tdata , m_axis_mm2s_cntrl_tkeep => m_axis_mm2s_cntrl_tkeep , m_axis_mm2s_cntrl_tvalid => m_axis_mm2s_cntrl_tvalid , m_axis_mm2s_cntrl_tready => m_axis_mm2s_cntrl_tready , m_axis_mm2s_cntrl_tlast => m_axis_mm2s_cntrl_tlast , bd_eq => bd_eq ); end generate GEN_SG_ENGINE; ------------------------------------------------------------------------------- -- Exclude Scatter Gather Engine (Simple DMA Mode Enabled) ------------------------------------------------------------------------------- GEN_NO_SG_ENGINE : if C_INCLUDE_SG = 0 generate begin -- Scatter Gather AXI Master Interface Tie-Off m_axi_sg_awaddr <= (others => '0'); m_axi_sg_awlen <= (others => '0'); m_axi_sg_awsize <= (others => '0'); m_axi_sg_awburst <= (others => '0'); m_axi_sg_awprot <= (others => '0'); m_axi_sg_awcache <= (others => '0'); m_axi_sg_awvalid <= '0'; m_axi_sg_wdata <= (others => '0'); m_axi_sg_wstrb <= (others => '0'); m_axi_sg_wlast <= '0'; m_axi_sg_wvalid <= '0'; m_axi_sg_bready <= '0'; m_axi_sg_araddr <= (others => '0'); m_axi_sg_arlen <= (others => '0'); m_axi_sg_arsize <= (others => '0'); m_axi_sg_arburst <= (others => '0'); m_axi_sg_arcache <= (others => '0'); m_axi_sg_arprot <= (others => '0'); m_axi_sg_arvalid <= '0'; m_axi_sg_rready <= '0'; m_axis_mm2s_cntrl_tdata <= (others => '0'); m_axis_mm2s_cntrl_tkeep <= (others => '0'); m_axis_mm2s_cntrl_tvalid <= '0'; m_axis_mm2s_cntrl_tlast <= '0'; -- MM2S Signal Remapping/Tie Off for Simple DMA Mode m_axis_mm2s_ftch_tdata <= (others => '0'); m_axis_mm2s_ftch_tvalid <= '0'; m_axis_mm2s_ftch_tlast <= '0'; s_axis_mm2s_updtptr_tready <= '0'; s_axis_mm2s_updtsts_tready <= '0'; mm2s_ftch_idle <= '1'; mm2s_updt_idle <= '1'; mm2s_ftch_interr_set <= '0'; mm2s_ftch_slverr_set <= '0'; mm2s_ftch_decerr_set <= '0'; mm2s_ftch_err_early <= '0'; mm2s_ftch_stale_desc <= '0'; mm2s_updt_interr_set <= '0'; mm2s_updt_slverr_set <= '0'; mm2s_updt_decerr_set <= '0'; mm2s_updt_ioc_irq_set <= mm2s_smpl_done; -- For TestVector mm2s_dma_interr_set <= mm2s_smpl_interr_set; -- To DMASR mm2s_dma_slverr_set <= mm2s_smpl_slverr_set; -- To DMASR mm2s_dma_decerr_set <= mm2s_smpl_decerr_set; -- To DMASR -- S2MM Signal Remapping/Tie Off for Simple DMA Mode m_axis_s2mm_ftch_tdata <= (others => '0'); m_axis_s2mm_ftch_tvalid <= '0'; m_axis_s2mm_ftch_tlast <= '0'; s_axis_s2mm_updtptr_tready <= '0'; s_axis_s2mm_updtsts_tready <= '0'; s2mm_ftch_idle <= '1'; s2mm_updt_idle <= '1'; s2mm_ftch_interr_set <= '0'; s2mm_ftch_slverr_set <= '0'; s2mm_ftch_decerr_set <= '0'; s2mm_ftch_err_early <= '0'; s2mm_ftch_stale_desc <= '0'; s2mm_updt_interr_set <= '0'; s2mm_updt_slverr_set <= '0'; s2mm_updt_decerr_set <= '0'; s2mm_updt_ioc_irq_set <= s2mm_smpl_done; -- For TestVector s2mm_dma_interr_set <= s2mm_smpl_interr_set; -- To DMASR s2mm_dma_slverr_set <= s2mm_smpl_slverr_set; -- To DMASR s2mm_dma_decerr_set <= s2mm_smpl_decerr_set; -- To DMASR ftch_error <= '0'; ftch_error_addr <= (others => '0'); updt_error <= '0'; updt_error_addr <= (others=> '0'); -- CR595462 - Removed interrupt coalescing logic for Simple DMA mode and replaced -- with interrupt complete. mm2s_ioc_irq_set <= mm2s_smpl_done; mm2s_dly_irq_set <= '0'; mm2s_irqdelay_status <= (others => '0'); mm2s_irqthresh_status <= (others => '0'); s2mm_ioc_irq_set <= s2mm_smpl_done; s2mm_dly_irq_set <= '0'; s2mm_irqdelay_status <= (others => '0'); s2mm_irqthresh_status <= (others => '0'); end generate GEN_NO_SG_ENGINE; ------------------------------------------------------------------------------- -- MM2S DMA Controller ------------------------------------------------------------------------------- I_MM2S_DMA_MNGR : entity axi_dma_v7_1.axi_dma_mm2s_mngr generic map( C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_PRMY_CMDFIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH , C_INCLUDE_SG => C_INCLUDE_SG , C_SG_INCLUDE_STSCNTRL_STRM => STSCNTRL_ENABLE , C_SG_INCLUDE_DESC_QUEUE => DESC_QUEUE , C_SG_LENGTH_WIDTH => C_SG_LENGTH_WIDTH_INT , C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXIS_SG_TDATA_WIDTH => M_AXIS_SG_TDATA_WIDTH , C_S_AXIS_UPDPTR_TDATA_WIDTH => S_AXIS_UPDPTR_TDATA_WIDTH , C_S_AXIS_UPDSTS_TDATA_WIDTH => S_AXIS_UPDSTS_TDATA_WIDTH , C_M_AXIS_MM2S_CNTRL_TDATA_WIDTH => C_M_AXIS_MM2S_CNTRL_TDATA_WIDTH , C_INCLUDE_MM2S => C_INCLUDE_MM2S , C_M_AXI_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH , C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL , C_MICRO_DMA => C_MICRO_DMA , C_FAMILY => C_FAMILY ) port map( -- Secondary Clock and Reset m_axi_sg_aclk => axi_sg_aclk , m_axi_sg_aresetn => mm2s_scndry_resetn , -- Primary Clock and Reset axi_prmry_aclk => m_axi_mm2s_aclk , p_reset_n => mm2s_prmry_resetn , soft_reset => soft_reset , -- MM2S Control and Status mm2s_run_stop => mm2s_dmacr(DMACR_RS_BIT) , mm2s_keyhole => mm2s_dmacr(DMACR_KH_BIT) , mm2s_halted => mm2s_dmasr(DMASR_HALTED_BIT) , mm2s_ftch_idle => mm2s_ftch_idle , mm2s_updt_idle => mm2s_updt_idle , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , mm2s_halted_clr => mm2s_halted_clr , mm2s_halted_set => mm2s_halted_set , mm2s_idle_set => mm2s_idle_set , mm2s_idle_clr => mm2s_idle_clr , mm2s_stop => mm2s_stop , mm2s_ftch_err_early => mm2s_ftch_err_early , mm2s_ftch_stale_desc => mm2s_ftch_stale_desc , mm2s_desc_flush => mm2s_desc_flush , cntrl_strm_stop => mm2s_cntrl_strm_stop , mm2s_tailpntr_enble => mm2s_dmacr(DMACR_TAILPEN_BIT) , mm2s_all_idle => mm2s_all_idle , mm2s_error => mm2s_error , s2mm_error => s2mm_error , -- Simple DMA Mode Signals mm2s_sa => mm2s_sa , mm2s_length => mm2s_length , mm2s_length_wren => mm2s_length_wren , mm2s_smple_done => mm2s_smpl_done , mm2s_interr_set => mm2s_smpl_interr_set , mm2s_slverr_set => mm2s_smpl_slverr_set , mm2s_decerr_set => mm2s_smpl_decerr_set , m_axis_mm2s_aclk => m_axi_mm2s_aclk, mm2s_strm_tlast => m_axis_mm2s_tlast_i_user, mm2s_strm_tready => m_axis_mm2s_tready, mm2s_axis_info => mm2s_axis_info, -- SG MM2S Descriptor Fetch AXI Stream In m_axis_mm2s_ftch_tdata => m_axis_mm2s_ftch_tdata , m_axis_mm2s_ftch_tvalid => m_axis_mm2s_ftch_tvalid , m_axis_mm2s_ftch_tready => m_axis_mm2s_ftch_tready , m_axis_mm2s_ftch_tlast => m_axis_mm2s_ftch_tlast , m_axis_mm2s_ftch_tdata_new => m_axis_mm2s_ftch_tdata_new , m_axis_mm2s_ftch_tdata_mcdma_new => m_axis_mm2s_ftch_tdata_mcdma_new , m_axis_mm2s_ftch_tvalid_new => m_axis_mm2s_ftch_tvalid_new , m_axis_ftch1_desc_available => m_axis_ftch1_desc_available, -- SG MM2S Descriptor Update AXI Stream Out s_axis_mm2s_updtptr_tdata => s_axis_mm2s_updtptr_tdata , s_axis_mm2s_updtptr_tvalid => s_axis_mm2s_updtptr_tvalid , s_axis_mm2s_updtptr_tready => s_axis_mm2s_updtptr_tready , s_axis_mm2s_updtptr_tlast => s_axis_mm2s_updtptr_tlast , s_axis_mm2s_updtsts_tdata => s_axis_mm2s_updtsts_tdata , s_axis_mm2s_updtsts_tvalid => s_axis_mm2s_updtsts_tvalid , s_axis_mm2s_updtsts_tready => s_axis_mm2s_updtsts_tready , s_axis_mm2s_updtsts_tlast => s_axis_mm2s_updtsts_tlast , -- Currently Being Processed Descriptor mm2s_new_curdesc => mm2s_new_curdesc , mm2s_new_curdesc_wren => mm2s_new_curdesc_wren , -- User Command Interface Ports (AXI Stream) s_axis_mm2s_cmd_tvalid => s_axis_mm2s_cmd_tvalid_split , s_axis_mm2s_cmd_tready => s_axis_mm2s_cmd_tready_split , s_axis_mm2s_cmd_tdata => s_axis_mm2s_cmd_tdata_split , -- User Status Interface Ports (AXI Stream) m_axis_mm2s_sts_tvalid => m_axis_mm2s_sts_tvalid , m_axis_mm2s_sts_tready => m_axis_mm2s_sts_tready , m_axis_mm2s_sts_tdata => m_axis_mm2s_sts_tdata , m_axis_mm2s_sts_tkeep => m_axis_mm2s_sts_tkeep , mm2s_err => mm2s_err , updt_error => updt_error , ftch_error => ftch_error , -- Memory Map to Stream Control Stream Interface m_axis_mm2s_cntrl_tdata => open, --m_axis_mm2s_cntrl_tdata , m_axis_mm2s_cntrl_tkeep => open, --m_axis_mm2s_cntrl_tkeep , m_axis_mm2s_cntrl_tvalid => open, --m_axis_mm2s_cntrl_tvalid , m_axis_mm2s_cntrl_tready => '0', --m_axis_mm2s_cntrl_tready , m_axis_mm2s_cntrl_tlast => open --m_axis_mm2s_cntrl_tlast ); m_axis_mm2s_tuser <= mm2s_axis_info (13 downto 10); m_axis_mm2s_tid <= mm2s_axis_info (9 downto 5); -- m_axis_mm2s_tdest <= mm2s_axis_info (4 downto 0) ; -- -- If MM2S channel included then include sof/eof generator INCLUDE_MM2S_SOF_EOF_GENERATOR : if C_INCLUDE_MM2S = 1 generate begin ------------------------------------------------------------------------------- -- MM2S SOF / EOF generation for interrupt coalescing ------------------------------------------------------------------------------- I_MM2S_SOFEOF_GEN : entity axi_dma_v7_1.axi_dma_sofeof_gen generic map( C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC ) port map( axi_prmry_aclk => m_axi_mm2s_aclk , p_reset_n => mm2s_prmry_resetn , m_axi_sg_aclk => axi_sg_aclk , m_axi_sg_aresetn => mm2s_scndry_resetn , axis_tready => m_axis_mm2s_tready , axis_tvalid => m_axis_mm2s_tvalid_i , axis_tlast => m_axis_mm2s_tlast_i , packet_sof => mm2s_packet_sof , packet_eof => mm2s_packet_eof ); end generate INCLUDE_MM2S_SOF_EOF_GENERATOR; -- If MM2S channel not included then exclude sof/eof generator EXCLUDE_MM2S_SOF_EOF_GENERATOR : if C_INCLUDE_MM2S = 0 generate begin mm2s_packet_sof <= '0'; mm2s_packet_eof <= '0'; end generate EXCLUDE_MM2S_SOF_EOF_GENERATOR; ------------------------------------------------------------------------------- -- S2MM DMA Controller ------------------------------------------------------------------------------- I_S2MM_DMA_MNGR : entity axi_dma_v7_1.axi_dma_s2mm_mngr generic map( C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC , C_PRMY_CMDFIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH , C_DM_STATUS_WIDTH => DM_STATUS_WIDTH , C_INCLUDE_SG => C_INCLUDE_SG , C_SG_INCLUDE_STSCNTRL_STRM => STSCNTRL_ENABLE , C_SG_INCLUDE_DESC_QUEUE => DESC_QUEUE , C_SG_USE_STSAPP_LENGTH => APPLENGTH_ENABLE , C_SG_LENGTH_WIDTH => C_SG_LENGTH_WIDTH_INT , C_M_AXI_SG_ADDR_WIDTH => C_M_AXI_SG_ADDR_WIDTH , C_M_AXIS_SG_TDATA_WIDTH => M_AXIS_SG_TDATA_WIDTH , C_S_AXIS_UPDPTR_TDATA_WIDTH => S_AXIS_UPDPTR_TDATA_WIDTH , C_S_AXIS_UPDSTS_TDATA_WIDTH => S_AXIS_UPDSTS_TDATA_WIDTH , C_S_AXIS_S2MM_STS_TDATA_WIDTH => C_S_AXIS_S2MM_STS_TDATA_WIDTH , C_INCLUDE_S2MM => C_INCLUDE_S2MM , C_M_AXI_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH , C_NUM_S2MM_CHANNELS => C_NUM_S2MM_CHANNELS , C_ENABLE_MULTI_CHANNEL => C_ENABLE_MULTI_CHANNEL , C_MICRO_DMA => C_MICRO_DMA , C_FAMILY => C_FAMILY ) port map( -- Secondary Clock and Reset m_axi_sg_aclk => axi_sg_aclk , m_axi_sg_aresetn => s2mm_scndry_resetn , -- Primary Clock and Reset axi_prmry_aclk => m_axi_s2mm_aclk , p_reset_n => s2mm_prmry_resetn , soft_reset => soft_reset , -- S2MM Control and Status s2mm_run_stop => s2mm_dmacr(DMACR_RS_BIT) , s2mm_keyhole => s2mm_dmacr(DMACR_KH_BIT) , s2mm_halted => s2mm_dmasr(DMASR_HALTED_BIT) , s2mm_packet_eof_out => s2mm_eof_s2mm , s2mm_ftch_idle => s2mm_ftch_idle , s2mm_updt_idle => s2mm_updt_idle , s2mm_halted_clr => s2mm_halted_clr , s2mm_halted_set => s2mm_halted_set , s2mm_idle_set => s2mm_idle_set , s2mm_idle_clr => s2mm_idle_clr , s2mm_stop => s2mm_stop , s2mm_ftch_err_early => s2mm_ftch_err_early , s2mm_ftch_stale_desc => s2mm_ftch_stale_desc , s2mm_desc_flush => s2mm_desc_flush , s2mm_tailpntr_enble => s2mm_dmacr(DMACR_TAILPEN_BIT) , s2mm_all_idle => s2mm_all_idle , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , s2mm_error => s2mm_error , mm2s_error => mm2s_error , s2mm_desc_info_in => s2mm_desc_info_in , -- Simple DMA Mode Signals s2mm_da => s2mm_da , s2mm_length => s2mm_length , s2mm_length_wren => s2mm_length_wren , s2mm_smple_done => s2mm_smpl_done , s2mm_interr_set => s2mm_smpl_interr_set , s2mm_slverr_set => s2mm_smpl_slverr_set , s2mm_decerr_set => s2mm_smpl_decerr_set , s2mm_bytes_rcvd => s2mm_bytes_rcvd , s2mm_bytes_rcvd_wren => s2mm_bytes_rcvd_wren , -- SG S2MM Descriptor Fetch AXI Stream In m_axis_s2mm_ftch_tdata => m_axis_s2mm_ftch_tdata , m_axis_s2mm_ftch_tvalid => m_axis_s2mm_ftch_tvalid , m_axis_s2mm_ftch_tready => m_axis_s2mm_ftch_tready , m_axis_s2mm_ftch_tlast => m_axis_s2mm_ftch_tlast , m_axis_s2mm_ftch_tdata_new => m_axis_s2mm_ftch_tdata_new , m_axis_s2mm_ftch_tdata_mcdma_new => m_axis_s2mm_ftch_tdata_mcdma_new , m_axis_s2mm_ftch_tdata_mcdma_nxt => m_axis_s2mm_ftch_tdata_mcdma_nxt , m_axis_s2mm_ftch_tvalid_new => m_axis_s2mm_ftch_tvalid_new , m_axis_ftch2_desc_available => m_axis_ftch2_desc_available, -- SG S2MM Descriptor Update AXI Stream Out s_axis_s2mm_updtptr_tdata => s_axis_s2mm_updtptr_tdata , s_axis_s2mm_updtptr_tvalid => s_axis_s2mm_updtptr_tvalid , s_axis_s2mm_updtptr_tready => s_axis_s2mm_updtptr_tready , s_axis_s2mm_updtptr_tlast => s_axis_s2mm_updtptr_tlast , s_axis_s2mm_updtsts_tdata => s_axis_s2mm_updtsts_tdata , s_axis_s2mm_updtsts_tvalid => s_axis_s2mm_updtsts_tvalid , s_axis_s2mm_updtsts_tready => s_axis_s2mm_updtsts_tready , s_axis_s2mm_updtsts_tlast => s_axis_s2mm_updtsts_tlast , -- Currently Being Processed Descriptor s2mm_new_curdesc => s2mm_new_curdesc , s2mm_new_curdesc_wren => s2mm_new_curdesc_wren , -- User Command Interface Ports (AXI Stream) -- s_axis_s2mm_cmd_tvalid => s_axis_s2mm_cmd_tvalid_split , -- s_axis_s2mm_cmd_tready => s_axis_s2mm_cmd_tready_split , -- s_axis_s2mm_cmd_tdata => s_axis_s2mm_cmd_tdata_split , s_axis_s2mm_cmd_tvalid => s_axis_s2mm_cmd_tvalid_split , s_axis_s2mm_cmd_tready => s_axis_s2mm_cmd_tready_split , s_axis_s2mm_cmd_tdata => s_axis_s2mm_cmd_tdata_split , -- User Status Interface Ports (AXI Stream) m_axis_s2mm_sts_tvalid => m_axis_s2mm_sts_tvalid , m_axis_s2mm_sts_tready => m_axis_s2mm_sts_tready , m_axis_s2mm_sts_tdata => m_axis_s2mm_sts_tdata , m_axis_s2mm_sts_tkeep => m_axis_s2mm_sts_tkeep , s2mm_err => s2mm_err , updt_error => updt_error , ftch_error => ftch_error , -- Stream to Memory Map Status Stream Interface s_axis_s2mm_sts_tdata => s_axis_s2mm_sts_tdata , s_axis_s2mm_sts_tkeep => s_axis_s2mm_sts_tkeep , s_axis_s2mm_sts_tvalid => s_axis_s2mm_sts_tvalid , s_axis_s2mm_sts_tready => s_axis_s2mm_sts_tready , s_axis_s2mm_sts_tlast => s_axis_s2mm_sts_tlast ); -- If S2MM channel included then include sof/eof generator INCLUDE_S2MM_SOF_EOF_GENERATOR : if C_INCLUDE_S2MM = 1 generate begin ------------------------------------------------------------------------------- -- S2MM SOF / EOF generation for interrupt coalescing ------------------------------------------------------------------------------- I_S2MM_SOFEOF_GEN : entity axi_dma_v7_1.axi_dma_sofeof_gen generic map( C_PRMRY_IS_ACLK_ASYNC => C_PRMRY_IS_ACLK_ASYNC ) port map( axi_prmry_aclk => m_axi_s2mm_aclk , p_reset_n => s2mm_prmry_resetn , m_axi_sg_aclk => axi_sg_aclk , m_axi_sg_aresetn => s2mm_scndry_resetn , axis_tready => s_axis_s2mm_tready_i , axis_tvalid => s_axis_s2mm_tvalid , axis_tlast => s_axis_s2mm_tlast , packet_sof => s2mm_packet_sof , packet_eof => s2mm_packet_eof ); end generate INCLUDE_S2MM_SOF_EOF_GENERATOR; -- If S2MM channel not included then exclude sof/eof generator EXCLUDE_S2MM_SOF_EOF_GENERATOR : if C_INCLUDE_S2MM = 0 generate begin s2mm_packet_sof <= '0'; s2mm_packet_eof <= '0'; end generate EXCLUDE_S2MM_SOF_EOF_GENERATOR; INCLUDE_S2MM_GATE : if (C_ENABLE_MULTI_CHANNEL = 1 and C_INCLUDE_S2MM = 1) generate begin cmpt_updt <= m_axis_s2mm_sts_tvalid & s2mm_eof_s2mm; I_S2MM_GATE_GEN : entity axi_dma_v7_1.axi_dma_s2mm generic map ( C_FAMILY => C_FAMILY ) port map ( clk_in => m_axi_s2mm_aclk, sg_clk => axi_sg_aclk, resetn => s2mm_prmry_resetn, reset_sg => m_axi_sg_aresetn, s2mm_tvalid => s_axis_s2mm_tvalid, s2mm_tready => s_axis_s2mm_tready_i, s2mm_tlast => s_axis_s2mm_tlast, s2mm_tdest => s_axis_s2mm_tdest, s2mm_tuser => s_axis_s2mm_tuser, s2mm_tid => s_axis_s2mm_tid, desc_available => s_axis_s2mm_cmd_tvalid_split, -- s2mm_eof => s2mm_eof_s2mm, s2mm_eof_det => cmpt_updt, --m_axis_s2mm_sts_tvalid, --s2mm_eof_s2mm, ch2_update_active => ch2_update_active, tdest_out => tdest_out_int, same_tdest => same_tdest, -- to DM -- updt_cmpt => updt_cmpt, s2mm_desc_info => s2mm_desc_info_in, s2mm_tvalid_out => open, --s_axis_s2mm_tvalid_int, s2mm_tready_out => open, --s_axis_s2mm_tready_i, s2mm_tlast_out => open, --s_axis_s2mm_tlast_int, s2mm_tdest_out => open ); end generate INCLUDE_S2MM_GATE; INCLUDE_S2MM_NOGATE : if (C_ENABLE_MULTI_CHANNEL = 0 and C_INCLUDE_S2MM = 1) generate begin updt_cmpt <= '0'; tdest_out_int <= (others => '0'); same_tdest <= '0'; s_axis_s2mm_tvalid_int <= s_axis_s2mm_tvalid; s_axis_s2mm_tlast_int <= s_axis_s2mm_tlast; end generate INCLUDE_S2MM_NOGATE; MM2S_SPLIT : if (C_ENABLE_MULTI_CHANNEL = 1 and C_INCLUDE_MM2S = 1) generate begin CLOCKS : if (C_PRMRY_IS_ACLK_ASYNC = 1) generate begin clock_splt <= axi_sg_aclk; end generate CLOCKS; CLOCKS_SYNC : if (C_PRMRY_IS_ACLK_ASYNC = 0) generate begin clock_splt <= m_axi_mm2s_aclk; end generate CLOCKS_SYNC; I_COMMAND_MM2S_SPLITTER : entity axi_dma_v7_1.axi_dma_cmd_split generic map ( C_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH, C_INCLUDE_S2MM => 0, C_DM_STATUS_WIDTH => 8 ) port map ( clock => clock_splt, --axi_sg_aclk, sgresetn => m_axi_sg_aresetn, clock_sec => m_axi_mm2s_aclk, --axi_sg_aclk, aresetn => m_axi_mm2s_aresetn, -- MM2S command coming from MM2S_MNGR s_axis_cmd_tvalid => s_axis_mm2s_cmd_tvalid_split, s_axis_cmd_tready => s_axis_mm2s_cmd_tready_split, s_axis_cmd_tdata => s_axis_mm2s_cmd_tdata_split, -- MM2S split command to DM s_axis_cmd_tvalid_s => s_axis_mm2s_cmd_tvalid, s_axis_cmd_tready_s => s_axis_mm2s_cmd_tready, s_axis_cmd_tdata_s => s_axis_mm2s_cmd_tdata, tvalid_from_datamover => m_axis_mm2s_sts_tvalid_int, status_in => m_axis_mm2s_sts_tdata_int, tvalid_unsplit => m_axis_mm2s_sts_tvalid, status_out => m_axis_mm2s_sts_tdata, tlast_stream_data => m_axis_mm2s_tlast_i_mcdma, tready_stream_data => m_axis_mm2s_tready, tlast_unsplit => m_axis_mm2s_tlast_i, tlast_unsplit_user => m_axis_mm2s_tlast_i_user ); end generate MM2S_SPLIT; MM2S_SPLIT_NOMCDMA : if (C_ENABLE_MULTI_CHANNEL = 0 and C_INCLUDE_MM2S = 1) generate begin s_axis_mm2s_cmd_tvalid <= s_axis_mm2s_cmd_tvalid_split; s_axis_mm2s_cmd_tready_split <= s_axis_mm2s_cmd_tready; s_axis_mm2s_cmd_tdata <= s_axis_mm2s_cmd_tdata_split ((C_M_AXI_MM2S_ADDR_WIDTH+CMD_BASE_WIDTH)-1 downto 0); m_axis_mm2s_sts_tvalid <= m_axis_mm2s_sts_tvalid_int; m_axis_mm2s_sts_tdata <= m_axis_mm2s_sts_tdata_int; m_axis_mm2s_tlast_i <= m_axis_mm2s_tlast_i_mcdma; m_axis_mm2s_tlast_i_user <= '0'; end generate MM2S_SPLIT_NOMCDMA; S2MM_SPLIT : if (C_ENABLE_MULTI_CHANNEL = 1 and C_INCLUDE_S2MM = 1) generate begin CLOCKS_S2MM : if (C_PRMRY_IS_ACLK_ASYNC = 1) generate begin clock_splt_s2mm <= axi_sg_aclk; end generate CLOCKS_S2MM; CLOCKS_SYNC_S2MM : if (C_PRMRY_IS_ACLK_ASYNC = 0) generate begin clock_splt_s2mm <= m_axi_s2mm_aclk; end generate CLOCKS_SYNC_S2MM; I_COMMAND_S2MM_SPLITTER : entity axi_dma_v7_1.axi_dma_cmd_split generic map ( C_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH, C_INCLUDE_S2MM => C_INCLUDE_S2MM, C_DM_STATUS_WIDTH => DM_STATUS_WIDTH ) port map ( clock => clock_splt_s2mm, sgresetn => m_axi_sg_aresetn, clock_sec => m_axi_s2mm_aclk, --axi_sg_aclk, --m_axi_s2mm_aclk, aresetn => m_axi_s2mm_aresetn, -- S2MM command coming from S2MM_MNGR s_axis_cmd_tvalid => s_axis_s2mm_cmd_tvalid_split, s_axis_cmd_tready => s_axis_s2mm_cmd_tready_split, s_axis_cmd_tdata => s_axis_s2mm_cmd_tdata_split, -- S2MM split command to DM s_axis_cmd_tvalid_s => s_axis_s2mm_cmd_tvalid, s_axis_cmd_tready_s => s_axis_s2mm_cmd_tready, s_axis_cmd_tdata_s => s_axis_s2mm_cmd_tdata, tvalid_from_datamover => m_axis_s2mm_sts_tvalid_int, status_in => m_axis_s2mm_sts_tdata_int, tvalid_unsplit => m_axis_s2mm_sts_tvalid, status_out => m_axis_s2mm_sts_tdata, tlast_stream_data => '0', tready_stream_data => '0', tlast_unsplit => open, tlast_unsplit_user => open ); end generate S2MM_SPLIT; S2MM_SPLIT_NOMCDMA : if (C_ENABLE_MULTI_CHANNEL = 0 and C_INCLUDE_S2MM = 1) generate begin s_axis_s2mm_cmd_tvalid <= s_axis_s2mm_cmd_tvalid_split; s_axis_s2mm_cmd_tready_split <= s_axis_s2mm_cmd_tready; s_axis_s2mm_cmd_tdata <= s_axis_s2mm_cmd_tdata_split ((C_M_AXI_MM2S_ADDR_WIDTH+CMD_BASE_WIDTH)-1 downto 0); m_axis_s2mm_sts_tvalid <= m_axis_s2mm_sts_tvalid_int; m_axis_s2mm_sts_tdata <= m_axis_s2mm_sts_tdata_int; end generate S2MM_SPLIT_NOMCDMA; ------------------------------------------------------------------------------- -- Primary MM2S and S2MM DataMover ------------------------------------------------------------------------------- I_PRMRY_DATAMOVER : entity axi_datamover_v5_1.axi_datamover generic map( C_INCLUDE_MM2S => MM2S_AXI_FULL_MODE, C_M_AXI_MM2S_ADDR_WIDTH => C_M_AXI_MM2S_ADDR_WIDTH, C_M_AXI_MM2S_DATA_WIDTH => C_M_AXI_MM2S_DATA_WIDTH, C_M_AXIS_MM2S_TDATA_WIDTH => C_M_AXIS_MM2S_TDATA_WIDTH, C_INCLUDE_MM2S_STSFIFO => DM_INCLUDE_STS_FIFO, C_MM2S_STSCMD_FIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH_1, C_MM2S_STSCMD_IS_ASYNC => C_PRMRY_IS_ACLK_ASYNC, C_INCLUDE_MM2S_DRE => C_INCLUDE_MM2S_DRE, C_MM2S_BURST_SIZE => C_MM2S_BURST_SIZE, C_MM2S_BTT_USED => DM_BTT_LENGTH_WIDTH, C_MM2S_ADDR_PIPE_DEPTH => DM_ADDR_PIPE_DEPTH, C_MM2S_INCLUDE_SF => DM_MM2S_INCLUDE_SF, C_ENABLE_CACHE_USER => C_ENABLE_MULTI_CHANNEL, C_ENABLE_SKID_BUF => skid_enable, --"11111", C_MICRO_DMA => C_MICRO_DMA, C_INCLUDE_S2MM => S2MM_AXI_FULL_MODE, C_M_AXI_S2MM_ADDR_WIDTH => C_M_AXI_S2MM_ADDR_WIDTH, C_M_AXI_S2MM_DATA_WIDTH => C_M_AXI_S2MM_DATA_WIDTH, C_S_AXIS_S2MM_TDATA_WIDTH => C_S_AXIS_S2MM_TDATA_WIDTH, C_INCLUDE_S2MM_STSFIFO => DM_INCLUDE_STS_FIFO, C_S2MM_STSCMD_FIFO_DEPTH => DM_CMDSTS_FIFO_DEPTH_1, C_S2MM_STSCMD_IS_ASYNC => C_PRMRY_IS_ACLK_ASYNC, C_INCLUDE_S2MM_DRE => C_INCLUDE_S2MM_DRE, C_S2MM_BURST_SIZE => C_S2MM_BURST_SIZE, C_S2MM_BTT_USED => DM_BTT_LENGTH_WIDTH, C_S2MM_SUPPORT_INDET_BTT => DM_SUPPORT_INDET_BTT, C_S2MM_ADDR_PIPE_DEPTH => DM_ADDR_PIPE_DEPTH, C_S2MM_INCLUDE_SF => DM_S2MM_INCLUDE_SF, C_FAMILY => C_FAMILY ) port map( -- MM2S Primary Clock / Reset input m_axi_mm2s_aclk => m_axi_mm2s_aclk , m_axi_mm2s_aresetn => m_axi_mm2s_aresetn , mm2s_halt => mm2s_halt , mm2s_halt_cmplt => mm2s_halt_cmplt , mm2s_err => mm2s_err , mm2s_allow_addr_req => ALWAYS_ALLOW , mm2s_addr_req_posted => open , mm2s_rd_xfer_cmplt => open , -- Memory Map to Stream Command FIFO and Status FIFO I/O -------------- m_axis_mm2s_cmdsts_aclk => axi_sg_aclk , m_axis_mm2s_cmdsts_aresetn => dm_mm2s_scndry_resetn , -- User Command Interface Ports (AXI Stream) s_axis_mm2s_cmd_tvalid => s_axis_mm2s_cmd_tvalid , s_axis_mm2s_cmd_tready => s_axis_mm2s_cmd_tready , s_axis_mm2s_cmd_tdata => s_axis_mm2s_cmd_tdata (((8*C_ENABLE_MULTI_CHANNEL)+ C_M_AXI_MM2S_ADDR_WIDTH+ CMD_BASE_WIDTH)-1 downto 0) , -- User Status Interface Ports (AXI Stream) m_axis_mm2s_sts_tvalid => m_axis_mm2s_sts_tvalid_int , m_axis_mm2s_sts_tready => m_axis_mm2s_sts_tready , m_axis_mm2s_sts_tdata => m_axis_mm2s_sts_tdata_int , m_axis_mm2s_sts_tkeep => m_axis_mm2s_sts_tkeep , m_axis_mm2s_sts_tlast => open , -- MM2S AXI Address Channel I/O -------------------------------------- m_axi_mm2s_arid => open , m_axi_mm2s_araddr => m_axi_mm2s_araddr , m_axi_mm2s_arlen => m_axi_mm2s_arlen , m_axi_mm2s_arsize => m_axi_mm2s_arsize , m_axi_mm2s_arburst => m_axi_mm2s_arburst , m_axi_mm2s_arprot => m_axi_mm2s_arprot , m_axi_mm2s_arcache => m_axi_mm2s_arcache , m_axi_mm2s_aruser => m_axi_mm2s_aruser , m_axi_mm2s_arvalid => m_axi_mm2s_arvalid , m_axi_mm2s_arready => m_axi_mm2s_arready , -- MM2S AXI MMap Read Data Channel I/O ------------------------------- m_axi_mm2s_rdata => m_axi_mm2s_rdata , m_axi_mm2s_rresp => m_axi_mm2s_rresp , m_axi_mm2s_rlast => m_axi_mm2s_rlast , m_axi_mm2s_rvalid => m_axi_mm2s_rvalid , m_axi_mm2s_rready => m_axi_mm2s_rready , -- MM2S AXI Master Stream Channel I/O -------------------------------- m_axis_mm2s_tdata => m_axis_mm2s_tdata , m_axis_mm2s_tkeep => m_axis_mm2s_tkeep , m_axis_mm2s_tlast => m_axis_mm2s_tlast_i_mcdma , m_axis_mm2s_tvalid => m_axis_mm2s_tvalid_i , m_axis_mm2s_tready => m_axis_mm2s_tready , -- Testing Support I/O mm2s_dbg_sel => (others => '0') , mm2s_dbg_data => open , -- S2MM Primary Clock/Reset input m_axi_s2mm_aclk => m_axi_s2mm_aclk , m_axi_s2mm_aresetn => m_axi_s2mm_aresetn , s2mm_halt => s2mm_halt , s2mm_halt_cmplt => s2mm_halt_cmplt , s2mm_err => s2mm_err , s2mm_allow_addr_req => ALWAYS_ALLOW , s2mm_addr_req_posted => open , s2mm_wr_xfer_cmplt => open , s2mm_ld_nxt_len => open , s2mm_wr_len => open , -- Stream to Memory Map Command FIFO and Status FIFO I/O -------------- m_axis_s2mm_cmdsts_awclk => axi_sg_aclk , m_axis_s2mm_cmdsts_aresetn => dm_s2mm_scndry_resetn , -- User Command Interface Ports (AXI Stream) s_axis_s2mm_cmd_tvalid => s_axis_s2mm_cmd_tvalid , s_axis_s2mm_cmd_tready => s_axis_s2mm_cmd_tready , s_axis_s2mm_cmd_tdata => s_axis_s2mm_cmd_tdata ( ((8*C_ENABLE_MULTI_CHANNEL)+ C_M_AXI_MM2S_ADDR_WIDTH+ CMD_BASE_WIDTH)-1 downto 0) , -- User Status Interface Ports (AXI Stream) m_axis_s2mm_sts_tvalid => m_axis_s2mm_sts_tvalid_int , m_axis_s2mm_sts_tready => m_axis_s2mm_sts_tready , m_axis_s2mm_sts_tdata => m_axis_s2mm_sts_tdata_int , m_axis_s2mm_sts_tkeep => m_axis_s2mm_sts_tkeep , m_axis_s2mm_sts_tlast => open , -- S2MM AXI Address Channel I/O -------------------------------------- m_axi_s2mm_awid => open , m_axi_s2mm_awaddr => m_axi_s2mm_awaddr , m_axi_s2mm_awlen => m_axi_s2mm_awlen , m_axi_s2mm_awsize => m_axi_s2mm_awsize , m_axi_s2mm_awburst => m_axi_s2mm_awburst , m_axi_s2mm_awprot => m_axi_s2mm_awprot , m_axi_s2mm_awcache => m_axi_s2mm_awcache , m_axi_s2mm_awuser => m_axi_s2mm_awuser , m_axi_s2mm_awvalid => m_axi_s2mm_awvalid , m_axi_s2mm_awready => m_axi_s2mm_awready , -- S2MM AXI MMap Write Data Channel I/O ------------------------------ m_axi_s2mm_wdata => m_axi_s2mm_wdata , m_axi_s2mm_wstrb => m_axi_s2mm_wstrb , m_axi_s2mm_wlast => m_axi_s2mm_wlast , m_axi_s2mm_wvalid => m_axi_s2mm_wvalid , m_axi_s2mm_wready => m_axi_s2mm_wready , -- S2MM AXI MMap Write response Channel I/O -------------------------- m_axi_s2mm_bresp => m_axi_s2mm_bresp , m_axi_s2mm_bvalid => m_axi_s2mm_bvalid , m_axi_s2mm_bready => m_axi_s2mm_bready , -- S2MM AXI Slave Stream Channel I/O --------------------------------- s_axis_s2mm_tdata => s_axis_s2mm_tdata , s_axis_s2mm_tkeep => s_axis_s2mm_tkeep , s_axis_s2mm_tlast => s_axis_s2mm_tlast , s_axis_s2mm_tvalid => s_axis_s2mm_tvalid , s_axis_s2mm_tready => s_axis_s2mm_tready_i , -- Testing Support I/O s2mm_dbg_sel => (others => '0') , s2mm_dbg_data => open ); end implementation;
gpl-3.0
8da214dd878266c01a30bed5f76d2e5d
0.437027
3.784738
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/uart/uart.vhd
1
2,677
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- package: uart -- File: uart.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: UART types and components ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; package uart is type uart_in_type is record rxd : std_ulogic; ctsn : std_ulogic; extclk : std_ulogic; end record; type uart_out_type is record rtsn : std_ulogic; txd : std_ulogic; scaler : std_logic_vector(31 downto 0); txen : std_ulogic; flow : std_ulogic; rxen : std_ulogic; end record; component apbuart generic ( pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff#; console : integer := 0; pirq : integer := 0; parity : integer := 1; flow : integer := 1; fifosize : integer range 1 to 32 := 1; abits : integer := 8; sbits : integer range 12 to 32 := 12); port ( rst : in std_ulogic; clk : in std_ulogic; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; uarti : in uart_in_type; uarto : out uart_out_type); end component; component ahbuart generic ( hindex : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#fff# ); port ( rst : in std_ulogic; clk : in std_ulogic; uarti : in uart_in_type; uarto : out uart_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type); end component; end;
gpl-2.0
a0cad7b0cc783060942902b1890e0907
0.575271
3.687328
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/lvds_combo.vhd
1
3,627
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: lvds_combo.vhd -- File: lvds_combo.vhd.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Differential input/output pads with IREF/OREF logic wrapper ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; use techmap.allpads.all; entity lvds_combo is generic (tech : integer := 0; voltage : integer := 0; width : integer := 1; oepol : integer := 0; term : integer := 0); port (odpadp, odpadn, ospadp, ospadn : out std_logic_vector(0 to width-1); odval, osval, en : in std_logic_vector(0 to width-1); idpadp, idpadn, ispadp, ispadn : in std_logic_vector(0 to width-1); idval, isval : out std_logic_vector(0 to width-1); lvdsref : in std_logic := '1' ); end ; architecture rtl of lvds_combo is signal gnd : std_ulogic; signal oen : std_logic_vector(0 to width-1); constant level : integer := lvds; begin gnd <= '0'; gen0 : if has_ds_combo(tech) = 0 generate swloop : for i in 0 to width-1 generate od0 : outpad_ds generic map (tech, level, voltage, oepol) port map (odpadp(i), odpadn(i), odval(i), en(i)); os0 : outpad_ds generic map (tech, level, voltage, oepol) port map (ospadp(i), ospadn(i), osval(i), en(i)); id0 : inpad_ds generic map (tech, level, voltage) port map (idpadp(i), idpadn(i), idval(i)); is0 : inpad_ds generic map (tech, level, voltage) port map (ispadp(i), ispadn(i), isval(i)); end generate; end generate; combo : if has_ds_combo(tech) /= 0 generate oen <= not en when oepol /= padoen_polarity(tech) else en; ut025 : if tech = ut25 generate u0: ut025crh_lvds_combo generic map (voltage, width) port map (odpadp, odpadn, ospadp, ospadn, odval, osval, oen, idpadp, idpadn, ispadp, ispadn, idval, isval); end generate; ut13 : if tech = ut130 generate u0: ut130hbd_lvds_combo generic map (voltage, width) port map (odpadp, odpadn, ospadp, ospadn, odval, osval, oen, idpadp, idpadn, ispadp, ispadn, idval, isval); end generate; um : if tech = umc generate u0: umc_lvds_combo generic map (voltage, width) port map (odpadp, odpadn, ospadp, ospadn, odval, osval, oen, idpadp, idpadn, ispadp, ispadn, idval, isval, lvdsref); end generate; rhu : if tech = rhumc generate u0: rhumc_lvds_combo generic map (voltage, width) port map (odpadp, odpadn, ospadp, ospadn, odval, osval, oen, idpadp, idpadn, ispadp, ispadn, idval, isval, lvdsref); end generate; end generate; end;
gpl-2.0
3d300e6cad81e6a0ed12cc095066549a
0.635511
3.689725
false
false
false
false
makestuff/mem-pipe
vhdl/tb_unit/mem_pipe_tb.vhdl
1
5,728
-- -- Copyright (C) 2012 Chris McClelland -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.std_logic_textio.all; use std.textio.all; use work.hex_util.all; use work.mem_ctrl_pkg.all; entity mem_pipe_tb is end entity; architecture behavioural of mem_pipe_tb is -- Clocks signal sysClk : std_logic; -- main system clock signal dispClk : std_logic; -- display version of sysClk, which transitions 4ns before it -- I/O pipes signal cmdData : std_logic_vector(15 downto 0); signal cmdValid : std_logic; signal cmdReady : std_logic; signal rspData : std_logic_vector(15 downto 0); signal rspValid : std_logic; signal rspReady : std_logic; -- Memory controller interface signal mcCmd : MCCmdType; signal mcAddr : std_logic_vector(22 downto 0); signal mcDataWr : std_logic_vector(15 downto 0); signal mcDataRd : std_logic_vector(15 downto 0); signal mcRDV : std_logic; signal mcReady : std_logic; signal reset : std_logic; begin -- Instantiate the memory controller for testing uut: entity work.mem_pipe port map( clk_in => sysClk, reset_in => reset, -- I/O pipes cmdData_in => cmdData, cmdValid_in => cmdValid, cmdReady_out => cmdReady, rspData_out => rspData, rspValid_out => rspValid, rspReady_in => rspReady, -- Memory controller interface mcReady_in => mcReady, mcCmd_out => mcCmd, mcAddr_out => mcAddr, mcData_out => mcDataWr, mcData_in => mcDataRd, mcRDV_in => mcRDV ); -- Drive the clocks. In simulation, sysClk lags 4ns behind dispClk, to give a visual hold time -- for signals in GTKWave. process begin sysClk <= '0'; dispClk <= '0'; wait for 16 ns; loop dispClk <= not(dispClk); -- first dispClk transitions wait for 4 ns; sysClk <= not(sysClk); -- then sysClk transitions, 4ns later wait for 6 ns; end loop; end process; -- Deassert the synchronous reset a couple of cycles after startup. -- process begin reset <= '1'; wait until rising_edge(sysClk); wait until rising_edge(sysClk); reset <= '0'; wait; end process; -- Drive the unit under test. Read stimulus from stimulus.sim and write results to results.sim process variable inLine : line; variable outLine : line; file inFile : text open read_mode is "stimulus.sim"; file outFile : text open write_mode is "results.sim"; function from_mcCmd(cmd : MCCmdType) return string is begin case cmd is when MC_RD => return "RD "; when MC_WR => return "WR "; when MC_REF => return "REF"; when MC_NOP => return "NOP"; when others => return "ILL"; end case; end function; begin cmdData <= (others => 'X'); cmdValid <= '0'; rspReady <= '1'; mcReady <= '0'; mcDataRd <= (others => 'X'); mcRDV <= '0'; wait until falling_edge(reset); wait until rising_edge(sysClk); while ( not endfile(inFile) ) loop readline(inFile, inLine); while ( inLine.all'length = 0 or inLine.all(1) = '#' or inLine.all(1) = ht or inLine.all(1) = ' ' ) loop readline(inFile, inLine); end loop; cmdData <= to_4(inLine.all(1)) & to_4(inLine.all(2)) & to_4(inLine.all(3)) & to_4(inLine.all(4)); cmdValid <= to_1(inLine.all(6)); rspReady <= to_1(inLine.all(8)); mcReady <= to_1(inLine.all(10)); mcDataRd <= to_4(inLine.all(12)) & to_4(inLine.all(13)) & to_4(inLine.all(14)) & to_4(inLine.all(15)); mcRDV <= to_1(inLine.all(17)); wait for 10 ns; write(outLine, from_4(cmdData(15 downto 12)) & from_4(cmdData(11 downto 8)) & from_4(cmdData(7 downto 4)) & from_4(cmdData(3 downto 0))); write(outLine, ' '); write(outLine, cmdValid); write(outLine, ' '); write(outLine, cmdReady); write(outLine, ' '); write(outLine, '|'); write(outLine, ' '); write(outLine, from_4(rspData(15 downto 12)) & from_4(rspData(11 downto 8)) & from_4(rspData(7 downto 4)) & from_4(rspData(3 downto 0))); write(outLine, ' '); write(outLine, rspValid); write(outLine, ' '); write(outLine, rspReady); write(outLine, ' '); write(outLine, '|'); write(outLine, ' '); write(outLine, mcReady); write(outLine, ' '); write(outLine, from_mcCmd(mcCmd)); write(outLine, ' '); write(outLine, from_4("0" & mcAddr(22 downto 20)) & from_4(mcAddr(19 downto 16)) & from_4(mcAddr(15 downto 12)) & from_4(mcAddr(11 downto 8)) & from_4(mcAddr(7 downto 4)) & from_4(mcAddr(3 downto 0))); write(outLine, ' '); write(outLine, from_4(mcDataWr(15 downto 12)) & from_4(mcDataWr(11 downto 8)) & from_4(mcDataWr(7 downto 4)) & from_4(mcDataWr(3 downto 0))); write(outLine, ' '); write(outLine, from_4(mcDataRd(15 downto 12)) & from_4(mcDataRd(11 downto 8)) & from_4(mcDataRd(7 downto 4)) & from_4(mcDataRd(3 downto 0))); write(outLine, ' '); write(outLine, mcRDV); writeline(outFile, outLine); wait for 10 ns; end loop; cmdData <= (others => 'X'); cmdValid <= '0'; mcRDV <= '0'; mcReady <= '0'; wait; end process; end architecture;
gpl-3.0
03bf2cfe033f7d091909a249a85ff1da
0.648219
3.107976
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/dware/mul_dware.vhd
1
4,077
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: misc -- File: mul_dware.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Dware multipliers ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library Dware; use DWARE.DWpackages.all; use DWARE.DW_Foundation_comp_arith.all; entity mul_dw is generic ( a_width : positive := 2; -- multiplier word width b_width : positive := 2; -- multiplicand word width num_stages : positive := 2; -- number of pipeline stages stall_mode : natural range 0 to 1 := 1 -- '0': non-stallable; '1': stallable ); port(a : in std_logic_vector(a_width-1 downto 0); b : in std_logic_vector(b_width-1 downto 0); clk : in std_logic; en : in std_logic; sign : in std_logic; product : out std_logic_vector(a_width+b_width-1 downto 0)); end; architecture rtl of mul_dw is component DW02_mult generic( A_width: NATURAL; -- multiplier wordlength B_width: NATURAL); -- multiplicand wordlength port(A : in std_logic_vector(A_width-1 downto 0); B : in std_logic_vector(B_width-1 downto 0); TC : in std_logic; -- signed -> '1', unsigned -> '0' PRODUCT : out std_logic_vector(A_width+B_width-1 downto 0)); end component; signal gnd : std_ulogic; begin gnd <= '0'; np : if num_stages = 1 generate u0 : DW02_mult generic map ( a_width => a_width, b_width => b_width) port map (a => a, b => b, TC => sign, product => product); end generate; pipe : if num_stages > 1 generate u0 : DW_mult_pipe generic map ( a_width => a_width, b_width => b_width, num_stages => num_stages, stall_mode => stall_mode, rst_mode => 0) port map (a => a, b => b, TC => sign, clk => clk, product => product, rst_n => gnd, en => en); end generate; end; library ieee; use ieee.std_logic_1164.all; library Dware; use DWARE.DWpackages.all; use DWARE.DW_Foundation_comp_arith.all; entity dw_mul_61x61 is port(A : in std_logic_vector(60 downto 0); B : in std_logic_vector(60 downto 0); CLK : in std_logic; PRODUCT : out std_logic_vector(121 downto 0)); end; architecture rtl of dw_mul_61x61 is signal gnd : std_ulogic; signal pin, p : std_logic_vector(121 downto 0); begin gnd <= '0'; -- u0 : DW02_mult_2_stage -- generic map ( A_width => A'length, B_width => B'length ) -- port map ( A => A, B => B, TC => gnd, CLK => CLK, PRODUCT => pin ); u0 : DW_mult_pipe generic map ( a_width => 61, b_width => 61, num_stages => 2, stall_mode => 0, rst_mode => 0) port map (a => a, b => b, TC => gnd, clk => clk, product => pin, rst_n => gnd, en => gnd); reg0 : process(CLK) begin if rising_edge(CLK) then p <= pin; end if; end process; PRODUCT <= p; end;
gpl-2.0
79d4d5c51ed77572a3b446ed62cad4b6
0.565612
3.551394
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep3c25-eek/testbench.vhd
1
14,308
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ -- Altera Cyclone-III Embedded Evaluation Kit LEON3 Demonstration design test -- Copyright (C) 2007 Jiri Gaisler, Gaisler Research -- Adapted for EEK by Jan Andersson, Gaisler Research ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; library cypress; use cypress.components.all; use work.debug.all; use work.config.all; -- configuration entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 20; -- system clock period romwidth : integer := 8; -- rom data width (8/32) romdepth : integer := 23; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 20; -- ram address depth srambanks : integer := 1 -- number of ram banks ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal clk : std_logic := '0'; signal clkout, pllref : std_ulogic; signal rst : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal address : std_logic_vector(25 downto 0); signal data : std_logic_vector(31 downto 0); signal romsn : std_ulogic; signal iosn : std_ulogic; signal oen : std_ulogic; signal writen : std_ulogic; signal dsuen, dsutx, dsurx, dsubren, dsuact : std_ulogic; signal dsurst : std_ulogic; signal test : std_ulogic; signal error : std_logic; signal gpio : std_logic_vector(CFG_GRGPIO_WIDTH-3 downto 0); signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal clk2 : std_ulogic := '1'; signal ssram_cen : std_logic; signal ssram_wen : std_logic; signal ssram_bw : std_logic_vector (0 to 3); signal ssram_oen : std_ulogic; signal ssram_clk : std_ulogic; signal ssram_adscn : std_ulogic; signal ssram_adsp_n : std_ulogic; signal ssram_adv_n : std_ulogic; signal datazz : std_logic_vector(3 downto 0); -- ddr memory signal ddr_clk : std_logic; signal ddr_clkb : std_logic; signal ddr_clkin : std_logic; signal ddr_cke : std_logic; signal ddr_csb : std_logic; signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (1 downto 0); -- ddr dm signal ddr_dqs : std_logic_vector (1 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (12 downto 0); -- ddr address signal ddr_ba : std_logic_vector (1 downto 0); -- ddr bank address signal ddr_dq : std_logic_vector (15 downto 0); -- ddr data -- Connections over HSMC connector -- LCD touch panel display signal hc_vd : std_logic; signal hc_hd : std_logic; signal hc_den : std_logic; signal hc_nclk : std_logic; signal hc_lcd_data : std_logic_vector(7 downto 0); signal hc_grest : std_logic; signal hc_scen : std_logic; signal hc_sda : std_logic; signal hc_adc_penirq_n : std_logic; signal hc_adc_dout : std_logic; signal hc_adc_busy : std_logic; signal hc_adc_din : std_logic; signal hc_adc_dclk : std_logic; signal hc_adc_cs_n : std_logic; -- Shared by video decoder and audio codec signal hc_i2c_sclk : std_logic; signal hc_i2c_sdat : std_logic; -- Video decoder signal hc_td_d : std_logic_vector(7 downto 0); signal hc_td_hs : std_logic; signal hc_td_vs : std_logic; signal hc_td_27mhz : std_logic; signal hc_td_reset : std_logic; -- Audio codec signal hc_aud_adclrck : std_logic; signal hc_aud_adcdat : std_logic; signal hc_aud_daclrck : std_logic; signal hc_aud_dacdat : std_logic; signal hc_aud_bclk : std_logic; signal hc_aud_xck : std_logic; -- SD card signal hc_sd_dat : std_logic; signal hc_sd_dat3 : std_logic; signal hc_sd_cmd : std_logic; signal hc_sd_clk : std_logic; -- Ethernet PHY signal hc_tx_d : std_logic_vector(3 downto 0); signal hc_rx_d : std_logic_vector(3 downto 0); signal hc_tx_clk : std_logic; signal hc_rx_clk : std_logic; signal hc_tx_en : std_logic; signal hc_rx_dv : std_logic; signal hc_rx_crs : std_logic; signal hc_rx_err : std_logic; signal hc_rx_col : std_logic; signal hc_mdio : std_logic; signal hc_mdc : std_logic; signal hc_eth_reset_n : std_logic; -- RX232 (console/debug UART) signal hc_uart_rxd : std_logic; signal hc_uart_txd : std_logic; -- PS/2 signal hc_ps2_dat : std_logic; signal hc_ps2_clk : std_logic; -- VGA/DAC signal hc_vga_data : std_logic_vector(9 downto 0); signal hc_vga_clock : std_ulogic; signal hc_vga_hs : std_ulogic; signal hc_vga_vs : std_ulogic; signal hc_vga_blank : std_ulogic; signal hc_vga_sync : std_ulogic; -- I2C EEPROM signal hc_id_i2cscl : std_logic; signal hc_id_i2cdat : std_logic; -- Ethernet PHY sim model signal phy_tx_er : std_ulogic; signal phy_gtx_clk : std_ulogic; signal hc_tx_dt : std_logic_vector(7 downto 0) := (others => '0'); signal hc_rx_dt : std_logic_vector(7 downto 0) := (others => '0'); constant lresp : boolean := false; begin -- clock and reset clk <= not clk after ct * 1 ns; ddr_clkin <= not clk after ct * 1 ns; rst <= dsurst; dsubren <= '1'; hc_uart_rxd <= '1'; address(0) <= '0'; -- ddr_dqs <= (others => 'L'); d3 : entity work.leon3mp generic map (fabtech, memtech, padtech, clktech, ncpu, disas, dbguart, pclow ) port map (rst, clk, error, address(25 downto 1), data, romsn, oen, writen, open, ssram_cen, ssram_wen, ssram_bw, ssram_oen, ssram_clk, ssram_adscn, iosn, -- DDR ddr_clk, ddr_clkb, ddr_cke, ddr_csb, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_ad, ddr_ba, ddr_dq, -- DSU dsubren, dsuact, -- I/O port gpio, -- LCD hc_vd, hc_hd, hc_den, hc_nclk, hc_lcd_data, hc_grest, hc_scen, hc_sda, hc_adc_penirq_n, hc_adc_dout, hc_adc_busy, hc_adc_din, hc_adc_dclk, hc_adc_cs_n, -- Shared by video decoder and audio codec hc_i2c_sclk, hc_i2c_sdat, -- Video decoder hc_td_d, hc_td_hs, hc_td_vs, hc_td_27mhz, hc_td_reset, -- Audio codec hc_aud_adclrck, hc_aud_adcdat, hc_aud_daclrck, hc_aud_dacdat, hc_aud_bclk, hc_aud_xck, -- SD card hc_sd_dat, hc_sd_dat3, hc_sd_cmd, hc_sd_clk, -- Ethernet PHY hc_tx_d, hc_rx_d, hc_tx_clk, hc_rx_clk, hc_tx_en, hc_rx_dv, hc_rx_crs, hc_rx_err, hc_rx_col, hc_mdio, hc_mdc, hc_eth_reset_n, -- RX232 (console/debug UART) hc_uart_rxd, hc_uart_txd, -- PS/2 hc_ps2_dat, hc_ps2_clk, -- VGA/DAC hc_vga_data, hc_vga_clock, hc_vga_hs, hc_vga_vs, hc_vga_blank, hc_vga_sync, -- I2C EEPROM hc_id_i2cscl, hc_id_i2cdat ); -- I2C bus pull-ups hc_i2c_sclk <= 'H'; hc_i2c_sdat <= 'H'; hc_id_i2cscl <= 'H'; hc_id_i2cdat <= 'H'; -- SD card signals spiflashmod : spi_flash generic map (ftype => 3, debug => 0, dummybyte => 0) port map (sck => hc_sd_clk, di => hc_sd_cmd, do => hc_sd_dat, csn => hc_sd_dat3); hc_sd_dat <= 'Z'; hc_sd_cmd <= 'Z'; -- hc_sd_dat <= hc_sd_cmd; -- Loopback ddr0 : mt46v16m16 generic map (index => -1, fname => sdramfile) port map( Dq => ddr_dq(15 downto 0), Dqs => ddr_dqs(1 downto 0), Addr => ddr_ad, Ba => ddr_ba, Clk => ddr_clk, Clk_n => ddr_clkb, Cke => ddr_cke, Cs_n => ddr_csb, Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, Dm => ddr_dm(1 downto 0)); datazz <= "HHHH"; ssram_adsp_n <= '1'; ssram_adv_n <= '1'; ssram0 : cy7c1380d generic map (fname => sramfile) port map( ioDq(35 downto 32) => datazz, ioDq(31 downto 0) => data, iAddr => address(20 downto 2), iMode => gnd, inGW => vcc, inBWE => ssram_wen, inADV => ssram_adv_n, inADSP => ssram_adsp_n, inADSC => ssram_adscn, iClk => ssram_clk, inBwa => ssram_bw(3), inBwb => ssram_bw(2), inBwc => ssram_bw(1), inBwd => ssram_bw(0), inOE => ssram_oen, inCE1 => ssram_cen, iCE2 => vcc, inCE3 => gnd, iZz => gnd); -- 16 bit prom prom0 : sram16 generic map (index => 4, abits => romdepth, fname => promfile) port map (address(romdepth downto 1), data(31 downto 16), gnd, gnd, romsn, writen, oen); -- Ethernet PHY hc_mdio <= 'H'; phy_tx_er <= '0'; phy_gtx_clk <= '0'; hc_tx_dt(3 downto 0) <= hc_tx_d; hc_rx_d <= hc_rx_dt(3 downto 0); p0: phy generic map(base1000_t_fd => 0, base1000_t_hd => 0, address => 1) port map(hc_eth_reset_n, hc_mdio, hc_tx_clk, hc_rx_clk, hc_rx_dt, hc_rx_dv, hc_rx_err, hc_rx_col, hc_rx_crs, hc_tx_dt, hc_tx_en, phy_tx_er, hc_mdc, phy_gtx_clk); -- I2C memory i0: i2c_slave_model port map (hc_id_i2cscl, hc_id_i2cdat); error <= 'H'; -- ERROR pull-up iuerr : process begin wait for 2500 ns; if to_x01(error) = '1' then wait on error; end if; assert (to_x01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure ; end process; data <= buskeep(data), (others => 'H') after 250 ns; test0 : grtestmod port map ( rst, clk, error, address(21 downto 2), data, iosn, oen, writen, open); dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; dsurst <= '0'; wait for 500 ns; dsurst <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#02#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#ae#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#24#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#03#, txp); -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#06#, 16#fc#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#2f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#00#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#6f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#11#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#00#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#04#, txp); txa(dsutx, 16#00#, 16#02#, 16#20#, 16#01#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#02#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#40#, 16#00#, 16#43#, 16#10#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#0f#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#40#, 16#00#, 16#24#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#24#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#91#, 16#70#, 16#00#, 16#00#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#03#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); txc(dsutx, 16#c0#, txp); txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); txc(dsutx, 16#80#, txp); txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end ;
gpl-2.0
562214ec6945d3d6ae1cb482e26426ad
0.569542
2.99644
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/syncram_dp.vhd
1
8,587
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: syncram_dp -- File: syncram_dp.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: syncronous dual-port ram with tech selection ------------------------------------------------------------------------------ library ieee; library techmap; use ieee.std_logic_1164.all; use techmap.gencomp.all; use work.allmem.all; library grlib; use grlib.config.all; use grlib.config_types.all; use grlib.stdlib.all; entity syncram_dp is generic (tech : integer := 0; abits : integer := 6; dbits : integer := 8; testen : integer := 0; custombits : integer := 1); port ( clk1 : in std_ulogic; address1 : in std_logic_vector((abits -1) downto 0); datain1 : in std_logic_vector((dbits -1) downto 0); dataout1 : out std_logic_vector((dbits -1) downto 0); enable1 : in std_ulogic; write1 : in std_ulogic; clk2 : in std_ulogic; address2 : in std_logic_vector((abits -1) downto 0); datain2 : in std_logic_vector((dbits -1) downto 0); dataout2 : out std_logic_vector((dbits -1) downto 0); enable2 : in std_ulogic; write2 : in std_ulogic; testin : in std_logic_vector(TESTIN_WIDTH-1 downto 0) := testin_none; customclk: in std_ulogic := '0'; customin : in std_logic_vector(custombits-1 downto 0) := (others => '0'); customout:out std_logic_vector(custombits-1 downto 0)); end; architecture rtl of syncram_dp is signal xenable1,xenable2,xwrite1,xwrite2: std_ulogic; signal custominx,customoutx: std_logic_vector(syncram_customif_maxwidth downto 0); begin xenable1 <= enable1 and not testin(TESTIN_WIDTH-2) when testen/=0 else enable1; xenable2 <= enable2 and not testin(TESTIN_WIDTH-2) when testen/=0 else enable2; xwrite1 <= write1 and not testin(TESTIN_WIDTH-2) when testen/=0 else write1; xwrite2 <= write2 and not testin(TESTIN_WIDTH-2) when testen/=0 else write2; -- pragma translate_off inf : if has_dpram(tech) = 0 generate x : process begin assert false report "synram_dp: technology " & tech_table(tech) & " not supported" severity failure; wait; end process; end generate; dmsg : if GRLIB_CONFIG_ARRAY(grlib_debug_level) >= 2 generate x : process begin assert false report "syncram_dp: " & tost(2**abits) & "x" & tost(dbits) & " (" & tech_table(tech) & ")" severity note; wait; end process; end generate; -- pragma translate_on custominx(custominx'high downto custombits) <= (others => '0'); custominx(custombits-1 downto 0) <= customin; customout <= customoutx(custombits-1 downto 0); nocust: if syncram_has_customif(tech)=0 generate customoutx <= (others => '0'); end generate; xcv : if (tech = virtex) generate x0 : virtex_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; xc2v : if (is_unisim(tech) = 1) and (tech /= virtex) generate x0 : unisim_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; vir : if tech = memvirage generate x0 : virage_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; arti : if tech = memartisan generate x0 : artisan_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; pa3 : if tech = apa3 generate x0 : proasic3_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; pa3e : if tech = apa3e generate x0 : proasic3e_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; pa3l : if tech = apa3l generate x0 : proasic3l_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; saed : if tech = saed32 generate x0 : saed32_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; dar : if tech = dare generate x0 : dare_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; fus : if tech = actfus generate x0 : fusion_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; alt : if (tech = altera) or (tech = stratix1) or (tech = stratix2) or (tech = stratix3) or (tech = stratix4) or (tech = cyclone3) generate x0 : altera_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; lat : if tech = lattice generate x0 : ec_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; vir90 : if tech = memvirage90 generate x0 : virage90_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; atrh : if tech = atc18rha generate x0 : atc18rha_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2, testin(TESTIN_WIDTH-1 downto TESTIN_WIDTH-4)); end generate; smic : if tech = smic013 generate x0 : smic13_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; tm65gplu : if tech = tm65gplus generate x0 : tm65gplus_syncram_dp generic map (abits, dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; n2x : if tech = easic45 generate x0 : n2x_syncram_dp generic map (abits => abits, dbits => dbits, sepclk => 1) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2); end generate; ut9 : if tech = ut90 generate x0 : ut90nhbd_syncram_dp generic map (abits => abits, dbits => dbits) port map (clk1, address1, datain1, dataout1, xenable1, xwrite1, clk2, address2, datain2, dataout2, xenable2, xwrite2, testin(TESTIN_WIDTH-3)); end generate; end;
gpl-2.0
a1bce022891ac8043b3cd57a7e3ff2f4
0.641901
3.592887
false
true
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-c5ekit/config.vhd
1
5,095
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := altera; constant CFG_MEMTECH : integer := altera; constant CFG_PADTECH : integer := altera; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 2 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 0; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (0); constant CFG_PWD : integer := 0*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 1; constant CFG_ISETSZ : integer := 4; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 0; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 1; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 8; constant CFG_DREPL : integer := 0; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 0; constant CFG_ITLBNUM : integer := 2; constant CFG_DTLBNUM : integer := 2; constant CFG_TLB_TYPE : integer := 1 + 0*2; constant CFG_TLB_REP : integer := 1; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 1; constant CFG_ATBSZ : integer := 1; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 1; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000000#; -- SSRAM controller constant CFG_SSCTRL : integer := 0; constant CFG_SSCTRLP16 : integer := 0; -- I2C master constant CFG_I2C_ENABLE : integer := 1; -- AHB ROM constant CFG_AHBROMEN : integer := 1; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#100#; constant CFG_ROMMASK : integer := 16#E00# + 16#100#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 8; -- Gaisler Ethernet core constant CFG_GRETH2 : integer := 1; constant CFG_GRETH21G : integer := 0; constant CFG_ETH2_FIFO : integer := 8; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 8; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#000F#; constant CFG_GRGPIO_WIDTH : integer := (2); -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
562e44608357eeff1a9d522b1c2df42b
0.638862
3.623755
false
false
false
false
capitanov/Stupid_watch
src/rtl/game_cores/cl_borders.vhd
1
9,885
-------------------------------------------------------------------------------- -- -- Title : cl_borders.vhd -- Design : Example -- Author : Kapitanov -- Company : InSys -- -- Version : 1.0 -------------------------------------------------------------------------------- -- -- Description : Game block for borders 8x8 -- -- -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; entity cl_borders is generic( constant yend : std_logic_vector(4 downto 0); --! Y end area constant ystart : std_logic_vector(4 downto 0); --! Y start area constant xend : std_logic_vector(6 downto 0); --! X end area constant xstart : std_logic_vector(6 downto 0) --! X start area ); port( -- system signals: clk : in std_logic; --! clock reset : in std_logic; --! system reset -- vga XoY coordinates: display : in std_logic; --! display enable x_char : in std_logic_vector(9 downto 0); --! X line: 0:79 y_char : in std_logic_vector(8 downto 0); --! Y line: 0:29 -- out color scheme: rgb : out std_logic_vector(2 downto 0) -- RGB Colour ); end cl_borders; architecture cl_borders of cl_borders is signal data_rom : std_logic_vector(7 downto 0); signal x_in : std_logic_vector(6 downto 0); signal y_in : std_logic_vector(4 downto 0); signal data : std_logic; signal data_x1 : std_logic; signal data_x2 : std_logic; signal data_y1 : std_logic; signal data_y2 : std_logic; signal data_ul : std_logic; signal data_ur : std_logic; signal data_dl : std_logic; signal data_dr : std_logic; signal x_rev : std_logic_vector(2 downto 0); signal x_del : std_logic_vector(2 downto 0); --signal x_z : std_logic_vector(2 downto 0); signal y_charz : std_logic_vector(3 downto 0); constant color : std_logic_vector(2 downto 0):="001"; begin y_charz <= y_char(3 downto 0) when rising_edge(clk); g_rev: for ii in 0 to 2 generate begin x_rev(ii) <= not x_char(ii) when rising_edge(clk); end generate; x_del <= x_rev when rising_edge(clk); --x_z <= x_del when rising_edge(clk); x_in <= x_char(9 downto 3); y_in <= y_char(8 downto 4); pr_select3: process(clk, reset) is begin if reset = '0' then data_x1 <= '0'; data_x2 <= '0'; data_y1 <= '0'; data_y2 <= '0'; data_ul <= '0'; data_ur <= '0'; data_dl <= '0'; data_dr <= '0'; elsif rising_edge(clk) then if display = '0' then data_x1 <= '0'; data_x2 <= '0'; data_y1 <= '0'; data_y2 <= '0'; data_ul <= '0'; data_ur <= '0'; data_dl <= '0'; data_dr <= '0'; else if (yend = y_in) then if (xstart-1 = x_in) then data_ul <= '1'; else data_ul <= '0'; end if; else data_ul <= '0'; end if; if (yend = y_in) then if (xend = x_in) then data_ur <= '1'; else data_ur <= '0'; end if; else data_ur <= '0'; end if; if (ystart-1 = y_in) then if (xstart-1 = x_in) then data_dl <= '1'; else data_dl <= '0'; end if; else data_dl <= '0'; end if; if (ystart-1 = y_in) then if (xend = x_in) then data_dr <= '1'; else data_dr <= '0'; end if; else data_dr <= '0'; end if; if (yend = y_in) then if (xstart <= x_in) and (x_in < xend) then data_x1 <= '1'; else data_x1 <= '0'; end if; else data_x1 <= '0'; end if; if ((ystart-1) = y_in) then if (xstart <= x_in) and (x_in < xend) then data_x2 <= '1'; else data_x2 <= '0'; end if; else data_x2 <= '0'; end if; if (xstart-1 = x_in) then if (ystart <= y_in) and (y_in < yend) then data_y1 <= '1'; else data_y1 <= '0'; end if; else data_y1 <= '0'; end if; if (xend = x_in) then if (ystart <= y_in) and (y_in < yend) then data_y2 <= '1'; else data_y2 <= '0'; end if; else data_y2 <= '0'; end if; end if; end if; end process; pr_new_box: process(clk, reset) begin if reset = '0' then data_rom <= x"00"; elsif rising_edge(clk) then if data_x1 = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"00"; when x"1" => data_rom <= x"00"; when x"2" => data_rom <= x"FF"; when x"3" => data_rom <= x"FF"; when x"4" => data_rom <= x"00"; when x"5" => data_rom <= x"00"; when x"6" => data_rom <= x"00"; when x"7" => data_rom <= x"00"; when x"8" => data_rom <= x"00"; when x"9" => data_rom <= x"00"; when x"A" => data_rom <= x"00"; when x"B" => data_rom <= x"00"; when x"C" => data_rom <= x"00"; when x"D" => data_rom <= x"00"; when x"E" => data_rom <= x"00"; when others => data_rom <= x"00"; end case; elsif data_x2 = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"00"; when x"1" => data_rom <= x"00"; when x"2" => data_rom <= x"00"; when x"3" => data_rom <= x"00"; when x"4" => data_rom <= x"00"; when x"5" => data_rom <= x"00"; when x"6" => data_rom <= x"00"; when x"7" => data_rom <= x"00"; when x"8" => data_rom <= x"00"; when x"9" => data_rom <= x"00"; when x"A" => data_rom <= x"00"; when x"B" => data_rom <= x"FF"; when x"C" => data_rom <= x"FF"; when x"D" => data_rom <= x"00"; when x"E" => data_rom <= x"00"; when others => data_rom <= x"00"; end case; elsif data_y1 = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"0C"; when x"1" => data_rom <= x"0C"; when x"2" => data_rom <= x"0C"; when x"3" => data_rom <= x"0C"; when x"4" => data_rom <= x"0C"; when x"5" => data_rom <= x"0C"; when x"6" => data_rom <= x"0C"; when x"7" => data_rom <= x"0C"; when x"8" => data_rom <= x"0C"; when x"9" => data_rom <= x"0C"; when x"A" => data_rom <= x"0C"; when x"B" => data_rom <= x"0C"; when x"C" => data_rom <= x"0C"; when x"D" => data_rom <= x"0C"; when x"E" => data_rom <= x"0C"; when others => data_rom <= x"0C"; end case; elsif data_y2 = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"18"; when x"1" => data_rom <= x"18"; when x"2" => data_rom <= x"18"; when x"3" => data_rom <= x"18"; when x"4" => data_rom <= x"18"; when x"5" => data_rom <= x"18"; when x"6" => data_rom <= x"18"; when x"7" => data_rom <= x"18"; when x"8" => data_rom <= x"18"; when x"9" => data_rom <= x"18"; when x"A" => data_rom <= x"18"; when x"B" => data_rom <= x"18"; when x"C" => data_rom <= x"18"; when x"D" => data_rom <= x"18"; when x"E" => data_rom <= x"18"; when others => data_rom <= x"18"; end case; elsif data_ur = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"18"; when x"1" => data_rom <= x"18"; when x"2" => data_rom <= x"F8"; when x"3" => data_rom <= x"F8"; when x"4" => data_rom <= x"00"; when x"5" => data_rom <= x"00"; when x"6" => data_rom <= x"00"; when x"7" => data_rom <= x"00"; when x"8" => data_rom <= x"00"; when x"9" => data_rom <= x"00"; when x"A" => data_rom <= x"00"; when x"B" => data_rom <= x"00"; when x"C" => data_rom <= x"00"; when x"D" => data_rom <= x"00"; when x"E" => data_rom <= x"00"; when others => data_rom <= x"00"; end case; elsif data_ul = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"0C"; when x"1" => data_rom <= x"0C"; when x"2" => data_rom <= x"0F"; when x"3" => data_rom <= x"0F"; when x"4" => data_rom <= x"00"; when x"5" => data_rom <= x"00"; when x"6" => data_rom <= x"00"; when x"7" => data_rom <= x"00"; when x"8" => data_rom <= x"00"; when x"9" => data_rom <= x"00"; when x"A" => data_rom <= x"00"; when x"B" => data_rom <= x"00"; when x"C" => data_rom <= x"00"; when x"D" => data_rom <= x"00"; when x"E" => data_rom <= x"00"; when others => data_rom <= x"00"; end case; elsif data_dr = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"00"; when x"1" => data_rom <= x"00"; when x"2" => data_rom <= x"00"; when x"3" => data_rom <= x"00"; when x"4" => data_rom <= x"00"; when x"5" => data_rom <= x"00"; when x"6" => data_rom <= x"00"; when x"7" => data_rom <= x"00"; when x"8" => data_rom <= x"00"; when x"9" => data_rom <= x"00"; when x"A" => data_rom <= x"00"; when x"B" => data_rom <= x"F8"; when x"C" => data_rom <= x"F8"; when x"D" => data_rom <= x"18"; when x"E" => data_rom <= x"18"; when others => data_rom <= x"18"; end case; elsif data_dl = '1' then case y_charz(3 downto 0) is when x"0" => data_rom <= x"00"; when x"1" => data_rom <= x"00"; when x"2" => data_rom <= x"00"; when x"3" => data_rom <= x"00"; when x"4" => data_rom <= x"00"; when x"5" => data_rom <= x"00"; when x"6" => data_rom <= x"00"; when x"7" => data_rom <= x"00"; when x"8" => data_rom <= x"00"; when x"9" => data_rom <= x"00"; when x"A" => data_rom <= x"00"; when x"B" => data_rom <= x"0F"; when x"C" => data_rom <= x"0F"; when x"D" => data_rom <= x"0C"; when x"E" => data_rom <= x"0C"; when others => data_rom <= x"0C"; end case; else data_rom <= x"00"; end if; end if; end process; g_rgb: for ii in 0 to 2 generate begin rgb(ii) <= data and color(ii); end generate; pr_sw_sel: process(clk, reset) is begin if reset = '0' then data <= '0'; elsif rising_edge(clk) then data <= data_rom(to_integer(unsigned(x_del))); end if; end process; end cl_borders;
mit
2e831e5ea277c4765f03cc09ae0a80df
0.485989
2.378489
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/ambatest/ahbtbm.vhd
1
14,241
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ahbtbm -- File: ahbtbm.vhd -- Author: Nils-Johan Wessman - Gaisler Research -- Description: AHB Testbench master ------------------------------------------------------------------------------ library IEEE; use IEEE.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; use work.ahbtbp.all; entity ahbtbm is generic ( hindex : integer := 0; hirq : integer := 0; venid : integer := VENDOR_GAISLER; devid : integer := 0; version : integer := 0; chprot : integer := 3; incaddr : integer := 0); port ( rst : in std_ulogic; clk : in std_ulogic; ctrli : in ahbtbm_ctrl_in_type; ctrlo : out ahbtbm_ctrl_out_type; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type ); end; architecture rtl of ahbtbm is constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( venid, devid, 0, version, 0), others => zero32); type reg_type is record -- new /* grant : std_logic; grant2 : std_logic; retry : std_logic_vector(1 downto 0); read : std_logic; -- indicate dbgl : integer; use128 : integer; hsize : std_logic_vector(2 downto 0); ac : ahbtbm_access_array_type; retryac : ahbtbm_access_type; curac : ahbtbm_access_type; haddr : std_logic_vector(31 downto 0); -- addr current access hdata : std_logic_vector(31 downto 0); -- data currnet access hdata128 : std_logic_vector(127 downto 0); -- data currnet access hwrite : std_logic; -- write current access hrdata : std_logic_vector(31 downto 0); hrdata128 : std_logic_vector(127 downto 0); status : ahbtbm_status_type; dvalid : std_logic; oldhtrans : std_logic_vector(1 downto 0); -- new */ start : std_ulogic; active : std_ulogic; end record; signal dmai : ahb_dma_in_type; signal dmao : ahb_dma_out_type; signal r, rin : reg_type; begin ctrlo.rst <= rst; ctrlo.clk <= clk; comb : process(ahbmi, ctrli, rst, r) -- new /* variable v : reg_type; variable update : std_logic; variable hbusreq : std_ulogic; -- bus request variable kblimit : std_logic; -- 1 kB limit indicator -- new */ variable ready : std_ulogic; variable retry : std_ulogic; variable mexc : std_ulogic; variable inc : std_logic_vector(3 downto 0); -- address increment variable haddr : std_logic_vector(31 downto 0); -- AHB address variable hwdata : std_logic_vector(31 downto 0); -- AHB write data variable htrans : std_logic_vector(1 downto 0); -- transfer type variable hwrite : std_ulogic; -- read/write variable hburst : std_logic_vector(2 downto 0); -- burst type variable newaddr : std_logic_vector(10 downto 0); -- next sequential address variable hprot : std_logic_vector(3 downto 0); -- transfer type variable xhirq : std_logic_vector(NAHBIRQ-1 downto 0); begin -- new /* v := r; update := '0'; hbusreq := '0';--v.retry := '0'; v.dvalid := '0'; xhirq := (others => '0'); hprot := "1110"; --v.hrdata := ahbmi.hrdata; --v.hrdata128 := ahbmi.hrdata128; v.hrdata := ahbmi.hrdata(31 downto 0); v.hrdata128 := ahbread4word(ahbmi.hrdata); -- pragma translate_off if ahbmi.hready = '1' and ahbmi.hresp = HRESP_ERROR then v.hrdata := (others => 'X'); v.hrdata128 := (others => 'X'); end if; -- pragma translate_on v.status.err := '0'; --v.oldhtrans := r.ac(1).htrans; kblimit := '0'; -- Sample grant when hready if ahbmi.hready = '1' then v.grant := ahbmi.hgrant(hindex); v.grant2 := r.grant; v.oldhtrans := r.ac(1).htrans; end if; -- 1k limit if (r.ac(0).htrans = HTRANS_SEQ and (r.ac(0).haddr(10) xor r.ac(1).haddr(10)) = '1') or (r.retryac.htrans = HTRANS_SEQ and (r.retryac.haddr(10) xor r.ac(1).haddr(10)) = '1' and r.retry = "10") then kblimit := '1'; end if; -- Read in new access --if ((ahbmi.hready = '1' and ahbmi.hresp = HRESP_OKAY and r.grant = '1') -- or r.ac(1).htrans = HTRANS_IDLE) and r.retry = '0' then --if ahbmi.hready = '1' and ((ahbmi.hresp = HRESP_OKAY and r.grant = '1') -- or r.ac(1).htrans = HTRANS_IDLE) and r.retry = "00" then if ahbmi.hready = '0' and (ahbmi.hresp = HRESP_RETRY or ahbmi.hresp = HRESP_SPLIT) and r.grant2 = '1' then if r.retry = "00" then v.retryac := r.ac(1); v.ac(1) := r.curac; v.ac(1).htrans := HTRANS_IDLE; v.ac(1).hburst := "000"; v.retry := "01"; elsif r.retry = "10" then v.ac(1) := r.retryac; if kblimit = '1' then v.ac(1).htrans := HTRANS_NONSEQ; end if; end if; elsif ahbmi.hready = '1' and ( r.grant = '1' or r.ac(1).htrans = HTRANS_IDLE) and r.retry = "00" then -- elsif ahbmi.hready = '1' and (( r.grant = '1' and -- (ahbmi.hresp = HRESP_OKAY or ahbmi.hresp = HRESP_ERROR)) -- or r.ac(1).htrans = HTRANS_IDLE) and r.retry = "00" then v.ac(1) := r.ac(0); v.ac(0) := ctrli.ac; v.curac := r.ac(1); v.hdata := r.ac(1).hdata; v.haddr := r.ac(1).haddr; v.hwrite := r.ac(1).hwrite; v.dbgl := r.ac(1).ctrl.dbgl; v.use128 := r.ac(1).ctrl.use128; if v.use128 = 0 then v.hdata128 := r.ac(1).hdata & r.ac(1).hdata & r.ac(1).hdata & r.ac(1).hdata; else v.hdata128 := r.ac(1).hdata128; end if; v.hsize := r.ac(1).hsize; v.read := (not r.ac(1).hwrite) and r.ac(1).htrans(1); update := '1'; if kblimit = '1' then v.ac(1).htrans := HTRANS_NONSEQ; end if; elsif ahbmi.hready = '0' and (ahbmi.hresp = HRESP_RETRY or ahbmi.hresp = HRESP_SPLIT) and r.grant2 = '1' then if r.retry = "00" then v.retryac := r.ac(1); v.ac(1) := r.curac; v.ac(1).htrans := HTRANS_IDLE; v.ac(1).hburst := "000"; v.retry := "01"; elsif r.retry = "10" then v.ac(1) := r.retryac; if kblimit = '1' then v.ac(1).htrans := HTRANS_NONSEQ; end if; end if; elsif r.retry = "01" then v.ac(1).htrans := HTRANS_NONSEQ; v.ac(1).hburst := r.curac.hburst; v.read := '0'; v.retry := "10"; elsif ahbmi.hready = '1' and r.grant = '1' and r.retry = "10" then v.read := (not r.ac(1).hwrite) and r.ac(1).htrans(1); --if ahbmi.hresp = HRESP_OKAY then --if ahbmi.hresp = HRESP_OKAY or ahbmi.hresp = HRESP_ERROR then v.ac(1) := r.retryac; if kblimit = '1' then v.ac(1).htrans := HTRANS_NONSEQ; end if; v.retry := "00"; --end if; end if; -- NONSEQ in retry --if r.retry = '1' then v.ac(1).htrans := HTRANS_NONSEQ; end if; -- NONSEQ if burst is interrupted if r.grant = '0' and r.ac(1).htrans = HTRANS_SEQ then v.ac(1).htrans := HTRANS_NONSEQ; end if; --if r.ac(1).htrans /= HTRANS_IDLE or r.ac(0).htrans /= HTRANS_IDLE then -- hbusreq := '1'; --end if; if r.ac(1).htrans = HTRANS_NONSEQ or (r.ac(1).htrans = HTRANS_SEQ and r.ac(0).htrans /= HTRANS_NONSEQ and kblimit = '0') then hbusreq := '1'; end if; --if r.grant = '0' then -- fix dvalid if grant deasserted *** ??? if r.grant = '0' and ahbmi.hready = '1' then v.read := '0'; end if; -- Check read data if r.read = '1' and ahbmi.hresp = HRESP_OKAY and ahbmi.hready = '1' then v.dvalid := '1'; if r.use128 = 0 then --if r.hdata /= ahbmi.hrdata then if r.hdata /= ahbmi.hrdata(31 downto 0) then v.status.err := '1'; end if; else if r.hsize = "100" then --if r.hdata128 /= ahbmi.hrdata128 then if r.hdata128 /= ahbread4word(ahbmi.hrdata) then v.status.err := '1'; end if; else --if r.hdata128(63 downto 0) /= ahbmi.hrdata128(63 downto 0) then --if r.hdata128(63 downto 0) /= ahbmi.hrdata(63 downto 0) then if r.hdata128(63 downto 0) /= ahbreaddword(ahbmi.hrdata) then v.status.err := '1'; end if; end if; end if; elsif r.read = '1' and ahbmi.hresp = HRESP_ERROR and ahbmi.hready = '1' then v.status.err := '1'; end if; -- new */ if rst = '0' then v.ac(0).htrans := (others => '0'); v.ac(1).htrans := (others => '0'); v.retry := (others => '0'); v.read := '0'; v.ac(1).haddr := (others => '0'); v.ac(1).htrans := (others => '0'); v.ac(1).hwrite := '0'; v.ac(1).hsize := (others => '0'); v.ac(1).hburst := (others =>'0'); end if; rin <= v; ctrlo.update <= update; ctrlo.status <= r.status; ctrlo.hrdata <= r.hrdata; ctrlo.hrdata128 <= r.hrdata128; ctrlo.dvalid <= r.dvalid; ahbmo.haddr <= r.ac(1).haddr; ahbmo.htrans <= r.ac(1).htrans; ahbmo.hbusreq <= hbusreq; --ahbmo.hwdata <= r.hdata; --ahbmo.hwdata128 <= r.hdata128; ahbmo.hwdata <= ahbdrivedata(r.hdata128); ahbmo.hconfig <= hconfig; ahbmo.hlock <= '0'; ahbmo.hwrite <= r.ac(1).hwrite; ahbmo.hsize <= r.ac(1).hsize; ahbmo.hburst <= r.ac(1).hburst; ahbmo.hprot <= r.ac(1).hprot; ahbmo.hirq <= xhirq; ahbmo.hindex <= hindex; end process; regs : process(clk) begin if rising_edge(clk) then r <= rin; -- pragma translate_off if r.read = '1' and ahbmi.hready = '1' then --and r.oldhtrans /= HTRANS_IDLE then if ahbmi.hresp = HRESP_OKAY then if rin.status.err = '0' then if r.dbgl >= 2 then if r.use128 = 0 then print(ptime & "Read[" & tost(r.haddr) & "]: " & tost(ahbmi.hrdata(31 downto 0))); else if r.hsize = "100" then print(ptime & "Read[" & tost(r.haddr) & "]: " & tost(ahbmi.hrdata)); else print(ptime & "Read[" & tost(r.haddr) & "]: " & tost(ahbreaddword(ahbmi.hrdata))); end if; end if; end if; else if r.dbgl >= 1 then if r.use128 = 0 then print(ptime & "Read[" & tost(r.haddr) & "]: " & tost(ahbmi.hrdata(31 downto 0)) & " != " & tost(r.hdata)); else if r.hsize = "100" then print(ptime & "Read[" & tost(r.haddr) & "]: " & tost(ahbmi.hrdata) & " != " & tost(r.hdata128)); else print(ptime & "Read[" & tost(r.haddr) & "]: " & tost(ahbreaddword(ahbmi.hrdata)) & " != " & tost(r.hdata128(63 downto 0))); end if; end if; end if; end if; elsif ahbmi.hresp = HRESP_RETRY then if r.dbgl >= 3 then print(ptime & "Read[" & tost(r.haddr) & "]: [RETRY]"); end if; elsif ahbmi.hresp = HRESP_SPLIT then if r.dbgl >= 3 then print(ptime & "Read[" & tost(r.haddr) & "]: [SPLIT]"); end if; elsif ahbmi.hresp = HRESP_ERROR then if r.dbgl >= 1 then print(ptime & "Read[" & tost(r.haddr) & "]: [ERROR]"); end if; end if; end if; if r.hwrite = '1' and ahbmi.hready = '1' and r.oldhtrans /= HTRANS_IDLE then if ahbmi.hresp = HRESP_OKAY then if r.dbgl >= 2 then if r.use128 = 0 then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata)); else if r.hsize = "100" then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata128)); else print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata128(63 downto 0))); end if; end if; end if; elsif ahbmi.hresp = HRESP_RETRY then if r.dbgl >= 3 then if r.use128 = 0 then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata) & " [RETRY]"); else if r.hsize = "100" then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata128) & " [RETRY]"); else print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata128(63 downto 0)) & " [RETRY]"); end if; end if; end if; elsif ahbmi.hresp = HRESP_SPLIT then if r.dbgl >= 3 then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata) & " [SPLIT]"); end if; elsif ahbmi.hresp = HRESP_SPLIT then if r.dbgl >= 3 then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata) & " [SPLIT]"); end if; elsif ahbmi.hresp = HRESP_ERROR then if r.dbgl >= 1 then if r.use128 = 0 then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata) & " [ERROR]"); else if r.hsize = "100" then print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata128) & " [ERROR]"); else print(ptime & "Write[" & tost(r.haddr) & "]: " & tost(r.hdata128(63 downto 0)) & " [ERROR]"); end if; end if; end if; end if; end if; -- pragma translate_on end if; end process; end;
gpl-2.0
9b0b197082f240a6c045d823aeaa6e68
0.533811
3.301113
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/alltap.vhd
1
12,059
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: alltap -- File: alltap.vhd -- Author: Edvin Catovic - Gaisler Research -- Description: JTAG Test Access Port (TAP) Controller component declaration ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; package alltap is component tap_gen generic ( irlen : integer range 2 to 8 := 2; idcode : integer range 0 to 255 := 9; manf : integer range 0 to 2047 := 804; part : integer range 0 to 65535 := 0; ver : integer range 0 to 15 := 0; trsten : integer range 0 to 1 := 1; scantest : integer := 0; oepol : integer := 1); port ( trst : in std_ulogic; tckp : in std_ulogic; tckn : in std_ulogic; tms : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; tapi_en1 : in std_ulogic; tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0); tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic; tapo_ninst : out std_logic_vector(7 downto 0); tapo_iupd : out std_ulogic; testen : in std_ulogic := '0'; testrst : in std_ulogic := '1'; testoen : in std_ulogic := '0'; tdoen : out std_ulogic ); end component; component virtex_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component virtex2_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component virtex4_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component virtex5_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component spartan3_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component altera_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0); tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component fusion_tap port ( tck : in std_ulogic; tms : in std_ulogic; tdi : in std_ulogic; trst : in std_ulogic; tdo : out std_ulogic; tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapi_en1 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0) ); end component; component proasic3_tap port ( tck : in std_ulogic; tms : in std_ulogic; tdi : in std_ulogic; trst : in std_ulogic; tdo : out std_ulogic; tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapi_en1 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0) ); end component; component proasic3e_tap port ( tck : in std_ulogic; tms : in std_ulogic; tdi : in std_ulogic; trst : in std_ulogic; tdo : out std_ulogic; tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapi_en1 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0) ); end component; component proasic3l_tap port ( tck : in std_ulogic; tms : in std_ulogic; tdi : in std_ulogic; trst : in std_ulogic; tdo : out std_ulogic; tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapi_en1 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_inst : out std_logic_vector(7 downto 0) ); end component; component virtex6_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component spartan6_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component virtex7_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component kintex7_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component artix7_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; component zynq_tap port ( tapi_tdo1 : in std_ulogic; tapi_tdo2 : in std_ulogic; tapo_tck : out std_ulogic; tapo_tdi : out std_ulogic; tapo_rst : out std_ulogic; tapo_capt : out std_ulogic; tapo_shft : out std_ulogic; tapo_upd : out std_ulogic; tapo_xsel1 : out std_ulogic; tapo_xsel2 : out std_ulogic ); end component; ------------------------------------------------------------------------------- component scanregi_inf generic ( intesten : integer := 1 ); port ( pad : in std_ulogic; core : out std_ulogic; tck : in std_ulogic; tckn : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; bsshft : in std_ulogic; bscapt : in std_ulogic; -- capture signal to scan reg on next tck edge bsupd : in std_ulogic; -- update data reg from scan reg on next tck edge bsdrive : in std_ulogic; -- drive data reg to core bshighz : in std_ulogic ); end component; component scanrego_inf port ( pad : out std_ulogic; core : in std_ulogic; samp : in std_ulogic; -- normally same as core unless outpad has feedback tck : in std_ulogic; tckn : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; bsshft : in std_ulogic; bscapt : in std_ulogic; -- capture signal to scan reg on next tck edge bsupd : in std_ulogic; -- update data reg from scan reg on next tck edge bsdrive : in std_ulogic -- drive data reg to pad ); end component; component scanregio_inf -- 3 scan registers: tdo<--input<--output<--outputen<--tdi generic ( hzsup : integer range 0 to 1 := 1; intesten: integer := 1 ); port ( pado : out std_ulogic; padoen : out std_ulogic; padi : in std_ulogic; coreo : in std_ulogic; coreoen : in std_ulogic; corei : out std_ulogic; tck : in std_ulogic; tckn : in std_ulogic; tdi : in std_ulogic; tdo : out std_ulogic; bsshft : in std_ulogic; bscapt : in std_ulogic; -- capture signals to scan regs on next tck edge bsupdi : in std_ulogic; -- update indata reg from scan reg on next tck edge bsupdo : in std_ulogic; -- update outdata reg from scan reg on next tck edge bsdrive : in std_ulogic; -- drive outdata regs to pad, -- drive datareg(coreoen=0) or coreo(coreoen=1) to corei bshighz : in std_ulogic ); end component; end;
gpl-2.0
d36d262029271dc20604de2d4109be1a
0.560577
3.414213
false
false
false
false
Yuriu5/MiniBlaze
src/hw1/general_purpose_register_bank.vhd
1
3,640
-- ********************************************************************************** -- Project : MiniBlaze -- Author : Benjamin Lemoine -- Module : general_purpose_register_bank -- Date : 07/07/2016 -- -- Description : Bank of 32 general purpose registers -- -- -------------------------------------------------------------------------------- -- Modifications -- -------------------------------------------------------------------------------- -- Date : Ver. : Author : Modification comments -- -------------------------------------------------------------------------------- -- : : : -- 25/07/2016 : 1.0 : B.Lemoine : First draft -- : : : -- ********************************************************************************** -- MIT License -- -- Copyright (c) 07/07/2016, Benjamin Lemoine -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -- ********************************************************************************** library ieee; use ieee.std_logic_1164.all; entity general_purpose_register_bank is generic( D_WIDTH : natural := 32 ); port( clk : in std_logic; addr_i : in std_logic_vector(4 downto 0); data_i : in std_logic_vector(D_WIDTH-1 downto 0); wr_i : in std_logic; data_o : in std_logic_vector(D_WIDTH-1 downto 0); ); )end general_purpose_register_bank; architecture rtl of general_purpose_register_bank is -- Component declaration -- ----------------------- component ram_single_port is generic ( ADDR_WIDTH : integer := 15; DATA_WIDTH : integer := 32 ); port ( clk : in std_logic; we : in std_logic; addr : in std_logic_vector(ADDR_WIDTH-1 downto 0); di : in std_logic_vector(NB_COL*COL_WIDTH-1 downto 0); do : out std_logic_vector(NB_COL*COL_WIDTH-1 downto 0) ); end component; -- Signal declaration -- ----------------------- signal s_wr_en_filt : std_logic := '0'; begin -- R0 : Always has a value of zero. Anything written to R0 is discarded s_wr_en_filt <= '0' when addr_i = (others => '0') else wr_i; i_reg32 : ram_single_port generic map( ADDR_WIDTH => 4, DATA_WIDTH => D_WIDTH, ) port map( clk => clk, we => s_wr_en_filt, addr => addr_i, di => data_i, do => data_o ); end rtl;
mit
002810f6d82743c8cb3dcf656cfad1a1
0.505769
4.212963
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep2sgx90-av/sram32.vhd
1
2,686
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: sram32 -- File: sram32.vhd -- Author: Jiri Gaisler Gaisler Research -- Description: Simulation model of generic 32-bit async SRAM ------------------------------------------------------------------------------ -- pragma translate_off library ieee; use ieee.std_logic_1164.all; use std.textio.all; library gaisler; use gaisler.sim.all; library grlib; use grlib.stdlib.all; entity sram32 is generic ( index : integer := 0; -- Byte lane (0 - 3) abits: Positive := 10; -- Default 10 address bits (1Kx32) echk : integer := 0; -- Generate EDAC checksum tacc : integer := 10; -- access time (ns) fname : string := "ram.dat"); -- File to read from port ( a : in std_logic_vector(abits-1 downto 0); d : inout std_logic_vector(31 downto 0); lb : in std_logic; ub : in std_logic; ce : in std_logic; we : in std_ulogic; oe : in std_ulogic); end; architecture sim of sram32 is signal cex : std_logic_vector(0 to 1); begin cex(0) <= ce or lb; cex(1) <= ce or ub; sr0 : sram generic map (index+3, abits, tacc, fname) port map (a, d(7 downto 0), cex(0), we, oe); sr1 : sram generic map (index+2, abits, tacc, fname) port map (a, d(15 downto 8), cex(1), we, oe); sr2 : sram generic map (index+1, abits, tacc, fname) port map (a, d(23 downto 16), cex(1), we, oe); sr3 : sram generic map (index, abits, tacc, fname) port map (a, d(31 downto 24), cex(1), we, oe); end sim; -- pragma translate_on
gpl-2.0
036e24a6157d534044f4ba8469909a3a
0.592703
3.709945
false
false
false
false
Luisda199824/ProcesadorMonociclo
InstructionMemory.vhd
1
1,192
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; use std.textio.all; entity instructionMemory is Port ( address : in STD_LOGIC_VECTOR (31 downto 0); rst : in STD_LOGIC; outInstruction : out STD_LOGIC_VECTOR (31 downto 0)); end instructionMemory; architecture arqInstructionMemory of instructionMemory is type rom_type is array (0 to 31) of std_logic_vector (31 downto 0); impure function InitRomFromFile (RomFileName : in string) return rom_type is FILE RomFile : text open read_mode is RomFileName; variable RomFileLine : line; variable temp_bv : bit_vector(31 downto 0); variable temp_mem : rom_type; begin for I in rom_type'range loop readline (RomFile, RomFileLine); read(RomFileLine, temp_bv); temp_mem(i) := to_stdlogicvector(temp_bv); end loop; return temp_mem; end function; signal instructions : rom_type := InitRomFromFile("codigo4.data"); begin process(rst,address, instructions) begin if(rst = '1')then outInstruction <= (others=>'0'); else outInstruction <= instructions(conv_integer(address(5 downto 0))); end if; end process; end arqInstructionMemory;
mit
d780b6264d5a4afb91c6b3611a22ff93
0.703859
3.445087
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/srmmu/mmulrue.vhd
1
3,267
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: mmulrue -- File: mmulrue.vhd -- Author: Konrad Eisele, Jiri Gaisler, Gaisler Research -- Description: MMU LRU logic ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.config_types.all; use grlib.config.all; use grlib.amba.all; use grlib.stdlib.all; library gaisler; use gaisler.mmuconfig.all; use gaisler.mmuiface.all; entity mmulrue is generic ( position : integer; entries : integer := 8 ); port ( rst : in std_logic; clk : in std_logic; lruei : in mmulrue_in_type; lrueo : out mmulrue_out_type ); end mmulrue; architecture rtl of mmulrue is constant entries_log : integer := log2(entries); type lru_rtype is record pos : std_logic_vector(entries_log-1 downto 0); movetop : std_logic; end record; constant RESET_ALL : boolean := GRLIB_CONFIG_ARRAY(grlib_sync_reset_enable_all) = 1; signal c,r : lru_rtype; begin p0: process (rst, r, lruei) variable v : lru_rtype; variable ov : mmulrue_out_type; begin v := r; ov := mmulrue_out_none; -- #init if (r.movetop) = '1' then if (lruei.fromleft) = '0' then v.pos := lruei.left(entries_log-1 downto 0); v.movetop := '0'; end if; elsif (lruei.fromright) = '1' then v.pos := lruei.right(entries_log-1 downto 0); v.movetop := not lruei.clear; end if; if (lruei.touch and not lruei.clear) = '1' then -- touch request if (v.pos = lruei.pos(entries_log-1 downto 0)) then -- check v.movetop := '1'; end if; end if; if ((not RESET_ALL) and (rst = '0')) or (lruei.flush = '1') then v.pos := conv_std_logic_vector(position, entries_log); v.movetop := '0'; end if; --# Drive signals ov.pos(entries_log-1 downto 0) := r.pos; ov.movetop := r.movetop; lrueo <= ov; c <= v; end process p0; p1: process (clk) begin if rising_edge(clk) then r <= c; if RESET_ALL and (rst = '0') then r.pos <= conv_std_logic_vector(position, entries_log); r.movetop <= '0'; end if; end if; end process p1; end rtl;
gpl-2.0
b4c76e68ed2d0b977e8a0b6eb49a32c0
0.588919
3.621951
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/stratixiii/clkgen_stratixiii.vhd
1
7,215
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; -- pragma translate_off library altera_mf; use altera_mf.altpll; -- pragma translate_on entity stratix3_pll is generic ( clk_mul : integer := 1; clk_div : integer := 1; clk_freq : integer := 25000; clk2xen : integer := 0; sdramen : integer := 0 ); port ( inclk0 : in std_ulogic; c0 : out std_ulogic; c0_2x : out std_ulogic; e0 : out std_ulogic; locked : out std_ulogic ); end; architecture rtl of stratix3_pll is component altpll generic ( intended_device_family : string := "Stratix III" ; operation_mode : string := "NORMAL" ; compensate_clock : string := "CLK0"; inclk0_input_frequency : positive; width_clock : positive := 10; clk0_multiply_by : positive := 1; clk0_divide_by : positive := 1; clk1_multiply_by : positive := 1; clk1_divide_by : positive := 1; clk2_multiply_by : positive := 1; clk2_divide_by : positive := 1 ); port ( inclk : in std_logic_vector(1 downto 0); clkena : in std_logic_vector(5 downto 0); clk : out std_logic_vector(width_clock-1 downto 0); locked : out std_logic ); end component; signal clkena : std_logic_vector (5 downto 0); signal clkout : std_logic_vector (9 downto 0); signal inclk : std_logic_vector (1 downto 0); signal fb : std_logic; constant clk_period : integer := 1000000000/clk_freq; constant CLK_MUL2X : integer := clk_mul * 2; begin clkena(5 downto 3) <= (others => '0'); clkena(0) <= '1'; clkena(1) <= '1' when sdramen = 1 else '0'; clkena(2) <= '1' when clk2xen = 1 else '0'; inclk <= '0' & inclk0; c0 <= clkout(0); c0_2x <= clkout(2); e0 <= clkout(1); sden : if sdramen = 1 generate altpll0 : altpll generic map ( intended_device_family => "Stratix III", --operation_mode => "ZERO_DELAY_BUFFER", inclk0_input_frequency => clk_period, operation_mode => "NORMAL", inclk0_input_frequency => clk_period, width_clock => 10, compensate_clock => "CLK1", clk0_multiply_by => clk_mul, clk0_divide_by => clk_div, clk1_multiply_by => clk_mul, clk1_divide_by => clk_div, clk2_multiply_by => CLK_MUL2X, clk2_divide_by => clk_div) port map ( clkena => clkena, inclk => inclk, clk => clkout, locked => locked); end generate; nosd : if sdramen = 0 generate altpll0 : altpll generic map ( intended_device_family => "Stratix III", operation_mode => "NORMAL", inclk0_input_frequency => clk_period, width_clock => 10, clk0_multiply_by => clk_mul, clk0_divide_by => clk_div, clk1_multiply_by => clk_mul, clk1_divide_by => clk_div, clk2_multiply_by => CLK_MUL2X, clk2_divide_by => clk_div) port map ( clkena => clkena, inclk => inclk, clk => clkout, locked => locked); end generate; end; library ieee; use ieee.std_logic_1164.all; -- pragma translate_off library altera_mf; library grlib; use grlib.stdlib.all; -- pragma translate_on library techmap; use techmap.gencomp.all; entity clkgen_stratixiii is generic ( clk_mul : integer := 1; clk_div : integer := 1; sdramen : integer := 0; sdinvclk : integer := 0; pcien : integer := 0; pcidll : integer := 0; pcisysclk: integer := 0; freq : integer := 25000; clk2xen : integer := 0; tech : integer := 0); port ( clkin : in std_logic; pciclkin: in std_logic; clk : out std_logic; -- main clock clkn : out std_logic; -- inverted main clock clk2x : out std_logic; -- double clock sdclk : out std_logic; -- SDRAM clock pciclk : out std_logic; -- PCI clock cgi : in clkgen_in_type; cgo : out clkgen_out_type); end; architecture rtl of clkgen_stratixiii is constant VERSION : integer := 1; constant CLKIN_PERIOD : integer := 20; signal clk_i : std_logic; signal clkint, pciclkint : std_logic; signal pllclk, pllclkn : std_logic; -- generated clocks signal s_clk : std_logic; component stratix3_pll generic ( clk_mul : integer := 1; clk_div : integer := 1; clk_freq : integer := 25000; clk2xen : integer := 0; sdramen : integer := 0 ); port ( inclk0 : in std_ulogic; c0 : out std_ulogic; c0_2x : out std_ulogic; e0 : out std_ulogic; locked : out std_ulogic); end component; begin cgo.pcilock <= '1'; -- c0 : if (PCISYSCLK = 0) generate -- Clkint <= Clkin; -- end generate; -- c1 : if (PCISYSCLK = 1) generate -- Clkint <= pciclkin; -- end generate; -- c2 : if (PCIEN = 1) generate -- p0 : if (PCIDLL = 1) generate -- pciclkint <= pciclkin; -- pciclk <= pciclkint; -- end generate; -- p1 : if (PCIDLL = 0) generate -- u0 : if (PCISYSCLK = 0) generate -- pciclkint <= pciclkin; -- end generate; -- pciclk <= clk_i when (PCISYSCLK = 1) else pciclkint; -- end generate; -- end generate; -- c3 : if (PCIEN = 0) generate -- pciclk <= Clkint; -- end generate; c0: if (PCISYSCLK = 0) or (PCIEN = 0) generate clkint <= clkin; end generate c0; c1: if PCIEN /= 0 generate d0: if PCISYSCLK = 1 generate clkint <= pciclkin; end generate d0; pciclk <= pciclkin; end generate c1; c2: if PCIEN = 0 generate pciclk <= '0'; end generate c2; sdclk_pll : stratix3_pll generic map (clk_mul, clk_div, freq, clk2xen, sdramen) port map ( inclk0 => clkint, e0 => sdclk, c0 => s_clk, c0_2x => clk2x, locked => cgo.clklock); clk <= s_clk; clkn <= not s_clk; -- pragma translate_off bootmsg : report_version generic map ( "clkgen_stratixiii" & ": altpll sdram/pci clock generator, version " & tost(VERSION), "clkgen_stratixiii" & ": Frequency " & tost(freq) & " KHz, PLL scaler " & tost(clk_mul) & "/" & tost(clk_div)); -- pragma translate_on end;
gpl-2.0
9306d74677c10ce4b4ee35a58eb7800f
0.585447
3.492256
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_sg_v4_1/0535f152/hdl/src/vhdl/axi_sg_ftch_cmdsts_if.vhd
5
13,180
-- ************************************************************************* -- -- (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_cmdsts_if.vhd -- Description: This entity is the descriptor fetch command and status inteface -- for the Scatter Gather Engine AXI DataMover. -- -- 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; use axi_sg_v4_1.axi_sg_pkg.all; ------------------------------------------------------------------------------- entity axi_sg_ftch_cmdsts_if 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 ); port ( ----------------------------------------------------------------------- -- AXI Scatter Gather Interface ----------------------------------------------------------------------- m_axi_sg_aclk : in std_logic ; -- m_axi_sg_aresetn : in std_logic ; -- -- -- Fetch command write interface from fetch sm -- ftch_cmnd_wr : in std_logic ; -- ftch_cmnd_data : in std_logic_vector -- ((C_M_AXI_SG_ADDR_WIDTH+CMD_BASE_WIDTH)-1 downto 0); -- -- -- User Command Interface Ports (AXI Stream) -- s_axis_ftch_cmd_tvalid : out std_logic ; -- s_axis_ftch_cmd_tready : in std_logic ; -- s_axis_ftch_cmd_tdata : out std_logic_vector -- ((C_M_AXI_SG_ADDR_WIDTH+CMD_BASE_WIDTH)-1 downto 0); -- -- -- Read response for detecting slverr, decerr early -- m_axi_sg_rresp : in std_logic_vector(1 downto 0) ; -- m_axi_sg_rvalid : in std_logic ; -- -- -- User Status Interface Ports (AXI Stream) -- m_axis_ftch_sts_tvalid : in std_logic ; -- m_axis_ftch_sts_tready : out std_logic ; -- m_axis_ftch_sts_tdata : in std_logic_vector(7 downto 0) ; -- m_axis_ftch_sts_tkeep : in std_logic_vector(0 downto 0) ; -- -- -- Scatter Gather Fetch Status -- mm2s_err : in std_logic ; -- ftch_done : out std_logic ; -- ftch_error : out std_logic ; -- ftch_interr : out std_logic ; -- ftch_slverr : out std_logic ; -- ftch_decerr : out std_logic ; -- ftch_error_early : out std_logic -- ); end axi_sg_ftch_cmdsts_if; ------------------------------------------------------------------------------- -- Architecture ------------------------------------------------------------------------------- architecture implementation of axi_sg_ftch_cmdsts_if is attribute DowngradeIPIdentifiedWarnings: string; attribute DowngradeIPIdentifiedWarnings of implementation : architecture is "yes"; ------------------------------------------------------------------------------- -- Functions ------------------------------------------------------------------------------- -- No Functions Declared ------------------------------------------------------------------------------- -- Constants Declarations ------------------------------------------------------------------------------- -- No Constants Declared ------------------------------------------------------------------------------- -- Signal / Type Declarations ------------------------------------------------------------------------------- signal ftch_slverr_i : std_logic := '0'; signal ftch_decerr_i : std_logic := '0'; signal ftch_interr_i : std_logic := '0'; signal mm2s_error : std_logic := '0'; signal sg_rresp : std_logic_vector(1 downto 0) := (others => '0'); signal sg_rvalid : std_logic := '0'; ------------------------------------------------------------------------------- -- Begin architecture logic ------------------------------------------------------------------------------- begin ftch_slverr <= ftch_slverr_i; ftch_decerr <= ftch_decerr_i; ftch_interr <= ftch_interr_i; ------------------------------------------------------------------------------- -- DataMover Command Interface ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- When command by fetch sm, drive descriptor fetch command to data mover. -- Hold until data mover indicates ready. ------------------------------------------------------------------------------- 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 s_axis_ftch_cmd_tvalid <= '0'; -- s_axis_ftch_cmd_tdata <= (others => '0'); elsif(ftch_cmnd_wr = '1')then s_axis_ftch_cmd_tvalid <= '1'; -- s_axis_ftch_cmd_tdata <= ftch_cmnd_data; elsif(s_axis_ftch_cmd_tready = '1')then s_axis_ftch_cmd_tvalid <= '0'; -- s_axis_ftch_cmd_tdata <= (others => '0'); end if; end if; end process GEN_DATAMOVER_CMND; s_axis_ftch_cmd_tdata <= ftch_cmnd_data; ------------------------------------------------------------------------------- -- DataMover Status Interface ------------------------------------------------------------------------------- -- Drive ready low during reset to indicate not ready REG_STS_READY : 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 m_axis_ftch_sts_tready <= '0'; else m_axis_ftch_sts_tready <= '1'; end if; end if; end process REG_STS_READY; ------------------------------------------------------------------------------- -- Log status bits out of data mover. ------------------------------------------------------------------------------- DATAMOVER_STS : 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_done <= '0'; ftch_slverr_i <= '0'; ftch_decerr_i <= '0'; ftch_interr_i <= '0'; -- Status valid, therefore capture status elsif(m_axis_ftch_sts_tvalid = '1')then ftch_done <= m_axis_ftch_sts_tdata(DATAMOVER_STS_CMDDONE_BIT); ftch_slverr_i <= m_axis_ftch_sts_tdata(DATAMOVER_STS_SLVERR_BIT); ftch_decerr_i <= m_axis_ftch_sts_tdata(DATAMOVER_STS_DECERR_BIT); ftch_interr_i <= m_axis_ftch_sts_tdata(DATAMOVER_STS_INTERR_BIT); -- Only assert when valid else ftch_done <= '0'; ftch_slverr_i <= '0'; ftch_decerr_i <= '0'; ftch_interr_i <= '0'; end if; end if; end process DATAMOVER_STS; ------------------------------------------------------------------------------- -- Early SlvErr and DecErr detections -- Early detection primarily required for non-queue mode because fetched desc -- is immediatle fed to DMA controller. Status from SG Datamover arrives -- too late to stop the insuing transfer on fetch error ------------------------------------------------------------------------------- REG_MM_RD_SIGNALS : 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 sg_rresp <= (others => '0'); sg_rvalid <= '0'; else sg_rresp <= m_axi_sg_rresp; sg_rvalid <= m_axi_sg_rvalid; end if; end if; end process REG_MM_RD_SIGNALS; REG_ERLY_FTCH_ERROR : 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_early <= '0'; elsif(sg_rvalid = '1' and (sg_rresp = SLVERR_RESP or sg_rresp = DECERR_RESP))then ftch_error_early <= '1'; end if; end if; end process REG_ERLY_FTCH_ERROR; ------------------------------------------------------------------------------- -- Register global error from data mover. ------------------------------------------------------------------------------- mm2s_error <= ftch_slverr_i or ftch_decerr_i or ftch_interr_i; -- Log errors into a global error output FETCH_ERROR_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')then ftch_error <= '0'; elsif(mm2s_error = '1')then ftch_error <= '1'; end if; end if; end process FETCH_ERROR_PROCESS; end implementation;
gpl-3.0
79053286153a0a65705abc80e921e33d
0.42003
4.960482
false
false
false
false
Luisda199824/ProcesadorMonociclo
TB_registerFile.vhd
1
1,848
LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY TB_registerFile IS END TB_registerFile; ARCHITECTURE behavior OF TB_registerFile IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT registerFile PORT( rs1 : IN std_logic_vector(4 downto 0); rs2 : IN std_logic_vector(4 downto 0); rd : IN std_logic_vector(4 downto 0); rst : IN std_logic; dataToWrite : IN std_logic_vector(31 downto 0); CRs1 : OUT std_logic_vector(31 downto 0); CRs2 : OUT std_logic_vector(31 downto 0) ); END COMPONENT; --Inputs signal rs1 : std_logic_vector(4 downto 0) := (others => '0'); signal rs2 : std_logic_vector(4 downto 0) := (others => '0'); signal rd : std_logic_vector(4 downto 0) := (others => '0'); signal rst : std_logic := '0'; signal dataToWrite : std_logic_vector(31 downto 0) := (others => '0'); --Outputs signal CRs1 : std_logic_vector(31 downto 0); signal CRs2 : std_logic_vector(31 downto 0); BEGIN -- Instantiate the Unit Under Test (UUT) uut: registerFile PORT MAP ( rs1 => rs1, rs2 => rs2, rd => rd, rst => rst, dataToWrite => dataToWrite, CRs1 => CRs1, CRs2 => CRs2 ); -- Stimulus process stim_proc: process begin rs1 <= "00000"; rs2 <= "00001"; rd <= "00000"; dataToWrite <= x"00000001"; wait for 20 ns; rd <= "00001"; wait for 20 ns; dataToWrite <= x"00000002"; rd <= "00010"; wait for 20 ns; dataToWrite <= x"00000003"; rd <= "00100"; wait for 20 ns; rd <= "00000"; rs1 <= "00001"; rs2 <= "00010"; wait for 40 ns; rs1 <= "00100"; rs2 <= "00001"; wait for 40 ns; rs1 <= "00000"; rs2 <= "00000"; wait; end process; END;
mit
55e39fbca06759ada197c9c11a517c74
0.570887
3.197232
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/eth/comp/ethcomp.vhd
1
19,635
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; package ethcomp is component grethc is generic( ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; mdcscaler : integer range 0 to 255 := 25; enable_mdio : integer range 0 to 1 := 0; fifosize : integer range 4 to 512 := 8; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 32 := 0; rmii : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; edclsepahbg : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0; mdiohold : integer := 1; maxsize : integer ); port( rst : in std_ulogic; clk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --edcl ahb mst in ehgrant : in std_ulogic; ehready : in std_ulogic; ehresp : in std_logic_vector(1 downto 0); ehrdata : in std_logic_vector(31 downto 0); --edcl ahb mst out ehbusreq : out std_ulogic; ehlock : out std_ulogic; ehtrans : out std_logic_vector(1 downto 0); ehaddr : out std_logic_vector(31 downto 0); ehwrite : out std_ulogic; ehsize : out std_logic_vector(2 downto 0); ehburst : out std_logic_vector(2 downto 0); ehprot : out std_logic_vector(3 downto 0); ehwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --irq irq : out std_logic; --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(10 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(10 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(10 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(10 downto 0); txrdata : in std_logic_vector(31 downto 0); --edcl buf erenable : out std_ulogic; eraddress : out std_logic_vector(15 downto 0); ewritem : out std_ulogic; ewritel : out std_ulogic; ewaddressm : out std_logic_vector(15 downto 0); ewaddressl : out std_logic_vector(15 downto 0); ewdata : out std_logic_vector(31 downto 0); erdata : in std_logic_vector(31 downto 0); --ethernet input signals rmii_clk : in std_ulogic; tx_clk : in std_ulogic; rx_clk : in std_ulogic; rxd : in std_logic_vector(3 downto 0); rx_dv : in std_ulogic; rx_er : in std_ulogic; rx_col : in std_ulogic; rx_crs : in std_ulogic; mdio_i : in std_ulogic; phyrstaddr : in std_logic_vector(4 downto 0); mdint : in std_ulogic; --ethernet output signals reset : out std_ulogic; txd : out std_logic_vector(3 downto 0); tx_en : out std_ulogic; tx_er : out std_ulogic; mdc : out std_ulogic; mdio_o : out std_ulogic; mdio_oe : out std_ulogic; --scantest testrst : in std_ulogic; testen : in std_ulogic; testoen : in std_ulogic; edcladdr : in std_logic_vector(3 downto 0) := "0000"; edclsepahb : in std_ulogic; edcldisable : in std_ulogic; speed : out std_ulogic ); end component; component greth_gbitc is generic( ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; slot_time : integer := 128; mdcscaler : integer range 0 to 255 := 25; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; burstlength : integer range 4 to 128 := 32; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 32 := 0; sim : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; edclsepahbg : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0; mdiohold : integer := 1); port( rst : in std_ulogic; clk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --edcl ahb mst in ehgrant : in std_ulogic; ehready : in std_ulogic; ehresp : in std_logic_vector(1 downto 0); ehrdata : in std_logic_vector(31 downto 0); --edcl ahb mst out ehbusreq : out std_ulogic; ehlock : out std_ulogic; ehtrans : out std_logic_vector(1 downto 0); ehaddr : out std_logic_vector(31 downto 0); ehwrite : out std_ulogic; ehsize : out std_logic_vector(2 downto 0); ehburst : out std_logic_vector(2 downto 0); ehprot : out std_logic_vector(3 downto 0); ehwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --irq irq : out std_logic; --rx ahb fifo rxrenable : out std_ulogic; rxraddress : out std_logic_vector(8 downto 0); rxwrite : out std_ulogic; rxwdata : out std_logic_vector(31 downto 0); rxwaddress : out std_logic_vector(8 downto 0); rxrdata : in std_logic_vector(31 downto 0); --tx ahb fifo txrenable : out std_ulogic; txraddress : out std_logic_vector(8 downto 0); txwrite : out std_ulogic; txwdata : out std_logic_vector(31 downto 0); txwaddress : out std_logic_vector(8 downto 0); txrdata : in std_logic_vector(31 downto 0); --edcl buf erenable : out std_ulogic; eraddress : out std_logic_vector(15 downto 0); ewritem : out std_ulogic; ewritel : out std_ulogic; ewaddressm : out std_logic_vector(15 downto 0); ewaddressl : out std_logic_vector(15 downto 0); ewdata : out std_logic_vector(31 downto 0); erdata : in std_logic_vector(31 downto 0); --ethernet input signals gtx_clk : in std_ulogic; tx_clk : in std_ulogic; rx_clk : in std_ulogic; rxd : in std_logic_vector(7 downto 0); rx_dv : in std_ulogic; rx_er : in std_ulogic; rx_col : in std_ulogic; rx_crs : in std_ulogic; mdio_i : in std_ulogic; phyrstaddr : in std_logic_vector(4 downto 0); mdint : in std_ulogic; --ethernet output signals reset : out std_ulogic; txd : out std_logic_vector(7 downto 0); tx_en : out std_ulogic; tx_er : out std_ulogic; mdc : out std_ulogic; mdio_o : out std_ulogic; mdio_oe : out std_ulogic; --scantest testrst : in std_ulogic; testen : in std_ulogic; testoen : in std_ulogic; edcladdr : in std_logic_vector(3 downto 0) := "0000"; edclsepahb : in std_ulogic; edcldisable : in std_ulogic; gbit : out std_ulogic; speed : out std_ulogic); end component; component greth_gen is generic( memtech : integer := 0; ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; mdcscaler : integer range 0 to 255 := 25; enable_mdio : integer range 0 to 1 := 0; fifosize : integer range 4 to 64 := 8; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 31 := 0; rmii : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0); port( rst : in std_ulogic; clk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --irq irq : out std_logic; --ethernet input signals rmii_clk : in std_ulogic; tx_clk : in std_ulogic; rx_clk : in std_ulogic; rxd : in std_logic_vector(3 downto 0); rx_dv : in std_ulogic; rx_er : in std_ulogic; rx_col : in std_ulogic; rx_crs : in std_ulogic; mdio_i : in std_ulogic; phyrstaddr : in std_logic_vector(4 downto 0); mdint : in std_ulogic; --ethernet output signals reset : out std_ulogic; txd : out std_logic_vector(3 downto 0); tx_en : out std_ulogic; tx_er : out std_ulogic; mdc : out std_ulogic; mdio_o : out std_ulogic; mdio_oe : out std_ulogic; --scantest testrst : in std_ulogic; testen : in std_ulogic; testoen : in std_ulogic; edcladdr : in std_logic_vector(3 downto 0); edclsepahb : in std_ulogic; edcldisable : in std_ulogic; speed : out std_ulogic ); end component; component greth_gbit_gen is generic( memtech : integer := 0; ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; slot_time : integer := 128; mdcscaler : integer range 0 to 255 := 25; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 1; edclbufsz : integer range 1 to 64 := 1; burstlength : integer range 4 to 128 := 32; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 32 := 0; sim : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; ft : integer range 0 to 2 := 0; edclft : integer range 0 to 2 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; edclsepahbg : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0); port( rst : in std_ulogic; clk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --edcl ahb mst in ehgrant : in std_ulogic; ehready : in std_ulogic; ehresp : in std_logic_vector(1 downto 0); ehrdata : in std_logic_vector(31 downto 0); --edcl ahb mst out ehbusreq : out std_ulogic; ehlock : out std_ulogic; ehtrans : out std_logic_vector(1 downto 0); ehaddr : out std_logic_vector(31 downto 0); ehwrite : out std_ulogic; ehsize : out std_logic_vector(2 downto 0); ehburst : out std_logic_vector(2 downto 0); ehprot : out std_logic_vector(3 downto 0); ehwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --irq irq : out std_logic; --ethernet input signals gtx_clk : in std_ulogic; tx_clk : in std_ulogic; rx_clk : in std_ulogic; rxd : in std_logic_vector(7 downto 0); rx_dv : in std_ulogic; rx_er : in std_ulogic; rx_col : in std_ulogic; rx_crs : in std_ulogic; mdio_i : in std_ulogic; phyrstaddr : in std_logic_vector(4 downto 0); mdint : in std_ulogic; --ethernet output signals reset : out std_ulogic; txd : out std_logic_vector(7 downto 0); tx_en : out std_ulogic; tx_er : out std_ulogic; mdc : out std_ulogic; mdio_o : out std_ulogic; mdio_oe : out std_ulogic; --scantest testrst : in std_ulogic; testen : in std_ulogic; testoen : in std_ulogic; edcladdr : in std_logic_vector(3 downto 0); edclsepahb : in std_ulogic; edcldisable : in std_ulogic; speed : out std_ulogic; gbit : out std_ulogic ); end component; end package;
gpl-2.0
b4731845704eaf38aabfaff870997ef1
0.49371
3.878135
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_gray_data_stream_0_V.vhd
2
4,621
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity FIFO_image_filter_gray_data_stream_0_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end FIFO_image_filter_gray_data_stream_0_V_shiftReg; architecture rtl of FIFO_image_filter_gray_data_stream_0_V_shiftReg is --constant DEPTH_WIDTH: integer := 16; type SRL_ARRAY is array (0 to DEPTH-1) of std_logic_vector(DATA_WIDTH-1 downto 0); signal SRL_SIG : SRL_ARRAY; begin p_shift: process (clk) begin if (clk'event and clk = '1') then if (ce = '1') then SRL_SIG <= data & SRL_SIG(0 to DEPTH-2); end if; end if; end process; q <= SRL_SIG(conv_integer(a)); end rtl; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity FIFO_image_filter_gray_data_stream_0_V is generic ( MEM_STYLE : string := "auto"; DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_empty_n : OUT STD_LOGIC; if_read_ce : IN STD_LOGIC; if_read : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); if_full_n : OUT STD_LOGIC; if_write_ce : IN STD_LOGIC; if_write : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0)); end entity; architecture rtl of FIFO_image_filter_gray_data_stream_0_V is component FIFO_image_filter_gray_data_stream_0_V_shiftReg is generic ( DATA_WIDTH : integer := 8; ADDR_WIDTH : integer := 1; DEPTH : integer := 2); port ( clk : in std_logic; data : in std_logic_vector(DATA_WIDTH-1 downto 0); ce : in std_logic; a : in std_logic_vector(ADDR_WIDTH-1 downto 0); q : out std_logic_vector(DATA_WIDTH-1 downto 0)); end component; signal shiftReg_addr : STD_LOGIC_VECTOR(ADDR_WIDTH - 1 downto 0); signal shiftReg_data, shiftReg_q : STD_LOGIC_VECTOR(DATA_WIDTH - 1 downto 0); signal shiftReg_ce : STD_LOGIC; signal mOutPtr : STD_LOGIC_VECTOR(ADDR_WIDTH downto 0) := (others => '1'); signal internal_empty_n : STD_LOGIC := '0'; signal internal_full_n : STD_LOGIC := '1'; begin if_empty_n <= internal_empty_n; if_full_n <= internal_full_n; shiftReg_data <= if_din; if_dout <= shiftReg_q; process (clk) begin if clk'event and clk = '1' then if reset = '1' then mOutPtr <= (others => '1'); internal_empty_n <= '0'; internal_full_n <= '1'; else if ((if_read and if_read_ce) = '1' and internal_empty_n = '1') and ((if_write and if_write_ce) = '0' or internal_full_n = '0') then mOutPtr <= mOutPtr -1; if (mOutPtr = 0) then internal_empty_n <= '0'; end if; internal_full_n <= '1'; elsif ((if_read and if_read_ce) = '0' or internal_empty_n = '0') and ((if_write and if_write_ce) = '1' and internal_full_n = '1') then mOutPtr <= mOutPtr +1; internal_empty_n <= '1'; if (mOutPtr = DEPTH -2) then internal_full_n <= '0'; end if; end if; end if; end if; end process; shiftReg_addr <= (others => '0') when mOutPtr(ADDR_WIDTH) = '1' else mOutPtr(ADDR_WIDTH-1 downto 0); shiftReg_ce <= (if_write and if_write_ce) and internal_full_n; U_FIFO_image_filter_gray_data_stream_0_V_shiftReg : FIFO_image_filter_gray_data_stream_0_V_shiftReg generic map ( DATA_WIDTH => DATA_WIDTH, ADDR_WIDTH => ADDR_WIDTH, DEPTH => DEPTH) port map ( clk => clk, data => shiftReg_data, ce => shiftReg_ce, a => shiftReg_addr, q => shiftReg_q); end rtl;
gpl-3.0
f9e444233eef1878e138242327192592
0.538628
3.484917
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/can/can_rd.vhd
1
6,705
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: can_oc -- File: can_oc.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: AHB interface for the OpenCores CAN MAC ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.can.all; entity can_rd is generic ( slvndx : integer := 0; ioaddr : integer := 16#000#; iomask : integer := 16#FF0#; irq : integer := 0; memtech : integer := DEFMEMTECH; syncrst : integer := 0; dmap : integer := 0); port ( resetn : in std_logic; clk : in std_logic; ahbsi : in ahb_slv_in_type; ahbso : out ahb_slv_out_type; can_rxi : in std_logic_vector(1 downto 0); can_txo : out std_logic_vector(1 downto 0) ); end; architecture rtl of can_rd is constant ncores : integer := 1; constant sepirq : integer := 0; constant REVISION : amba_version_type := ncores-1; constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_CANAHB, 0, REVISION, irq), 4 => ahb_iobar(ioaddr, iomask), others => zero32); type ahbregs is record hsel : std_ulogic; hwrite : std_ulogic; hwrite2 : std_ulogic; htrans : std_logic_vector(1 downto 0); haddr : std_logic_vector(10 downto 0); hwdata : std_logic_vector(7 downto 0); herr : std_ulogic; hready : std_ulogic; ws : std_logic_vector(1 downto 0); irqi : std_logic_vector(ncores-1 downto 0); irqo : std_logic_vector(ncores-1 downto 0); muxsel : std_logic; writemux : std_logic; end record; subtype cdata is std_logic_vector(7 downto 0); type cdataarr is array (0 to 7) of cdata; signal data_out : cdataarr; signal reset : std_logic; signal irqo : std_logic_vector(ncores-1 downto 0); signal addr : std_logic_vector(7 downto 0); signal vcc, gnd : std_ulogic; signal r, rin : ahbregs; signal can_lrxi, can_ltxo : std_logic; begin gnd <= '0'; vcc <= '1'; reset <= not resetn; comb : process(ahbsi, r, resetn, data_out, irqo) variable v : ahbregs; variable hresp : std_logic_vector(1 downto 0); variable dataout : std_logic_vector(7 downto 0); variable irqvec : std_logic_vector(NAHBIRQ-1 downto 0); variable vmuxreg : std_logic; variable hwdata : std_logic_vector(31 downto 0); begin v := r; hwdata := ahbreadword(ahbsi.hwdata, r.haddr(4 downto 2)); if (r.hsel = '1' ) and (r.ws /= "11") then v.ws := r.ws + 1; end if; if ahbsi.hready = '1' then v.hsel := ahbsi.hsel(slvndx); v.haddr := ahbsi.haddr(10 downto 0); v.htrans := ahbsi.htrans; v.hwrite := ahbsi.hwrite; v.herr := orv(ahbsi.hsize) and ahbsi.hwrite; v.ws := "00"; end if; v.hready := (r.hsel and r.ws(1) and not r.ws(0)) or not resetn or (ahbsi.hready and not ahbsi.htrans(1)); vmuxreg := not r.haddr(7) and r.haddr(6); --v.hwrite2 := r.hwrite and r.hsel and r.htrans(1) and r.ws(1) -- and not r.ws(0) and not r.herr; v.hwrite2 := r.hwrite and r.hsel and r.htrans(1) and r.ws(1) and not r.ws(0) and not r.herr and not vmuxreg; v.writemux := r.hwrite and r.hsel and r.htrans(1) and r.ws(1) and not r.ws(0) and vmuxreg; if (r.herr and r.ws(1)) = '1' then hresp := HRESP_ERROR; else hresp := HRESP_OKAY; end if; case r.haddr(1 downto 0) is when "00" => v.hwdata := hwdata(31 downto 24); when "01" => v.hwdata := hwdata(23 downto 16); when "10" => v.hwdata := hwdata(15 downto 8); when others => v.hwdata := hwdata(7 downto 0); end case; --dataout := data_out(0); if r.haddr(7 downto 6) = "01" then dataout := (others => r.muxsel); if r.writemux = '1' then v.muxsel := r.hwdata(0); end if; else dataout := data_out(0); end if; -- Interrupt goes to low when appeard and is normal high -- but the irq controller from leon is active high and the interrupt should appear only -- for 1 Clk cycle, v.irqi := irqo; v.irqo:= (r.irqi and not irqo); irqvec := (others => '0'); if sepirq = 1 then irqvec(ncores-1+irq downto irq) := r.irqo; else irqvec(irq) := orv(r.irqo); end if; ahbso.hirq <= irqvec; ahbso.hrdata <= ahbdrivedata(dataout); ahbso.hresp <= hresp; rin <= v; end process; -- Double mapping of registers [byte (offset 0), word (offset 0x80)] dmap0 : if dmap = 0 generate addr <= r.haddr(7 downto 0); end generate; dmap1 : if dmap = 1 generate addr <= "000"&r.haddr(6 downto 2) when r.haddr(7) = '1' else r.haddr(7 downto 0); end generate; reg : process(clk) begin if clk'event and clk = '1' then r <= rin; end if; end process; cmod : can_mod generic map (memtech, syncrst) --port map (reset, clk, r.hsel, r.hwrite2, r.haddr(7 downto 0), r.hwdata, port map (reset, clk, r.hsel, r.hwrite2, addr, r.hwdata, data_out(0), irqo(0), can_lrxi, can_ltxo, ahbsi.testen); cmux : canmux port map (r.muxsel, can_lrxi, can_ltxo, can_rxi, can_txo); ahbso.hconfig <= hconfig; ahbso.hindex <= slvndx; ahbso.hsplit <= (others => '0'); ahbso.hready <= r.hready; -- pragma translate_off bootmsg : report_version generic map ( "can_oc" & tost(slvndx) & ": SJA1000 Compatible CAN MAC, revision " & tost(REVISION) & ", irq " & tost(irq)); -- pragma translate_on end;
gpl-2.0
64665bbecc7a1fdd3808e7c02b0b214c
0.594631
3.412214
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/toutpad.vhd
1
6,917
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: toutpad -- File: toutpad.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: tri-state output pad with technology wrapper ------------------------------------------------------------------------------ library techmap; library ieee; use ieee.std_logic_1164.all; use techmap.gencomp.all; use techmap.allpads.all; entity toutpad is generic (tech : integer := 0; level : integer := 0; slew : integer := 0; voltage : integer := x33v; strength : integer := 12; oepol : integer := 0); port (pad : out std_ulogic; i, en : in std_ulogic; cfgi: in std_logic_vector(19 downto 0) := "00000000000000000000"); end; architecture rtl of toutpad is signal oen : std_ulogic; signal padx, gnd : std_ulogic; begin gnd <= '0'; oen <= not en when oepol /= padoen_polarity(tech) else en; gen0 : if has_pads(tech) = 0 generate pad <= i -- pragma translate_off after 2 ns -- pragma translate_on when oen = '0' -- pragma translate_off else 'X' after 2 ns when is_x(en) -- pragma translate_on else 'Z' -- pragma translate_off after 2 ns -- pragma translate_on ; end generate; xcv : if (is_unisim(tech) = 1) generate u0 : unisim_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; axc : if (tech = axcel) or (tech = axdsp) generate u0 : axcel_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; pa3 : if (tech = proasic) or (tech = apa3) generate u0 : apa3_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; pa3e : if (tech = apa3e) generate u0 : apa3e_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; pa3l : if (tech = apa3l) generate u0 : apa3l_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; fus : if (tech = actfus) generate u0 : fusion_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; atc : if (tech = atc18s) generate u0 : atc18_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; atcrh : if (tech = atc18rha) generate u0 : atc18rha_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; um : if (tech = umc) generate u0 : umc_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; rhu : if (tech = rhumc) generate u0 : rhumc_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; saed : if (tech = saed32) generate u0 : saed32_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; dar : if (tech = dare) generate u0 : dare_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; ihp : if (tech = ihp25) generate u0 : ihp25_toutpad generic map (level, slew, voltage, strength) port map(pad, i, oen); end generate; ihprh : if (tech = ihp25rh) generate u0 : ihp25rh_toutpad generic map (level, slew, voltage, strength) port map(pad, i, oen); end generate; rh18t : if (tech = rhlib18t) generate u0 : rh_lib18t_iopad generic map (strength) port map (padx, i, oen, open); pad <= padx; end generate; ut025 : if (tech = ut25) generate u0 : ut025crh_toutpad generic map (level, slew, voltage, strength) port map(pad, i, oen); end generate; ut13 : if (tech = ut130) generate u0 : ut130hbd_toutpad generic map (level, slew, voltage, strength) port map(pad, i, oen); end generate; pere : if (tech = peregrine) generate u0 : peregrine_toutpad generic map (level, slew, voltage, strength) port map(pad, i, oen); end generate; nex : if (tech = easic90) generate u0 : nextreme_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen); end generate; n2x : if (tech = easic45) generate u0 : n2x_toutpad generic map (level, slew, voltage, strength) port map (pad, i, oen, cfgi(0), cfgi(1), cfgi(19 downto 15), cfgi(14 downto 10), cfgi(9 downto 6), cfgi(5 downto 2)); end generate; ut90nhbd : if (tech = ut90) generate u0 : ut90nhbd_toutpad generic map (level, slew, voltage, strength) port map(pad, i, oen, cfgi(0)); end generate; end; library techmap; library ieee; use ieee.std_logic_1164.all; use techmap.gencomp.all; entity toutpadv is generic (tech : integer := 0; level : integer := 0; slew : integer := 0; voltage : integer := x33v; strength : integer := 12; width : integer := 1; oepol : integer := 0); port ( pad : out std_logic_vector(width-1 downto 0); i : in std_logic_vector(width-1 downto 0); en : in std_ulogic; cfgi: in std_logic_vector(19 downto 0) := "00000000000000000000" ); end; architecture rtl of toutpadv is begin v : for j in width-1 downto 0 generate u0 : toutpad generic map (tech, level, slew, voltage, strength, oepol) port map (pad(j), i(j), en, cfgi); end generate; end; library techmap; library ieee; use ieee.std_logic_1164.all; use techmap.gencomp.all; entity toutpadvv is generic (tech : integer := 0; level : integer := 0; slew : integer := 0; voltage : integer := x33v; strength : integer := 12; width : integer := 1; oepol : integer := 0); port ( pad : out std_logic_vector(width-1 downto 0); i : in std_logic_vector(width-1 downto 0); en : in std_logic_vector(width-1 downto 0); cfgi: in std_logic_vector(19 downto 0) := "00000000000000000000"); end; architecture rtl of toutpadvv is begin v : for j in width-1 downto 0 generate u0 : toutpad generic map (tech, level, slew, voltage, strength, oepol) port map (pad(j), i(j), en(j), cfgi); end generate; end;
gpl-2.0
a52e0af5d36a8cf42ec6567e24c21e27
0.640596
3.477627
false
false
false
false
mistryalok/Zedboard
learning/training/Microsystem/axi_interface_part2/project_1/project_1.srcs/sources_1/bd/design_1/ip/design_1_axi_bram_ctrl_0_0/sim/design_1_axi_bram_ctrl_0_0.vhd
1
15,629
-- (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_bram_ctrl:4.0 -- IP Revision: 3 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY axi_bram_ctrl_v4_0; USE axi_bram_ctrl_v4_0.axi_bram_ctrl; ENTITY design_1_axi_bram_ctrl_0_0 IS PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; s_axi_awid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_awaddr : IN STD_LOGIC_VECTOR(12 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; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wlast : IN STD_LOGIC; s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_arid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_araddr : IN STD_LOGIC_VECTOR(12 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; s_axi_rid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_rdata : OUT STD_LOGIC_VECTOR(31 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; 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(3 DOWNTO 0); bram_addr_a : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); bram_wrdata_a : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_a : IN STD_LOGIC_VECTOR(31 DOWNTO 0) ); END design_1_axi_bram_ctrl_0_0; ARCHITECTURE design_1_axi_bram_ctrl_0_0_arch OF design_1_axi_bram_ctrl_0_0 IS ATTRIBUTE DowngradeIPIdentifiedWarnings : string; ATTRIBUTE DowngradeIPIdentifiedWarnings OF design_1_axi_bram_ctrl_0_0_arch: ARCHITECTURE IS "yes"; COMPONENT axi_bram_ctrl IS GENERIC ( C_BRAM_INST_MODE : STRING; C_MEMORY_DEPTH : INTEGER; C_BRAM_ADDR_WIDTH : INTEGER; C_S_AXI_ADDR_WIDTH : INTEGER; C_S_AXI_DATA_WIDTH : INTEGER; C_S_AXI_ID_WIDTH : INTEGER; C_S_AXI_PROTOCOL : STRING; C_S_AXI_SUPPORTS_NARROW_BURST : INTEGER; C_SINGLE_PORT_BRAM : INTEGER; C_FAMILY : STRING; C_S_AXI_CTRL_ADDR_WIDTH : INTEGER; C_S_AXI_CTRL_DATA_WIDTH : INTEGER; C_ECC : INTEGER; C_ECC_TYPE : INTEGER; C_FAULT_INJECT : INTEGER; C_ECC_ONOFF_RESET_VALUE : INTEGER ); PORT ( s_axi_aclk : IN STD_LOGIC; s_axi_aresetn : IN STD_LOGIC; ecc_interrupt : OUT STD_LOGIC; ecc_ue : OUT STD_LOGIC; s_axi_awid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_awaddr : IN STD_LOGIC_VECTOR(12 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; s_axi_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_wstrb : IN STD_LOGIC_VECTOR(3 DOWNTO 0); s_axi_wlast : IN STD_LOGIC; s_axi_wvalid : IN STD_LOGIC; s_axi_wready : OUT STD_LOGIC; s_axi_bid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_bresp : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); s_axi_bvalid : OUT STD_LOGIC; s_axi_bready : IN STD_LOGIC; s_axi_arid : IN STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_araddr : IN STD_LOGIC_VECTOR(12 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; s_axi_rid : OUT STD_LOGIC_VECTOR(11 DOWNTO 0); s_axi_rdata : OUT STD_LOGIC_VECTOR(31 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; s_axi_ctrl_awvalid : IN STD_LOGIC; s_axi_ctrl_awready : OUT STD_LOGIC; s_axi_ctrl_awaddr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_wvalid : IN STD_LOGIC; s_axi_ctrl_wready : OUT STD_LOGIC; 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; s_axi_ctrl_araddr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); s_axi_ctrl_arvalid : IN STD_LOGIC; s_axi_ctrl_arready : OUT STD_LOGIC; s_axi_ctrl_rdata : OUT STD_LOGIC_VECTOR(31 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_rst_a : OUT STD_LOGIC; bram_clk_a : OUT STD_LOGIC; bram_en_a : OUT STD_LOGIC; bram_we_a : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); bram_addr_a : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); bram_wrdata_a : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_a : IN STD_LOGIC_VECTOR(31 DOWNTO 0); 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(3 DOWNTO 0); bram_addr_b : OUT STD_LOGIC_VECTOR(12 DOWNTO 0); bram_wrdata_b : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); bram_rddata_b : IN STD_LOGIC_VECTOR(31 DOWNTO 0) ); END COMPONENT axi_bram_ctrl; ATTRIBUTE X_INTERFACE_INFO : STRING; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aclk: SIGNAL IS "xilinx.com:signal:clock:1.0 CLKIF CLK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_aresetn: SIGNAL IS "xilinx.com:signal:reset:1.0 RSTIF RST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWID"; 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_awlen: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWLEN"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awsize: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWSIZE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awburst: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWBURST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awlock: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWLOCK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awcache: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWCACHE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_awprot: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI AWPROT"; 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_wlast: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI WLAST"; 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_bid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI BID"; 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_arid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARID"; 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_arlen: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARLEN"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arsize: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARSIZE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arburst: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARBURST"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arlock: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARLOCK"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arcache: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARCACHE"; ATTRIBUTE X_INTERFACE_INFO OF s_axi_arprot: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI ARPROT"; 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_rid: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RID"; 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_rlast: SIGNAL IS "xilinx.com:interface:aximm:1.0 S_AXI RLAST"; 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"; ATTRIBUTE X_INTERFACE_INFO OF bram_rst_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA RST"; ATTRIBUTE X_INTERFACE_INFO OF bram_clk_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA CLK"; ATTRIBUTE X_INTERFACE_INFO OF bram_en_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA EN"; ATTRIBUTE X_INTERFACE_INFO OF bram_we_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA WE"; ATTRIBUTE X_INTERFACE_INFO OF bram_addr_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA ADDR"; ATTRIBUTE X_INTERFACE_INFO OF bram_wrdata_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA DIN"; ATTRIBUTE X_INTERFACE_INFO OF bram_rddata_a: SIGNAL IS "xilinx.com:interface:bram:1.0 BRAM_PORTA DOUT"; BEGIN U0 : axi_bram_ctrl GENERIC MAP ( C_BRAM_INST_MODE => "EXTERNAL", C_MEMORY_DEPTH => 2048, C_BRAM_ADDR_WIDTH => 11, C_S_AXI_ADDR_WIDTH => 13, C_S_AXI_DATA_WIDTH => 32, C_S_AXI_ID_WIDTH => 12, C_S_AXI_PROTOCOL => "AXI4", C_S_AXI_SUPPORTS_NARROW_BURST => 0, C_SINGLE_PORT_BRAM => 1, C_FAMILY => "zynq", C_S_AXI_CTRL_ADDR_WIDTH => 32, C_S_AXI_CTRL_DATA_WIDTH => 32, C_ECC => 0, C_ECC_TYPE => 0, C_FAULT_INJECT => 0, C_ECC_ONOFF_RESET_VALUE => 0 ) PORT MAP ( s_axi_aclk => s_axi_aclk, s_axi_aresetn => s_axi_aresetn, 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, 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, s_axi_bid => s_axi_bid, s_axi_bresp => s_axi_bresp, s_axi_bvalid => s_axi_bvalid, s_axi_bready => s_axi_bready, 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, 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, s_axi_ctrl_awvalid => '0', s_axi_ctrl_awaddr => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_wdata => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_wvalid => '0', s_axi_ctrl_bready => '0', s_axi_ctrl_araddr => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)), s_axi_ctrl_arvalid => '0', s_axi_ctrl_rready => '0', 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_rddata_b => STD_LOGIC_VECTOR(TO_UNSIGNED(0, 32)) ); END design_1_axi_bram_ctrl_0_0_arch;
gpl-3.0
e93da131986823d46a4b3dfa31c603ff
0.67074
3.100377
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/ddr_ireg.vhd
1
2,775
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: ddr_ireg -- File: ddr_ireg.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: DDR input reg with tech selection ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; use techmap.allddr.all; entity ddr_ireg is generic ( tech : integer; arch : integer := 0); port ( Q1 : out std_ulogic; Q2 : out std_ulogic; C1 : in std_ulogic; C2 : in std_ulogic; CE : in std_ulogic; D : in std_ulogic; R : in std_ulogic; S : in std_ulogic); end; architecture rtl of ddr_ireg is begin inf : if not((is_unisim(tech) = 1) or (tech = axcel) or (tech = axdsp) or (tech = apa3) or (tech = apa3e) or (tech = apa3l)) generate inf0 : gen_iddr_reg port map (Q1, Q2, C1, C2, CE, D, R, S); end generate; ax : if (tech = axcel) or (tech = axdsp) generate axc0 : axcel_iddr_reg port map (Q1, Q2, C1, C2, CE, D, R, S); end generate; pa3 : if (tech = apa3) generate pa0 : apa3_iddr_reg port map (Q1, Q2, C1, C2, CE, D, R, S); end generate; pa3e : if (tech = apa3e) generate pa0 : apa3e_iddr_reg port map (Q1, Q2, C1, C2, CE, D, R, S); end generate; pa3l : if (tech = apa3l) generate pa0 : apa3l_iddr_reg port map (Q1, Q2, C1, C2, CE, D, R, S); end generate; xil : if is_unisim(tech) = 1 generate xil0 : unisim_iddr_reg generic map (tech, arch) port map (Q1, Q2, C1, C2, CE, D, R, S); end generate; --pragma translate_off assert (tech /= easic45) and (tech /= easic90) report "ddr_ireg: Not supported on eASIC. Use DDR pad instead." severity failure; --pragma translate_on end architecture;
gpl-2.0
5e24b788cef9aad99642356b07bf19bd
0.597838
3.447205
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/tech/altera_mf/simprims/altera_mf_components.vhd
1
108,712
-- Copyright (C) 1991-2009 Altera Corporation -- Your use of Altera Corporation's design tools, logic functions -- and other software and tools, and its AMPP partner logic -- functions, and any output files from any of the foregoing -- (including device programming or simulation files), and any -- associated documentation or information are expressly subject -- to the terms and conditions of the Altera Program License -- Subscription Agreement, Altera MegaCore Function License -- Agreement, or other applicable license agreement, including, -- without limitation, that your use is for the sole purpose of -- programming logic devices manufactured by Altera and sold by -- Altera or its authorized distributors. Please refer to the -- applicable agreement for further details. -- Quartus II 9.0 Build 235 03/01/2009 ---------------------------------------------------------------------------- -- ALtera Megafunction Component Declaration File ---------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; package altera_mf_components is type altera_mf_logic_2D is array (NATURAL RANGE <>, NATURAL RANGE <>) of STD_LOGIC; component lcell port ( a_in : in std_logic; a_out : out std_logic); end component; component altcam generic ( width : natural := 1; widthad : natural := 1; numwords : natural := 1; lpm_file : string := "UNUSED"; lpm_filex : string := "UNUSED"; match_mode : string := "MULTIPLE"; output_reg : string := "UNREGISTERED"; output_aclr : string := "ON"; pattern_reg : string := "INCLOCK"; pattern_aclr : string := "ON"; wraddress_aclr : string := "ON"; wrx_reg : string := "INCLOCK"; wrx_aclr : string := "ON"; wrcontrol_aclr : string := "ON"; use_eab : string := "ON"; lpm_hint : string := "UNUSED"; lpm_type : string := "altcam" ); port ( pattern : in std_logic_vector(width-1 downto 0); wrx : in std_logic_vector(width-1 downto 0) := (others => 'Z'); wrxused : in std_logic := '1'; wrdelete : in std_logic := '0'; wraddress : in std_logic_vector(widthad-1 downto 0); wren : in std_logic; inclock : in std_logic; inclocken : in std_logic := '1'; inaclr : in std_logic := '0'; outclock : in std_logic := '0'; outclocken : in std_logic := '1'; outaclr : in std_logic := '0'; mstart : in std_logic := 'X'; mnext : in std_logic := '0'; maddress : out std_logic_vector(widthad-1 downto 0); mbits : out std_logic_vector(numwords-1 downto 0); mfound : out std_logic; mcount : out std_logic_vector(widthad-1 downto 0); rdbusy : out std_logic; wrbusy : out std_logic ); end component; component altclklock generic ( inclock_period : natural := 10000; -- units in ps inclock_settings : string := "UNUSED"; valid_lock_cycles : natural := 5; invalid_lock_cycles : natural := 5; valid_lock_multiplier : natural := 5; invalid_lock_multiplier : natural := 5; operation_mode : string := "NORMAL"; clock0_boost : natural := 1; clock0_divide : natural := 1; clock0_settings : string := "UNUSED"; clock0_time_delay : string := "0"; clock1_boost : natural := 1; clock1_divide : natural := 1; clock1_settings : string := "UNUSED"; clock1_time_delay : string := "0"; clock2_boost : natural := 1; clock2_divide : natural := 1; clock2_settings : string := "UNUSED"; clock2_time_delay : string := "0"; clock_ext_boost : natural := 1; clock_ext_divide : natural := 1; clock_ext_settings : string := "UNUSED"; clock_ext_time_delay : string := "0"; outclock_phase_shift : natural := 0; -- units in ps intended_device_family : string := "APEX20KE" ; lpm_hint : string := "UNUSED"; lpm_type : string := "altclklock" ); port( inclock : in std_logic; -- required port, input reference clock inclocken : in std_logic := '1'; -- PLL enable signal fbin : in std_logic := '1'; -- feedback input for the PLL clock0 : out std_logic; -- clock0 output clock1 : out std_logic; -- clock1 output clock2 : out std_logic; -- clock2 output clock_ext : out std_logic; -- external clock output locked : out std_logic ); -- PLL lock signal end component; component altlvds_rx generic ( number_of_channels : natural; deserialization_factor : natural; inclock_boost : natural:= 0; registered_output : string := "ON"; inclock_period : natural; cds_mode : string := "UNUSED"; intended_device_family : string := "APEX20KE"; input_data_rate : natural:= 0; inclock_data_alignment : string := "EDGE_ALIGNED"; registered_data_align_input : string :="ON"; common_rx_tx_pll : string :="ON"; enable_dpa_mode : string := "OFF"; enable_dpa_pll_calibration : string := "OFF"; enable_dpa_fifo : string := "ON"; use_dpll_rawperror : string := "OFF"; use_coreclock_input : string := "OFF"; dpll_lock_count : natural:= 0; dpll_lock_window : natural:= 0; outclock_resource : string := "AUTO"; data_align_rollover : natural := 10; lose_lock_on_one_change : string := "OFF"; reset_fifo_at_first_lock : string := "ON"; use_external_pll : string := "OFF"; implement_in_les : string := "OFF"; buffer_implementation : string := "RAM"; port_rx_data_align : string := "PORT_CONNECTIVITY"; port_rx_channel_data_align : string := "PORT_CONNECTIVITY"; pll_operation_mode : string := "NORMAL"; x_on_bitslip : string := "ON"; use_no_phase_shift : string := "ON"; rx_align_data_reg : string := "RISING_EDGE"; inclock_phase_shift : integer := 0; enable_soft_cdr_mode : string := "OFF"; sim_dpa_output_clock_phase_shift : integer := 0; sim_dpa_is_negative_ppm_drift : string := "OFF"; sim_dpa_net_ppm_variation : natural := 0; enable_dpa_align_to_rising_edge_only : string := "OFF"; enable_dpa_initial_phase_selection : string := "OFF"; dpa_initial_phase_value :natural := 0; pll_self_reset_on_loss_lock : string := "OFF"; lpm_hint : string := "UNUSED"; lpm_type : string := "altlvds_rx"; clk_src_is_pll : string := "off" ); port ( rx_in : in std_logic_vector(number_of_channels-1 downto 0); rx_inclock : in std_logic := '0'; rx_syncclock : in std_logic := '0'; rx_readclock : in std_logic := '0'; rx_enable : in std_logic := '1'; rx_deskew : in std_logic := '0'; rx_pll_enable : in std_logic := '1'; rx_data_align : in std_logic := '0'; rx_data_align_reset : in std_logic := '0'; rx_reset : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_dpll_reset : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_dpll_hold : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_dpll_enable : in std_logic_vector(number_of_channels-1 downto 0) := (others => '1'); rx_fifo_reset : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_channel_data_align : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_cda_reset : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_coreclk : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); pll_areset : in std_logic := '0'; dpa_pll_recal : in std_logic := '0'; pll_phasedone : in std_logic := '1'; rx_dpa_lock_reset : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0'); rx_out : out std_logic_vector(deserialization_factor*number_of_channels -1 downto 0); rx_outclock : out std_logic; rx_locked : out std_logic; rx_dpa_locked : out std_logic_vector(number_of_channels-1 downto 0); rx_cda_max : out std_logic_vector(number_of_channels-1 downto 0); rx_divfwdclk : out std_logic_vector(number_of_channels-1 downto 0); dpa_pll_cal_busy : out std_logic; pll_phasestep : out std_logic; pll_phaseupdown : out std_logic; pll_phasecounterselect: out std_logic_Vector(3 downto 0); pll_scanclk : out std_logic); end component; component altlvds_tx generic ( number_of_channels : natural; deserialization_factor : natural:= 4; inclock_boost : natural := 0; outclock_divide_by : positive:= 1; registered_input : string := "ON"; multi_clock : string := "OFF"; inclock_period : natural; center_align_msb : string := "UNUSED"; intended_device_family : string := "APEX20KE"; output_data_rate : natural:= 0; outclock_resource : string := "AUTO"; common_rx_tx_pll : string := "ON"; inclock_data_alignment : string := "EDGE_ALIGNED"; outclock_alignment : string := "EDGE_ALIGNED"; use_external_pll : string := "OFF"; implement_in_les : STRING := "OFF"; preemphasis_setting : natural := 0; vod_setting : natural := 0; differential_drive : natural := 0; outclock_multiply_by : natural := 1; coreclock_divide_by : natural := 2; outclock_duty_cycle : natural := 50; inclock_phase_shift : integer := 0; outclock_phase_shift : integer := 0; use_no_phase_shift : string := "ON"; pll_self_reset_on_loss_lock : string := "OFF"; lpm_hint : string := "UNUSED"; lpm_type : string := "altlvds_tx"; clk_src_is_pll : string := "off" ); port ( tx_in : in std_logic_vector(deserialization_factor*number_of_channels -1 downto 0); tx_inclock : in std_logic := '0'; tx_syncclock : in std_logic := '0'; tx_enable : in std_logic := '1'; sync_inclock : in std_logic := '0'; tx_pll_enable : in std_logic := '1'; pll_areset : in std_logic := '0'; tx_out : out std_logic_vector(number_of_channels-1 downto 0); tx_outclock : out std_logic; tx_coreclock : out std_logic; tx_locked : out std_logic ); end component; component altdpram generic ( width : natural; widthad : natural; numwords : natural := 0; lpm_file : string := "UNUSED"; lpm_hint : string := "USE_EAB=ON"; use_eab : string := "ON"; indata_reg : string := "INCLOCK"; indata_aclr : string := "ON"; wraddress_reg : string := "INCLOCK"; wraddress_aclr : string := "ON"; wrcontrol_reg : string := "INCLOCK"; wrcontrol_aclr : string := "ON"; rdaddress_reg : string := "OUTCLOCK"; rdaddress_aclr : string := "ON"; rdcontrol_reg : string := "OUTCLOCK"; rdcontrol_aclr : string := "ON"; outdata_reg : string := "UNREGISTERED"; outdata_aclr : string := "ON"; ram_block_type : string := "AUTO"; width_byteena : natural := 1; byte_size : natural := 5; read_during_write_mode_mixed_ports : string := "DONT_CARE"; intended_device_family : string := "APEX20KE"; lpm_type : string := "altdpram" ); port( wren : in std_logic := '0'; data : in std_logic_vector(width-1 downto 0); wraddress : in std_logic_vector(widthad-1 downto 0); wraddressstall : in std_logic := '0'; inclock : in std_logic := '1'; inclocken : in std_logic := '1'; rden : in std_logic := '1'; rdaddress : in std_logic_vector(widthad-1 downto 0); rdaddressstall : in std_logic := '0'; byteena : in std_logic_vector(width_byteena-1 downto 0) := (others => '1'); outclock : in std_logic := '1'; outclocken : in std_logic := '1'; aclr : in std_logic := '0'; q : out std_logic_vector(width-1 downto 0) ); end component; component alt3pram generic ( width : natural; widthad : natural; numwords : natural := 0; lpm_file : string := "UNUSED"; lpm_hint : string := "USE_EAB=ON"; indata_reg : string := "UNREGISTERED"; indata_aclr : string := "OFF"; write_reg : string := "UNREGISTERED"; write_aclr : string := "OFF"; rdaddress_reg_a : string := "UNREGISTERED"; rdaddress_aclr_a : string := "OFF"; rdaddress_reg_b : string := "UNREGISTERED"; rdaddress_aclr_b : string := "OFF"; rdcontrol_reg_a : string := "UNREGISTERED"; rdcontrol_aclr_a : string := "OFF"; rdcontrol_reg_b : string := "UNREGISTERED"; rdcontrol_aclr_b : string := "OFF"; outdata_reg_a : string := "UNREGISTERED"; outdata_aclr_a : string := "OFF"; outdata_reg_b : string := "UNREGISTERED"; outdata_aclr_b : string := "OFF"; intended_device_family : string := "APEX20KE"; ram_block_type : string := "AUTO"; maximum_depth : integer := 0; lpm_type : string := "alt3pram" ); port ( wren : in std_logic := '0'; data : in std_logic_vector(width-1 downto 0); wraddress : in std_logic_vector(widthad-1 downto 0); inclock : in std_logic := '0'; inclocken : in std_logic := '1'; rden_a : in std_logic := '1'; rden_b : in std_logic := '1'; rdaddress_a : in std_logic_vector(widthad-1 downto 0); rdaddress_b : in std_logic_vector(widthad-1 downto 0); outclock : in std_logic := '0'; outclocken : in std_logic := '1'; aclr : in std_logic := '0'; qa : out std_logic_vector(width-1 downto 0); qb : out std_logic_vector(width-1 downto 0) ); end component; component altqpram generic ( operation_mode : string := "QUAD_PORT"; width_write_a : natural := 1; widthad_write_a : natural := 1; numwords_write_a : natural := 0; -- default = 2^widthad_write_a indata_reg_a : string := "INCLOCK_A"; indata_aclr_a : string := "INACLR_A"; wrcontrol_wraddress_reg_a : string := "INCLOCK_A"; wrcontrol_aclr_a : string := "INACLR_A"; wraddress_aclr_a : string := "INACLR_A"; width_write_b : natural := 1; -- default = width_write_a widthad_write_b : natural := 1; -- default = widthad_write_a numwords_write_b : natural := 0; -- default = 2^widthad_write_b indata_reg_b : string := "INCLOCK_B"; indata_aclr_b : string := "INACLR_B"; wrcontrol_wraddress_reg_b : string := "INCLOCK_B"; wrcontrol_aclr_b : string := "INACLR_B"; wraddress_aclr_b : string := "INACLR_B"; width_read_a : natural := 1; widthad_read_a : natural := 1; numwords_read_a : natural := 0; -- default = 2^widthad_read_a rdcontrol_reg_a : string := "OUTCLOCK_A"; rdcontrol_aclr_a : string := "OUTACLR_A"; rdaddress_reg_a : string := "OUTCLOCK_A"; rdaddress_aclr_a : string := "OUTACLR_A"; outdata_reg_a : string := "UNREGISTERED"; outdata_aclr_a : string := "OUTACLR_A"; width_read_b : natural := 1; -- default = width_read_a widthad_read_b : natural := 1; -- default = widthad_read_a numwords_read_b : natural := 0; -- default = 2^widthad_read_b rdcontrol_reg_b : string := "OUTCLOCK_B"; rdcontrol_aclr_b : string := "OUTACLR_B"; rdaddress_reg_b : string := "OUTCLOCK_B"; rdaddress_aclr_b : string := "OUTACLR_B"; outdata_reg_b : string := "UNREGISTERED"; outdata_aclr_b : string := "OUTACLR_B"; init_file : string := "UNUSED"; lpm_hint : string := "UNUSED"; lpm_type : string := "altqpram" ); port ( wren_a : in std_logic := '0'; wren_b : in std_logic := '0'; data_a : in std_logic_vector(width_write_a-1 downto 0) := (OTHERS => '0'); data_b : in std_logic_vector(width_write_b-1 downto 0) := (OTHERS => '0'); wraddress_a : in std_logic_vector(widthad_write_a-1 downto 0) := (OTHERS => '0'); wraddress_b : in std_logic_vector(widthad_write_b-1 downto 0) := (OTHERS => '0'); inclock_a : in std_logic := '0'; inclock_b : in std_logic := '0'; inclocken_a : in std_logic := '1'; inclocken_b : in std_logic := '1'; rden_a : in std_logic := '1'; rden_b : in std_logic := '1'; rdaddress_a : in std_logic_vector(widthad_read_a-1 downto 0) := (OTHERS => '0'); rdaddress_b : in std_logic_vector(widthad_read_b-1 downto 0) := (OTHERS => '0'); outclock_a : in std_logic := '0'; outclock_b : in std_logic := '0'; outclocken_a : in std_logic := '1'; outclocken_b : in std_logic := '1'; inaclr_a : in std_logic := '0'; inaclr_b : in std_logic := '0'; outaclr_a : in std_logic := '0'; outaclr_b : in std_logic := '0'; q_a : out std_logic_vector(width_read_a-1 downto 0); q_b : out std_logic_vector(width_read_b-1 downto 0) ); end component; component scfifo generic ( lpm_width : natural; lpm_widthu : natural; lpm_numwords : natural; lpm_showahead : string := "OFF"; lpm_hint : string := "USE_EAB=ON"; intended_device_family : string := "NON_STRATIX"; almost_full_value : natural := 0; almost_empty_value : natural := 0; overflow_checking : string := "ON"; underflow_checking : string := "ON"; allow_rwcycle_when_full : string := "OFF"; add_ram_output_register : string := "OFF"; use_eab : string := "ON"; lpm_type : string := "scfifo"; maximum_depth : natural := 0 ); port ( data : in std_logic_vector(lpm_width-1 downto 0); clock : in std_logic; wrreq : in std_logic; rdreq : in std_logic; aclr : in std_logic := '0'; sclr : in std_logic := '0'; full : out std_logic; almost_full : out std_logic; empty : out std_logic; almost_empty : out std_logic; q : out std_logic_vector(lpm_width-1 downto 0); usedw : out std_logic_vector(lpm_widthu-1 downto 0) ); end component; component dcfifo_mixed_widths generic ( lpm_width : natural; lpm_widthu : natural; lpm_width_r : natural := 0; lpm_widthu_r : natural := 0; lpm_numwords : natural; lpm_showahead : string := "OFF"; lpm_hint : string := "USE_EAB=ON"; overflow_checking : string := "ON"; underflow_checking : string := "ON"; delay_rdusedw : natural := 1; delay_wrusedw : natural := 1; rdsync_delaypipe : natural := 0; wrsync_delaypipe : natural := 0; use_eab : string := "ON"; add_ram_output_register : string := "OFF"; add_width : natural := 1; clocks_are_synchronized : string := "FALSE"; ram_block_type : string := "AUTO"; add_usedw_msb_bit : string := "OFF"; write_aclr_synch : string := "OFF"; lpm_type : string := "dcfifo_mixed_widths"; intended_device_family : string := "NON_STRATIX" ); port ( data : in std_logic_vector(lpm_width-1 downto 0); rdclk : in std_logic; wrclk : in std_logic; wrreq : in std_logic; rdreq : in std_logic; aclr : in std_logic := '0'; rdfull : out std_logic; wrfull : out std_logic; wrempty : out std_logic; rdempty : out std_logic; q : out std_logic_vector(lpm_width_r-1 downto 0); rdusedw : out std_logic_vector(lpm_widthu_r-1 downto 0); wrusedw : out std_logic_vector(lpm_widthu-1 downto 0) ); end component; component dcfifo generic ( lpm_width : natural; lpm_widthu : natural; lpm_numwords : natural; lpm_showahead : string := "OFF"; lpm_hint : string := "USE_EAB=ON"; overflow_checking : string := "ON"; underflow_checking : string := "ON"; delay_rdusedw : natural := 1; delay_wrusedw : natural := 1; rdsync_delaypipe : natural := 0; wrsync_delaypipe : natural := 0; use_eab : string := "ON"; add_ram_output_register : string := "OFF"; add_width : natural := 1; clocks_are_synchronized : string := "FALSE"; ram_block_type : string := "AUTO"; add_usedw_msb_bit : string := "OFF"; write_aclr_synch : string := "OFF"; lpm_type : string := "dcfifo"; intended_device_family : string := "NON_STRATIX" ); port ( data : in std_logic_vector(lpm_width-1 downto 0); rdclk : in std_logic; wrclk : in std_logic; wrreq : in std_logic; rdreq : in std_logic; aclr : in std_logic := '0'; rdfull : out std_logic; wrfull : out std_logic; wrempty : out std_logic; rdempty : out std_logic; q : out std_logic_vector(lpm_width-1 downto 0); rdusedw : out std_logic_vector(lpm_widthu-1 downto 0); wrusedw : out std_logic_vector(lpm_widthu-1 downto 0) ); end component; component altddio_in generic ( width : positive; -- required parameter invert_input_clocks : string := "OFF"; intended_device_family : string := "Stratix"; power_up_high : string := "OFF"; lpm_hint : string := "UNUSED"; lpm_type : string := "altddio_in" ); port ( datain : in std_logic_vector(width-1 downto 0); inclock : in std_logic; inclocken : in std_logic := '1'; aset : in std_logic := '0'; aclr : in std_logic := '0'; sset : in std_logic := '0'; sclr : in std_logic := '0'; dataout_h : out std_logic_vector(width-1 downto 0); dataout_l : out std_logic_vector(width-1 downto 0) ); end component; component altddio_out generic ( width : positive; -- required parameter power_up_high : string := "OFF"; oe_reg : string := "UNUSED"; extend_oe_disable : string := "UNUSED"; invert_output : string := "OFF"; intended_device_family : string := "Stratix"; lpm_hint : string := "UNUSED"; lpm_type : string := "altddio_out" ); port ( datain_h : in std_logic_vector(width-1 downto 0); datain_l : in std_logic_vector(width-1 downto 0); outclock : in std_logic; outclocken : in std_logic := '1'; aset : in std_logic := '0'; aclr : in std_logic := '0'; sset : in std_logic := '0'; sclr : in std_logic := '0'; oe : in std_logic := '1'; dataout : out std_logic_vector(width-1 downto 0); oe_out : out std_logic_vector(width-1 downto 0) ); end component; component altddio_bidir generic( width : positive; -- required parameter power_up_high : string := "OFF"; oe_reg : string := "UNUSED"; extend_oe_disable : string := "UNUSED"; implement_input_in_lcell : string := "UNUSED"; invert_output : string := "OFF"; intended_device_family : string := "Stratix"; lpm_hint : string := "UNUSED"; lpm_type : string := "altddio_bidir" ); port ( datain_h : in std_logic_vector(width-1 downto 0); datain_l : in std_logic_vector(width-1 downto 0); inclock : in std_logic := '0'; inclocken : in std_logic := '1'; outclock : in std_logic; outclocken : in std_logic := '1'; aset : in std_logic := '0'; aclr : in std_logic := '0'; sset : in std_logic := '0'; sclr : in std_logic := '0'; oe : in std_logic := '1'; dataout_h : out std_logic_vector(width-1 downto 0); dataout_l : out std_logic_vector(width-1 downto 0); combout : out std_logic_vector(width-1 downto 0); oe_out : out std_logic_vector(width-1 downto 0); dqsundelayedout : out std_logic_vector(width-1 downto 0); padio : inout std_logic_vector(width-1 downto 0) ); end component; component altshift_taps generic ( number_of_taps : integer := 4; tap_distance : integer := 3; width : integer := 8; power_up_state : string := "CLEARED"; lpm_hint : string := "UNUSED"; lpm_type : string := "altshift_taps" ); port ( shiftin : in std_logic_vector (width-1 downto 0); clock : in std_logic; clken : in std_logic := '1'; aclr : in std_logic := '0'; shiftout : out std_logic_vector (width-1 downto 0); taps : out std_logic_vector ((width*number_of_taps)-1 downto 0)); end component; component altmult_add generic ( WIDTH_A : integer := 1; WIDTH_B : integer := 1; WIDTH_RESULT : integer := 1; NUMBER_OF_MULTIPLIERS : integer := 1; -- A inputs INPUT_REGISTER_A0 : string := "CLOCK0"; INPUT_ACLR_A0 : string := "ACLR3"; INPUT_SOURCE_A0 : string := "DATAA"; INPUT_REGISTER_A1 : string := "CLOCK0"; INPUT_ACLR_A1 : string := "ACLR3"; INPUT_SOURCE_A1 : string := "DATAA"; INPUT_REGISTER_A2 : string := "CLOCK0"; INPUT_ACLR_A2 : string := "ACLR3"; INPUT_SOURCE_A2 : string := "DATAA"; INPUT_REGISTER_A3 : string := "CLOCK0"; INPUT_ACLR_A3 : string := "ACLR3"; INPUT_SOURCE_A3 : string := "DATAA"; PORT_SIGNA : string := "PORT_CONNECTIVITY"; REPRESENTATION_A : string := "UNSIGNED"; SIGNED_REGISTER_A : string := "CLOCK0"; SIGNED_ACLR_A : string := "ACLR3"; SIGNED_PIPELINE_REGISTER_A : string := "CLOCK0"; SIGNED_PIPELINE_ACLR_A : string := "ACLR3"; -- B inputs INPUT_REGISTER_B0 : string := "CLOCK0"; INPUT_ACLR_B0 : string := "ACLR3"; INPUT_SOURCE_B0 : string := "DATAB"; INPUT_REGISTER_B1 : string := "CLOCK0"; INPUT_ACLR_B1 : string := "ACLR3"; INPUT_SOURCE_B1 : string := "DATAB"; INPUT_REGISTER_B2 : string := "CLOCK0"; INPUT_ACLR_B2 : string := "ACLR3"; INPUT_SOURCE_B2 : string := "DATAB"; INPUT_REGISTER_B3 : string := "CLOCK0"; INPUT_ACLR_B3 : string := "ACLR3"; INPUT_SOURCE_B3 : string := "DATAB"; PORT_SIGNB : string := "PORT_CONNECTIVITY"; REPRESENTATION_B : string := "UNSIGNED"; SIGNED_REGISTER_B : string := "CLOCK0"; SIGNED_ACLR_B : string := "ACLR3"; SIGNED_PIPELINE_REGISTER_B : string := "CLOCK0"; SIGNED_PIPELINE_ACLR_B : string := "ACLR3"; MULTIPLIER_REGISTER0 : string := "CLOCK0"; MULTIPLIER_ACLR0 : string := "ACLR3"; MULTIPLIER_REGISTER1 : string := "CLOCK0"; MULTIPLIER_ACLR1 : string := "ACLR3"; MULTIPLIER_REGISTER2 : string := "CLOCK0"; MULTIPLIER_ACLR2 : string := "ACLR3"; MULTIPLIER_REGISTER3 : string := "CLOCK0"; MULTIPLIER_ACLR3 : string := "ACLR3"; PORT_ADDNSUB1 : string := "PORT_CONNECTIVITY"; ADDNSUB_MULTIPLIER_REGISTER1 : string := "CLOCK0"; ADDNSUB_MULTIPLIER_ACLR1 : string := "ACLR3"; ADDNSUB_MULTIPLIER_PIPELINE_REGISTER1 : string := "CLOCK0"; ADDNSUB_MULTIPLIER_PIPELINE_ACLR1 : string := "ACLR3"; PORT_ADDNSUB3 : string := "PORT_CONNECTIVITY"; ADDNSUB_MULTIPLIER_REGISTER3 : string := "CLOCK0"; ADDNSUB_MULTIPLIER_ACLR3 : string := "ACLR3"; ADDNSUB_MULTIPLIER_PIPELINE_REGISTER3: string := "CLOCK0"; ADDNSUB_MULTIPLIER_PIPELINE_ACLR3 : string := "ACLR3"; ADDNSUB1_ROUND_ACLR : string := "ACLR3"; ADDNSUB1_ROUND_PIPELINE_ACLR : string := "ACLR3"; ADDNSUB1_ROUND_REGISTER : string := "CLOCK0"; ADDNSUB1_ROUND_PIPELINE_REGISTER : string := "CLOCK0"; ADDNSUB3_ROUND_ACLR : string := "ACLR3"; ADDNSUB3_ROUND_PIPELINE_ACLR : string := "ACLR3"; ADDNSUB3_ROUND_REGISTER : string := "CLOCK0"; ADDNSUB3_ROUND_PIPELINE_REGISTER : string := "CLOCK0"; MULT01_ROUND_ACLR : string := "ACLR3"; MULT01_ROUND_REGISTER : string := "CLOCK0"; MULT01_SATURATION_REGISTER : string := "CLOCK0"; MULT01_SATURATION_ACLR : string := "ACLR3"; MULT23_ROUND_REGISTER : string := "CLOCK0"; MULT23_ROUND_ACLR : string := "ACLR3"; MULT23_SATURATION_REGISTER : string := "CLOCK0"; MULT23_SATURATION_ACLR : string := "ACLR3"; multiplier1_direction : string := "ADD"; multiplier3_direction : string := "ADD"; OUTPUT_REGISTER : string := "CLOCK0"; OUTPUT_ACLR : string := "ACLR0"; -- StratixII parameters multiplier01_rounding : string := "NO"; multiplier01_saturation : string := "NO"; multiplier23_rounding : string := "NO"; multiplier23_saturation : string := "NO"; adder1_rounding : string := "NO"; adder3_rounding : string := "NO"; port_mult0_is_saturated : string := "UNUSED"; port_mult1_is_saturated : string := "UNUSED"; port_mult2_is_saturated : string := "UNUSED"; port_mult3_is_saturated : string := "UNUSED"; -- Stratix III parameters scanouta_register : string := "UNREGISTERED"; scanouta_aclr : string := "NONE"; -- Rounding parameters output_rounding : string := "NO"; output_round_type : string := "NEAREST_INTEGER"; width_msb : integer := 17; output_round_register : string := "UNREGISTERED"; output_round_aclr : string := "NONE"; output_round_pipeline_register : string := "UNREGISTERED"; output_round_pipeline_aclr : string := "NONE"; chainout_rounding : string := "NO"; chainout_round_register : string := "UNREGISTERED"; chainout_round_aclr : string := "NONE"; chainout_round_pipeline_register : string := "UNREGISTERED"; chainout_round_pipeline_aclr : string := "NONE"; chainout_round_output_register : string := "UNREGISTERED"; chainout_round_output_aclr : string := "NONE"; -- saturation parameters port_output_is_overflow : string := "PORT_UNUSED"; port_chainout_sat_is_overflow : string := "PORT_UNUSED"; output_saturation : string := "NO"; output_saturate_type : string := "ASYMMETRIC"; width_saturate_sign : integer := 1; output_saturate_register : string := "UNREGISTERED"; output_saturate_aclr : string := "NONE"; output_saturate_pipeline_register : string := "UNREGISTERED"; output_saturate_pipeline_aclr : string := "NONE"; chainout_saturation : string := "NO"; chainout_saturate_register : string := "UNREGISTERED"; chainout_saturate_aclr : string := "NONE"; chainout_saturate_pipeline_register : string := "UNREGISTERED"; chainout_saturate_pipeline_aclr : string := "NONE"; chainout_saturate_output_register : string := "UNREGISTERED"; chainout_saturate_output_aclr : string := "NONE"; -- chainout parameters chainout_adder : string := "NO"; chainout_register : string := "UNREGISTERED"; chainout_aclr : string := "NONE"; width_chainin : integer := 1; zero_chainout_output_register : string := "UNREGISTERED"; zero_chainout_output_aclr : string := "NONE"; -- rotate & shift parameters shift_mode : string := "NO"; rotate_aclr : string := "NONE"; rotate_register : string := "UNREGISTERED"; rotate_pipeline_register : string := "UNREGISTERED"; rotate_pipeline_aclr : string := "NONE"; rotate_output_register : string := "UNREGISTERED"; rotate_output_aclr : string := "NONE"; shift_right_register : string := "UNREGISTERED"; shift_right_aclr : string := "NONE"; shift_right_pipeline_register : string := "UNREGISTERED"; shift_right_pipeline_aclr : string := "NONE"; shift_right_output_register : string := "UNREGISTERED"; shift_right_output_aclr : string := "NONE"; -- loopback parameters zero_loopback_register : string := "UNREGISTERED"; zero_loopback_aclr : string := "NONE"; zero_loopback_pipeline_register : string := "UNREGISTERED"; zero_loopback_pipeline_aclr : string := "NONE"; zero_loopback_output_register : string := "UNREGISTERED"; zero_loopback_output_aclr : string := "NONE"; -- accumulator parameters accum_sload_register : string := "UNREGISTERED"; accum_sload_aclr : string := "NONE"; accum_sload_pipeline_register : string := "UNREGISTERED"; accum_sload_pipeline_aclr : string := "NONE"; accum_direction : string := "ADD"; accumulator : string := "NO"; EXTRA_LATENCY : integer :=0; DEDICATED_MULTIPLIER_CIRCUITRY:string := "AUTO"; DSP_BLOCK_BALANCING : string := "AUTO"; lpm_hint : string := "UNUSED"; lpm_type : string := "altmult_add"; intended_device_family : string := "Stratix" ); port ( dataa : in std_logic_vector(NUMBER_OF_MULTIPLIERS * WIDTH_A -1 downto 0); datab : in std_logic_vector(NUMBER_OF_MULTIPLIERS * WIDTH_B -1 downto 0); scanina : in std_logic_vector(width_a -1 downto 0) := (others => '0'); scaninb : in std_logic_vector(width_b -1 downto 0) := (others => '0'); sourcea : in std_logic_vector(NUMBER_OF_MULTIPLIERS -1 downto 0) := (others => '0'); sourceb : in std_logic_vector(NUMBER_OF_MULTIPLIERS -1 downto 0) := (others => '0'); -- clock ports clock3 : in std_logic := '1'; clock2 : in std_logic := '1'; clock1 : in std_logic := '1'; clock0 : in std_logic := '1'; aclr3 : in std_logic := '0'; aclr2 : in std_logic := '0'; aclr1 : in std_logic := '0'; aclr0 : in std_logic := '0'; ena3 : in std_logic := '1'; ena2 : in std_logic := '1'; ena1 : in std_logic := '1'; ena0 : in std_logic := '1'; -- control signals signa : in std_logic := 'Z'; signb : in std_logic := 'Z'; addnsub1 : in std_logic := 'Z'; addnsub3 : in std_logic := 'Z'; -- StratixII only input ports mult01_round : in std_logic := '0'; mult23_round : in std_logic := '0'; mult01_saturation : in std_logic := '0'; mult23_saturation : in std_logic := '0'; addnsub1_round : in std_logic := '0'; addnsub3_round : in std_logic := '0'; -- Stratix III only input ports output_round : in std_logic := '0'; chainout_round : in std_logic := '0'; output_saturate : in std_logic := '0'; chainout_saturate : in std_logic := '0'; chainin : in std_logic_vector (width_chainin - 1 downto 0) := (others => '0'); zero_chainout : in std_logic := '0'; rotate : in std_logic := '0'; shift_right : in std_logic := '0'; zero_loopback : in std_logic := '0'; accum_sload : in std_logic := '0'; -- output ports result : out std_logic_vector(WIDTH_RESULT -1 downto 0); scanouta : out std_logic_vector (WIDTH_A -1 downto 0); scanoutb : out std_logic_vector (WIDTH_B -1 downto 0); -- StratixII only output ports mult0_is_saturated : out std_logic := '0'; mult1_is_saturated : out std_logic := '0'; mult2_is_saturated : out std_logic := '0'; mult3_is_saturated : out std_logic := '0'; -- Stratix III only output ports overflow : out std_logic := '0'; chainout_sat_overflow : out std_logic := '0'); end component; component altmult_accum generic ( width_a : integer := 1; width_b : integer := 1; width_result : integer := 2; width_upper_data : integer := 1; input_source_a : string := "DATAA"; input_source_b : string := "DATAB"; input_reg_a : string := "CLOCK0"; input_aclr_a : string := "ACLR3"; input_reg_b : string := "CLOCK0"; input_aclr_b : string := "ACLR3"; port_addnsub : string := "PORT_CONNECTIVITY"; addnsub_reg : string := "CLOCK0"; addnsub_aclr : string := "ACLR3"; addnsub_pipeline_reg : string := "CLOCK0"; addnsub_pipeline_aclr : string := "ACLR3"; accum_direction : string := "ADD"; accum_sload_reg : string := "CLOCK0"; accum_sload_aclr : string := "ACLR3"; accum_sload_pipeline_reg : string := "CLOCK0"; accum_sload_pipeline_aclr : string := "ACLR3"; representation_a : string := "UNSIGNED"; port_signa : string := "PORT_CONNECTIVITY"; sign_reg_a : string := "CLOCK0"; sign_aclr_a : string := "ACLR3"; sign_pipeline_reg_a : string := "CLOCK0"; sign_pipeline_aclr_a : string := "ACLR3"; representation_b : string := "UNSIGNED"; port_signb : string := "PORT_CONNECTIVITY"; sign_reg_b : string := "CLOCK0"; sign_aclr_b : string := "ACLR3"; sign_pipeline_reg_b : string := "CLOCK0"; sign_pipeline_aclr_b : string := "ACLR3"; multiplier_reg : string := "CLOCK0"; multiplier_aclr : string := "ACLR3"; output_reg : string := "CLOCK0"; output_aclr : string := "ACLR0"; extra_multiplier_latency : integer := 0; extra_accumulator_latency : integer := 0; dedicated_multiplier_circuitry : string := "AUTO"; dsp_block_balancing : string := "AUTO"; lpm_hint : string := "UNUSED"; lpm_type : string := "altmult_accum"; intended_device_family : string := "Stratix"; multiplier_rounding : string := "NO"; multiplier_saturation : string := "NO"; accumulator_rounding : string := "NO"; accumulator_saturation : string := "NO"; port_mult_is_saturated : string := "UNUSED"; port_accum_is_saturated : string := "UNUSED"; mult_round_aclr : string := "ACLR3"; mult_round_reg : string := "CLOCK0"; mult_saturation_aclr : string := "ACLR3"; mult_saturation_reg : string := "CLOCK0"; accum_round_aclr : string := "ACLR3"; accum_round_reg : string := "CLOCK3"; accum_round_pipeline_aclr : string := "ACLR3"; accum_round_pipeline_reg : string := "CLOCK0"; accum_saturation_aclr : string := "ACLR3"; accum_saturation_reg : string := "CLOCK0"; accum_saturation_pipeline_aclr : string := "ACLR3"; accum_saturation_pipeline_reg : string := "CLOCK0"; accum_sload_upper_data_aclr : string := "ACLR3"; accum_sload_upper_data_pipeline_aclr : string := "ACLR3"; accum_sload_upper_data_pipeline_reg : string := "CLOCK0"; accum_sload_upper_data_reg : string := "CLOCK0" ); port ( dataa : in std_logic_vector(width_a -1 downto 0) := (others => '0'); datab : in std_logic_vector(width_b -1 downto 0) := (others => '0'); scanina : in std_logic_vector(width_a -1 downto 0) := (others => 'Z'); scaninb : in std_logic_vector(width_b -1 downto 0) := (others => 'Z'); accum_sload_upper_data : in std_logic_vector(width_result -1 downto width_result - width_upper_data) := (others => '0'); sourcea : in std_logic := '1'; sourceb : in std_logic := '1'; -- control signals addnsub : in std_logic := 'Z'; accum_sload : in std_logic := '0'; signa : in std_logic := 'Z'; signb : in std_logic := 'Z'; -- clock ports clock0 : in std_logic := '1'; clock1 : in std_logic := '1'; clock2 : in std_logic := '1'; clock3 : in std_logic := '1'; ena0 : in std_logic := '1'; ena1 : in std_logic := '1'; ena2 : in std_logic := '1'; ena3 : in std_logic := '1'; aclr0 : in std_logic := '0'; aclr1 : in std_logic := '0'; aclr2 : in std_logic := '0'; aclr3 : in std_logic := '0'; -- round and saturation ports mult_round : in std_logic := '0'; mult_saturation : in std_logic := '0'; accum_round : in std_logic := '0'; accum_saturation : in std_logic := '0'; -- output ports result : out std_logic_vector(width_result -1 downto 0); overflow : out std_logic; scanouta : out std_logic_vector (width_a -1 downto 0); scanoutb : out std_logic_vector (width_b -1 downto 0); mult_is_saturated : out std_logic := '0'; accum_is_saturated : out std_logic := '0' ); end component; component altaccumulate generic ( width_in : integer:= 4; width_out : integer:= 8; lpm_representation : string := "UNSIGNED"; extra_latency : integer:= 0; use_wys : string := "ON"; lpm_hint : string := "UNUSED"; lpm_type : string := "altaccumulate" ); port ( -- Input ports cin : in std_logic := 'Z'; data : in std_logic_vector(width_in -1 downto 0); -- Required port add_sub : in std_logic := '1'; clock : in std_logic; -- Required port sload : in std_logic := '0'; clken : in std_logic := '1'; sign_data : in std_logic := '0'; aclr : in std_logic := '0'; -- Output ports result : out std_logic_vector(width_out -1 downto 0) := (others => '0'); cout : out std_logic := '0'; overflow : out std_logic := '0' ); end component; component altsyncram generic ( operation_mode : string := "BIDIR_DUAL_PORT"; -- port a parameters width_a : integer := 1; widthad_a : integer := 1; numwords_a : integer := 0; -- registering parameters -- port a read parameters outdata_reg_a : string := "UNREGISTERED"; -- clearing parameters address_aclr_a : string := "NONE"; outdata_aclr_a : string := "NONE"; -- clearing parameters -- port a write parameters indata_aclr_a : string := "NONE"; wrcontrol_aclr_a : string := "NONE"; -- clear for the byte enable port reigsters which are clocked by clk0 byteena_aclr_a : string := "NONE"; -- width of the byte enable ports. if it is used, must be WIDTH_WRITE_A/8 or /9 width_byteena_a : integer := 1; -- port b parameters width_b : integer := 1; widthad_b : integer := 1; numwords_b : integer := 0; -- registering parameters -- port b read parameters rdcontrol_reg_b : string := "CLOCK1"; address_reg_b : string := "CLOCK1"; outdata_reg_b : string := "UNREGISTERED"; -- clearing parameters outdata_aclr_b : string := "NONE"; rdcontrol_aclr_b : string := "NONE"; -- registering parameters -- port b write parameters indata_reg_b : string := "CLOCK1"; wrcontrol_wraddress_reg_b : string := "CLOCK1"; -- registering parameter for the byte enable reister for port b byteena_reg_b : string := "CLOCK1"; -- clearing parameters indata_aclr_b : string := "NONE"; wrcontrol_aclr_b : string := "NONE"; address_aclr_b : string := "NONE"; -- clear parameter for byte enable port register byteena_aclr_b : string := "NONE"; -- StratixII only : to bypass clock enable or using clock enable clock_enable_input_a : string := "NORMAL"; clock_enable_output_a : string := "NORMAL"; clock_enable_input_b : string := "NORMAL"; clock_enable_output_b : string := "NORMAL"; -- width of the byte enable ports. if it is used, must be WIDTH_WRITE_A/8 or /9 width_byteena_b : integer := 1; -- clock enable setting for the core clock_enable_core_a : string := "USE_INPUT_CLKEN"; clock_enable_core_b : string := "USE_INPUT_CLKEN"; -- read-during-write-same-port setting read_during_write_mode_port_a : string := "NEW_DATA_NO_NBE_READ"; read_during_write_mode_port_b : string := "NEW_DATA_NO_NBE_READ"; -- ECC status ports setting enable_ecc : string := "FALSE"; -- global parameters -- width of a byte for byte enables byte_size : integer := 0; read_during_write_mode_mixed_ports: string := "DONT_CARE"; -- ram block type choices are "AUTO", "M512", "M4K" and "MEGARAM" ram_block_type : string := "AUTO"; -- determine whether LE support is turned on or off for altsyncram implement_in_les : string := "OFF"; -- determine whether RAM would be power up to uninitialized or not power_up_uninitialized : string := "FALSE"; sim_show_memory_data_in_port_b_layout : string := "OFF"; -- general operation parameters init_file : string := "UNUSED"; init_file_layout : string := "UNUSED"; maximum_depth : integer := 0; intended_device_family : string := "Stratix"; lpm_hint : string := "UNUSED"; lpm_type : string := "altsyncram" ); port ( wren_a : in std_logic := '0'; wren_b : in std_logic := '0'; rden_a : in std_logic := '1'; rden_b : in std_logic := '1'; data_a : in std_logic_vector(width_a - 1 downto 0):= (others => '1'); data_b : in std_logic_vector(width_b - 1 downto 0):= (others => '1'); address_a : in std_logic_vector(widthad_a - 1 downto 0); address_b : in std_logic_vector(widthad_b - 1 downto 0) := (others => '1'); clock0 : in std_logic := '1'; clock1 : in std_logic := 'Z'; clocken0 : in std_logic := '1'; clocken1 : in std_logic := '1'; clocken2 : in std_logic := '1'; clocken3 : in std_logic := '1'; aclr0 : in std_logic := '0'; aclr1 : in std_logic := '0'; byteena_a : in std_logic_vector( (width_byteena_a - 1) downto 0) := (others => '1'); byteena_b : in std_logic_vector( (width_byteena_b - 1) downto 0) := (others => 'Z'); addressstall_a : in std_logic := '0'; addressstall_b : in std_logic := '0'; q_a : out std_logic_vector(width_a - 1 downto 0); q_b : out std_logic_vector(width_b - 1 downto 0); eccstatus : out std_logic_vector(2 downto 0) ); end component; component altpll generic ( intended_device_family : string := "Stratix" ; operation_mode : string := "NORMAL" ; pll_type : string := "AUTO" ; qualify_conf_done : string := "OFF" ; compensate_clock : string := "CLK0" ; scan_chain : string := "LONG"; primary_clock : string := "inclk0" ; inclk0_input_frequency : natural; -- required parameter inclk1_input_frequency : natural := 0; gate_lock_signal : string := "NO"; gate_lock_counter : integer := 0; lock_high : natural := 1; lock_low : natural := 5; valid_lock_multiplier : natural := 1; invalid_lock_multiplier : natural := 5; switch_over_type : string := "AUTO"; switch_over_on_lossclk : string := "OFF" ; switch_over_on_gated_lock : string := "OFF" ; enable_switch_over_counter : string := "OFF"; switch_over_counter : natural := 0; feedback_source : string := "EXTCLK0" ; bandwidth : natural := 0; bandwidth_type : string := "UNUSED"; spread_frequency : natural := 0; down_spread : string := "0.0"; self_reset_on_gated_loss_lock : string := "OFF"; self_reset_on_loss_lock : string := "OFF"; lock_window_ui : string := "0.05"; width_clock : natural := 6; width_phasecounterselect : natural := 4; charge_pump_current_bits : natural := 9999; loop_filter_c_bits : natural := 9999; loop_filter_r_bits : natural := 9999; scan_chain_mif_file : string := "UNUSED"; -- simulation-only parameters simulation_type : string := "functional"; source_is_pll : string := "off"; skip_vco : string := "off"; -- internal clock specifications clk9_multiply_by : natural := 1; clk8_multiply_by : natural := 1; clk7_multiply_by : natural := 1; clk6_multiply_by : natural := 1; clk5_multiply_by : natural := 1; clk4_multiply_by : natural := 1; clk3_multiply_by : natural := 1; clk2_multiply_by : natural := 1; clk1_multiply_by : natural := 1; clk0_multiply_by : natural := 1; clk9_divide_by : natural := 1; clk8_divide_by : natural := 1; clk7_divide_by : natural := 1; clk6_divide_by : natural := 1; clk5_divide_by : natural := 1; clk4_divide_by : natural := 1; clk3_divide_by : natural := 1; clk2_divide_by : natural := 1; clk1_divide_by : natural := 1; clk0_divide_by : natural := 1; clk9_phase_shift : string := "0"; clk8_phase_shift : string := "0"; clk7_phase_shift : string := "0"; clk6_phase_shift : string := "0"; clk5_phase_shift : string := "0"; clk4_phase_shift : string := "0"; clk3_phase_shift : string := "0"; clk2_phase_shift : string := "0"; clk1_phase_shift : string := "0"; clk0_phase_shift : string := "0"; clk5_time_delay : string := "0"; clk4_time_delay : string := "0"; clk3_time_delay : string := "0"; clk2_time_delay : string := "0"; clk1_time_delay : string := "0"; clk0_time_delay : string := "0"; clk9_duty_cycle : natural := 50; clk8_duty_cycle : natural := 50; clk7_duty_cycle : natural := 50; clk6_duty_cycle : natural := 50; clk5_duty_cycle : natural := 50; clk4_duty_cycle : natural := 50; clk3_duty_cycle : natural := 50; clk2_duty_cycle : natural := 50; clk1_duty_cycle : natural := 50; clk0_duty_cycle : natural := 50; clk2_output_frequency : natural := 0; clk1_output_frequency : natural := 0; clk0_output_frequency : natural := 0; clk9_use_even_counter_mode : string := "OFF"; clk8_use_even_counter_mode : string := "OFF"; clk7_use_even_counter_mode : string := "OFF"; clk6_use_even_counter_mode : string := "OFF"; clk5_use_even_counter_mode : string := "OFF"; clk4_use_even_counter_mode : string := "OFF"; clk3_use_even_counter_mode : string := "OFF"; clk2_use_even_counter_mode : string := "OFF"; clk1_use_even_counter_mode : string := "OFF"; clk0_use_even_counter_mode : string := "OFF"; clk9_use_even_counter_value : string := "OFF"; clk8_use_even_counter_value : string := "OFF"; clk7_use_even_counter_value : string := "OFF"; clk6_use_even_counter_value : string := "OFF"; clk5_use_even_counter_value : string := "OFF"; clk4_use_even_counter_value : string := "OFF"; clk3_use_even_counter_value : string := "OFF"; clk2_use_even_counter_value : string := "OFF"; clk1_use_even_counter_value : string := "OFF"; clk0_use_even_counter_value : string := "OFF"; -- external clock specifications extclk3_multiply_by : natural := 1; extclk2_multiply_by : natural := 1; extclk1_multiply_by : natural := 1; extclk0_multiply_by : natural := 1; extclk3_divide_by : natural := 1; extclk2_divide_by : natural := 1; extclk1_divide_by : natural := 1; extclk0_divide_by : natural := 1; extclk3_phase_shift : string := "0"; extclk2_phase_shift : string := "0"; extclk1_phase_shift : string := "0"; extclk0_phase_shift : string := "0"; extclk3_time_delay : string := "0"; extclk2_time_delay : string := "0"; extclk1_time_delay : string := "0"; extclk0_time_delay : string := "0"; extclk3_duty_cycle : natural := 50; extclk2_duty_cycle : natural := 50; extclk1_duty_cycle : natural := 50; extclk0_duty_cycle : natural := 50; vco_multiply_by : integer := 0; vco_divide_by : integer := 0; sclkout0_phase_shift : string := "0"; sclkout1_phase_shift : string := "0"; dpa_multiply_by : integer := 0; dpa_divide_by : integer := 0; dpa_divider : integer := 0; -- advanced user parameters vco_min : natural := 0; vco_max : natural := 0; vco_center : natural := 0; pfd_min : natural := 0; pfd_max : natural := 0; m_initial : natural := 1; m : natural := 0; -- m must default to 0 to force altpll to calculate the internal parameters for itself n : natural := 1; m2 : natural := 1; n2 : natural := 1; ss : natural := 0; c0_high : natural := 1; c1_high : natural := 1; c2_high : natural := 1; c3_high : natural := 1; c4_high : natural := 1; c5_high : natural := 1; c6_high : natural := 1; c7_high : natural := 1; c8_high : natural := 1; c9_high : natural := 1; l0_high : natural := 1; l1_high : natural := 1; g0_high : natural := 1; g1_high : natural := 1; g2_high : natural := 1; g3_high : natural := 1; e0_high : natural := 1; e1_high : natural := 1; e2_high : natural := 1; e3_high : natural := 1; c0_low : natural := 1; c1_low : natural := 1; c2_low : natural := 1; c3_low : natural := 1; c4_low : natural := 1; c5_low : natural := 1; c6_low : natural := 1; c7_low : natural := 1; c8_low : natural := 1; c9_low : natural := 1; l0_low : natural := 1; l1_low : natural := 1; g0_low : natural := 1; g1_low : natural := 1; g2_low : natural := 1; g3_low : natural := 1; e0_low : natural := 1; e1_low : natural := 1; e2_low : natural := 1; e3_low : natural := 1; c0_initial : natural := 1; c1_initial : natural := 1; c2_initial : natural := 1; c3_initial : natural := 1; c4_initial : natural := 1; c5_initial : natural := 1; c6_initial : natural := 1; c7_initial : natural := 1; c8_initial : natural := 1; c9_initial : natural := 1; l0_initial : natural := 1; l1_initial : natural := 1; g0_initial : natural := 1; g1_initial : natural := 1; g2_initial : natural := 1; g3_initial : natural := 1; e0_initial : natural := 1; e1_initial : natural := 1; e2_initial : natural := 1; e3_initial : natural := 1; c0_mode : string := "bypass" ; c1_mode : string := "bypass" ; c2_mode : string := "bypass" ; c3_mode : string := "bypass" ; c4_mode : string := "bypass" ; c5_mode : string := "bypass" ; c6_mode : string := "bypass" ; c7_mode : string := "bypass" ; c8_mode : string := "bypass" ; c9_mode : string := "bypass" ; l0_mode : string := "bypass" ; l1_mode : string := "bypass" ; g0_mode : string := "bypass" ; g1_mode : string := "bypass" ; g2_mode : string := "bypass" ; g3_mode : string := "bypass" ; e0_mode : string := "bypass" ; e1_mode : string := "bypass" ; e2_mode : string := "bypass" ; e3_mode : string := "bypass" ; c0_ph : natural := 0; c1_ph : natural := 0; c2_ph : natural := 0; c3_ph : natural := 0; c4_ph : natural := 0; c5_ph : natural := 0; c6_ph : natural := 0; c7_ph : natural := 0; c8_ph : natural := 0; c9_ph : natural := 0; l0_ph : natural := 0; l1_ph : natural := 0; g0_ph : natural := 0; g1_ph : natural := 0; g2_ph : natural := 0; g3_ph : natural := 0; e0_ph : natural := 0; e1_ph : natural := 0; e2_ph : natural := 0; e3_ph : natural := 0; m_ph : natural := 0; l0_time_delay : natural := 0; l1_time_delay : natural := 0; g0_time_delay : natural := 0; g1_time_delay : natural := 0; g2_time_delay : natural := 0; g3_time_delay : natural := 0; e0_time_delay : natural := 0; e1_time_delay : natural := 0; e2_time_delay : natural := 0; e3_time_delay : natural := 0; m_time_delay : natural := 0; n_time_delay : natural := 0; c1_use_casc_in : string := "off"; c2_use_casc_in : string := "off"; c3_use_casc_in : string := "off"; c4_use_casc_in : string := "off"; c5_use_casc_in : string := "off"; c6_use_casc_in : string := "off"; c7_use_casc_in : string := "off"; c8_use_casc_in : string := "off"; c9_use_casc_in : string := "off"; m_test_source : integer := 5; c0_test_source : integer := 5; c1_test_source : integer := 5; c2_test_source : integer := 5; c3_test_source : integer := 5; c4_test_source : integer := 5; c5_test_source : integer := 5; c6_test_source : integer := 5; c7_test_source : integer := 5; c8_test_source : integer := 5; c9_test_source : integer := 5; extclk3_counter : string := "e3" ; extclk2_counter : string := "e2" ; extclk1_counter : string := "e1" ; extclk0_counter : string := "e0" ; clk9_counter : string := "c9" ; clk8_counter : string := "c8" ; clk7_counter : string := "c7" ; clk6_counter : string := "c6" ; clk5_counter : string := "l1" ; clk4_counter : string := "l0" ; clk3_counter : string := "g3" ; clk2_counter : string := "g2" ; clk1_counter : string := "g1" ; clk0_counter : string := "g0" ; enable0_counter : string := "l0"; enable1_counter : string := "l0"; charge_pump_current : natural := 2; loop_filter_r : string := " 1.000000"; loop_filter_c : natural := 5; vco_post_scale : natural := 0; vco_frequency_control : string := "AUTO"; vco_phase_shift_step : natural := 0; lpm_hint : string := "UNUSED"; lpm_type : string := "altpll"; port_clkena0 : string := "PORT_CONNECTIVITY"; port_clkena1 : string := "PORT_CONNECTIVITY"; port_clkena2 : string := "PORT_CONNECTIVITY"; port_clkena3 : string := "PORT_CONNECTIVITY"; port_clkena4 : string := "PORT_CONNECTIVITY"; port_clkena5 : string := "PORT_CONNECTIVITY"; port_extclkena0 : string := "PORT_CONNECTIVITY"; port_extclkena1 : string := "PORT_CONNECTIVITY"; port_extclkena2 : string := "PORT_CONNECTIVITY"; port_extclkena3 : string := "PORT_CONNECTIVITY"; port_extclk0 : string := "PORT_CONNECTIVITY"; port_extclk1 : string := "PORT_CONNECTIVITY"; port_extclk2 : string := "PORT_CONNECTIVITY"; port_extclk3 : string := "PORT_CONNECTIVITY"; port_clkbad0 : string := "PORT_CONNECTIVITY"; port_clkbad1 : string := "PORT_CONNECTIVITY"; port_clk0 : string := "PORT_CONNECTIVITY"; port_clk1 : string := "PORT_CONNECTIVITY"; port_clk2 : string := "PORT_CONNECTIVITY"; port_clk3 : string := "PORT_CONNECTIVITY"; port_clk4 : string := "PORT_CONNECTIVITY"; port_clk5 : string := "PORT_CONNECTIVITY"; port_clk6 : string := "PORT_CONNECTIVITY"; port_clk7 : string := "PORT_CONNECTIVITY"; port_clk8 : string := "PORT_CONNECTIVITY"; port_clk9 : string := "PORT_CONNECTIVITY"; port_scandata : string := "PORT_CONNECTIVITY"; port_scandataout : string := "PORT_CONNECTIVITY"; port_scandone : string := "PORT_CONNECTIVITY"; port_sclkout1 : string := "PORT_CONNECTIVITY"; port_sclkout0 : string := "PORT_CONNECTIVITY"; port_activeclock : string := "PORT_CONNECTIVITY"; port_clkloss : string := "PORT_CONNECTIVITY"; port_inclk1 : string := "PORT_CONNECTIVITY"; port_inclk0 : string := "PORT_CONNECTIVITY"; port_fbin : string := "PORT_CONNECTIVITY"; port_fbout : string := "PORT_CONNECTIVITY"; port_pllena : string := "PORT_CONNECTIVITY"; port_clkswitch : string := "PORT_CONNECTIVITY"; port_areset : string := "PORT_CONNECTIVITY"; port_pfdena : string := "PORT_CONNECTIVITY"; port_scanclk : string := "PORT_CONNECTIVITY"; port_scanaclr : string := "PORT_CONNECTIVITY"; port_scanread : string := "PORT_CONNECTIVITY"; port_scanwrite : string := "PORT_CONNECTIVITY"; port_enable0 : string := "PORT_CONNECTIVITY"; port_enable1 : string := "PORT_CONNECTIVITY"; port_locked : string := "PORT_CONNECTIVITY"; port_configupdate : string := "PORT_CONNECTIVITY"; port_phasecounterselect : string := "PORT_CONNECTIVITY"; port_phasedone : string := "PORT_CONNECTIVITY"; port_phasestep : string := "PORT_CONNECTIVITY"; port_phaseupdown : string := "PORT_CONNECTIVITY"; port_vcooverrange : string := "PORT_CONNECTIVITY"; port_vcounderrange : string := "PORT_CONNECTIVITY"; port_scanclkena : string := "PORT_CONNECTIVITY"; using_fbmimicbidir_port : string := "ON"; sim_gate_lock_device_behavior : string := "OFF" ); port ( inclk : in std_logic_vector(1 downto 0) := (others => '0'); fbin : in std_logic := '0'; pllena : in std_logic := '1'; clkswitch : in std_logic := '0'; areset : in std_logic := '0'; pfdena : in std_logic := '1'; clkena : in std_logic_vector(5 downto 0) := (others => '1'); extclkena : in std_logic_vector(3 downto 0) := (others => '1'); scanclk : in std_logic := '0'; scanclkena : in std_logic := '1'; scanaclr : in std_logic := '0'; scanread : in std_logic := '0'; scanwrite : in std_logic := '0'; scandata : in std_logic := '0'; phasecounterselect : in std_logic_vector(width_phasecounterselect-1 downto 0) := (others => '0'); phaseupdown : in std_logic := '0'; phasestep : in std_logic := '0'; configupdate : in std_logic := '0'; fbmimicbidir : inout std_logic := '1'; clk : out std_logic_vector(width_clock-1 downto 0); extclk : out std_logic_vector(3 downto 0); clkbad : out std_logic_vector(1 downto 0); enable0 : out std_logic; enable1 : out std_logic; activeclock : out std_logic; clkloss : out std_logic; locked : out std_logic; scandataout : out std_logic; scandone : out std_logic; sclkout0 : out std_logic; sclkout1 : out std_logic; phasedone : out std_logic; vcooverrange : out std_logic; vcounderrange : out std_logic; fbout : out std_logic ); end component; component altfp_mult generic ( width_exp : integer := 11; width_man : integer := 31; dedicated_multiplier_circuitry : string := "AUTO"; reduced_functionality : string := "NO"; pipeline : natural := 5; denormal_support : string := "YES"; exception_handling : string := "YES"; lpm_hint : string := "UNUSED"; lpm_type : string := "altfp_mult" ); port ( clock : in std_logic; clk_en : in std_logic := '1'; aclr : in std_logic := '0'; dataa : in std_logic_vector(WIDTH_EXP + WIDTH_MAN downto 0) ; datab : in std_logic_vector(WIDTH_EXP + WIDTH_MAN downto 0) ; result : out std_logic_vector(WIDTH_EXP + WIDTH_MAN downto 0) ; overflow : out std_logic ; underflow : out std_logic ; zero : out std_logic ; denormal : out std_logic ; indefinite : out std_logic ; nan : out std_logic ); end component; component altsqrt generic ( q_port_width : integer := 1; r_port_width : integer := 1; width : integer := 1; pipeline : integer := 0; lpm_hint : string := "UNUSED"; lpm_type : string := "altsqrt" ); port ( radical : in std_logic_vector(width - 1 downto 0) ; clk : in std_logic := '1'; ena : in std_logic := '1'; aclr : in std_logic := '0'; q : out std_logic_vector( q_port_width - 1 downto 0) ; remainder : out std_logic_vector( r_port_width - 1 downto 0) ); end component; component parallel_add generic ( width : natural := 4; size : natural := 2; widthr : natural := 4; shift : natural := 0; msw_subtract : string := "NO"; representation : string := "UNSIGNED"; pipeline : natural := 0; result_alignment : string := "LSB"; lpm_hint : string := "UNUSED"; lpm_type : string := "parallel_add" ); port ( data : in altera_mf_logic_2D(size - 1 downto 0, width - 1 downto 0); clock : in std_logic := '1'; aclr : in std_logic := '0'; clken : in std_logic := '1'; result : out std_logic_vector(widthr - 1 downto 0) ); end component; component a_graycounter generic ( width : natural; pvalue : natural; lpm_hint : string := "UNUSED"; lpm_type : string := "a_graycounter" ); port ( clock : in std_logic; clk_en : in std_logic := '1'; cnt_en : in std_logic := '1'; updown : in std_logic := '1'; aclr : in std_logic := '0'; sclr : in std_logic := '0'; qbin : out std_logic_vector(width-1 downto 0); q : out std_logic_vector(width-1 downto 0) ); end component; component altsquare generic ( data_width : natural; pipeline : natural; representation : string := "UNSIGNED"; result_alignment : string := "LSB"; result_width : natural; lpm_hint : string := "UNUSED"; lpm_type : string := "altsquare" ); port( aclr : in std_logic := '0'; clock : in std_logic := '1'; data : in std_logic_vector(data_width-1 downto 0); ena : in std_logic := '1'; result : out std_logic_vector(result_width-1 downto 0) ); end component; component sld_virtual_jtag generic ( lpm_type : string; lpm_hint : string; sld_auto_instance_index : string; sld_instance_index : integer; sld_ir_width : integer; sld_sim_n_scan : integer; sld_sim_total_length : integer; sld_sim_action : string); port ( tdo : in std_logic := '0'; ir_out : in std_logic_vector(sld_ir_width - 1 downto 0) := (others => '0'); tck : out std_logic; tdi : out std_logic; ir_in : out std_logic_vector(sld_ir_width - 1 downto 0); virtual_state_cdr : out std_logic; virtual_state_sdr : out std_logic; virtual_state_e1dr : out std_logic; virtual_state_pdr : out std_logic; virtual_state_e2dr : out std_logic; virtual_state_udr : out std_logic; virtual_state_cir : out std_logic; virtual_state_uir : out std_logic; jtag_state_tlr : out std_logic; jtag_state_rti : out std_logic; jtag_state_sdrs : out std_logic; jtag_state_cdr : out std_logic; jtag_state_sdr : out std_logic; jtag_state_e1dr : out std_logic; jtag_state_pdr : out std_logic; jtag_state_e2dr : out std_logic; jtag_state_udr : out std_logic; jtag_state_sirs : out std_logic; jtag_state_cir : out std_logic; jtag_state_sir : out std_logic; jtag_state_e1ir : out std_logic; jtag_state_pir : out std_logic; jtag_state_e2ir : out std_logic; jtag_state_uir : out std_logic; tms : out std_logic); end component; component sld_virtual_jtag_basic generic ( lpm_type : string; lpm_hint : string; sld_mfg_id : natural range 0 to 2047; sld_type_id : natural range 0 to 255; sld_version : natural range 0 to 31; sld_auto_instance_index : string; sld_instance_index : integer; sld_ir_width : integer; sld_sim_n_scan : integer; sld_sim_total_length : integer; sld_sim_action : string); port ( tdo : in std_logic := '0'; ir_out : in std_logic_vector(sld_ir_width - 1 downto 0) := (others => '0'); tck : out std_logic; tdi : out std_logic; ir_in : out std_logic_vector(sld_ir_width - 1 downto 0); virtual_state_cdr : out std_logic; virtual_state_sdr : out std_logic; virtual_state_e1dr : out std_logic; virtual_state_pdr : out std_logic; virtual_state_e2dr : out std_logic; virtual_state_udr : out std_logic; virtual_state_cir : out std_logic; virtual_state_uir : out std_logic; jtag_state_tlr : out std_logic; jtag_state_rti : out std_logic; jtag_state_sdrs : out std_logic; jtag_state_cdr : out std_logic; jtag_state_sdr : out std_logic; jtag_state_e1dr : out std_logic; jtag_state_pdr : out std_logic; jtag_state_e2dr : out std_logic; jtag_state_udr : out std_logic; jtag_state_sirs : out std_logic; jtag_state_cir : out std_logic; jtag_state_sir : out std_logic; jtag_state_e1ir : out std_logic; jtag_state_pir : out std_logic; jtag_state_e2ir : out std_logic; jtag_state_uir : out std_logic; tms : out std_logic); end component; component altdq_dqs generic ( delay_buffer_mode : string := "LOW"; delay_dqs_enable_by_half_cycle : string := "FALSE"; intended_device_family : string := "UNUSED"; dq_half_rate_use_dataoutbypass : string := "FALSE"; dq_input_reg_async_mode : string := "NONE"; dq_input_reg_clk_source : string := "DQS_BUS"; dq_input_reg_mode : string := "NONE"; dq_input_reg_power_up : string := "LOW"; dq_input_reg_sync_mode : string := "NONE"; dq_input_reg_use_clkn : string := "FALSE"; dq_ipa_add_input_cycle_delay : string := "FALSE"; dq_ipa_add_phase_transfer_reg : string := "FALSE"; dq_ipa_bypass_output_register : string := "FALSE"; dq_ipa_invert_phase : string := "FALSE"; dq_ipa_phase_setting : integer := 0; dq_oe_reg_async_mode : string := "NONE"; dq_oe_reg_mode : string := "NONE"; dq_oe_reg_power_up : string := "LOW"; dq_oe_reg_sync_mode : string := "NONE"; dq_output_reg_async_mode : string := "NONE"; dq_output_reg_mode : string := "NONE"; dq_output_reg_power_up : string := "LOW"; dq_output_reg_sync_mode : string := "NONE"; dqs_ctrl_latches_enable : string := "FALSE"; dqs_delay_chain_delayctrlin_source : string := "CORE"; dqs_delay_chain_phase_setting : integer := 0; dqs_dqsn_mode : string := "NONE"; dqs_enable_ctrl_add_phase_transfer_reg : string := "FALSE"; dqs_enable_ctrl_invert_phase : string := "FALSE"; dqs_enable_ctrl_phase_setting : integer := 0; dqs_input_frequency : string := "UNUSED"; dqs_oe_reg_async_mode : string := "NONE"; dqs_oe_reg_mode : string := "NONE"; dqs_oe_reg_power_up : string := "LOW"; dqs_oe_reg_sync_mode : string := "NONE"; dqs_offsetctrl_enable : string := "FALSE"; dqs_output_reg_async_mode : string := "NONE"; dqs_output_reg_mode : string := "NONE"; dqs_output_reg_power_up : string := "LOW"; dqs_output_reg_sync_mode : string := "NONE"; dqs_phase_shift : integer := 0; io_clock_divider_clk_source : string := "CORE"; io_clock_divider_invert_phase : string := "FALSE"; io_clock_divider_phase_setting : integer := 0; level_dqs_enable : string := "FALSE"; number_of_bidir_dq : integer := 1; number_of_clk_divider : integer := 1; number_of_input_dq : integer := 1; number_of_output_dq : integer := 1; oct_reg_mode : string := "NONE"; use_dq_input_delay_chain : string := "FALSE"; use_dq_ipa : string := "FALSE"; use_dq_ipa_phasectrlin : string := "TRUE"; use_dq_oe_delay_chain1 : string := "FALSE"; use_dq_oe_delay_chain2 : string := "FALSE"; use_dq_oe_path : string := "FALSE"; use_dq_output_delay_chain1 : string := "FALSE"; use_dq_output_delay_chain2 : string := "FALSE"; use_dqs : string := "FALSE"; use_dqs_delay_chain : string := "FALSE"; use_dqs_delay_chain_phasectrlin : string := "FALSE"; use_dqs_enable : string := "FALSE"; use_dqs_enable_ctrl : string := "FALSE"; use_dqs_enable_ctrl_phasectrlin : string := "TRUE"; use_dqs_input_delay_chain : string := "FALSE"; use_dqs_input_path : string := "FALSE"; use_dqs_oe_delay_chain1 : string := "FALSE"; use_dqs_oe_delay_chain2 : string := "FALSE"; use_dqs_oe_path : string := "FALSE"; use_dqs_output_delay_chain1 : string := "FALSE"; use_dqs_output_delay_chain2 : string := "FALSE"; use_dqs_output_path : string := "FALSE"; use_dqsbusout_delay_chain : string := "FALSE"; use_dqsenable_delay_chain : string := "FALSE"; use_dynamic_oct : string := "FALSE"; use_half_rate : string := "FALSE"; use_io_clock_divider_masterin : string := "FALSE"; use_io_clock_divider_phasectrlin : string := "TRUE"; use_oct_delay_chain1 : string := "FALSE"; use_oct_delay_chain2 : string := "FALSE"; lpm_hint : string := "UNUSED"; lpm_type : string := "altdq_dqs"); port ( bidir_dq_areset : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_hr_oct_in : in std_logic_vector(2 * number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_hr_oe_in : in std_logic_vector(2 * number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_hr_output_data_in : in std_logic_vector(4 * number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_input_data_in : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_io_config_ena : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '1'); bidir_dq_oct_in : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_oe_in : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_output_data_in : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_output_data_in_high : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_output_data_in_low : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); bidir_dq_sreset : in std_logic_vector(number_of_bidir_dq - 1 downto 0) := (others => '0'); config_clk : in std_logic := '0'; config_datain : in std_logic := '0'; config_update : in std_logic := '0'; core_delayctrlin : in std_logic_vector(5 downto 0) := (others => '0'); dll_delayctrlin : in std_logic_vector(5 downto 0) := (others => '0'); dq_hr_output_reg_clk : in std_logic := '0'; dq_input_reg_clk : in std_logic := '0'; dq_input_reg_clkena : in std_logic := '1'; dq_ipa_clk : in std_logic := '0'; dq_output_reg_clk : in std_logic := '0'; dq_output_reg_clkena : in std_logic := '1'; dqs_areset : in std_logic := '0'; dqs_config_ena : in std_logic := '1'; dqs_enable_ctrl_clk : in std_logic := '1'; dqs_enable_ctrl_hr_datainhi : in std_logic := '0'; dqs_enable_ctrl_hr_datainlo : in std_logic := '0'; dqs_enable_ctrl_in : in std_logic := '1'; dqs_enable_in : in std_logic := '1'; dqs_hr_oct_in : in std_logic_vector(1 downto 0) := (others => '0'); dqs_hr_oe_in : in std_logic_vector(1 downto 0) := (others => '0'); dqs_hr_output_data_in : in std_logic_vector(3 downto 0) := (others => '0'); dqs_hr_output_reg_clk : in std_logic := '0'; dqs_input_data_in : in std_logic := '0'; dqs_io_config_ena : in std_logic := '1'; dqs_oct_in : in std_logic := '0'; dqs_oe_in : in std_logic := '0'; dqs_output_data_in : in std_logic := '0'; dqs_output_data_in_high : in std_logic := '0'; dqs_output_data_in_low : in std_logic := '0'; dqs_output_reg_clk : in std_logic := '0'; dqs_output_reg_clkena : in std_logic := '1'; dqs_sreset : in std_logic := '0'; dqsn_areset : in std_logic := '0'; dqsn_hr_oct_in : in std_logic_vector(1 downto 0) := (others => '0'); dqsn_hr_oe_in : in std_logic_vector(1 downto 0) := (others => '0'); dqsn_hr_output_data_in : in std_logic_vector(3 downto 0) := (others => '0'); dqsn_input_data_in : in std_logic := '0'; dqsn_io_config_ena : in std_logic := '1'; dqsn_oct_in : in std_logic := '0'; dqsn_oe_in : in std_logic := '0'; dqsn_output_data_in : in std_logic := '0'; dqsn_output_data_in_high : in std_logic := '0'; dqsn_output_data_in_low : in std_logic := '0'; dqsn_sreset : in std_logic := '0'; dqsupdateen : in std_logic := '0'; hr_oct_reg_clk : in std_logic := '0'; input_dq_areset : in std_logic_vector(number_of_input_dq - 1 downto 0) := (others => '0'); input_dq_hr_oct_in : in std_logic_vector(2 * number_of_input_dq - 1 downto 0) := (others => '0'); input_dq_input_data_in : in std_logic_vector(number_of_input_dq - 1 downto 0) := (others => '0'); input_dq_io_config_ena : in std_logic_vector(number_of_input_dq - 1 downto 0) := (others => '1'); input_dq_oct_in : in std_logic_vector(number_of_input_dq - 1 downto 0) := (others => '0'); input_dq_sreset : in std_logic_vector(number_of_input_dq - 1 downto 0) := (others => '0'); io_clock_divider_clk : in std_logic := '0'; io_clock_divider_masterin : in std_logic := '0'; oct_reg_clk : in std_logic := '0'; offsetctrlin : in std_logic_vector(5 downto 0) := (others => '0'); output_dq_areset : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_hr_oct_in : in std_logic_vector(2 * number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_hr_oe_in : in std_logic_vector(2 * number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_hr_output_data_in : in std_logic_vector(4 * number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_io_config_ena : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '1'); output_dq_oct_in : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_oe_in : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_output_data_in : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_output_data_in_high : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_output_data_in_low : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); output_dq_sreset : in std_logic_vector(number_of_output_dq - 1 downto 0) := (others => '0'); bidir_dq_hr_input_data_out : out std_logic_vector(4 * number_of_bidir_dq - 1 downto 0); bidir_dq_input_data_out : out std_logic_vector(number_of_bidir_dq - 1 downto 0); bidir_dq_input_data_out_high : out std_logic_vector(number_of_bidir_dq - 1 downto 0); bidir_dq_input_data_out_low : out std_logic_vector(number_of_bidir_dq - 1 downto 0); bidir_dq_oct_out : out std_logic_vector(number_of_bidir_dq - 1 downto 0); bidir_dq_oe_out : out std_logic_vector(number_of_bidir_dq - 1 downto 0); bidir_dq_output_data_out : out std_logic_vector(number_of_bidir_dq - 1 downto 0); dqs_bus_out : out std_logic; dqs_input_data_out : out std_logic; dqs_oct_out : out std_logic; dqs_oe_out : out std_logic; dqs_output_data_out : out std_logic; dqsn_bus_out : out std_logic; dqsn_input_data_out : out std_logic; dqsn_oct_out : out std_logic; dqsn_oe_out : out std_logic; dqsn_output_data_out : out std_logic; input_dq_hr_input_data_out : out std_logic_vector(4 * number_of_input_dq - 1 downto 0); input_dq_input_data_out : out std_logic_vector(number_of_input_dq - 1 downto 0); input_dq_input_data_out_high : out std_logic_vector(number_of_input_dq - 1 downto 0); input_dq_input_data_out_low : out std_logic_vector(number_of_input_dq - 1 downto 0); input_dq_oct_out : out std_logic_vector(number_of_input_dq - 1 downto 0); io_clock_divider_clkout : out std_logic_vector(number_of_clk_divider - 1 downto 0); io_clock_divider_slaveout : out std_logic; output_dq_oct_out : out std_logic_vector(number_of_output_dq - 1 downto 0); output_dq_oe_out : out std_logic_vector(number_of_output_dq - 1 downto 0); output_dq_output_data_out : out std_logic_vector(number_of_output_dq - 1 downto 0)); end component; component altera_std_synchronizer generic (depth : integer := 3); port ( clk : in std_logic; reset_n : in std_logic; din : in std_logic; dout : out std_logic ); end component; component altera_std_synchronizer_bundle generic (depth : integer := 3; width : integer := 1); port ( clk : in std_logic; reset_n : in std_logic; din : in std_logic_vector(width-1 downto 0); dout : out std_logic_vector(width-1 downto 0) ); end component; component alt_cal generic ( number_of_channels : integer := 1; channel_address_width : integer := 1; sim_model_mode : string := "TRUE"; lpm_hint : string := "UNUSED"; lpm_type : string := "alt_cal" ); PORT ( busy : OUT STD_LOGIC; cal_error : OUT STD_LOGIC_VECTOR (0 DOWNTO 0); clock : IN STD_LOGIC; dprio_addr : OUT STD_LOGIC_VECTOR (15 DOWNTO 0); dprio_busy : IN STD_LOGIC; dprio_datain : IN STD_LOGIC_VECTOR (15 DOWNTO 0); dprio_dataout : OUT STD_LOGIC_VECTOR (15 DOWNTO 0); dprio_rden : OUT STD_LOGIC; dprio_wren : OUT STD_LOGIC; quad_addr : OUT STD_LOGIC_VECTOR (6 DOWNTO 0); remap_addr : IN STD_LOGIC_VECTOR (9 DOWNTO 0) := (OTHERS => '0'); reset : IN STD_LOGIC := '0'; retain_addr : OUT STD_LOGIC_VECTOR (0 DOWNTO 0); start : IN STD_LOGIC := '0'; testbuses : IN STD_LOGIC_VECTOR (4 * number_of_channels - 1 DOWNTO 0) := (OTHERS => '0') ); end component; constant ELA_STATUS_BITS : natural := 4; constant N_ELA_INSTRS : natural := 8; constant SLD_IR_BITS : natural := N_ELA_INSTRS; component sld_signaltap generic ( SLD_CURRENT_RESOURCE_WIDTH : natural := 0; SLD_INVERSION_MASK : std_logic_vector := "0"; SLD_POWER_UP_TRIGGER : natural := 0; SLD_ADVANCED_TRIGGER_6 : string := "NONE"; SLD_ADVANCED_TRIGGER_9 : string := "NONE"; SLD_ADVANCED_TRIGGER_7 : string := "NONE"; SLD_STORAGE_QUALIFIER_ADVANCED_CONDITION_ENTITY : string := "basic"; SLD_STORAGE_QUALIFIER_GAP_RECORD : natural := 0; SLD_INCREMENTAL_ROUTING : natural := 0; SLD_STORAGE_QUALIFIER_PIPELINE : natural := 0; SLD_TRIGGER_IN_ENABLED : natural := 0; SLD_STATE_BITS : natural := 11; SLD_STATE_FLOW_USE_GENERATED : natural := 0; SLD_INVERSION_MASK_LENGTH : integer := 1; SLD_DATA_BITS : natural := 1; SLD_BUFFER_FULL_STOP : natural := 1; SLD_STORAGE_QUALIFIER_INVERSION_MASK_LENGTH : natural := 0; SLD_ATTRIBUTE_MEM_MODE : string := "OFF"; SLD_STORAGE_QUALIFIER_MODE : string := "OFF"; SLD_STATE_FLOW_MGR_ENTITY : string := "state_flow_mgr_entity.vhd"; SLD_NODE_CRC_LOWORD : natural := 50132; SLD_ADVANCED_TRIGGER_5 : string := "NONE"; SLD_TRIGGER_BITS : natural := 1; SLD_STORAGE_QUALIFIER_BITS : natural := 1; SLD_ADVANCED_TRIGGER_10 : string := "NONE"; SLD_MEM_ADDRESS_BITS : natural := 7; SLD_ADVANCED_TRIGGER_ENTITY : string := "basic"; SLD_ADVANCED_TRIGGER_4 : string := "NONE"; SLD_TRIGGER_LEVEL : natural := 10; SLD_ADVANCED_TRIGGER_8 : string := "NONE"; SLD_RAM_BLOCK_TYPE : string := "AUTO"; SLD_ADVANCED_TRIGGER_2 : string := "NONE"; SLD_ADVANCED_TRIGGER_1 : string := "NONE"; SLD_DATA_BIT_CNTR_BITS : natural := 4; lpm_type : string := "sld_signaltap"; SLD_NODE_CRC_BITS : natural := 32; SLD_SAMPLE_DEPTH : natural := 16; SLD_ENABLE_ADVANCED_TRIGGER : natural := 0; SLD_SEGMENT_SIZE : natural := 0; SLD_NODE_INFO : natural := 0; SLD_STORAGE_QUALIFIER_ENABLE_ADVANCED_CONDITION : natural := 0; SLD_NODE_CRC_HIWORD : natural := 41394; SLD_TRIGGER_LEVEL_PIPELINE : natural := 1; SLD_ADVANCED_TRIGGER_3 : string := "NONE" ); port ( jtag_state_sdr : in std_logic := '0'; ir_out : out std_logic_vector(SLD_IR_BITS-1 downto 0); jtag_state_cdr : in std_logic := '0'; ir_in : in std_logic_vector(SLD_IR_BITS-1 downto 0) := (others => '0'); tdi : in std_logic := '0'; acq_trigger_out : out std_logic_vector(SLD_TRIGGER_BITS-1 downto 0); jtag_state_uir : in std_logic := '0'; acq_trigger_in : in std_logic_vector(SLD_TRIGGER_BITS-1 downto 0) := (others => '0'); trigger_out : out std_logic; storage_enable : in std_logic := '0'; acq_data_out : out std_logic_vector(SLD_DATA_BITS-1 downto 0); acq_data_in : in std_logic_vector(SLD_DATA_BITS-1 downto 0) := (others => '0'); acq_storage_qualifier_in : in std_logic_vector(SLD_STORAGE_QUALIFIER_BITS-1 downto 0) := (others => '0'); jtag_state_udr : in std_logic := '0'; tdo : out std_logic; crc : in std_logic_vector(SLD_NODE_CRC_BITS-1 downto 0) := (others => '0'); jtag_state_e1dr : in std_logic := '0'; raw_tck : in std_logic := '0'; usr1 : in std_logic := '0'; acq_clk : in std_logic; shift : in std_logic := '0'; ena : in std_logic := '0'; clr : in std_logic := '0'; trigger_in : in std_logic := '0'; update : in std_logic := '0'; rti : in std_logic := '0' ); end component; --sld_signaltap component altstratixii_oct generic ( lpm_type : string := "altstratixii_oct" ); port ( terminationenable : in std_logic; terminationclock : in std_logic; rdn : in std_logic; rup : in std_logic ); end component; --altstratixii_oct constant TOP_PFL_IR_BITS : natural := 5; constant N_FLASH_BITS : natural := 4; component altparallel_flash_loader generic ( flash_data_width : natural := 16; normal_mode : natural := 1; fifo_size : natural := 16; safe_mode_revert : natural := 0; dclk_divisor : natural := 1; safe_mode_retry : natural := 1; features_cfg : natural := 1; burst_mode_numonyx : natural := 0; burst_mode_intel : natural := 0; burst_mode : natural := 0; clk_divisor : natural := 1; addr_width : natural := 20; option_bits_start_address : natural := 0; safe_mode_revert_addr : natural := 0; enhanced_flash_programming : natural := 0; page_mode : natural := 0; lpm_type : string := "ALTPARALLEL_FLASH_LOADER"; features_pgm : natural := 1; n_flash : natural := 1; burst_mode_spansion : natural := 0; auto_restart : STRING := "OFF"; page_clk_divisor : natural := 1; conf_data_width : natural := 1; TRISTATE_CHECKBOX : natural := 0; safe_mode_halt : natural := 0 ); port ( fpga_data : out std_logic_vector(conf_data_width-1 downto 0); fpga_dclk : out std_logic; flash_nce : out std_logic; fpga_nstatus : in std_logic := '0'; pfl_clk : in std_logic := '0'; fpga_nconfig : out std_logic; flash_noe : out std_logic; flash_nwe : out std_logic; fpga_conf_done : in std_logic := '0'; pfl_flash_access_granted : in std_logic := '0'; pfl_nreconfigure : in std_logic := '1'; flash_nreset : out std_logic; pfl_nreset : in std_logic := '0'; flash_data : inout std_logic_vector(flash_data_width-1 downto 0); flash_nadv : out std_logic; flash_clk : out std_logic; flash_addr : out std_logic_vector(addr_width-1 downto 0); pfl_flash_access_request : out std_logic; fpga_pgm : in std_logic_vector(2 downto 0) := (others => '0') ); end component; --altparallel_flash_loader component altserial_flash_loader generic ( enhanced_mode : natural := 0; intended_device_family : STRING := "Cyclone"; enable_shared_access : STRING := "OFF"; lpm_type : STRING := "ALTSERIAL_FLASH_LOADER" ); port ( noe : in std_logic := '0'; asmi_access_granted : in std_logic := '1'; sdoin : in std_logic := '0'; asmi_access_request : out std_logic; data0out : out std_logic; scein : in std_logic := '0'; dclkin : in std_logic := '0' ); end component; --altserial_flash_loader component altsource_probe generic ( probe_width : natural := 1; lpm_hint : string := "UNUSED"; source_width : natural := 1; instance_id : string := "UNUSED"; sld_instance_index : natural := 0; source_initial_value : string := "0"; sld_ir_width : natural := 4; lpm_type : string := "altsource_probe"; sld_auto_instance_index : string := "YES"; SLD_NODE_INFO : natural := 4746752; enable_metastability : string := "NO" ); port ( jtag_state_sdr : in std_logic; source : out std_logic_vector(source_width-1 downto 0); ir_out : out std_logic_vector(sld_ir_width-1 downto 0); jtag_state_cdr : in std_logic; ir_in : in std_logic_vector(sld_ir_width-1 downto 0); jtag_state_tlr : in std_logic; tdi : in std_logic; jtag_state_uir : in std_logic; source_ena : in std_logic; jtag_state_cir : in std_logic; jtag_state_udr : in std_logic; tdo : out std_logic; clrn : in std_logic; jtag_state_e1dr : in std_logic; source_clk : in std_logic; raw_tck : in std_logic; usr1 : in std_logic; ena : in std_logic; probe : in std_logic_vector(probe_width-1 downto 0) ); end component; --altsource_probe end altera_mf_components;
gpl-2.0
b8cc1409779428f26648bf0c4610b0ca
0.472367
3.843586
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/leon3v3/leon3sh.vhd
1
6,522
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: leon3sh -- File: leon3sh.vhd -- Author: Jan Andersson, Aeroflex Gaisler -- Description: Top-level LEON3 component ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.leon3.all; entity leon3sh is generic ( hindex : integer := 0; fabtech : integer range 0 to NTECH := DEFFABTECH; memtech : integer range 0 to NTECH := DEFMEMTECH; nwindows : integer range 2 to 32 := 8; dsu : integer range 0 to 1 := 0; fpu : integer range 0 to 63 := 0; v8 : integer range 0 to 63 := 0; cp : integer range 0 to 1 := 0; mac : integer range 0 to 1 := 0; pclow : integer range 0 to 2 := 2; notag : integer range 0 to 1 := 0; nwp : integer range 0 to 4 := 0; icen : integer range 0 to 1 := 0; irepl : integer range 0 to 3 := 2; isets : integer range 1 to 4 := 1; ilinesize : integer range 4 to 8 := 4; isetsize : integer range 1 to 256 := 1; isetlock : integer range 0 to 1 := 0; dcen : integer range 0 to 1 := 0; drepl : integer range 0 to 3 := 2; dsets : integer range 1 to 4 := 1; dlinesize : integer range 4 to 8 := 4; dsetsize : integer range 1 to 256 := 1; dsetlock : integer range 0 to 1 := 0; dsnoop : integer range 0 to 6 := 0; ilram : integer range 0 to 1 := 0; ilramsize : integer range 1 to 512 := 1; ilramstart : integer range 0 to 255 := 16#8e#; dlram : integer range 0 to 1 := 0; dlramsize : integer range 1 to 512 := 1; dlramstart : integer range 0 to 255 := 16#8f#; mmuen : integer range 0 to 1 := 0; itlbnum : integer range 2 to 64 := 8; dtlbnum : integer range 2 to 64 := 8; tlb_type : integer range 0 to 3 := 1; tlb_rep : integer range 0 to 1 := 0; lddel : integer range 1 to 2 := 2; disas : integer range 0 to 2 := 0; tbuf : integer range 0 to 64 := 0; pwd : integer range 0 to 2 := 2; -- power-down svt : integer range 0 to 1 := 1; -- single vector trapping rstaddr : integer := 0; smp : integer range 0 to 15 := 0; -- support SMP systems cached : integer := 0; -- cacheability table scantest : integer := 0; mmupgsz : integer range 0 to 5 := 0; bp : integer := 1 ); port ( clk : in std_ulogic; rstn : in std_ulogic; ahbi : in ahb_mst_in_type; ahbo : out ahb_mst_out_type; ahbsi : in ahb_slv_in_type; ahbso : in ahb_slv_out_vector; irqi : in l3_irq_in_type; irqo : out l3_irq_out_type; dbgi : in l3_debug_in_type; dbgo : out l3_debug_out_type; fpui : out grfpu_in_type; fpuo : in grfpu_out_type ); end; architecture rtl of leon3sh is signal gnd, vcc : std_logic; begin gnd <= '0'; vcc <= '1'; leon3x0 : leon3x generic map ( hindex => hindex, fabtech => fabtech, memtech => memtech, nwindows => nwindows, dsu => dsu, fpu => fpu, v8 => v8, cp => cp, mac => mac, pclow => pclow, notag => notag, nwp => nwp, icen => icen, irepl => irepl, isets => isets, ilinesize => ilinesize, isetsize => isetsize, isetlock => isetlock, dcen => dcen, drepl => drepl, dsets => dsets, dlinesize => dlinesize, dsetsize => dsetsize, dsetlock => dsetlock, dsnoop => dsnoop, ilram => ilram, ilramsize => ilramsize, ilramstart => ilramstart, dlram => dlram, dlramsize => dlramsize, dlramstart => dlramstart, mmuen => mmuen, itlbnum => itlbnum, dtlbnum => dtlbnum, tlb_type => tlb_type, tlb_rep => tlb_rep, lddel => lddel, disas => disas, tbuf => tbuf, pwd => pwd, svt => svt, rstaddr => rstaddr, smp => smp, iuft => 0, fpft => 0, cmft => 0, iuinj => 0, ceinj => 0, cached => cached, clk2x => 0, netlist => 0, scantest => scantest, mmupgsz => mmupgsz, bp => bp) port map ( clk => gnd, gclk2 => clk, gfclk2 => clk, clk2 => clk, rstn => rstn, ahbi => ahbi, ahbo => ahbo, ahbsi => ahbsi, ahbso => ahbso, irqi => irqi, irqo => irqo, dbgi => dbgi, dbgo => dbgo, fpui => fpui, fpuo => fpuo, clken => vcc); end;
gpl-2.0
924273501cbfeeadfaa3cd14107e35a6
0.468261
3.976829
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/acme/prj/solution1/syn/vhdl/image_filter.vhd
2
57,414
-- ============================================================== -- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- =========================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity image_filter is port ( INPUT_STREAM_TDATA : IN STD_LOGIC_VECTOR (31 downto 0); INPUT_STREAM_TKEEP : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TSTRB : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TUSER : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TLAST : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TID : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TDEST : IN STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDATA : OUT STD_LOGIC_VECTOR (31 downto 0); OUTPUT_STREAM_TKEEP : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TSTRB : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TUSER : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TLAST : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TID : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDEST : OUT STD_LOGIC_VECTOR (0 downto 0); rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); ap_clk : IN STD_LOGIC; ap_rst_n : IN STD_LOGIC; ap_start : IN STD_LOGIC; INPUT_STREAM_TVALID : IN STD_LOGIC; INPUT_STREAM_TREADY : OUT STD_LOGIC; OUTPUT_STREAM_TVALID : OUT STD_LOGIC; OUTPUT_STREAM_TREADY : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC ); end; architecture behav of image_filter is attribute CORE_GENERATION_INFO : STRING; attribute CORE_GENERATION_INFO of behav : architecture is "image_filter,hls_ip_2014_4,{HLS_INPUT_TYPE=cxx,HLS_INPUT_FLOAT=0,HLS_INPUT_FIXED=0,HLS_INPUT_PART=xc7z020clg484-1,HLS_INPUT_CLOCK=6.666670,HLS_INPUT_ARCH=dataflow,HLS_SYN_CLOCK=5.681000,HLS_SYN_LAT=-1,HLS_SYN_TPT=-1,HLS_SYN_MEM=6,HLS_SYN_DSP=4,HLS_SYN_FF=1026,HLS_SYN_LUT=1358}"; constant ap_const_lv32_0 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000000"; constant ap_const_lv4_0 : STD_LOGIC_VECTOR (3 downto 0) := "0000"; constant ap_const_lv1_0 : STD_LOGIC_VECTOR (0 downto 0) := "0"; constant ap_true : BOOLEAN := true; constant ap_const_logic_0 : STD_LOGIC := '0'; constant ap_const_logic_1 : STD_LOGIC := '1'; signal ap_rst_n_inv : STD_LOGIC; signal image_filter_Block_proc_U0_ap_start : STD_LOGIC; signal image_filter_Block_proc_U0_ap_done : STD_LOGIC; signal image_filter_Block_proc_U0_ap_continue : STD_LOGIC; signal image_filter_Block_proc_U0_ap_idle : STD_LOGIC; signal image_filter_Block_proc_U0_ap_ready : STD_LOGIC; signal image_filter_Block_proc_U0_rows : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Block_proc_U0_cols : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Block_proc_U0_ap_return_0 : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Block_proc_U0_ap_return_1 : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Block_proc_U0_ap_return_2 : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Block_proc_U0_ap_return_3 : STD_LOGIC_VECTOR (11 downto 0); signal ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel : STD_LOGIC; signal img_0_rows_V_channel_full_n : STD_LOGIC; signal ap_reg_ready_img_0_rows_V_channel_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_0_rows_V_channel_full_n : STD_LOGIC; signal ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V : STD_LOGIC; signal img_1_rows_V_full_n : STD_LOGIC; signal ap_reg_ready_img_1_rows_V_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_1_rows_V_full_n : STD_LOGIC; signal ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V : STD_LOGIC; signal img_1_cols_V_full_n : STD_LOGIC; signal ap_reg_ready_img_1_cols_V_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_1_cols_V_full_n : STD_LOGIC; signal ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel : STD_LOGIC; signal img_0_cols_V_channel_full_n : STD_LOGIC; signal ap_reg_ready_img_0_cols_V_channel_full_n : STD_LOGIC := '0'; signal ap_sig_ready_img_0_cols_V_channel_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_start : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_done : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_continue : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_idle : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_ap_ready : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDATA : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TVALID : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TREADY : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TKEEP : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TSTRB : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TUSER : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TLAST : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TID : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDEST : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_AXIvideo2Mat_U0_img_rows_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_AXIvideo2Mat_U0_img_cols_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_write : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_write : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_full_n : STD_LOGIC; signal image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_start : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_done : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_continue : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_idle : STD_LOGIC; signal image_filter_Loop_1_proc_U0_ap_ready : STD_LOGIC; signal image_filter_Loop_1_proc_U0_rows : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Loop_1_proc_U0_cols : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_empty_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_read : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_empty_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_read : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_empty_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_read : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_full_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_full_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_write : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_full_n : STD_LOGIC; signal image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_write : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_start : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_done : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_continue : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_idle : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_ap_ready : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_rows_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Mat2AXIvideo_U0_img_cols_V_read : STD_LOGIC_VECTOR (11 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_empty_n : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_read : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_empty_n : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_read : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_empty_n : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_read : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDATA : STD_LOGIC_VECTOR (31 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TVALID : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TREADY : STD_LOGIC; signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TKEEP : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TSTRB : STD_LOGIC_VECTOR (3 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TUSER : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TLAST : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TID : STD_LOGIC_VECTOR (0 downto 0); signal image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDEST : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_hs_continue : STD_LOGIC; signal img_0_rows_V_channel_U_ap_dummy_ce : STD_LOGIC; signal img_0_rows_V_channel_din : STD_LOGIC_VECTOR (11 downto 0); signal img_0_rows_V_channel_write : STD_LOGIC; signal img_0_rows_V_channel_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_0_rows_V_channel_empty_n : STD_LOGIC; signal img_0_rows_V_channel_read : STD_LOGIC; signal img_0_cols_V_channel_U_ap_dummy_ce : STD_LOGIC; signal img_0_cols_V_channel_din : STD_LOGIC_VECTOR (11 downto 0); signal img_0_cols_V_channel_write : STD_LOGIC; signal img_0_cols_V_channel_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_0_cols_V_channel_empty_n : STD_LOGIC; signal img_0_cols_V_channel_read : STD_LOGIC; signal img_1_rows_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_rows_V_din : STD_LOGIC_VECTOR (11 downto 0); signal img_1_rows_V_write : STD_LOGIC; signal img_1_rows_V_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_1_rows_V_empty_n : STD_LOGIC; signal img_1_rows_V_read : STD_LOGIC; signal img_1_cols_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_cols_V_din : STD_LOGIC_VECTOR (11 downto 0); signal img_1_cols_V_write : STD_LOGIC; signal img_1_cols_V_dout : STD_LOGIC_VECTOR (11 downto 0); signal img_1_cols_V_empty_n : STD_LOGIC; signal img_1_cols_V_read : STD_LOGIC; signal img_0_data_stream_0_V_U_ap_dummy_ce : STD_LOGIC; signal img_0_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_0_V_full_n : STD_LOGIC; signal img_0_data_stream_0_V_write : STD_LOGIC; signal img_0_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_0_V_empty_n : STD_LOGIC; signal img_0_data_stream_0_V_read : STD_LOGIC; signal img_0_data_stream_1_V_U_ap_dummy_ce : STD_LOGIC; signal img_0_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_1_V_full_n : STD_LOGIC; signal img_0_data_stream_1_V_write : STD_LOGIC; signal img_0_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_1_V_empty_n : STD_LOGIC; signal img_0_data_stream_1_V_read : STD_LOGIC; signal img_0_data_stream_2_V_U_ap_dummy_ce : STD_LOGIC; signal img_0_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_2_V_full_n : STD_LOGIC; signal img_0_data_stream_2_V_write : STD_LOGIC; signal img_0_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_0_data_stream_2_V_empty_n : STD_LOGIC; signal img_0_data_stream_2_V_read : STD_LOGIC; signal img_1_data_stream_0_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_data_stream_0_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_0_V_full_n : STD_LOGIC; signal img_1_data_stream_0_V_write : STD_LOGIC; signal img_1_data_stream_0_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_0_V_empty_n : STD_LOGIC; signal img_1_data_stream_0_V_read : STD_LOGIC; signal img_1_data_stream_1_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_data_stream_1_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_1_V_full_n : STD_LOGIC; signal img_1_data_stream_1_V_write : STD_LOGIC; signal img_1_data_stream_1_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_1_V_empty_n : STD_LOGIC; signal img_1_data_stream_1_V_read : STD_LOGIC; signal img_1_data_stream_2_V_U_ap_dummy_ce : STD_LOGIC; signal img_1_data_stream_2_V_din : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_2_V_full_n : STD_LOGIC; signal img_1_data_stream_2_V_write : STD_LOGIC; signal img_1_data_stream_2_V_dout : STD_LOGIC_VECTOR (7 downto 0); signal img_1_data_stream_2_V_empty_n : STD_LOGIC; signal img_1_data_stream_2_V_read : STD_LOGIC; signal ap_reg_procdone_image_filter_Block_proc_U0 : STD_LOGIC := '0'; signal ap_sig_hs_done : STD_LOGIC; signal ap_reg_procdone_image_filter_AXIvideo2Mat_U0 : STD_LOGIC := '0'; signal ap_reg_procdone_image_filter_Loop_1_proc_U0 : STD_LOGIC := '0'; signal ap_reg_procdone_image_filter_Mat2AXIvideo_U0 : STD_LOGIC := '0'; signal ap_CS : STD_LOGIC; signal ap_sig_top_allready : STD_LOGIC; component image_filter_Block_proc IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); ap_return_0 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_1 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_2 : OUT STD_LOGIC_VECTOR (11 downto 0); ap_return_3 : OUT STD_LOGIC_VECTOR (11 downto 0) ); end component; component image_filter_AXIvideo2Mat IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; INPUT_STREAM_TDATA : IN STD_LOGIC_VECTOR (31 downto 0); INPUT_STREAM_TVALID : IN STD_LOGIC; INPUT_STREAM_TREADY : OUT STD_LOGIC; INPUT_STREAM_TKEEP : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TSTRB : IN STD_LOGIC_VECTOR (3 downto 0); INPUT_STREAM_TUSER : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TLAST : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TID : IN STD_LOGIC_VECTOR (0 downto 0); INPUT_STREAM_TDEST : IN STD_LOGIC_VECTOR (0 downto 0); img_rows_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_cols_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_data_stream_0_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_data_stream_0_V_full_n : IN STD_LOGIC; img_data_stream_0_V_write : OUT STD_LOGIC; img_data_stream_1_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_data_stream_1_V_full_n : IN STD_LOGIC; img_data_stream_1_V_write : OUT STD_LOGIC; img_data_stream_2_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_data_stream_2_V_full_n : IN STD_LOGIC; img_data_stream_2_V_write : OUT STD_LOGIC ); end component; component image_filter_Loop_1_proc IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; rows : IN STD_LOGIC_VECTOR (31 downto 0); cols : IN STD_LOGIC_VECTOR (31 downto 0); img_0_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_0_V_empty_n : IN STD_LOGIC; img_0_data_stream_0_V_read : OUT STD_LOGIC; img_0_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_1_V_empty_n : IN STD_LOGIC; img_0_data_stream_1_V_read : OUT STD_LOGIC; img_0_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_0_data_stream_2_V_empty_n : IN STD_LOGIC; img_0_data_stream_2_V_read : OUT STD_LOGIC; img_1_data_stream_0_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_0_V_full_n : IN STD_LOGIC; img_1_data_stream_0_V_write : OUT STD_LOGIC; img_1_data_stream_1_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_1_V_full_n : IN STD_LOGIC; img_1_data_stream_1_V_write : OUT STD_LOGIC; img_1_data_stream_2_V_din : OUT STD_LOGIC_VECTOR (7 downto 0); img_1_data_stream_2_V_full_n : IN STD_LOGIC; img_1_data_stream_2_V_write : OUT STD_LOGIC ); end component; component image_filter_Mat2AXIvideo IS port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; img_rows_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_cols_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_0_V_empty_n : IN STD_LOGIC; img_data_stream_0_V_read : OUT STD_LOGIC; img_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_1_V_empty_n : IN STD_LOGIC; img_data_stream_1_V_read : OUT STD_LOGIC; img_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_2_V_empty_n : IN STD_LOGIC; img_data_stream_2_V_read : OUT STD_LOGIC; OUTPUT_STREAM_TDATA : OUT STD_LOGIC_VECTOR (31 downto 0); OUTPUT_STREAM_TVALID : OUT STD_LOGIC; OUTPUT_STREAM_TREADY : IN STD_LOGIC; OUTPUT_STREAM_TKEEP : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TSTRB : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TUSER : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TLAST : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TID : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDEST : OUT STD_LOGIC_VECTOR (0 downto 0) ); end component; component FIFO_image_filter_img_0_rows_V_channel IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_cols_V_channel IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_rows_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_cols_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (11 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (11 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_data_stream_0_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_data_stream_1_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_0_data_stream_2_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_data_stream_0_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_data_stream_1_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; component FIFO_image_filter_img_1_data_stream_2_V IS port ( clk : IN STD_LOGIC; reset : IN STD_LOGIC; if_read_ce : IN STD_LOGIC; if_write_ce : IN STD_LOGIC; if_din : IN STD_LOGIC_VECTOR (7 downto 0); if_full_n : OUT STD_LOGIC; if_write : IN STD_LOGIC; if_dout : OUT STD_LOGIC_VECTOR (7 downto 0); if_empty_n : OUT STD_LOGIC; if_read : IN STD_LOGIC ); end component; begin image_filter_Block_proc_U0 : component image_filter_Block_proc port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_Block_proc_U0_ap_start, ap_done => image_filter_Block_proc_U0_ap_done, ap_continue => image_filter_Block_proc_U0_ap_continue, ap_idle => image_filter_Block_proc_U0_ap_idle, ap_ready => image_filter_Block_proc_U0_ap_ready, rows => image_filter_Block_proc_U0_rows, cols => image_filter_Block_proc_U0_cols, ap_return_0 => image_filter_Block_proc_U0_ap_return_0, ap_return_1 => image_filter_Block_proc_U0_ap_return_1, ap_return_2 => image_filter_Block_proc_U0_ap_return_2, ap_return_3 => image_filter_Block_proc_U0_ap_return_3); image_filter_AXIvideo2Mat_U0 : component image_filter_AXIvideo2Mat port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_AXIvideo2Mat_U0_ap_start, ap_done => image_filter_AXIvideo2Mat_U0_ap_done, ap_continue => image_filter_AXIvideo2Mat_U0_ap_continue, ap_idle => image_filter_AXIvideo2Mat_U0_ap_idle, ap_ready => image_filter_AXIvideo2Mat_U0_ap_ready, INPUT_STREAM_TDATA => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDATA, INPUT_STREAM_TVALID => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TVALID, INPUT_STREAM_TREADY => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TREADY, INPUT_STREAM_TKEEP => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TKEEP, INPUT_STREAM_TSTRB => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TSTRB, INPUT_STREAM_TUSER => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TUSER, INPUT_STREAM_TLAST => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TLAST, INPUT_STREAM_TID => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TID, INPUT_STREAM_TDEST => image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDEST, img_rows_V_read => image_filter_AXIvideo2Mat_U0_img_rows_V_read, img_cols_V_read => image_filter_AXIvideo2Mat_U0_img_cols_V_read, img_data_stream_0_V_din => image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_din, img_data_stream_0_V_full_n => image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_full_n, img_data_stream_0_V_write => image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_write, img_data_stream_1_V_din => image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_din, img_data_stream_1_V_full_n => image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_full_n, img_data_stream_1_V_write => image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_write, img_data_stream_2_V_din => image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_din, img_data_stream_2_V_full_n => image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_full_n, img_data_stream_2_V_write => image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_write); image_filter_Loop_1_proc_U0 : component image_filter_Loop_1_proc port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_Loop_1_proc_U0_ap_start, ap_done => image_filter_Loop_1_proc_U0_ap_done, ap_continue => image_filter_Loop_1_proc_U0_ap_continue, ap_idle => image_filter_Loop_1_proc_U0_ap_idle, ap_ready => image_filter_Loop_1_proc_U0_ap_ready, rows => image_filter_Loop_1_proc_U0_rows, cols => image_filter_Loop_1_proc_U0_cols, img_0_data_stream_0_V_dout => image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_dout, img_0_data_stream_0_V_empty_n => image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_empty_n, img_0_data_stream_0_V_read => image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_read, img_0_data_stream_1_V_dout => image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_dout, img_0_data_stream_1_V_empty_n => image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_empty_n, img_0_data_stream_1_V_read => image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_read, img_0_data_stream_2_V_dout => image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_dout, img_0_data_stream_2_V_empty_n => image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_empty_n, img_0_data_stream_2_V_read => image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_read, img_1_data_stream_0_V_din => image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_din, img_1_data_stream_0_V_full_n => image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_full_n, img_1_data_stream_0_V_write => image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_write, img_1_data_stream_1_V_din => image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_din, img_1_data_stream_1_V_full_n => image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_full_n, img_1_data_stream_1_V_write => image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_write, img_1_data_stream_2_V_din => image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_din, img_1_data_stream_2_V_full_n => image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_full_n, img_1_data_stream_2_V_write => image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_write); image_filter_Mat2AXIvideo_U0 : component image_filter_Mat2AXIvideo port map ( ap_clk => ap_clk, ap_rst => ap_rst_n_inv, ap_start => image_filter_Mat2AXIvideo_U0_ap_start, ap_done => image_filter_Mat2AXIvideo_U0_ap_done, ap_continue => image_filter_Mat2AXIvideo_U0_ap_continue, ap_idle => image_filter_Mat2AXIvideo_U0_ap_idle, ap_ready => image_filter_Mat2AXIvideo_U0_ap_ready, img_rows_V_read => image_filter_Mat2AXIvideo_U0_img_rows_V_read, img_cols_V_read => image_filter_Mat2AXIvideo_U0_img_cols_V_read, img_data_stream_0_V_dout => image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_dout, img_data_stream_0_V_empty_n => image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_empty_n, img_data_stream_0_V_read => image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_read, img_data_stream_1_V_dout => image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_dout, img_data_stream_1_V_empty_n => image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_empty_n, img_data_stream_1_V_read => image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_read, img_data_stream_2_V_dout => image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_dout, img_data_stream_2_V_empty_n => image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_empty_n, img_data_stream_2_V_read => image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_read, OUTPUT_STREAM_TDATA => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDATA, OUTPUT_STREAM_TVALID => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TVALID, OUTPUT_STREAM_TREADY => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TREADY, OUTPUT_STREAM_TKEEP => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TKEEP, OUTPUT_STREAM_TSTRB => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TSTRB, OUTPUT_STREAM_TUSER => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TUSER, OUTPUT_STREAM_TLAST => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TLAST, OUTPUT_STREAM_TID => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TID, OUTPUT_STREAM_TDEST => image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDEST); img_0_rows_V_channel_U : component FIFO_image_filter_img_0_rows_V_channel port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_rows_V_channel_U_ap_dummy_ce, if_write_ce => img_0_rows_V_channel_U_ap_dummy_ce, if_din => img_0_rows_V_channel_din, if_full_n => img_0_rows_V_channel_full_n, if_write => img_0_rows_V_channel_write, if_dout => img_0_rows_V_channel_dout, if_empty_n => img_0_rows_V_channel_empty_n, if_read => img_0_rows_V_channel_read); img_0_cols_V_channel_U : component FIFO_image_filter_img_0_cols_V_channel port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_cols_V_channel_U_ap_dummy_ce, if_write_ce => img_0_cols_V_channel_U_ap_dummy_ce, if_din => img_0_cols_V_channel_din, if_full_n => img_0_cols_V_channel_full_n, if_write => img_0_cols_V_channel_write, if_dout => img_0_cols_V_channel_dout, if_empty_n => img_0_cols_V_channel_empty_n, if_read => img_0_cols_V_channel_read); img_1_rows_V_U : component FIFO_image_filter_img_1_rows_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_rows_V_U_ap_dummy_ce, if_write_ce => img_1_rows_V_U_ap_dummy_ce, if_din => img_1_rows_V_din, if_full_n => img_1_rows_V_full_n, if_write => img_1_rows_V_write, if_dout => img_1_rows_V_dout, if_empty_n => img_1_rows_V_empty_n, if_read => img_1_rows_V_read); img_1_cols_V_U : component FIFO_image_filter_img_1_cols_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_cols_V_U_ap_dummy_ce, if_write_ce => img_1_cols_V_U_ap_dummy_ce, if_din => img_1_cols_V_din, if_full_n => img_1_cols_V_full_n, if_write => img_1_cols_V_write, if_dout => img_1_cols_V_dout, if_empty_n => img_1_cols_V_empty_n, if_read => img_1_cols_V_read); img_0_data_stream_0_V_U : component FIFO_image_filter_img_0_data_stream_0_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_data_stream_0_V_U_ap_dummy_ce, if_write_ce => img_0_data_stream_0_V_U_ap_dummy_ce, if_din => img_0_data_stream_0_V_din, if_full_n => img_0_data_stream_0_V_full_n, if_write => img_0_data_stream_0_V_write, if_dout => img_0_data_stream_0_V_dout, if_empty_n => img_0_data_stream_0_V_empty_n, if_read => img_0_data_stream_0_V_read); img_0_data_stream_1_V_U : component FIFO_image_filter_img_0_data_stream_1_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_data_stream_1_V_U_ap_dummy_ce, if_write_ce => img_0_data_stream_1_V_U_ap_dummy_ce, if_din => img_0_data_stream_1_V_din, if_full_n => img_0_data_stream_1_V_full_n, if_write => img_0_data_stream_1_V_write, if_dout => img_0_data_stream_1_V_dout, if_empty_n => img_0_data_stream_1_V_empty_n, if_read => img_0_data_stream_1_V_read); img_0_data_stream_2_V_U : component FIFO_image_filter_img_0_data_stream_2_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_0_data_stream_2_V_U_ap_dummy_ce, if_write_ce => img_0_data_stream_2_V_U_ap_dummy_ce, if_din => img_0_data_stream_2_V_din, if_full_n => img_0_data_stream_2_V_full_n, if_write => img_0_data_stream_2_V_write, if_dout => img_0_data_stream_2_V_dout, if_empty_n => img_0_data_stream_2_V_empty_n, if_read => img_0_data_stream_2_V_read); img_1_data_stream_0_V_U : component FIFO_image_filter_img_1_data_stream_0_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_data_stream_0_V_U_ap_dummy_ce, if_write_ce => img_1_data_stream_0_V_U_ap_dummy_ce, if_din => img_1_data_stream_0_V_din, if_full_n => img_1_data_stream_0_V_full_n, if_write => img_1_data_stream_0_V_write, if_dout => img_1_data_stream_0_V_dout, if_empty_n => img_1_data_stream_0_V_empty_n, if_read => img_1_data_stream_0_V_read); img_1_data_stream_1_V_U : component FIFO_image_filter_img_1_data_stream_1_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_data_stream_1_V_U_ap_dummy_ce, if_write_ce => img_1_data_stream_1_V_U_ap_dummy_ce, if_din => img_1_data_stream_1_V_din, if_full_n => img_1_data_stream_1_V_full_n, if_write => img_1_data_stream_1_V_write, if_dout => img_1_data_stream_1_V_dout, if_empty_n => img_1_data_stream_1_V_empty_n, if_read => img_1_data_stream_1_V_read); img_1_data_stream_2_V_U : component FIFO_image_filter_img_1_data_stream_2_V port map ( clk => ap_clk, reset => ap_rst_n_inv, if_read_ce => img_1_data_stream_2_V_U_ap_dummy_ce, if_write_ce => img_1_data_stream_2_V_U_ap_dummy_ce, if_din => img_1_data_stream_2_V_din, if_full_n => img_1_data_stream_2_V_full_n, if_write => img_1_data_stream_2_V_write, if_dout => img_1_data_stream_2_V_dout, if_empty_n => img_1_data_stream_2_V_empty_n, if_read => img_1_data_stream_2_V_read); -- ap_reg_procdone_image_filter_AXIvideo2Mat_U0 assign process. -- ap_reg_procdone_image_filter_AXIvideo2Mat_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_AXIvideo2Mat_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_AXIvideo2Mat_U0 <= ap_const_logic_0; elsif ((ap_const_logic_1 = image_filter_AXIvideo2Mat_U0_ap_done)) then ap_reg_procdone_image_filter_AXIvideo2Mat_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_procdone_image_filter_Block_proc_U0 assign process. -- ap_reg_procdone_image_filter_Block_proc_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_Block_proc_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_Block_proc_U0 <= ap_const_logic_0; elsif ((image_filter_Block_proc_U0_ap_done = ap_const_logic_1)) then ap_reg_procdone_image_filter_Block_proc_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_procdone_image_filter_Loop_1_proc_U0 assign process. -- ap_reg_procdone_image_filter_Loop_1_proc_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_Loop_1_proc_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_Loop_1_proc_U0 <= ap_const_logic_0; elsif ((ap_const_logic_1 = image_filter_Loop_1_proc_U0_ap_done)) then ap_reg_procdone_image_filter_Loop_1_proc_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_procdone_image_filter_Mat2AXIvideo_U0 assign process. -- ap_reg_procdone_image_filter_Mat2AXIvideo_U0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_procdone_image_filter_Mat2AXIvideo_U0 <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_sig_hs_done)) then ap_reg_procdone_image_filter_Mat2AXIvideo_U0 <= ap_const_logic_0; elsif ((ap_const_logic_1 = image_filter_Mat2AXIvideo_U0_ap_done)) then ap_reg_procdone_image_filter_Mat2AXIvideo_U0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_0_cols_V_channel_full_n assign process. -- ap_reg_ready_img_0_cols_V_channel_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_0_cols_V_channel_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_0_cols_V_channel_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (ap_const_logic_1 = img_0_cols_V_channel_full_n))) then ap_reg_ready_img_0_cols_V_channel_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_0_rows_V_channel_full_n assign process. -- ap_reg_ready_img_0_rows_V_channel_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_0_rows_V_channel_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_0_rows_V_channel_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (img_0_rows_V_channel_full_n = ap_const_logic_1))) then ap_reg_ready_img_0_rows_V_channel_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_1_cols_V_full_n assign process. -- ap_reg_ready_img_1_cols_V_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_1_cols_V_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_1_cols_V_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (ap_const_logic_1 = img_1_cols_V_full_n))) then ap_reg_ready_img_1_cols_V_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ready_img_1_rows_V_full_n assign process. -- ap_reg_ready_img_1_rows_V_full_n_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst_n_inv = '1') then ap_reg_ready_img_1_rows_V_full_n <= ap_const_logic_0; else if (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (image_filter_Block_proc_U0_ap_continue = ap_const_logic_1))) then ap_reg_ready_img_1_rows_V_full_n <= ap_const_logic_0; elsif (((image_filter_Block_proc_U0_ap_done = ap_const_logic_1) and (ap_const_logic_1 = img_1_rows_V_full_n))) then ap_reg_ready_img_1_rows_V_full_n <= ap_const_logic_1; end if; end if; end if; end process; -- ap_CS assign process. -- ap_CS_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then ap_CS <= ap_const_logic_0; end if; end process; INPUT_STREAM_TREADY <= image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TREADY; OUTPUT_STREAM_TDATA <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDATA; OUTPUT_STREAM_TDEST <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TDEST; OUTPUT_STREAM_TID <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TID; OUTPUT_STREAM_TKEEP <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TKEEP; OUTPUT_STREAM_TLAST <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TLAST; OUTPUT_STREAM_TSTRB <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TSTRB; OUTPUT_STREAM_TUSER <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TUSER; OUTPUT_STREAM_TVALID <= image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TVALID; -- ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_0_cols_V_channel_full_n) begin if ((ap_const_logic_1 = ap_reg_ready_img_0_cols_V_channel_full_n)) then ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel <= image_filter_Block_proc_U0_ap_done; end if; end process; -- ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_0_rows_V_channel_full_n) begin if ((ap_reg_ready_img_0_rows_V_channel_full_n = ap_const_logic_1)) then ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel <= image_filter_Block_proc_U0_ap_done; end if; end process; -- ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_1_cols_V_full_n) begin if ((ap_const_logic_1 = ap_reg_ready_img_1_cols_V_full_n)) then ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V <= image_filter_Block_proc_U0_ap_done; end if; end process; -- ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V assign process. -- ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V_assign_proc : process(image_filter_Block_proc_U0_ap_done, ap_reg_ready_img_1_rows_V_full_n) begin if ((ap_const_logic_1 = ap_reg_ready_img_1_rows_V_full_n)) then ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V <= ap_const_logic_0; else ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V <= image_filter_Block_proc_U0_ap_done; end if; end process; ap_done <= ap_sig_hs_done; -- ap_idle assign process. -- ap_idle_assign_proc : process(image_filter_Block_proc_U0_ap_idle, image_filter_AXIvideo2Mat_U0_ap_idle, image_filter_Loop_1_proc_U0_ap_idle, image_filter_Mat2AXIvideo_U0_ap_idle, img_0_rows_V_channel_empty_n, img_0_cols_V_channel_empty_n, img_1_rows_V_empty_n, img_1_cols_V_empty_n) begin if (((image_filter_Block_proc_U0_ap_idle = ap_const_logic_1) and (ap_const_logic_1 = image_filter_AXIvideo2Mat_U0_ap_idle) and (ap_const_logic_1 = image_filter_Loop_1_proc_U0_ap_idle) and (ap_const_logic_1 = image_filter_Mat2AXIvideo_U0_ap_idle) and (ap_const_logic_0 = img_0_rows_V_channel_empty_n) and (ap_const_logic_0 = img_0_cols_V_channel_empty_n) and (ap_const_logic_0 = img_1_rows_V_empty_n) and (ap_const_logic_0 = img_1_cols_V_empty_n))) then ap_idle <= ap_const_logic_1; else ap_idle <= ap_const_logic_0; end if; end process; ap_ready <= ap_sig_top_allready; -- ap_rst_n_inv assign process. -- ap_rst_n_inv_assign_proc : process(ap_rst_n) begin ap_rst_n_inv <= not(ap_rst_n); end process; ap_sig_hs_continue <= ap_const_logic_1; -- ap_sig_hs_done assign process. -- ap_sig_hs_done_assign_proc : process(image_filter_Mat2AXIvideo_U0_ap_done) begin if ((ap_const_logic_1 = image_filter_Mat2AXIvideo_U0_ap_done)) then ap_sig_hs_done <= ap_const_logic_1; else ap_sig_hs_done <= ap_const_logic_0; end if; end process; -- ap_sig_ready_img_0_cols_V_channel_full_n assign process. -- ap_sig_ready_img_0_cols_V_channel_full_n_assign_proc : process(img_0_cols_V_channel_full_n, ap_reg_ready_img_0_cols_V_channel_full_n) begin if ((ap_const_logic_0 = ap_reg_ready_img_0_cols_V_channel_full_n)) then ap_sig_ready_img_0_cols_V_channel_full_n <= img_0_cols_V_channel_full_n; else ap_sig_ready_img_0_cols_V_channel_full_n <= ap_const_logic_1; end if; end process; -- ap_sig_ready_img_0_rows_V_channel_full_n assign process. -- ap_sig_ready_img_0_rows_V_channel_full_n_assign_proc : process(img_0_rows_V_channel_full_n, ap_reg_ready_img_0_rows_V_channel_full_n) begin if ((ap_reg_ready_img_0_rows_V_channel_full_n = ap_const_logic_0)) then ap_sig_ready_img_0_rows_V_channel_full_n <= img_0_rows_V_channel_full_n; else ap_sig_ready_img_0_rows_V_channel_full_n <= ap_const_logic_1; end if; end process; -- ap_sig_ready_img_1_cols_V_full_n assign process. -- ap_sig_ready_img_1_cols_V_full_n_assign_proc : process(img_1_cols_V_full_n, ap_reg_ready_img_1_cols_V_full_n) begin if ((ap_const_logic_0 = ap_reg_ready_img_1_cols_V_full_n)) then ap_sig_ready_img_1_cols_V_full_n <= img_1_cols_V_full_n; else ap_sig_ready_img_1_cols_V_full_n <= ap_const_logic_1; end if; end process; -- ap_sig_ready_img_1_rows_V_full_n assign process. -- ap_sig_ready_img_1_rows_V_full_n_assign_proc : process(img_1_rows_V_full_n, ap_reg_ready_img_1_rows_V_full_n) begin if ((ap_const_logic_0 = ap_reg_ready_img_1_rows_V_full_n)) then ap_sig_ready_img_1_rows_V_full_n <= img_1_rows_V_full_n; else ap_sig_ready_img_1_rows_V_full_n <= ap_const_logic_1; end if; end process; ap_sig_top_allready <= image_filter_AXIvideo2Mat_U0_ap_ready; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDATA <= INPUT_STREAM_TDATA; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TDEST <= INPUT_STREAM_TDEST; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TID <= INPUT_STREAM_TID; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TKEEP <= INPUT_STREAM_TKEEP; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TLAST <= INPUT_STREAM_TLAST; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TSTRB <= INPUT_STREAM_TSTRB; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TUSER <= INPUT_STREAM_TUSER; image_filter_AXIvideo2Mat_U0_INPUT_STREAM_TVALID <= INPUT_STREAM_TVALID; image_filter_AXIvideo2Mat_U0_ap_continue <= ap_const_logic_1; image_filter_AXIvideo2Mat_U0_ap_start <= (ap_start and img_0_rows_V_channel_empty_n and img_0_cols_V_channel_empty_n); image_filter_AXIvideo2Mat_U0_img_cols_V_read <= img_0_cols_V_channel_dout; image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_full_n <= img_0_data_stream_0_V_full_n; image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_full_n <= img_0_data_stream_1_V_full_n; image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_full_n <= img_0_data_stream_2_V_full_n; image_filter_AXIvideo2Mat_U0_img_rows_V_read <= img_0_rows_V_channel_dout; -- image_filter_Block_proc_U0_ap_continue assign process. -- image_filter_Block_proc_U0_ap_continue_assign_proc : process(ap_sig_ready_img_0_rows_V_channel_full_n, ap_sig_ready_img_1_rows_V_full_n, ap_sig_ready_img_1_cols_V_full_n, ap_sig_ready_img_0_cols_V_channel_full_n) begin if (((ap_sig_ready_img_0_rows_V_channel_full_n = ap_const_logic_1) and (ap_const_logic_1 = ap_sig_ready_img_1_rows_V_full_n) and (ap_const_logic_1 = ap_sig_ready_img_1_cols_V_full_n) and (ap_const_logic_1 = ap_sig_ready_img_0_cols_V_channel_full_n))) then image_filter_Block_proc_U0_ap_continue <= ap_const_logic_1; else image_filter_Block_proc_U0_ap_continue <= ap_const_logic_0; end if; end process; image_filter_Block_proc_U0_ap_start <= ap_start; image_filter_Block_proc_U0_cols <= cols; image_filter_Block_proc_U0_rows <= rows; image_filter_Loop_1_proc_U0_ap_continue <= ap_const_logic_1; image_filter_Loop_1_proc_U0_ap_start <= ap_start; image_filter_Loop_1_proc_U0_cols <= cols; image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_dout <= img_0_data_stream_0_V_dout; image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_empty_n <= img_0_data_stream_0_V_empty_n; image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_dout <= img_0_data_stream_1_V_dout; image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_empty_n <= img_0_data_stream_1_V_empty_n; image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_dout <= img_0_data_stream_2_V_dout; image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_empty_n <= img_0_data_stream_2_V_empty_n; image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_full_n <= img_1_data_stream_0_V_full_n; image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_full_n <= img_1_data_stream_1_V_full_n; image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_full_n <= img_1_data_stream_2_V_full_n; image_filter_Loop_1_proc_U0_rows <= rows; image_filter_Mat2AXIvideo_U0_OUTPUT_STREAM_TREADY <= OUTPUT_STREAM_TREADY; image_filter_Mat2AXIvideo_U0_ap_continue <= ap_sig_hs_continue; image_filter_Mat2AXIvideo_U0_ap_start <= (img_1_rows_V_empty_n and img_1_cols_V_empty_n); image_filter_Mat2AXIvideo_U0_img_cols_V_read <= img_1_cols_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_dout <= img_1_data_stream_0_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_empty_n <= img_1_data_stream_0_V_empty_n; image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_dout <= img_1_data_stream_1_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_empty_n <= img_1_data_stream_1_V_empty_n; image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_dout <= img_1_data_stream_2_V_dout; image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_empty_n <= img_1_data_stream_2_V_empty_n; image_filter_Mat2AXIvideo_U0_img_rows_V_read <= img_1_rows_V_dout; img_0_cols_V_channel_U_ap_dummy_ce <= ap_const_logic_1; img_0_cols_V_channel_din <= image_filter_Block_proc_U0_ap_return_1; img_0_cols_V_channel_read <= image_filter_AXIvideo2Mat_U0_ap_ready; img_0_cols_V_channel_write <= ap_chn_write_image_filter_Block_proc_U0_img_0_cols_V_channel; img_0_data_stream_0_V_U_ap_dummy_ce <= ap_const_logic_1; img_0_data_stream_0_V_din <= image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_din; img_0_data_stream_0_V_read <= image_filter_Loop_1_proc_U0_img_0_data_stream_0_V_read; img_0_data_stream_0_V_write <= image_filter_AXIvideo2Mat_U0_img_data_stream_0_V_write; img_0_data_stream_1_V_U_ap_dummy_ce <= ap_const_logic_1; img_0_data_stream_1_V_din <= image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_din; img_0_data_stream_1_V_read <= image_filter_Loop_1_proc_U0_img_0_data_stream_1_V_read; img_0_data_stream_1_V_write <= image_filter_AXIvideo2Mat_U0_img_data_stream_1_V_write; img_0_data_stream_2_V_U_ap_dummy_ce <= ap_const_logic_1; img_0_data_stream_2_V_din <= image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_din; img_0_data_stream_2_V_read <= image_filter_Loop_1_proc_U0_img_0_data_stream_2_V_read; img_0_data_stream_2_V_write <= image_filter_AXIvideo2Mat_U0_img_data_stream_2_V_write; img_0_rows_V_channel_U_ap_dummy_ce <= ap_const_logic_1; img_0_rows_V_channel_din <= image_filter_Block_proc_U0_ap_return_0; img_0_rows_V_channel_read <= image_filter_AXIvideo2Mat_U0_ap_ready; img_0_rows_V_channel_write <= ap_chn_write_image_filter_Block_proc_U0_img_0_rows_V_channel; img_1_cols_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_cols_V_din <= image_filter_Block_proc_U0_ap_return_3; img_1_cols_V_read <= image_filter_Mat2AXIvideo_U0_ap_ready; img_1_cols_V_write <= ap_chn_write_image_filter_Block_proc_U0_img_1_cols_V; img_1_data_stream_0_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_data_stream_0_V_din <= image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_din; img_1_data_stream_0_V_read <= image_filter_Mat2AXIvideo_U0_img_data_stream_0_V_read; img_1_data_stream_0_V_write <= image_filter_Loop_1_proc_U0_img_1_data_stream_0_V_write; img_1_data_stream_1_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_data_stream_1_V_din <= image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_din; img_1_data_stream_1_V_read <= image_filter_Mat2AXIvideo_U0_img_data_stream_1_V_read; img_1_data_stream_1_V_write <= image_filter_Loop_1_proc_U0_img_1_data_stream_1_V_write; img_1_data_stream_2_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_data_stream_2_V_din <= image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_din; img_1_data_stream_2_V_read <= image_filter_Mat2AXIvideo_U0_img_data_stream_2_V_read; img_1_data_stream_2_V_write <= image_filter_Loop_1_proc_U0_img_1_data_stream_2_V_write; img_1_rows_V_U_ap_dummy_ce <= ap_const_logic_1; img_1_rows_V_din <= image_filter_Block_proc_U0_ap_return_2; img_1_rows_V_read <= image_filter_Mat2AXIvideo_U0_ap_ready; img_1_rows_V_write <= ap_chn_write_image_filter_Block_proc_U0_img_1_rows_V; end behav;
gpl-3.0
0cf4feb19616db670114ded31488d748
0.636639
2.735694
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/amba/defmst.vhd
1
1,920
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ---------------------------------------------------------------------------- -- Entity: defmst -- File: defmst.vhd -- Author: Edvin Catovic, Gaisler Research -- Description: Default AHB master ------------------------------------------------------------------------------ library IEEE; use IEEE.std_logic_1164.all; library grlib; use grlib.stdlib.all; use grlib.amba.all; entity ahbdefmst is generic ( hindex : integer range 0 to NAHBMST-1 := 0); port ( ahbmo : out ahb_mst_out_type); end; architecture rtl of ahbdefmst is begin ahbmo.hbusreq <= '0'; ahbmo.hlock <= '0'; ahbmo.htrans <= HTRANS_IDLE; ahbmo.haddr <= (others => '0'); ahbmo.hwrite <= '0'; ahbmo.hsize <= (others => '0'); ahbmo.hburst <= (others => '0'); ahbmo.hprot <= (others => '0'); ahbmo.hwdata <= (others => '0'); ahbmo.hirq <= (others => '0'); ahbmo.hconfig <= (others => (others => '0')); ahbmo.hindex <= hindex; end;
gpl-2.0
db21552ef374e3d1a294717d3232932e
0.585417
4.042105
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-ep3c25/leon3mp.vhd
1
17,839
------------------------------------------------------------------------------ -- LEON3 Demonstration design -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; library gaisler; use gaisler.memctrl.all; use gaisler.ddrpkg.all; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.jtag.all; library esa; use esa.memoryctrl.all; use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; ncpu : integer := CFG_NCPU; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; freq : integer := 50000 -- frequency of main clock (used for PLLs) ); port ( resetn : in std_ulogic; clk : in std_ulogic; errorn : out std_ulogic; -- flash/ssram bus address : out std_logic_vector(25 downto 1); data : inout std_logic_vector(31 downto 0); romsn : out std_ulogic; oen : out std_logic; writen : out std_logic; rstoutn : out std_ulogic; ssram_cen : out std_logic; ssram_wen : out std_logic; ssram_bw : out std_logic_vector (0 to 3); ssram_oen : out std_ulogic; ssram_clk : out std_ulogic; ssram_adscn : out std_ulogic; -- ssram_adsp_n : out std_ulogic; -- ssram_adv_n : out std_ulogic; -- pragma translate_off iosn : out std_ulogic; -- pragma translate_on ddr_clk : out std_logic; ddr_clkn : out std_logic; ddr_cke : out std_logic; ddr_csb : out std_logic; ddr_web : out std_ulogic; -- ddr write enable ddr_rasb : out std_ulogic; -- ddr ras ddr_casb : out std_ulogic; -- ddr cas ddr_dm : out std_logic_vector (1 downto 0); -- ddr dm ddr_dqs : inout std_logic_vector (1 downto 0); -- ddr dqs ddr_ad : out std_logic_vector (12 downto 0); -- ddr address ddr_ba : out std_logic_vector (1 downto 0); -- ddr bank address ddr_dq : inout std_logic_vector (15 downto 0); -- ddr data -- debug support unit dsubren : in std_ulogic; dsuact : out std_ulogic; -- console/debug UART rxd1 : in std_logic; txd1 : out std_logic; gpio : in std_logic_vector(CFG_GRGPIO_WIDTH-1 downto 0) -- I/O port ); end; architecture rtl of leon3mp is constant blength : integer := 12; constant fifodepth : integer := 8; constant maxahbm : integer := NCPU+CFG_AHB_UART+CFG_AHB_JTAG; signal vcc, gnd : std_logic_vector(7 downto 0); signal memi, smemi : memory_in_type; signal memo, smemo : memory_out_type; signal wpo : wprot_out_type; signal ddrclkfb, ssrclkfb, ddr_clkl, ddr_clk90l, ddr_clknl, ddr_clk270l : std_ulogic; signal ddr_clkv : std_logic_vector(2 downto 0); signal ddr_clkbv : std_logic_vector(2 downto 0); signal ddr_ckev : std_logic_vector(1 downto 0); signal ddr_csbv : std_logic_vector(1 downto 0); signal ddr_adl : std_logic_vector (13 downto 0); signal clklock, lock, clkml, rst, ndsuact : std_ulogic; signal tck, tckn, tms, tdi, tdo : std_ulogic; signal ddrclk, ddrrst : std_ulogic; -- attribute syn_keep : boolean; -- attribute syn_preserve : boolean; -- attribute syn_keep of clkml : signal is true; -- attribute syn_preserve of clkml : signal is true; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal clkm, rstn, ssram_clkl : std_ulogic; signal cgi : clkgen_in_type; signal cgo : clkgen_out_type; signal u1i, dui : uart_in_type; signal u1o, duo : uart_out_type; signal irqi : irq_in_vector(0 to NCPU-1); signal irqo : irq_out_vector(0 to NCPU-1); signal dbgi : l3_debug_in_vector(0 to NCPU-1); signal dbgo : l3_debug_out_vector(0 to NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal gpti : gptimer_in_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; constant IOAEN : integer := 1; constant BOARD_FREQ : integer := 50000; -- input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz signal lclk, lclkout : std_ulogic; signal dsubre : std_ulogic; begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= (others => '1'); gnd <= (others => '0'); cgi.pllctrl <= "00"; cgi.pllrst <= not resetn; cgi.pllref <= '0'; clklock <= cgo.clklock and lock; clk_pad : clkpad generic map (tech => padtech) port map (clk, lclk); clkgen0 : clkgen -- clock generator using toplevel generic 'freq' generic map (tech => CFG_CLKTECH, clk_mul => CFG_CLKMUL, clk_div => CFG_CLKDIV, sdramen => 1, freq => freq) port map (clkin => lclk, pciclkin => gnd(0), clk => clkm, clkn => open, clk2x => open, sdclk => ssram_clkl, pciclk => open, cgi => cgi, cgo => cgo); ssrclk_pad : outpad generic map (tech => padtech, slew => 1, strength => 24) port map (ssram_clk, ssram_clkl); rst0 : rstgen -- reset generator port map (resetn, clkm, clklock, rstn); rstoutn <= resetn; ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, ioen => IOAEN, nahbm => maxahbm, nahbs => 8) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- l3 : if CFG_LEON3 = 1 generate cpu : for i in 0 to NCPU-1 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, NCPU-1) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; errorn_pad : outpad generic map (tech => padtech) port map (errorn, dbgo(0).error); dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsui.enable <= '1'; dsubre_pad : inpad generic map (tech => padtech) port map (dsubre, dsui.break); dsuact_pad : outpad generic map (tech => padtech) port map (dsuact, dsuo.active); end generate; end generate; nodsu : if CFG_DSU = 0 generate ahbso(2) <= ahbs_none; dsuo.tstop <= '0'; dsuo.active <= '0'; end generate; dcomgen : if CFG_AHB_UART = 1 generate dcom0 : ahbuart -- Debug UART generic map (hindex => NCPU, pindex => 4, paddr => 7) port map (rstn, clkm, dui, duo, apbi, apbo(4), ahbmi, ahbmo(NCPU)); dsurx_pad : inpad generic map (tech => padtech) port map (rxd1, dui.rxd); dsutx_pad : outpad generic map (tech => padtech) port map (txd1, duo.txd); end generate; nouah : if CFG_AHB_UART = 0 generate apbo(4) <= apb_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => NCPU+CFG_AHB_UART) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(NCPU+CFG_AHB_UART), open, open, open, open, open, open, open, gnd(0)); end generate; ---------------------------------------------------------------------- --- Memory controllers ---------------------------------------------- ---------------------------------------------------------------------- mg2 : if CFG_MCTRL_LEON2 = 1 generate -- LEON2 memory controller sr1 :mctrl generic map (hindex => 0, pindex => 0, paddr => 0, ramaddr => 16#400#+16#600#*CFG_DDRSP, rammask =>16#F00#, srbanks => 1, sden => 0, ram16 => 1) port map (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo); end generate; memi.brdyn <= '1'; memi.bexcn <= '1'; memi.writen <= '1'; memi.wrn <= "1111"; memi.bwidth <= "01"; ssr0 : if CFG_SSCTRL = 1 generate ssrctrl0 : ssrctrl generic map (hindex => 0, pindex => 0, iomask => 0, ramaddr => 16#400#+16#600#*CFG_DDRSP, bus16 => CFG_SSCTRLP16) port map (rstn, clkm, ahbsi, ahbso(0), apbi, apbo(0), memi, memo); end generate; mg0 : if (CFG_MCTRL_LEON2 + CFG_SSCTRL) = 0 generate -- no prom/sram pads apbo(0) <= apb_none; ahbso(0) <= ahbs_none; roms_pad : outpad generic map (tech => padtech) port map (romsn, vcc(0)); end generate; mgpads : if (CFG_MCTRL_LEON2 + CFG_SSCTRL) /= 0 generate -- prom/sram pads addr_pad : outpadv generic map (width => 25, tech => padtech) port map (address, memo.address(25 downto 1)); roms_pad : outpad generic map (tech => padtech) port map (romsn, memo.romsn(0)); oen_pad : outpad generic map (tech => padtech) port map (oen, memo.oen); wri_pad : outpad generic map (tech => padtech) port map (writen, memo.writen); -- pragma translate_off iosn_pad : outpad generic map (tech => padtech) port map (iosn, memo.iosn); -- pragma translate_on -- ssram_adv_n_pad : outpad generic map (tech => padtech) -- port map (ssram_adv_n, vcc(0)); -- ssram_adsp_n_pad : outpad generic map (tech => padtech) -- port map (ssram_adsp_n, gnd(0)); ssram_adscn_pad : outpad generic map (tech => padtech) port map (ssram_adscn, gnd(0)); ssrams_pad : outpad generic map ( tech => padtech) port map (ssram_cen, memo.ramsn(0)); ssram_oen_pad : outpad generic map (tech => padtech) port map (ssram_oen, memo.oen); ssram_rwen_pad : outpadv generic map (width => 4, tech => padtech) port map (ssram_bw, memo.wrn); ssram_wri_pad : outpad generic map (tech => padtech) port map (ssram_wen, memo.writen); data_pad : iopadvv generic map (tech => padtech, width => 32) port map (data(31 downto 0), memo.data(31 downto 0), memo.vbdrive, memi.data(31 downto 0)); end generate; ddrsp0 : if (CFG_DDRSP /= 0) generate ddrc0 : ddrspa generic map ( fabtech => fabtech, memtech => memtech, hindex => 3, haddr => 16#400#, hmask => 16#F00#, ioaddr => 1, pwron => CFG_DDRSP_INIT, MHz => BOARD_FREQ/1000, rskew => CFG_DDRSP_RSKEW, clkmul => CFG_DDRSP_FREQ/5, clkdiv => 10, ahbfreq => CPU_FREQ/1000, col => CFG_DDRSP_COL, Mbyte => CFG_DDRSP_SIZE, ddrbits => 16, regoutput => 1) port map ( resetn, rstn, lclk, clkm, lock, clkml, clkml, ahbsi, ahbso(3), ddr_clkv, ddr_clkbv, open, gnd(0), ddr_ckev, ddr_csbv, ddr_web, ddr_rasb, ddr_casb, ddr_dm, ddr_dqs, ddr_adl, ddr_ba, ddr_dq); ddr_ad <= ddr_adl(12 downto 0); ddr_clk <= ddr_clkv(0); ddr_clkn <= ddr_clkbv(0); ddr_cke <= ddr_ckev(0); ddr_csb <= ddr_csbv(0); end generate; ddrsp1 : if (CFG_DDRSP = 0) generate ddr_cke <= '0'; ddr_csb <= '1'; lock <= '1'; end generate; ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo); ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.ctsn <= '0'; u1i.extclk <= '0'; upads : if CFG_AHB_UART = 0 generate u1i.rxd <= rxd1; txd1 <= u1o.txd; end generate; end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW) port map (rstn, clkm, apbi, apbo(3), gpti, open); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; notim : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GPIO unit grgpio0: grgpio generic map(pindex => 5, paddr => 5, imask => CFG_GRGPIO_IMASK, nbits => CFG_GRGPIO_WIDTH) port map(rst => rstn, clk => clkm, apbi => apbi, apbo => apbo(5), gpioi => gpioi, gpioo => gpioo); pio_pads : for i in 0 to CFG_GRGPIO_WIDTH-1 generate gpioi.din(i) <= gpio(i); end generate; end generate; ----------------------------------------------------------------------- --- AHB ROM ---------------------------------------------------------- ----------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 6, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(6)); end generate; nobpromgen : if CFG_AHBROMEN = 0 generate ahbso(6) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ahbramgen : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 7, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map (rstn, clkm, ahbsi, ahbso(7)); end generate; nram : if CFG_AHBRAMEN = 0 generate ahbso(7) <= ahbs_none; end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- nam1 : for i in (NCPU+CFG_AHB_UART+CFG_AHB_JTAG) to NAHBMST-1 generate ahbmo(i) <= ahbm_none; end generate; -- nap0 : for i in 6 to NAPBSLV-1 generate apbo(i) <= apb_none; end generate; -- nah0 : for i in 7 to NAHBSLV-1 generate ahbso(i) <= ahbs_none; end generate; -- invert signal for input via a key dsubre <= not dsubren; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Altera EP3C25 SSRAM/DDR Demonstration design", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
6adcccabdce13a9be2280145abfa20d2
0.544593
3.761915
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-arrow-bemicro-sdk/config.vhd
1
6,490
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2011 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := cyclone3; constant CFG_MEMTECH : integer := cyclone3; constant CFG_PADTECH : integer := cyclone3; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := cyclone3; constant CFG_CLKMUL : integer := (5); constant CFG_CLKDIV : integer := (5); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 2 + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 1; constant CFG_SVT : integer := 0; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 1; constant CFG_NWP : integer := (2); constant CFG_PWD : integer := 0*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 1; constant CFG_ISETSZ : integer := 4; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 0; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 1; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 0; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 1 + 4*1; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 2; constant CFG_TLB_TYPE : integer := 1 + 0*2; constant CFG_TLB_REP : integer := 1; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 0 + 0 + 0; constant CFG_ETH_BUF : integer := 1; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000009#; -- DDR controller constant CFG_DDRSP : integer := 1; constant CFG_DDRSP_INIT : integer := 1; constant CFG_DDRSP_FREQ : integer := (100); constant CFG_DDRSP_COL : integer := (9); constant CFG_DDRSP_SIZE : integer := (8); constant CFG_DDRSP_RSKEW : integer := (0); -- SPI memory controller constant CFG_SPIMCTRL : integer := 1; constant CFG_SPIMCTRL_SDCARD : integer := 0; constant CFG_SPIMCTRL_READCMD : integer := 16#0b#; constant CFG_SPIMCTRL_DUMMYBYTE : integer := 1; constant CFG_SPIMCTRL_DUALOUTPUT : integer := 0; constant CFG_SPIMCTRL_SCALER : integer := (1); constant CFG_SPIMCTRL_ASCALER : integer := (2); constant CFG_SPIMCTRL_PWRUPCNT : integer := (0); constant CFG_SPIMCTRL_OFFSET : integer := 16#50000#; -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 16; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (4); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0#; constant CFG_GRGPIO_WIDTH : integer := (6); -- SPI controller constant CFG_SPICTRL_ENABLE : integer := 1; constant CFG_SPICTRL_NUM : integer := (2); constant CFG_SPICTRL_SLVS : integer := (1); constant CFG_SPICTRL_FIFO : integer := (2); constant CFG_SPICTRL_SLVREG : integer := 1; constant CFG_SPICTRL_ODMODE : integer := 0; constant CFG_SPICTRL_AM : integer := 0; constant CFG_SPICTRL_ASEL : integer := 1; constant CFG_SPICTRL_TWEN : integer := 1; constant CFG_SPICTRL_MAXWLEN : integer := (0); constant CFG_SPICTRL_SYNCRAM : integer := 0; constant CFG_SPICTRL_FT : integer := 0; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
8c43dcecc543dd31d250a01d1bbe60d2
0.647304
3.666667
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/image_filter_Mat2AXIvideo.vhd
2
23,118
-- ============================================================== -- RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- =========================================================== library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity image_filter_Mat2AXIvideo is port ( ap_clk : IN STD_LOGIC; ap_rst : IN STD_LOGIC; ap_start : IN STD_LOGIC; ap_done : OUT STD_LOGIC; ap_continue : IN STD_LOGIC; ap_idle : OUT STD_LOGIC; ap_ready : OUT STD_LOGIC; img_rows_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_cols_V_read : IN STD_LOGIC_VECTOR (11 downto 0); img_data_stream_0_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_0_V_empty_n : IN STD_LOGIC; img_data_stream_0_V_read : OUT STD_LOGIC; img_data_stream_1_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_1_V_empty_n : IN STD_LOGIC; img_data_stream_1_V_read : OUT STD_LOGIC; img_data_stream_2_V_dout : IN STD_LOGIC_VECTOR (7 downto 0); img_data_stream_2_V_empty_n : IN STD_LOGIC; img_data_stream_2_V_read : OUT STD_LOGIC; OUTPUT_STREAM_TDATA : OUT STD_LOGIC_VECTOR (31 downto 0); OUTPUT_STREAM_TVALID : OUT STD_LOGIC; OUTPUT_STREAM_TREADY : IN STD_LOGIC; OUTPUT_STREAM_TKEEP : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TSTRB : OUT STD_LOGIC_VECTOR (3 downto 0); OUTPUT_STREAM_TUSER : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TLAST : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TID : OUT STD_LOGIC_VECTOR (0 downto 0); OUTPUT_STREAM_TDEST : OUT STD_LOGIC_VECTOR (0 downto 0) ); end; architecture behav of image_filter_Mat2AXIvideo is constant ap_const_logic_1 : STD_LOGIC := '1'; constant ap_const_logic_0 : STD_LOGIC := '0'; constant ap_ST_st1_fsm_0 : STD_LOGIC_VECTOR (3 downto 0) := "0001"; constant ap_ST_st2_fsm_1 : STD_LOGIC_VECTOR (3 downto 0) := "0010"; constant ap_ST_pp0_stg0_fsm_2 : STD_LOGIC_VECTOR (3 downto 0) := "0100"; constant ap_ST_st5_fsm_3 : STD_LOGIC_VECTOR (3 downto 0) := "1000"; constant ap_const_lv32_0 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000000"; constant ap_const_lv1_1 : STD_LOGIC_VECTOR (0 downto 0) := "1"; constant ap_const_lv32_1 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000001"; constant ap_const_lv32_2 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000010"; constant ap_const_lv1_0 : STD_LOGIC_VECTOR (0 downto 0) := "0"; constant ap_const_lv12_0 : STD_LOGIC_VECTOR (11 downto 0) := "000000000000"; constant ap_const_lv32_3 : STD_LOGIC_VECTOR (31 downto 0) := "00000000000000000000000000000011"; constant ap_const_lv4_F : STD_LOGIC_VECTOR (3 downto 0) := "1111"; constant ap_const_lv4_0 : STD_LOGIC_VECTOR (3 downto 0) := "0000"; constant ap_const_lv13_1FFF : STD_LOGIC_VECTOR (12 downto 0) := "1111111111111"; constant ap_const_lv12_1 : STD_LOGIC_VECTOR (11 downto 0) := "000000000001"; constant ap_const_lv8_FF : STD_LOGIC_VECTOR (7 downto 0) := "11111111"; signal ap_done_reg : STD_LOGIC := '0'; signal ap_CS_fsm : STD_LOGIC_VECTOR (3 downto 0) := "0001"; attribute fsm_encoding : string; attribute fsm_encoding of ap_CS_fsm : signal is "none"; signal ap_sig_cseq_ST_st1_fsm_0 : STD_LOGIC; signal ap_sig_bdd_23 : BOOLEAN; signal p_s_reg_170 : STD_LOGIC_VECTOR (11 downto 0); signal ap_sig_bdd_60 : BOOLEAN; signal op2_assign_fu_186_p2 : STD_LOGIC_VECTOR (12 downto 0); signal op2_assign_reg_267 : STD_LOGIC_VECTOR (12 downto 0); signal exitcond5_fu_197_p2 : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_cseq_ST_st2_fsm_1 : STD_LOGIC; signal ap_sig_bdd_74 : BOOLEAN; signal i_V_fu_202_p2 : STD_LOGIC_VECTOR (11 downto 0); signal i_V_reg_276 : STD_LOGIC_VECTOR (11 downto 0); signal exitcond6_fu_208_p2 : STD_LOGIC_VECTOR (0 downto 0); signal exitcond6_reg_281 : STD_LOGIC_VECTOR (0 downto 0); signal ap_sig_cseq_ST_pp0_stg0_fsm_2 : STD_LOGIC; signal ap_sig_bdd_85 : BOOLEAN; signal ap_reg_ppiten_pp0_it0 : STD_LOGIC := '0'; signal ap_sig_bdd_99 : BOOLEAN; signal ap_sig_ioackin_OUTPUT_STREAM_TREADY : STD_LOGIC; signal ap_reg_ppiten_pp0_it1 : STD_LOGIC := '0'; signal j_V_fu_213_p2 : STD_LOGIC_VECTOR (11 downto 0); signal axi_last_V_fu_223_p2 : STD_LOGIC_VECTOR (0 downto 0); signal axi_last_V_reg_290 : STD_LOGIC_VECTOR (0 downto 0); signal p_1_reg_159 : STD_LOGIC_VECTOR (11 downto 0); signal ap_sig_cseq_ST_st5_fsm_3 : STD_LOGIC; signal ap_sig_bdd_130 : BOOLEAN; signal tmp_user_V_fu_96 : STD_LOGIC_VECTOR (0 downto 0); signal ap_reg_ioackin_OUTPUT_STREAM_TREADY : STD_LOGIC := '0'; signal tmp_cast_fu_182_p1 : STD_LOGIC_VECTOR (12 downto 0); signal tmp_cast_64_fu_219_p1 : STD_LOGIC_VECTOR (12 downto 0); signal ap_NS_fsm : STD_LOGIC_VECTOR (3 downto 0); begin -- the current state (ap_CS_fsm) of the state machine. -- ap_CS_fsm_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_CS_fsm <= ap_ST_st1_fsm_0; else ap_CS_fsm <= ap_NS_fsm; end if; end if; end process; -- ap_done_reg assign process. -- ap_done_reg_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_done_reg <= ap_const_logic_0; else if ((ap_const_logic_1 = ap_continue)) then ap_done_reg <= ap_const_logic_0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((exitcond5_fu_197_p2 = ap_const_lv1_0)))) then ap_done_reg <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ioackin_OUTPUT_STREAM_TREADY assign process. -- ap_reg_ioackin_OUTPUT_STREAM_TREADY_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ioackin_OUTPUT_STREAM_TREADY <= ap_const_logic_0; else if ((((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1)))))) then ap_reg_ioackin_OUTPUT_STREAM_TREADY <= ap_const_logic_0; elsif ((((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not((ap_sig_bdd_99 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and (ap_const_logic_1 = OUTPUT_STREAM_TREADY)))) then ap_reg_ioackin_OUTPUT_STREAM_TREADY <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it0 assign process. -- ap_reg_ppiten_pp0_it0_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it0 <= ap_const_logic_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and not((exitcond6_fu_208_p2 = ap_const_lv1_0)))) then ap_reg_ppiten_pp0_it0 <= ap_const_logic_0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond5_fu_197_p2 = ap_const_lv1_0))) then ap_reg_ppiten_pp0_it0 <= ap_const_logic_1; end if; end if; end if; end process; -- ap_reg_ppiten_pp0_it1 assign process. -- ap_reg_ppiten_pp0_it1_assign_proc : process(ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (ap_rst = '1') then ap_reg_ppiten_pp0_it1 <= ap_const_logic_0; else if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and (exitcond6_fu_208_p2 = ap_const_lv1_0))) then ap_reg_ppiten_pp0_it1 <= ap_const_logic_1; elsif ((((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond5_fu_197_p2 = ap_const_lv1_0)) or ((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and not((exitcond6_fu_208_p2 = ap_const_lv1_0))))) then ap_reg_ppiten_pp0_it1 <= ap_const_logic_0; end if; end if; end if; end process; -- p_1_reg_159 assign process. -- p_1_reg_159_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((ap_const_logic_1 = ap_sig_cseq_ST_st5_fsm_3)) then p_1_reg_159 <= i_V_reg_276; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) and not(ap_sig_bdd_60))) then p_1_reg_159 <= ap_const_lv12_0; end if; end if; end process; -- p_s_reg_170 assign process. -- p_s_reg_170_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it0) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and (exitcond6_fu_208_p2 = ap_const_lv1_0))) then p_s_reg_170 <= j_V_fu_213_p2; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and (exitcond5_fu_197_p2 = ap_const_lv1_0))) then p_s_reg_170 <= ap_const_lv12_0; end if; end if; end process; -- tmp_user_V_fu_96 assign process. -- tmp_user_V_fu_96_assign_proc : process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))))) then tmp_user_V_fu_96 <= ap_const_lv1_0; elsif (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) and not(ap_sig_bdd_60))) then tmp_user_V_fu_96 <= ap_const_lv1_1; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and (exitcond6_fu_208_p2 = ap_const_lv1_0))) then axi_last_V_reg_290 <= axi_last_V_fu_223_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))))) then exitcond6_reg_281 <= exitcond6_fu_208_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if ((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1)) then i_V_reg_276 <= i_V_fu_202_p2; end if; end if; end process; -- assign process. -- process (ap_clk) begin if (ap_clk'event and ap_clk = '1') then if (((ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0) and not(ap_sig_bdd_60))) then op2_assign_reg_267 <= op2_assign_fu_186_p2; end if; end if; end process; -- the next state (ap_NS_fsm) of the state machine. -- ap_NS_fsm_assign_proc : process (ap_CS_fsm, ap_sig_bdd_60, exitcond5_fu_197_p2, exitcond6_fu_208_p2, exitcond6_reg_281, ap_reg_ppiten_pp0_it0, ap_sig_bdd_99, ap_sig_ioackin_OUTPUT_STREAM_TREADY, ap_reg_ppiten_pp0_it1) begin case ap_CS_fsm is when ap_ST_st1_fsm_0 => if (not(ap_sig_bdd_60)) then ap_NS_fsm <= ap_ST_st2_fsm_1; else ap_NS_fsm <= ap_ST_st1_fsm_0; end if; when ap_ST_st2_fsm_1 => if (not((exitcond5_fu_197_p2 = ap_const_lv1_0))) then ap_NS_fsm <= ap_ST_st1_fsm_0; else ap_NS_fsm <= ap_ST_pp0_stg0_fsm_2; end if; when ap_ST_pp0_stg0_fsm_2 => if (not(((ap_const_logic_1 = ap_reg_ppiten_pp0_it0) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and not((exitcond6_fu_208_p2 = ap_const_lv1_0))))) then ap_NS_fsm <= ap_ST_pp0_stg0_fsm_2; elsif (((ap_const_logic_1 = ap_reg_ppiten_pp0_it0) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and not((exitcond6_fu_208_p2 = ap_const_lv1_0)))) then ap_NS_fsm <= ap_ST_st5_fsm_3; else ap_NS_fsm <= ap_ST_pp0_stg0_fsm_2; end if; when ap_ST_st5_fsm_3 => ap_NS_fsm <= ap_ST_st2_fsm_1; when others => ap_NS_fsm <= "XXXX"; end case; end process; OUTPUT_STREAM_TDATA <= (((ap_const_lv8_FF & img_data_stream_2_V_dout) & img_data_stream_1_V_dout) & img_data_stream_0_V_dout); OUTPUT_STREAM_TDEST <= ap_const_lv1_0; OUTPUT_STREAM_TID <= ap_const_lv1_0; OUTPUT_STREAM_TKEEP <= ap_const_lv4_F; OUTPUT_STREAM_TLAST <= axi_last_V_reg_290; OUTPUT_STREAM_TSTRB <= ap_const_lv4_0; OUTPUT_STREAM_TUSER <= tmp_user_V_fu_96; -- OUTPUT_STREAM_TVALID assign process. -- OUTPUT_STREAM_TVALID_assign_proc : process(exitcond6_reg_281, ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_99, ap_reg_ppiten_pp0_it1, ap_reg_ioackin_OUTPUT_STREAM_TREADY) begin if ((((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not((ap_sig_bdd_99 and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))) and (ap_const_logic_0 = ap_reg_ioackin_OUTPUT_STREAM_TREADY)))) then OUTPUT_STREAM_TVALID <= ap_const_logic_1; else OUTPUT_STREAM_TVALID <= ap_const_logic_0; end if; end process; -- ap_done assign process. -- ap_done_assign_proc : process(ap_done_reg, exitcond5_fu_197_p2, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_done_reg) or ((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((exitcond5_fu_197_p2 = ap_const_lv1_0))))) then ap_done <= ap_const_logic_1; else ap_done <= ap_const_logic_0; end if; end process; -- ap_idle assign process. -- ap_idle_assign_proc : process(ap_start, ap_sig_cseq_ST_st1_fsm_0) begin if ((not((ap_const_logic_1 = ap_start)) and (ap_const_logic_1 = ap_sig_cseq_ST_st1_fsm_0))) then ap_idle <= ap_const_logic_1; else ap_idle <= ap_const_logic_0; end if; end process; -- ap_ready assign process. -- ap_ready_assign_proc : process(exitcond5_fu_197_p2, ap_sig_cseq_ST_st2_fsm_1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_st2_fsm_1) and not((exitcond5_fu_197_p2 = ap_const_lv1_0)))) then ap_ready <= ap_const_logic_1; else ap_ready <= ap_const_logic_0; end if; end process; -- ap_sig_bdd_130 assign process. -- ap_sig_bdd_130_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_130 <= (ap_const_lv1_1 = ap_CS_fsm(3 downto 3)); end process; -- ap_sig_bdd_23 assign process. -- ap_sig_bdd_23_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_23 <= (ap_CS_fsm(0 downto 0) = ap_const_lv1_1); end process; -- ap_sig_bdd_60 assign process. -- ap_sig_bdd_60_assign_proc : process(ap_start, ap_done_reg) begin ap_sig_bdd_60 <= ((ap_start = ap_const_logic_0) or (ap_done_reg = ap_const_logic_1)); end process; -- ap_sig_bdd_74 assign process. -- ap_sig_bdd_74_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_74 <= (ap_const_lv1_1 = ap_CS_fsm(1 downto 1)); end process; -- ap_sig_bdd_85 assign process. -- ap_sig_bdd_85_assign_proc : process(ap_CS_fsm) begin ap_sig_bdd_85 <= (ap_const_lv1_1 = ap_CS_fsm(2 downto 2)); end process; -- ap_sig_bdd_99 assign process. -- ap_sig_bdd_99_assign_proc : process(img_data_stream_0_V_empty_n, img_data_stream_1_V_empty_n, img_data_stream_2_V_empty_n, exitcond6_reg_281) begin ap_sig_bdd_99 <= (((img_data_stream_0_V_empty_n = ap_const_logic_0) and (exitcond6_reg_281 = ap_const_lv1_0)) or ((exitcond6_reg_281 = ap_const_lv1_0) and (img_data_stream_1_V_empty_n = ap_const_logic_0)) or ((exitcond6_reg_281 = ap_const_lv1_0) and (img_data_stream_2_V_empty_n = ap_const_logic_0))); end process; -- ap_sig_cseq_ST_pp0_stg0_fsm_2 assign process. -- ap_sig_cseq_ST_pp0_stg0_fsm_2_assign_proc : process(ap_sig_bdd_85) begin if (ap_sig_bdd_85) then ap_sig_cseq_ST_pp0_stg0_fsm_2 <= ap_const_logic_1; else ap_sig_cseq_ST_pp0_stg0_fsm_2 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st1_fsm_0 assign process. -- ap_sig_cseq_ST_st1_fsm_0_assign_proc : process(ap_sig_bdd_23) begin if (ap_sig_bdd_23) then ap_sig_cseq_ST_st1_fsm_0 <= ap_const_logic_1; else ap_sig_cseq_ST_st1_fsm_0 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st2_fsm_1 assign process. -- ap_sig_cseq_ST_st2_fsm_1_assign_proc : process(ap_sig_bdd_74) begin if (ap_sig_bdd_74) then ap_sig_cseq_ST_st2_fsm_1 <= ap_const_logic_1; else ap_sig_cseq_ST_st2_fsm_1 <= ap_const_logic_0; end if; end process; -- ap_sig_cseq_ST_st5_fsm_3 assign process. -- ap_sig_cseq_ST_st5_fsm_3_assign_proc : process(ap_sig_bdd_130) begin if (ap_sig_bdd_130) then ap_sig_cseq_ST_st5_fsm_3 <= ap_const_logic_1; else ap_sig_cseq_ST_st5_fsm_3 <= ap_const_logic_0; end if; end process; -- ap_sig_ioackin_OUTPUT_STREAM_TREADY assign process. -- ap_sig_ioackin_OUTPUT_STREAM_TREADY_assign_proc : process(OUTPUT_STREAM_TREADY, ap_reg_ioackin_OUTPUT_STREAM_TREADY) begin if ((ap_const_logic_0 = ap_reg_ioackin_OUTPUT_STREAM_TREADY)) then ap_sig_ioackin_OUTPUT_STREAM_TREADY <= OUTPUT_STREAM_TREADY; else ap_sig_ioackin_OUTPUT_STREAM_TREADY <= ap_const_logic_1; end if; end process; axi_last_V_fu_223_p2 <= "1" when (tmp_cast_64_fu_219_p1 = op2_assign_reg_267) else "0"; exitcond5_fu_197_p2 <= "1" when (p_1_reg_159 = img_rows_V_read) else "0"; exitcond6_fu_208_p2 <= "1" when (p_s_reg_170 = img_cols_V_read) else "0"; i_V_fu_202_p2 <= std_logic_vector(unsigned(p_1_reg_159) + unsigned(ap_const_lv12_1)); -- img_data_stream_0_V_read assign process. -- img_data_stream_0_V_read_assign_proc : process(exitcond6_reg_281, ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_99, ap_sig_ioackin_OUTPUT_STREAM_TREADY, ap_reg_ppiten_pp0_it1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))))) then img_data_stream_0_V_read <= ap_const_logic_1; else img_data_stream_0_V_read <= ap_const_logic_0; end if; end process; -- img_data_stream_1_V_read assign process. -- img_data_stream_1_V_read_assign_proc : process(exitcond6_reg_281, ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_99, ap_sig_ioackin_OUTPUT_STREAM_TREADY, ap_reg_ppiten_pp0_it1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))))) then img_data_stream_1_V_read <= ap_const_logic_1; else img_data_stream_1_V_read <= ap_const_logic_0; end if; end process; -- img_data_stream_2_V_read assign process. -- img_data_stream_2_V_read_assign_proc : process(exitcond6_reg_281, ap_sig_cseq_ST_pp0_stg0_fsm_2, ap_sig_bdd_99, ap_sig_ioackin_OUTPUT_STREAM_TREADY, ap_reg_ppiten_pp0_it1) begin if (((ap_const_logic_1 = ap_sig_cseq_ST_pp0_stg0_fsm_2) and (exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1) and not(((ap_sig_bdd_99 or ((exitcond6_reg_281 = ap_const_lv1_0) and (ap_const_logic_0 = ap_sig_ioackin_OUTPUT_STREAM_TREADY))) and (ap_const_logic_1 = ap_reg_ppiten_pp0_it1))))) then img_data_stream_2_V_read <= ap_const_logic_1; else img_data_stream_2_V_read <= ap_const_logic_0; end if; end process; j_V_fu_213_p2 <= std_logic_vector(unsigned(p_s_reg_170) + unsigned(ap_const_lv12_1)); op2_assign_fu_186_p2 <= std_logic_vector(unsigned(tmp_cast_fu_182_p1) + unsigned(ap_const_lv13_1FFF)); tmp_cast_64_fu_219_p1 <= std_logic_vector(resize(unsigned(p_s_reg_170),13)); tmp_cast_fu_182_p1 <= std_logic_vector(resize(unsigned(img_cols_V_read),13)); end behav;
gpl-3.0
54b629072a4ce6a778164cd2412c2cc3
0.592093
2.795067
false
false
false
false
mistryalok/Zedboard
learning/opencv_hls/xapp1167_vivado/sw/fast-corner/prj/solution1/syn/vhdl/FIFO_image_filter_src1_data_stream_0_V.vhd
2
6,292
-- ============================================================== -- File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC -- Version: 2014.4 -- Copyright (C) 2014 Xilinx Inc. All rights reserved. -- -- ============================================================== library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity FIFO_image_filter_src1_data_stream_0_V is generic ( MEM_STYLE : string := "block"; DATA_WIDTH : natural := 8; ADDR_WIDTH : natural := 15; DEPTH : natural := 20000 ); port ( clk : in std_logic; reset : in std_logic; if_full_n : out std_logic; if_write_ce : in std_logic; if_write : in std_logic; if_din : in std_logic_vector(DATA_WIDTH - 1 downto 0); if_empty_n : out std_logic; if_read_ce : in std_logic; if_read : in std_logic; if_dout : out std_logic_vector(DATA_WIDTH - 1 downto 0) ); end entity; architecture arch of FIFO_image_filter_src1_data_stream_0_V is type memtype is array (0 to DEPTH - 1) of std_logic_vector(DATA_WIDTH - 1 downto 0); signal mem : memtype; signal q_buf : std_logic_vector(DATA_WIDTH - 1 downto 0) := (others => '0'); signal waddr : unsigned(ADDR_WIDTH - 1 downto 0) := (others => '0'); signal raddr : unsigned(ADDR_WIDTH - 1 downto 0) := (others => '0'); signal wnext : unsigned(ADDR_WIDTH - 1 downto 0); signal rnext : unsigned(ADDR_WIDTH - 1 downto 0); signal push : std_logic; signal pop : std_logic; signal usedw : unsigned(ADDR_WIDTH - 1 downto 0) := (others => '0'); signal full_n : std_logic := '1'; signal empty_n : std_logic := '0'; signal q_tmp : std_logic_vector(DATA_WIDTH - 1 downto 0) := (others => '0'); signal show_ahead : std_logic := '0'; signal dout_buf : std_logic_vector(DATA_WIDTH - 1 downto 0) := (others => '0'); signal dout_valid : std_logic := '0'; attribute ram_style: string; attribute ram_style of mem: signal is MEM_STYLE; begin if_full_n <= full_n; if_empty_n <= dout_valid; if_dout <= dout_buf; push <= full_n and if_write_ce and if_write; pop <= empty_n and if_read_ce and (not dout_valid or if_read); wnext <= waddr when push = '0' else (others => '0') when waddr = DEPTH - 1 else waddr + 1; rnext <= raddr when pop = '0' else (others => '0') when raddr = DEPTH - 1 else raddr + 1; -- waddr process (clk) begin if clk'event and clk = '1' then if reset = '1' then waddr <= (others => '0'); else waddr <= wnext; end if; end if; end process; -- raddr process (clk) begin if clk'event and clk = '1' then if reset = '1' then raddr <= (others => '0'); else raddr <= rnext; end if; end if; end process; -- usedw process (clk) begin if clk'event and clk = '1' then if reset = '1' then usedw <= (others => '0'); elsif push = '1' and pop = '0' then usedw <= usedw + 1; elsif push = '0' and pop = '1' then usedw <= usedw - 1; end if; end if; end process; -- full_n process (clk) begin if clk'event and clk = '1' then if reset = '1' then full_n <= '1'; elsif push = '1' and pop = '0' then if usedw = DEPTH - 1 then full_n <= '0'; else full_n <= '1'; end if; elsif push = '0' and pop = '1' then full_n <= '1'; end if; end if; end process; -- empty_n process (clk) begin if clk'event and clk = '1' then if reset = '1' then empty_n <= '0'; elsif push = '1' and pop = '0' then empty_n <= '1'; elsif push = '0' and pop = '1' then if usedw = 1 then empty_n <= '0'; else empty_n <= '1'; end if; end if; end if; end process; -- mem process (clk) begin if clk'event and clk = '1' then if push = '1' then mem(to_integer(waddr)) <= if_din; end if; end if; end process; -- q_buf process (clk) begin if clk'event and clk = '1' then q_buf <= mem(to_integer(rnext)); end if; end process; -- q_tmp process (clk) begin if clk'event and clk = '1' then if reset = '1' then q_tmp <= (others => '0'); elsif push = '1' then q_tmp <= if_din; end if; end if; end process; -- show_ahead process (clk) begin if clk'event and clk = '1' then if reset = '1' then show_ahead <= '0'; elsif push = '1' and (usedw = 0 or (usedw = 1 and pop = '1')) then show_ahead <= '1'; else show_ahead <= '0'; end if; end if; end process; -- dout_buf process (clk) begin if clk'event and clk = '1' then if reset = '1' then dout_buf <= (others => '0'); elsif pop = '1' then if show_ahead = '1' then dout_buf <= q_tmp; else dout_buf <= q_buf; end if; end if; end if; end process; -- dout_valid process (clk) begin if clk'event and clk = '1' then if reset = '1' then dout_valid <= '0'; elsif pop = '1' then dout_valid <= '1'; elsif if_read_ce = '1' and if_read = '1' then dout_valid <= '0'; end if; end if; end process; end architecture;
gpl-3.0
d3ba42013efb15495bec937ae3a552a1
0.446599
3.799517
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/grfpw_net.vhd
1
32,823
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: grfpw_net -- File: grfpw_net.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: GRFPU / GRLFPC netlist wrapper ------------------------------------------------------------------------------ library IEEE; use IEEE.std_logic_1164.all; use work.gencomp.all; entity grfpw_net is generic (tech : integer := 0; pclow : integer range 0 to 2 := 2; dsu : integer range 0 to 2 := 1; disas : integer range 0 to 2 := 0; pipe : integer range 0 to 2 := 0 ); port ( rst : in std_ulogic; -- Reset clk : in std_ulogic; holdn : in std_ulogic; -- pipeline hold cpi_flush : in std_ulogic; -- pipeline flush cpi_exack : in std_ulogic; -- FP exception acknowledge cpi_a_rs1 : in std_logic_vector(4 downto 0); cpi_d_pc : in std_logic_vector(31 downto 0); cpi_d_inst : in std_logic_vector(31 downto 0); cpi_d_cnt : in std_logic_vector(1 downto 0); cpi_d_trap : in std_ulogic; cpi_d_annul : in std_ulogic; cpi_d_pv : in std_ulogic; cpi_a_pc : in std_logic_vector(31 downto 0); cpi_a_inst : in std_logic_vector(31 downto 0); cpi_a_cnt : in std_logic_vector(1 downto 0); cpi_a_trap : in std_ulogic; cpi_a_annul : in std_ulogic; cpi_a_pv : in std_ulogic; cpi_e_pc : in std_logic_vector(31 downto 0); cpi_e_inst : in std_logic_vector(31 downto 0); cpi_e_cnt : in std_logic_vector(1 downto 0); cpi_e_trap : in std_ulogic; cpi_e_annul : in std_ulogic; cpi_e_pv : in std_ulogic; cpi_m_pc : in std_logic_vector(31 downto 0); cpi_m_inst : in std_logic_vector(31 downto 0); cpi_m_cnt : in std_logic_vector(1 downto 0); cpi_m_trap : in std_ulogic; cpi_m_annul : in std_ulogic; cpi_m_pv : in std_ulogic; cpi_x_pc : in std_logic_vector(31 downto 0); cpi_x_inst : in std_logic_vector(31 downto 0); cpi_x_cnt : in std_logic_vector(1 downto 0); cpi_x_trap : in std_ulogic; cpi_x_annul : in std_ulogic; cpi_x_pv : in std_ulogic; cpi_lddata : in std_logic_vector(31 downto 0); -- load data cpi_dbg_enable : in std_ulogic; cpi_dbg_write : in std_ulogic; cpi_dbg_fsr : in std_ulogic; -- FSR access cpi_dbg_addr : in std_logic_vector(4 downto 0); cpi_dbg_data : in std_logic_vector(31 downto 0); cpo_data : out std_logic_vector(31 downto 0); -- store data cpo_exc : out std_logic; -- FP exception cpo_cc : out std_logic_vector(1 downto 0); -- FP condition codes cpo_ccv : out std_ulogic; -- FP condition codes valid cpo_ldlock : out std_logic; -- FP pipeline hold cpo_holdn : out std_ulogic; cpo_dbg_data : out std_logic_vector(31 downto 0); rfi1_rd1addr : out std_logic_vector(3 downto 0); rfi1_rd2addr : out std_logic_vector(3 downto 0); rfi1_wraddr : out std_logic_vector(3 downto 0); rfi1_wrdata : out std_logic_vector(31 downto 0); rfi1_ren1 : out std_ulogic; rfi1_ren2 : out std_ulogic; rfi1_wren : out std_ulogic; rfi2_rd1addr : out std_logic_vector(3 downto 0); rfi2_rd2addr : out std_logic_vector(3 downto 0); rfi2_wraddr : out std_logic_vector(3 downto 0); rfi2_wrdata : out std_logic_vector(31 downto 0); rfi2_ren1 : out std_ulogic; rfi2_ren2 : out std_ulogic; rfi2_wren : out std_ulogic; rfo1_data1 : in std_logic_vector(31 downto 0); rfo1_data2 : in std_logic_vector(31 downto 0); rfo2_data1 : in std_logic_vector(31 downto 0); rfo2_data2 : in std_logic_vector(31 downto 0) ); end; architecture rtl of grfpw_net is component grfpw_0_unisim port( rst : in std_logic; clk : in std_logic; holdn : in std_logic; cpi_flush : in std_logic; cpi_exack : in std_logic; cpi_a_rs1 : in std_logic_vector (4 downto 0); cpi_d_pc : in std_logic_vector (31 downto 0); cpi_d_inst : in std_logic_vector (31 downto 0); cpi_d_cnt : in std_logic_vector (1 downto 0); cpi_d_trap : in std_logic; cpi_d_annul : in std_logic; cpi_d_pv : in std_logic; cpi_a_pc : in std_logic_vector (31 downto 0); cpi_a_inst : in std_logic_vector (31 downto 0); cpi_a_cnt : in std_logic_vector (1 downto 0); cpi_a_trap : in std_logic; cpi_a_annul : in std_logic; cpi_a_pv : in std_logic; cpi_e_pc : in std_logic_vector (31 downto 0); cpi_e_inst : in std_logic_vector (31 downto 0); cpi_e_cnt : in std_logic_vector (1 downto 0); cpi_e_trap : in std_logic; cpi_e_annul : in std_logic; cpi_e_pv : in std_logic; cpi_m_pc : in std_logic_vector (31 downto 0); cpi_m_inst : in std_logic_vector (31 downto 0); cpi_m_cnt : in std_logic_vector (1 downto 0); cpi_m_trap : in std_logic; cpi_m_annul : in std_logic; cpi_m_pv : in std_logic; cpi_x_pc : in std_logic_vector (31 downto 0); cpi_x_inst : in std_logic_vector (31 downto 0); cpi_x_cnt : in std_logic_vector (1 downto 0); cpi_x_trap : in std_logic; cpi_x_annul : in std_logic; cpi_x_pv : in std_logic; cpi_lddata : in std_logic_vector (31 downto 0); cpi_dbg_enable : in std_logic; cpi_dbg_write : in std_logic; cpi_dbg_fsr : in std_logic; cpi_dbg_addr : in std_logic_vector (4 downto 0); cpi_dbg_data : in std_logic_vector (31 downto 0); cpo_data : out std_logic_vector (31 downto 0); cpo_exc : out std_logic; cpo_cc : out std_logic_vector (1 downto 0); cpo_ccv : out std_logic; cpo_ldlock : out std_logic; cpo_holdn : out std_logic; cpo_dbg_data : out std_logic_vector (31 downto 0); rfi1_rd1addr : out std_logic_vector (3 downto 0); rfi1_rd2addr : out std_logic_vector (3 downto 0); rfi1_wraddr : out std_logic_vector (3 downto 0); rfi1_wrdata : out std_logic_vector (31 downto 0); rfi1_ren1 : out std_logic; rfi1_ren2 : out std_logic; rfi1_wren : out std_logic; rfi2_rd1addr : out std_logic_vector (3 downto 0); rfi2_rd2addr : out std_logic_vector (3 downto 0); rfi2_wraddr : out std_logic_vector (3 downto 0); rfi2_wrdata : out std_logic_vector (31 downto 0); rfi2_ren1 : out std_logic; rfi2_ren2 : out std_logic; rfi2_wren : out std_logic; rfo1_data1 : in std_logic_vector (31 downto 0); rfo1_data2 : in std_logic_vector (31 downto 0); rfo2_data1 : in std_logic_vector (31 downto 0); rfo2_data2 : in std_logic_vector (31 downto 0)); -- disasen : in std_logic); end component; component grfpw_0_stratixii port( rst : in std_logic; clk : in std_logic; holdn : in std_logic; cpi_flush : in std_logic; cpi_exack : in std_logic; cpi_a_rs1 : in std_logic_vector (4 downto 0); cpi_d_pc : in std_logic_vector (31 downto 0); cpi_d_inst : in std_logic_vector (31 downto 0); cpi_d_cnt : in std_logic_vector (1 downto 0); cpi_d_trap : in std_logic; cpi_d_annul : in std_logic; cpi_d_pv : in std_logic; cpi_a_pc : in std_logic_vector (31 downto 0); cpi_a_inst : in std_logic_vector (31 downto 0); cpi_a_cnt : in std_logic_vector (1 downto 0); cpi_a_trap : in std_logic; cpi_a_annul : in std_logic; cpi_a_pv : in std_logic; cpi_e_pc : in std_logic_vector (31 downto 0); cpi_e_inst : in std_logic_vector (31 downto 0); cpi_e_cnt : in std_logic_vector (1 downto 0); cpi_e_trap : in std_logic; cpi_e_annul : in std_logic; cpi_e_pv : in std_logic; cpi_m_pc : in std_logic_vector (31 downto 0); cpi_m_inst : in std_logic_vector (31 downto 0); cpi_m_cnt : in std_logic_vector (1 downto 0); cpi_m_trap : in std_logic; cpi_m_annul : in std_logic; cpi_m_pv : in std_logic; cpi_x_pc : in std_logic_vector (31 downto 0); cpi_x_inst : in std_logic_vector (31 downto 0); cpi_x_cnt : in std_logic_vector (1 downto 0); cpi_x_trap : in std_logic; cpi_x_annul : in std_logic; cpi_x_pv : in std_logic; cpi_lddata : in std_logic_vector (31 downto 0); cpi_dbg_enable : in std_logic; cpi_dbg_write : in std_logic; cpi_dbg_fsr : in std_logic; cpi_dbg_addr : in std_logic_vector (4 downto 0); cpi_dbg_data : in std_logic_vector (31 downto 0); cpo_data : out std_logic_vector (31 downto 0); cpo_exc : out std_logic; cpo_cc : out std_logic_vector (1 downto 0); cpo_ccv : out std_logic; cpo_ldlock : out std_logic; cpo_holdn : out std_logic; cpo_dbg_data : out std_logic_vector (31 downto 0); rfi1_rd1addr : out std_logic_vector (3 downto 0); rfi1_rd2addr : out std_logic_vector (3 downto 0); rfi1_wraddr : out std_logic_vector (3 downto 0); rfi1_wrdata : out std_logic_vector (31 downto 0); rfi1_ren1 : out std_logic; rfi1_ren2 : out std_logic; rfi1_wren : out std_logic; rfi2_rd1addr : out std_logic_vector (3 downto 0); rfi2_rd2addr : out std_logic_vector (3 downto 0); rfi2_wraddr : out std_logic_vector (3 downto 0); rfi2_wrdata : out std_logic_vector (31 downto 0); rfi2_ren1 : out std_logic; rfi2_ren2 : out std_logic; rfi2_wren : out std_logic; rfo1_data1 : in std_logic_vector (31 downto 0); rfo1_data2 : in std_logic_vector (31 downto 0); rfo2_data1 : in std_logic_vector (31 downto 0); rfo2_data2 : in std_logic_vector (31 downto 0)); end component; component grfpw_0_cycloneiii port( rst : in std_logic; clk : in std_logic; holdn : in std_logic; cpi_flush : in std_logic; cpi_exack : in std_logic; cpi_a_rs1 : in std_logic_vector (4 downto 0); cpi_d_pc : in std_logic_vector (31 downto 0); cpi_d_inst : in std_logic_vector (31 downto 0); cpi_d_cnt : in std_logic_vector (1 downto 0); cpi_d_trap : in std_logic; cpi_d_annul : in std_logic; cpi_d_pv : in std_logic; cpi_a_pc : in std_logic_vector (31 downto 0); cpi_a_inst : in std_logic_vector (31 downto 0); cpi_a_cnt : in std_logic_vector (1 downto 0); cpi_a_trap : in std_logic; cpi_a_annul : in std_logic; cpi_a_pv : in std_logic; cpi_e_pc : in std_logic_vector (31 downto 0); cpi_e_inst : in std_logic_vector (31 downto 0); cpi_e_cnt : in std_logic_vector (1 downto 0); cpi_e_trap : in std_logic; cpi_e_annul : in std_logic; cpi_e_pv : in std_logic; cpi_m_pc : in std_logic_vector (31 downto 0); cpi_m_inst : in std_logic_vector (31 downto 0); cpi_m_cnt : in std_logic_vector (1 downto 0); cpi_m_trap : in std_logic; cpi_m_annul : in std_logic; cpi_m_pv : in std_logic; cpi_x_pc : in std_logic_vector (31 downto 0); cpi_x_inst : in std_logic_vector (31 downto 0); cpi_x_cnt : in std_logic_vector (1 downto 0); cpi_x_trap : in std_logic; cpi_x_annul : in std_logic; cpi_x_pv : in std_logic; cpi_lddata : in std_logic_vector (31 downto 0); cpi_dbg_enable : in std_logic; cpi_dbg_write : in std_logic; cpi_dbg_fsr : in std_logic; cpi_dbg_addr : in std_logic_vector (4 downto 0); cpi_dbg_data : in std_logic_vector (31 downto 0); cpo_data : out std_logic_vector (31 downto 0); cpo_exc : out std_logic; cpo_cc : out std_logic_vector (1 downto 0); cpo_ccv : out std_logic; cpo_ldlock : out std_logic; cpo_holdn : out std_logic; cpo_dbg_data : out std_logic_vector (31 downto 0); rfi1_rd1addr : out std_logic_vector (3 downto 0); rfi1_rd2addr : out std_logic_vector (3 downto 0); rfi1_wraddr : out std_logic_vector (3 downto 0); rfi1_wrdata : out std_logic_vector (31 downto 0); rfi1_ren1 : out std_logic; rfi1_ren2 : out std_logic; rfi1_wren : out std_logic; rfi2_rd1addr : out std_logic_vector (3 downto 0); rfi2_rd2addr : out std_logic_vector (3 downto 0); rfi2_wraddr : out std_logic_vector (3 downto 0); rfi2_wrdata : out std_logic_vector (31 downto 0); rfi2_ren1 : out std_logic; rfi2_ren2 : out std_logic; rfi2_wren : out std_logic; rfo1_data1 : in std_logic_vector (31 downto 0); rfo1_data2 : in std_logic_vector (31 downto 0); rfo2_data1 : in std_logic_vector (31 downto 0); rfo2_data2 : in std_logic_vector (31 downto 0)); end component; component grfpw_0_stratixiii port( rst : in std_logic; clk : in std_logic; holdn : in std_logic; cpi_flush : in std_logic; cpi_exack : in std_logic; cpi_a_rs1 : in std_logic_vector (4 downto 0); cpi_d_pc : in std_logic_vector (31 downto 0); cpi_d_inst : in std_logic_vector (31 downto 0); cpi_d_cnt : in std_logic_vector (1 downto 0); cpi_d_trap : in std_logic; cpi_d_annul : in std_logic; cpi_d_pv : in std_logic; cpi_a_pc : in std_logic_vector (31 downto 0); cpi_a_inst : in std_logic_vector (31 downto 0); cpi_a_cnt : in std_logic_vector (1 downto 0); cpi_a_trap : in std_logic; cpi_a_annul : in std_logic; cpi_a_pv : in std_logic; cpi_e_pc : in std_logic_vector (31 downto 0); cpi_e_inst : in std_logic_vector (31 downto 0); cpi_e_cnt : in std_logic_vector (1 downto 0); cpi_e_trap : in std_logic; cpi_e_annul : in std_logic; cpi_e_pv : in std_logic; cpi_m_pc : in std_logic_vector (31 downto 0); cpi_m_inst : in std_logic_vector (31 downto 0); cpi_m_cnt : in std_logic_vector (1 downto 0); cpi_m_trap : in std_logic; cpi_m_annul : in std_logic; cpi_m_pv : in std_logic; cpi_x_pc : in std_logic_vector (31 downto 0); cpi_x_inst : in std_logic_vector (31 downto 0); cpi_x_cnt : in std_logic_vector (1 downto 0); cpi_x_trap : in std_logic; cpi_x_annul : in std_logic; cpi_x_pv : in std_logic; cpi_lddata : in std_logic_vector (31 downto 0); cpi_dbg_enable : in std_logic; cpi_dbg_write : in std_logic; cpi_dbg_fsr : in std_logic; cpi_dbg_addr : in std_logic_vector (4 downto 0); cpi_dbg_data : in std_logic_vector (31 downto 0); cpo_data : out std_logic_vector (31 downto 0); cpo_exc : out std_logic; cpo_cc : out std_logic_vector (1 downto 0); cpo_ccv : out std_logic; cpo_ldlock : out std_logic; cpo_holdn : out std_logic; cpo_dbg_data : out std_logic_vector (31 downto 0); rfi1_rd1addr : out std_logic_vector (3 downto 0); rfi1_rd2addr : out std_logic_vector (3 downto 0); rfi1_wraddr : out std_logic_vector (3 downto 0); rfi1_wrdata : out std_logic_vector (31 downto 0); rfi1_ren1 : out std_logic; rfi1_ren2 : out std_logic; rfi1_wren : out std_logic; rfi2_rd1addr : out std_logic_vector (3 downto 0); rfi2_rd2addr : out std_logic_vector (3 downto 0); rfi2_wraddr : out std_logic_vector (3 downto 0); rfi2_wrdata : out std_logic_vector (31 downto 0); rfi2_ren1 : out std_logic; rfi2_ren2 : out std_logic; rfi2_wren : out std_logic; rfo1_data1 : in std_logic_vector (31 downto 0); rfo1_data2 : in std_logic_vector (31 downto 0); rfo2_data1 : in std_logic_vector (31 downto 0); rfo2_data2 : in std_logic_vector (31 downto 0)); end component; component grfpw_tsmc90 port ( rst : in std_ulogic; -- Reset clk : in std_ulogic; holdn : in std_ulogic; -- pipeline hold cpi_flush : in std_ulogic; -- pipeline flush cpi_exack : in std_ulogic; -- FP exception acknowledge cpi_a_rs1 : in std_logic_vector(4 downto 0); cpi_d_pc : in std_logic_vector(31 downto 0); cpi_d_inst : in std_logic_vector(31 downto 0); cpi_d_cnt : in std_logic_vector(1 downto 0); cpi_d_trap : in std_ulogic; cpi_d_annul : in std_ulogic; cpi_d_pv : in std_ulogic; cpi_a_pc : in std_logic_vector(31 downto 0); cpi_a_inst : in std_logic_vector(31 downto 0); cpi_a_cnt : in std_logic_vector(1 downto 0); cpi_a_trap : in std_ulogic; cpi_a_annul : in std_ulogic; cpi_a_pv : in std_ulogic; cpi_e_pc : in std_logic_vector(31 downto 0); cpi_e_inst : in std_logic_vector(31 downto 0); cpi_e_cnt : in std_logic_vector(1 downto 0); cpi_e_trap : in std_ulogic; cpi_e_annul : in std_ulogic; cpi_e_pv : in std_ulogic; cpi_m_pc : in std_logic_vector(31 downto 0); cpi_m_inst : in std_logic_vector(31 downto 0); cpi_m_cnt : in std_logic_vector(1 downto 0); cpi_m_trap : in std_ulogic; cpi_m_annul : in std_ulogic; cpi_m_pv : in std_ulogic; cpi_x_pc : in std_logic_vector(31 downto 0); cpi_x_inst : in std_logic_vector(31 downto 0); cpi_x_cnt : in std_logic_vector(1 downto 0); cpi_x_trap : in std_ulogic; cpi_x_annul : in std_ulogic; cpi_x_pv : in std_ulogic; cpi_lddata : in std_logic_vector(31 downto 0); -- load data cpi_dbg_enable : in std_ulogic; cpi_dbg_write : in std_ulogic; cpi_dbg_fsr : in std_ulogic; -- FSR access cpi_dbg_addr : in std_logic_vector(4 downto 0); cpi_dbg_data : in std_logic_vector(31 downto 0); cpo_data : out std_logic_vector(31 downto 0); -- store data cpo_exc : out std_logic; -- FP exception cpo_cc : out std_logic_vector(1 downto 0); -- FP condition codes cpo_ccv : out std_ulogic; -- FP condition codes valid cpo_ldlock : out std_logic; -- FP pipeline hold cpo_holdn : out std_ulogic; --cpo_restart : out std_ulogic; cpo_dbg_data : out std_logic_vector(31 downto 0); rfi1_rd1addr : out std_logic_vector(3 downto 0); rfi1_rd2addr : out std_logic_vector(3 downto 0); rfi1_wraddr : out std_logic_vector(3 downto 0); rfi1_wrdata : out std_logic_vector(31 downto 0); rfi1_ren1 : out std_ulogic; rfi1_ren2 : out std_ulogic; rfi1_wren : out std_ulogic; rfi2_rd1addr : out std_logic_vector(3 downto 0); rfi2_rd2addr : out std_logic_vector(3 downto 0); rfi2_wraddr : out std_logic_vector(3 downto 0); rfi2_wrdata : out std_logic_vector(31 downto 0); rfi2_ren1 : out std_ulogic; rfi2_ren2 : out std_ulogic; rfi2_wren : out std_ulogic; rfo1_data1 : in std_logic_vector(31 downto 0); rfo1_data2 : in std_logic_vector(31 downto 0); rfo2_data1 : in std_logic_vector(31 downto 0); rfo2_data2 : in std_logic_vector(31 downto 0) ); end component; component grfpw_tm65gplus port ( rst : in std_ulogic; -- Reset clk : in std_ulogic; holdn : in std_ulogic; -- pipeline hold cpi_flush : in std_ulogic; -- pipeline flush cpi_exack : in std_ulogic; -- FP exception acknowledge cpi_a_rs1 : in std_logic_vector(4 downto 0); cpi_d_pc : in std_logic_vector(31 downto 0); cpi_d_inst : in std_logic_vector(31 downto 0); cpi_d_cnt : in std_logic_vector(1 downto 0); cpi_d_trap : in std_ulogic; cpi_d_annul : in std_ulogic; cpi_d_pv : in std_ulogic; cpi_a_pc : in std_logic_vector(31 downto 0); cpi_a_inst : in std_logic_vector(31 downto 0); cpi_a_cnt : in std_logic_vector(1 downto 0); cpi_a_trap : in std_ulogic; cpi_a_annul : in std_ulogic; cpi_a_pv : in std_ulogic; cpi_e_pc : in std_logic_vector(31 downto 0); cpi_e_inst : in std_logic_vector(31 downto 0); cpi_e_cnt : in std_logic_vector(1 downto 0); cpi_e_trap : in std_ulogic; cpi_e_annul : in std_ulogic; cpi_e_pv : in std_ulogic; cpi_m_pc : in std_logic_vector(31 downto 0); cpi_m_inst : in std_logic_vector(31 downto 0); cpi_m_cnt : in std_logic_vector(1 downto 0); cpi_m_trap : in std_ulogic; cpi_m_annul : in std_ulogic; cpi_m_pv : in std_ulogic; cpi_x_pc : in std_logic_vector(31 downto 0); cpi_x_inst : in std_logic_vector(31 downto 0); cpi_x_cnt : in std_logic_vector(1 downto 0); cpi_x_trap : in std_ulogic; cpi_x_annul : in std_ulogic; cpi_x_pv : in std_ulogic; cpi_lddata : in std_logic_vector(31 downto 0); -- load data cpi_dbg_enable : in std_ulogic; cpi_dbg_write : in std_ulogic; cpi_dbg_fsr : in std_ulogic; -- FSR access cpi_dbg_addr : in std_logic_vector(4 downto 0); cpi_dbg_data : in std_logic_vector(31 downto 0); cpo_data : out std_logic_vector(31 downto 0); -- store data cpo_exc : out std_logic; -- FP exception cpo_cc : out std_logic_vector(1 downto 0); -- FP condition codes cpo_ccv : out std_ulogic; -- FP condition codes valid cpo_ldlock : out std_logic; -- FP pipeline hold cpo_holdn : out std_ulogic; --cpo_restart : out std_ulogic; cpo_dbg_data : out std_logic_vector(31 downto 0); rfi1_rd1addr : out std_logic_vector(3 downto 0); rfi1_rd2addr : out std_logic_vector(3 downto 0); rfi1_wraddr : out std_logic_vector(3 downto 0); rfi1_wrdata : out std_logic_vector(31 downto 0); rfi1_ren1 : out std_ulogic; rfi1_ren2 : out std_ulogic; rfi1_wren : out std_ulogic; rfi2_rd1addr : out std_logic_vector(3 downto 0); rfi2_rd2addr : out std_logic_vector(3 downto 0); rfi2_wraddr : out std_logic_vector(3 downto 0); rfi2_wrdata : out std_logic_vector(31 downto 0); rfi2_ren1 : out std_ulogic; rfi2_ren2 : out std_ulogic; rfi2_wren : out std_ulogic; rfo1_data1 : in std_logic_vector(31 downto 0); rfo1_data2 : in std_logic_vector(31 downto 0); rfo2_data1 : in std_logic_vector(31 downto 0); rfo2_data2 : in std_logic_vector(31 downto 0) ); end component; component grfpw_cust1 port ( rst : in std_ulogic; -- Reset clk : in std_ulogic; holdn : in std_ulogic; -- pipeline hold cpi_flush : in std_ulogic; -- pipeline flush cpi_exack : in std_ulogic; -- FP exception acknowledge cpi_a_rs1 : in std_logic_vector(4 downto 0); cpi_d_pc : in std_logic_vector(31 downto 0); cpi_d_inst : in std_logic_vector(31 downto 0); cpi_d_cnt : in std_logic_vector(1 downto 0); cpi_d_trap : in std_ulogic; cpi_d_annul : in std_ulogic; cpi_d_pv : in std_ulogic; cpi_a_pc : in std_logic_vector(31 downto 0); cpi_a_inst : in std_logic_vector(31 downto 0); cpi_a_cnt : in std_logic_vector(1 downto 0); cpi_a_trap : in std_ulogic; cpi_a_annul : in std_ulogic; cpi_a_pv : in std_ulogic; cpi_e_pc : in std_logic_vector(31 downto 0); cpi_e_inst : in std_logic_vector(31 downto 0); cpi_e_cnt : in std_logic_vector(1 downto 0); cpi_e_trap : in std_ulogic; cpi_e_annul : in std_ulogic; cpi_e_pv : in std_ulogic; cpi_m_pc : in std_logic_vector(31 downto 0); cpi_m_inst : in std_logic_vector(31 downto 0); cpi_m_cnt : in std_logic_vector(1 downto 0); cpi_m_trap : in std_ulogic; cpi_m_annul : in std_ulogic; cpi_m_pv : in std_ulogic; cpi_x_pc : in std_logic_vector(31 downto 0); cpi_x_inst : in std_logic_vector(31 downto 0); cpi_x_cnt : in std_logic_vector(1 downto 0); cpi_x_trap : in std_ulogic; cpi_x_annul : in std_ulogic; cpi_x_pv : in std_ulogic; cpi_lddata : in std_logic_vector(31 downto 0); -- load data cpi_dbg_enable : in std_ulogic; cpi_dbg_write : in std_ulogic; cpi_dbg_fsr : in std_ulogic; -- FSR access cpi_dbg_addr : in std_logic_vector(4 downto 0); cpi_dbg_data : in std_logic_vector(31 downto 0); cpo_data : out std_logic_vector(31 downto 0); -- store data cpo_exc : out std_logic; -- FP exception cpo_cc : out std_logic_vector(1 downto 0); -- FP condition codes cpo_ccv : out std_ulogic; -- FP condition codes valid cpo_ldlock : out std_logic; -- FP pipeline hold cpo_holdn : out std_ulogic; --cpo_restart : out std_ulogic; cpo_dbg_data : out std_logic_vector(31 downto 0); rfi1_rd1addr : out std_logic_vector(3 downto 0); rfi1_rd2addr : out std_logic_vector(3 downto 0); rfi1_wraddr : out std_logic_vector(3 downto 0); rfi1_wrdata : out std_logic_vector(31 downto 0); rfi1_ren1 : out std_ulogic; rfi1_ren2 : out std_ulogic; rfi1_wren : out std_ulogic; rfi2_rd1addr : out std_logic_vector(3 downto 0); rfi2_rd2addr : out std_logic_vector(3 downto 0); rfi2_wraddr : out std_logic_vector(3 downto 0); rfi2_wrdata : out std_logic_vector(31 downto 0); rfi2_ren1 : out std_ulogic; rfi2_ren2 : out std_ulogic; rfi2_wren : out std_ulogic; rfo1_data1 : in std_logic_vector(31 downto 0); rfo1_data2 : in std_logic_vector(31 downto 0); rfo2_data1 : in std_logic_vector(31 downto 0); rfo2_data2 : in std_logic_vector(31 downto 0) ); end component; attribute DONT_TOUCH : boolean; attribute DONT_TOUCH of u0_tsmc90 : label is TRUE; attribute DONT_TOUCH of u0_tm65gplus : label is TRUE; -- signal disasen : std_logic; begin -- disasen <= '1' when disas /= 0 else '0'; uni : if (is_unisim(tech) = 1) generate grfpw0 : grfpw_0_unisim port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2);--, disasen); end generate; alt : if (tech = stratix1) or (tech = stratix2) or (tech = altera) generate grfpw0 : grfpw_0_stratixii port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2 ); end generate; strtxiii : if (tech = stratix3) or (tech = stratix4) generate grfpw0 : grfpw_0_stratixiii port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2 ); end generate; cyc3 : if (tech = cyclone3) generate grfpw0 : grfpw_0_cycloneiii port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2 ); end generate; u0_tsmc90 : if tech = tsmc90 generate grfpw0 : grfpw_tsmc90 port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2 ); end generate; u0_tm65gplus : if tech = tm65gplus generate grfpw0 : grfpw_tm65gplus port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2 ); end generate; u0_cust1 : if tech = custom1 generate grfpw0 : grfpw_cust1 port map (rst, clk, holdn, cpi_flush, cpi_exack, cpi_a_rs1, cpi_d_pc, cpi_d_inst, cpi_d_cnt, cpi_d_trap, cpi_d_annul, cpi_d_pv, cpi_a_pc, cpi_a_inst, cpi_a_cnt, cpi_a_trap, cpi_a_annul, cpi_a_pv, cpi_e_pc, cpi_e_inst, cpi_e_cnt, cpi_e_trap, cpi_e_annul, cpi_e_pv, cpi_m_pc, cpi_m_inst, cpi_m_cnt, cpi_m_trap, cpi_m_annul, cpi_m_pv, cpi_x_pc, cpi_x_inst, cpi_x_cnt, cpi_x_trap, cpi_x_annul, cpi_x_pv, cpi_lddata, cpi_dbg_enable, cpi_dbg_write, cpi_dbg_fsr, cpi_dbg_addr, cpi_dbg_data, cpo_data, cpo_exc, cpo_cc, cpo_ccv, cpo_ldlock, cpo_holdn, cpo_dbg_data, rfi1_rd1addr, rfi1_rd2addr, rfi1_wraddr, rfi1_wrdata, rfi1_ren1, rfi1_ren2, rfi1_wren, rfi2_rd1addr, rfi2_rd2addr, rfi2_wraddr, rfi2_wrdata, rfi2_ren1, rfi2_ren2, rfi2_wren, rfo1_data1, rfo1_data2, rfo2_data1, rfo2_data2 ); end generate; end;
gpl-2.0
bbcc535708d7ad0220f05aece4d5b9c9
0.613868
2.719838
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/eth/wrapper/greth_gen.vhd
1
13,607
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: greth_gen -- File: greth_gen.vhd -- Author: Marko Isomaki -- Description: Generic Ethernet MAC ------------------------------------------------------------------------------ library ieee; library grlib; use ieee.std_logic_1164.all; use grlib.stdlib.all; library techmap; use techmap.gencomp.all; library eth; use eth.ethcomp.all; entity greth_gen is generic( memtech : integer := 0; ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; mdcscaler : integer range 0 to 255 := 25; enable_mdio : integer range 0 to 1 := 0; fifosize : integer range 4 to 64 := 8; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 31 := 0; rmii : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; ft : integer range 0 to 2 := 0; edclft : integer range 0 to 2 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; edclsepahbg : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0; maxsize : integer ); port( rst : in std_ulogic; clk : in std_ulogic; --ahb mst in hgrant : in std_ulogic; hready : in std_ulogic; hresp : in std_logic_vector(1 downto 0); hrdata : in std_logic_vector(31 downto 0); --ahb mst out hbusreq : out std_ulogic; hlock : out std_ulogic; htrans : out std_logic_vector(1 downto 0); haddr : out std_logic_vector(31 downto 0); hwrite : out std_ulogic; hsize : out std_logic_vector(2 downto 0); hburst : out std_logic_vector(2 downto 0); hprot : out std_logic_vector(3 downto 0); hwdata : out std_logic_vector(31 downto 0); --edcl ahb mst in ehgrant : in std_ulogic; ehready : in std_ulogic; ehresp : in std_logic_vector(1 downto 0); ehrdata : in std_logic_vector(31 downto 0); --edcl ahb mst out ehbusreq : out std_ulogic; ehlock : out std_ulogic; ehtrans : out std_logic_vector(1 downto 0); ehaddr : out std_logic_vector(31 downto 0); ehwrite : out std_ulogic; ehsize : out std_logic_vector(2 downto 0); ehburst : out std_logic_vector(2 downto 0); ehprot : out std_logic_vector(3 downto 0); ehwdata : out std_logic_vector(31 downto 0); --apb slv in psel : in std_ulogic; penable : in std_ulogic; paddr : in std_logic_vector(31 downto 0); pwrite : in std_ulogic; pwdata : in std_logic_vector(31 downto 0); --apb slv out prdata : out std_logic_vector(31 downto 0); --irq irq : out std_logic; --ethernet input signals rmii_clk : in std_ulogic; tx_clk : in std_ulogic; rx_clk : in std_ulogic; rxd : in std_logic_vector(3 downto 0); rx_dv : in std_ulogic; rx_er : in std_ulogic; rx_col : in std_ulogic; rx_crs : in std_ulogic; mdio_i : in std_ulogic; phyrstaddr : in std_logic_vector(4 downto 0); mdint : in std_ulogic; --ethernet output signals reset : out std_ulogic; txd : out std_logic_vector(3 downto 0); tx_en : out std_ulogic; tx_er : out std_ulogic; mdc : out std_ulogic; mdio_o : out std_ulogic; mdio_oe : out std_ulogic; --scantest testrst : in std_ulogic; testen : in std_ulogic; testoen : in std_ulogic; edcladdr : in std_logic_vector(3 downto 0); edclsepahb : in std_ulogic; edcldisable : in std_ulogic; speed : out std_ulogic ); end entity; architecture rtl of greth_gen is function getfifosize(edcl, fifosize, ebufsize : in integer) return integer is begin if (edcl = 1) then return ebufsize; else return fifosize; end if; end function; constant fabits : integer := log2(fifosize); type szvct is array (0 to 6) of integer; constant ebuf : szvct := (64, 128, 128, 256, 256, 256, 256); constant eabits : integer := log2(edclbufsz) + 8; constant bufsize : std_logic_vector(2 downto 0) := conv_std_logic_vector(log2(edclbufsz), 3); constant ebufsize : integer := ebuf(log2(edclbufsz)); constant txfifosize : integer := getfifosize(edcl, fifosize, ebufsize); constant txfabits : integer := log2(txfifosize); --rx ahb fifo signal rxrenable : std_ulogic; signal rxraddress : std_logic_vector(10 downto 0); signal rxwrite : std_ulogic; signal rxwdata : std_logic_vector(31 downto 0); signal rxwaddress : std_logic_vector(10 downto 0); signal rxrdata : std_logic_vector(31 downto 0); --tx ahb fifo signal txrenable : std_ulogic; signal txraddress : std_logic_vector(10 downto 0); signal txwrite : std_ulogic; signal txwdata : std_logic_vector(31 downto 0); signal txwaddress : std_logic_vector(10 downto 0); signal txrdata : std_logic_vector(31 downto 0); --edcl buf signal erenable : std_ulogic; signal eraddress : std_logic_vector(15 downto 0); signal ewritem : std_ulogic; signal ewritel : std_ulogic; signal ewaddressm : std_logic_vector(15 downto 0); signal ewaddressl : std_logic_vector(15 downto 0); signal ewdata : std_logic_vector(31 downto 0); signal erdata : std_logic_vector(31 downto 0); begin ethc0: grethc generic map( ifg_gap => ifg_gap, attempt_limit => attempt_limit, backoff_limit => backoff_limit, mdcscaler => mdcscaler, enable_mdio => enable_mdio, fifosize => fifosize, nsync => nsync, edcl => edcl, edclbufsz => edclbufsz, macaddrh => macaddrh, macaddrl => macaddrl, ipaddrh => ipaddrh, ipaddrl => ipaddrl, phyrstadr => phyrstadr, rmii => rmii, oepol => oepol, scanen => scanen, mdint_pol => mdint_pol, enable_mdint => enable_mdint, multicast => multicast, edclsepahbg => edclsepahbg, ramdebug => ramdebug, maxsize => maxsize) port map( rst => rst, clk => clk, --ahb mst in hgrant => hgrant, hready => hready, hresp => hresp, hrdata => hrdata, --ahb mst out hbusreq => hbusreq, hlock => hlock, htrans => htrans, haddr => haddr, hwrite => hwrite, hsize => hsize, hburst => hburst, hprot => hprot, hwdata => hwdata, --edcl ahb mst in ehgrant => ehgrant, ehready => ehready, ehresp => ehresp, ehrdata => ehrdata, --edcl ahb mst out ehbusreq => ehbusreq, ehlock => ehlock, ehtrans => ehtrans, ehaddr => ehaddr, ehwrite => ehwrite, ehsize => ehsize, ehburst => ehburst, ehprot => ehprot, ehwdata => ehwdata, --apb slv in psel => psel, penable => penable, paddr => paddr, pwrite => pwrite, pwdata => pwdata, --apb slv out prdata => prdata, --irq irq => irq, --rx ahb fifo rxrenable => rxrenable, rxraddress => rxraddress, rxwrite => rxwrite, rxwdata => rxwdata, rxwaddress => rxwaddress, rxrdata => rxrdata, --tx ahb fifo txrenable => txrenable, txraddress => txraddress, txwrite => txwrite, txwdata => txwdata, txwaddress => txwaddress, txrdata => txrdata, --edcl buf erenable => erenable, eraddress => eraddress, ewritem => ewritem, ewritel => ewritel, ewaddressm => ewaddressm, ewaddressl => ewaddressl, ewdata => ewdata, erdata => erdata, --ethernet input signals rmii_clk => rmii_clk, tx_clk => tx_clk, rx_clk => rx_clk, rxd => rxd(3 downto 0), rx_dv => rx_dv, rx_er => rx_er, rx_col => rx_col, rx_crs => rx_crs, mdio_i => mdio_i, phyrstaddr => phyrstaddr, mdint => mdint, --ethernet output signals reset => reset, txd => txd(3 downto 0), tx_en => tx_en, tx_er => tx_er, mdc => mdc, mdio_o => mdio_o, mdio_oe => mdio_oe, --scantest testrst => testrst, testen => testen, testoen => testoen, edcladdr => edcladdr, edclsepahb => edclsepahb, edcldisable => edcldisable, speed => speed); ------------------------------------------------------------------------------- -- FIFOS ---------------------------------------------------------------------- ------------------------------------------------------------------------------- nft : if ft = 0 generate tx_fifo0 : syncram_2p generic map(tech => memtech, abits => txfabits, dbits => 32, sepclk => 0) port map(clk, txrenable, txraddress(txfabits-1 downto 0), txrdata, clk, txwrite, txwaddress(txfabits-1 downto 0), txwdata); rx_fifo0 : syncram_2p generic map(tech => memtech, abits => fabits, dbits => 32, sepclk => 0) port map(clk, rxrenable, rxraddress(fabits-1 downto 0), rxrdata, clk, rxwrite, rxwaddress(fabits-1 downto 0), rxwdata); end generate; ft1 : if ft /= 0 generate tx_fifo0 : syncram_2pft generic map(tech => memtech, abits => txfabits, dbits => 32, sepclk => 0, ft => ft) port map(clk, txrenable, txraddress(txfabits-1 downto 0), txrdata, clk, txwrite, txwaddress(txfabits-1 downto 0), txwdata); rx_fifo0 : syncram_2pft generic map(tech => memtech, abits => fabits, dbits => 32, sepclk => 0, ft => ft) port map(clk, rxrenable, rxraddress(fabits-1 downto 0), rxrdata, clk, rxwrite, rxwaddress(fabits-1 downto 0), rxwdata); end generate; ------------------------------------------------------------------------------- -- EDCL buffer ram ------------------------------------------------------------ ------------------------------------------------------------------------------- edclramnft : if (edcl /= 0) and (edclft = 0) generate r0 : syncram_2p generic map (memtech, eabits, 16) port map( clk, erenable, eraddress(eabits-1 downto 0), erdata(31 downto 16), clk, ewritem, ewaddressm(eabits-1 downto 0), ewdata(31 downto 16)); r1 : syncram_2p generic map (memtech, eabits, 16) port map( clk, erenable, eraddress(eabits-1 downto 0), erdata(15 downto 0), clk, ewritel, ewaddressl(eabits-1 downto 0), ewdata(15 downto 0)); end generate; edclramft1 : if (edcl /= 0) and (edclft /= 0) generate r0 : syncram_2p generic map (memtech, eabits, 16, 0, 0, ft) port map( clk, erenable, eraddress(eabits-1 downto 0), erdata(31 downto 16), clk, ewritem, ewaddressm(eabits-1 downto 0), ewdata(31 downto 16)); r1 : syncram_2p generic map (memtech, eabits, 16, 0, 0, ft) port map( clk, erenable, eraddress(eabits-1 downto 0), erdata(15 downto 0), clk, ewritel, ewaddressl(eabits-1 downto 0), ewdata(15 downto 0)); end generate; end architecture;
gpl-2.0
f84f28a2ff87eaf79d5aa02efa54fa5d
0.517307
4.143423
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s09/axi_dma_sg/vivado/project_1/project_1.srcs/sources_1/ipshared/xilinx.com/axi_dma_v7_1/2a047f91/hdl/src/vhdl/axi_dma_pkg.vhd
2
23,670
-- (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_pkg.vhd -- Description: This package contains various constants and functions for -- AXI DMA operations. -- -- VHDL-Standard: VHDL'93 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library lib_pkg_v1_0; use lib_pkg_v1_0.lib_pkg.clog2; package axi_dma_pkg is ------------------------------------------------------------------------------- -- Function declarations ------------------------------------------------------------------------------- -- Find minimum required btt width function required_btt_width (dwidth : integer; burst_size : integer; btt_width : integer) return integer; -- Return correct hertz paramter value function hertz_prmtr_select(included : integer; lite_frequency : integer; sg_frequency : integer) return integer; -- Return SnF enable or disable function enable_snf (sf_enabled : integer; axi_data_width : integer; axis_tdata_width : integer) return integer; ------------------------------------------------------------------------------- -- Constant Declarations ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- AXI Responce Values ------------------------------------------------------------------------------- constant OKAY_RESP : std_logic_vector(1 downto 0) := "00"; constant EXOKAY_RESP : std_logic_vector(1 downto 0) := "01"; constant SLVERR_RESP : std_logic_vector(1 downto 0) := "10"; constant DECERR_RESP : std_logic_vector(1 downto 0) := "11"; constant MTBF_STAGES : integer := 4; constant C_FIFO_MTBF : integer := 4; ------------------------------------------------------------------------------- -- Misc Constants ------------------------------------------------------------------------------- --constant NUM_REG_TOTAL : integer := 18; --constant NUM_REG_TOTAL : integer := 23; constant NUM_REG_TOTAL : integer := 143; -- To accomodate S2MM registers --constant NUM_REG_PER_CHANNEL : integer := 6; constant NUM_REG_PER_CHANNEL : integer := 12; constant NUM_REG_PER_S2MM : integer := 120; --constant REG_MSB_ADDR_BIT : integer := clog2(NUM_REG_TOTAL)-1; constant CMD_BASE_WIDTH : integer := 40; constant BUFFER_LENGTH_WIDTH : integer := 23; -- Constants Used in Desc Updates constant DESC_STS_TYPE : std_logic := '1'; constant DESC_DATA_TYPE : std_logic := '0'; constant DESC_LAST : std_logic := '1'; constant DESC_NOT_LAST : std_logic := '0'; -- Interrupt Coalescing constant ZERO_THRESHOLD : std_logic_vector(7 downto 0) := (others => '0'); constant ONE_THRESHOLD : std_logic_vector(7 downto 0) := "00000001"; constant ZERO_DELAY : std_logic_vector(7 downto 0) := (others => '0'); ------------------------------------------------------------------------------- -- AXI Lite AXI DMA Register Offsets ------------------------------------------------------------------------------- constant MM2S_DMACR_INDEX : integer := 0; constant MM2S_DMASR_INDEX : integer := 1; constant MM2S_CURDESC_LSB_INDEX : integer := 2; constant MM2S_CURDESC_MSB_INDEX : integer := 3; constant MM2S_TAILDESC_LSB_INDEX : integer := 4; constant MM2S_TAILDESC_MSB_INDEX : integer := 5; constant MM2S_SA_INDEX : integer := 6; constant RESERVED_1C_INDEX : integer := 7; constant RESERVED_20_INDEX : integer := 8; constant RESERVED_24_INDEX : integer := 9; constant MM2S_LENGTH_INDEX : integer := 10; constant RESERVED_2C_INDEX : integer := 11; constant S2MM_DMACR_INDEX : integer := 12; constant S2MM_DMASR_INDEX : integer := 13; constant S2MM_CURDESC_LSB_INDEX : integer := 14; constant S2MM_CURDESC_MSB_INDEX : integer := 15; constant S2MM_TAILDESC_LSB_INDEX : integer := 16; constant S2MM_TAILDESC_MSB_INDEX : integer := 17; constant S2MM_DA_INDEX : integer := 18; constant RESERVED_4C_INDEX : integer := 19; constant RESERVED_50_INDEX : integer := 20; constant RESERVED_54_INDEX : integer := 21; --constant S2MM_LENGTH_INDEX : integer := 22; constant S2MM_LENGTH_INDEX : integer := 142; constant MM2S_DMACR_OFFSET : std_logic_vector(9 downto 0) := "0000000000"; -- 0x00 constant MM2S_DMASR_OFFSET : std_logic_vector(9 downto 0) := "0000000100"; -- 0x04 constant MM2S_CURDESC_LSB_OFFSET : std_logic_vector(9 downto 0) := "0000001000"; -- 0x08 constant MM2S_CURDESC_MSB_OFFSET : std_logic_vector(9 downto 0) := "0000001100"; -- 0x0C constant MM2S_TAILDESC_LSB_OFFSET : std_logic_vector(9 downto 0) := "0000010000"; -- 0x10 constant MM2S_TAILDESC_MSB_OFFSET : std_logic_vector(9 downto 0) := "0000010100"; -- 0x14 constant MM2S_SA_OFFSET : std_logic_vector(9 downto 0) := "0000011000"; -- 0x18 constant RESERVED_1C_OFFSET : std_logic_vector(9 downto 0) := "0000011100"; -- 0x1C constant RESERVED_20_OFFSET : std_logic_vector(9 downto 0) := "0000100000"; -- 0x20 constant RESERVED_24_OFFSET : std_logic_vector(9 downto 0) := "0000100100"; -- 0x24 constant MM2S_LENGTH_OFFSET : std_logic_vector(9 downto 0) := "0000101000"; -- 0x28 -- Following was reserved, now is used for SG xCache and xUser constant SGCTL_OFFSET : std_logic_vector(9 downto 0) := "0000101100"; -- 0x2C constant S2MM_DMACR_OFFSET : std_logic_vector(9 downto 0) := "0000110000"; -- 0x30 constant S2MM_DMASR_OFFSET : std_logic_vector(9 downto 0) := "0000110100"; -- 0x34 constant S2MM_CURDESC_LSB_OFFSET : std_logic_vector(9 downto 0) := "0000111000"; -- 0x38 constant S2MM_CURDESC_MSB_OFFSET : std_logic_vector(9 downto 0) := "0000111100"; -- 0x3C constant S2MM_TAILDESC_LSB_OFFSET : std_logic_vector(9 downto 0) := "0001000000"; -- 0x40 constant S2MM_TAILDESC_MSB_OFFSET : std_logic_vector(9 downto 0) := "0001000100"; -- 0x44 constant S2MM_DA_OFFSET : std_logic_vector(9 downto 0) := "0001001000"; -- 0x48 --CR603034 constant RESERVED_4C_OFFSET : std_logic_vector(9 downto 0) := "0001001100"; -- 0x4C constant RESERVED_50_OFFSET : std_logic_vector(9 downto 0) := "0001010000"; -- 0x50 constant RESERVED_54_OFFSET : std_logic_vector(9 downto 0) := "0001010100"; -- 0x54 constant S2MM_LENGTH_OFFSET : std_logic_vector(9 downto 0) := "0001011000"; -- 0x58 -- New registers for S2MM channels constant S2MM_CURDESC1_LSB_OFFSET : std_logic_vector(9 downto 0) := "0001110000"; -- 0x70 constant S2MM_CURDESC1_MSB_OFFSET : std_logic_vector(9 downto 0) := "0001110100"; -- 0x74 constant S2MM_TAILDESC1_LSB_OFFSET : std_logic_vector(9 downto 0) := "0001111000"; -- 0x78 constant S2MM_TAILDESC1_MSB_OFFSET : std_logic_vector(9 downto 0) := "0001111100"; -- 0x7C constant S2MM_CURDESC2_LSB_OFFSET : std_logic_vector(9 downto 0) := "0010010000"; -- 0x90 constant S2MM_CURDESC2_MSB_OFFSET : std_logic_vector(9 downto 0) := "0010010100"; -- 0x94 constant S2MM_TAILDESC2_LSB_OFFSET : std_logic_vector(9 downto 0) := "0010011000"; -- 0x98 constant S2MM_TAILDESC2_MSB_OFFSET : std_logic_vector(9 downto 0) := "0010011100"; -- 0x9C constant S2MM_CURDESC3_LSB_OFFSET : std_logic_vector(9 downto 0) := "0010110000"; -- 0xB0 constant S2MM_CURDESC3_MSB_OFFSET : std_logic_vector(9 downto 0) := "0010110100"; -- 0xB4 constant S2MM_TAILDESC3_LSB_OFFSET : std_logic_vector(9 downto 0) := "0010111000"; -- 0xB8 constant S2MM_TAILDESC3_MSB_OFFSET : std_logic_vector(9 downto 0) := "0010111100"; -- 0xBC constant S2MM_CURDESC4_LSB_OFFSET : std_logic_vector(9 downto 0) := "0011010000"; -- 0xD0 constant S2MM_CURDESC4_MSB_OFFSET : std_logic_vector(9 downto 0) := "0011010100"; -- 0xD4 constant S2MM_TAILDESC4_LSB_OFFSET : std_logic_vector(9 downto 0) := "0011011000"; -- 0xD8 constant S2MM_TAILDESC4_MSB_OFFSET : std_logic_vector(9 downto 0) := "0011011100"; -- 0xDC constant S2MM_CURDESC5_LSB_OFFSET : std_logic_vector(9 downto 0) := "0011110000"; -- 0xF0 constant S2MM_CURDESC5_MSB_OFFSET : std_logic_vector(9 downto 0) := "0011110100"; -- 0xF4 constant S2MM_TAILDESC5_LSB_OFFSET : std_logic_vector(9 downto 0) := "0011111000"; -- 0xF8 constant S2MM_TAILDESC5_MSB_OFFSET : std_logic_vector(9 downto 0) := "0011111100"; -- 0xFC constant S2MM_CURDESC6_LSB_OFFSET : std_logic_vector(9 downto 0) := "0100010000"; -- 0x110 constant S2MM_CURDESC6_MSB_OFFSET : std_logic_vector(9 downto 0) := "0100010100"; -- 0x114 constant S2MM_TAILDESC6_LSB_OFFSET : std_logic_vector(9 downto 0) := "0100011000"; -- 0x118 constant S2MM_TAILDESC6_MSB_OFFSET : std_logic_vector(9 downto 0) := "0100011100"; -- 0x11C constant S2MM_CURDESC7_LSB_OFFSET : std_logic_vector(9 downto 0) := "0100110000"; -- 0x130 constant S2MM_CURDESC7_MSB_OFFSET : std_logic_vector(9 downto 0) := "0100110100"; -- 0x134 constant S2MM_TAILDESC7_LSB_OFFSET : std_logic_vector(9 downto 0) := "0100111000"; -- 0x138 constant S2MM_TAILDESC7_MSB_OFFSET : std_logic_vector(9 downto 0) := "0100111100"; -- 0x13C constant S2MM_CURDESC8_LSB_OFFSET : std_logic_vector(9 downto 0) := "0101010000"; -- 0x150 constant S2MM_CURDESC8_MSB_OFFSET : std_logic_vector(9 downto 0) := "0101010100"; -- 0x154 constant S2MM_TAILDESC8_LSB_OFFSET : std_logic_vector(9 downto 0) := "0101011000"; -- 0x158 constant S2MM_TAILDESC8_MSB_OFFSET : std_logic_vector(9 downto 0) := "0101011100"; -- 0x15C constant S2MM_CURDESC9_LSB_OFFSET : std_logic_vector(9 downto 0) := "0101110000"; -- 0x170 constant S2MM_CURDESC9_MSB_OFFSET : std_logic_vector(9 downto 0) := "0101110100"; -- 0x174 constant S2MM_TAILDESC9_LSB_OFFSET : std_logic_vector(9 downto 0) := "0101111000"; -- 0x178 constant S2MM_TAILDESC9_MSB_OFFSET : std_logic_vector(9 downto 0) := "0101111100"; -- 0x17C constant S2MM_CURDESC10_LSB_OFFSET : std_logic_vector(9 downto 0) := "0110010000"; -- 0x190 constant S2MM_CURDESC10_MSB_OFFSET : std_logic_vector(9 downto 0) := "0110010100"; -- 0x194 constant S2MM_TAILDESC10_LSB_OFFSET : std_logic_vector(9 downto 0) := "0110011000"; -- 0x198 constant S2MM_TAILDESC10_MSB_OFFSET : std_logic_vector(9 downto 0) := "0110011100"; -- 0x19C constant S2MM_CURDESC11_LSB_OFFSET : std_logic_vector(9 downto 0) := "0110110000"; -- 0x1B0 constant S2MM_CURDESC11_MSB_OFFSET : std_logic_vector(9 downto 0) := "0110110100"; -- 0x1B4 constant S2MM_TAILDESC11_LSB_OFFSET : std_logic_vector(9 downto 0) := "0110111000"; -- 0x1B8 constant S2MM_TAILDESC11_MSB_OFFSET : std_logic_vector(9 downto 0) := "0110111100"; -- 0x1BC constant S2MM_CURDESC12_LSB_OFFSET : std_logic_vector(9 downto 0) := "0111010000"; -- 0x1D0 constant S2MM_CURDESC12_MSB_OFFSET : std_logic_vector(9 downto 0) := "0111010100"; -- 0x1D4 constant S2MM_TAILDESC12_LSB_OFFSET : std_logic_vector(9 downto 0) := "0111011000"; -- 0x1D8 constant S2MM_TAILDESC12_MSB_OFFSET : std_logic_vector(9 downto 0) := "0111011100"; -- 0x1DC constant S2MM_CURDESC13_LSB_OFFSET : std_logic_vector(9 downto 0) := "0111110000"; -- 0x1F0 constant S2MM_CURDESC13_MSB_OFFSET : std_logic_vector(9 downto 0) := "0111110100"; -- 0x1F4 constant S2MM_TAILDESC13_LSB_OFFSET : std_logic_vector(9 downto 0) := "0111111000"; -- 0x1F8 constant S2MM_TAILDESC13_MSB_OFFSET : std_logic_vector(9 downto 0) := "0111111100"; -- 0x1FC constant S2MM_CURDESC14_LSB_OFFSET : std_logic_vector(9 downto 0) := "1000010000"; -- 0x210 constant S2MM_CURDESC14_MSB_OFFSET : std_logic_vector(9 downto 0) := "1000010100"; -- 0x214 constant S2MM_TAILDESC14_LSB_OFFSET : std_logic_vector(9 downto 0) := "1000011000"; -- 0x218 constant S2MM_TAILDESC14_MSB_OFFSET : std_logic_vector(9 downto 0) := "1000011100"; -- 0x21C constant S2MM_CURDESC15_LSB_OFFSET : std_logic_vector(9 downto 0) := "1000110000"; -- 0x230 constant S2MM_CURDESC15_MSB_OFFSET : std_logic_vector(9 downto 0) := "1000110100"; -- 0x234 constant S2MM_TAILDESC15_LSB_OFFSET : std_logic_vector(9 downto 0) := "1000111000"; -- 0x238 constant S2MM_TAILDESC15_MSB_OFFSET : std_logic_vector(9 downto 0) := "1000111100"; -- 0x23C ------------------------------------------------------------------------------- -- Register Bit Constants ------------------------------------------------------------------------------- -- DMACR constant DMACR_RS_BIT : integer := 0; constant DMACR_TAILPEN_BIT : integer := 1; constant DMACR_RESET_BIT : integer := 2; constant DMACR_KH_BIT : integer := 3; constant CYCLIC_BIT : integer := 4; --constant DMACR_RESERVED3_BIT : integer := 3; --constant DMACR_RESERVED4_BIT : integer := 4; constant DMACR_RESERVED5_BIT : integer := 5; constant DMACR_RESERVED6_BIT : integer := 6; constant DMACR_RESERVED7_BIT : integer := 7; constant DMACR_RESERVED8_BIT : integer := 8; constant DMACR_RESERVED9_BIT : integer := 9; constant DMACR_RESERVED10_BIT : integer := 10; constant DMACR_RESERVED11_BIT : integer := 11; constant DMACR_IOC_IRQEN_BIT : integer := 12; constant DMACR_DLY_IRQEN_BIT : integer := 13; constant DMACR_ERR_IRQEN_BIT : integer := 14; constant DMACR_RESERVED15_BIT : integer := 15; constant DMACR_IRQTHRESH_LSB_BIT : integer := 16; constant DMACR_IRQTHRESH_MSB_BIT : integer := 23; constant DMACR_IRQDELAY_LSB_BIT : integer := 24; constant DMACR_IRQDELAY_MSB_BIT : integer := 31; -- DMASR constant DMASR_HALTED_BIT : integer := 0; constant DMASR_IDLE_BIT : integer := 1; constant DMASR_CMPLT_BIT : integer := 2; constant DMASR_ERROR_BIT : integer := 3; constant DMASR_DMAINTERR_BIT : integer := 4; constant DMASR_DMASLVERR_BIT : integer := 5; constant DMASR_DMADECERR_BIT : integer := 6; constant DMASR_RESERVED7_BIT : integer := 7; constant DMASR_SGINTERR_BIT : integer := 8; constant DMASR_SGSLVERR_BIT : integer := 9; constant DMASR_SGDECERR_BIT : integer := 10; constant DMASR_RESERVED11_BIT : integer := 11; constant DMASR_IOCIRQ_BIT : integer := 12; constant DMASR_DLYIRQ_BIT : integer := 13; constant DMASR_ERRIRQ_BIT : integer := 14; constant DMASR_RESERVED15_BIT : integer := 15; constant DMASR_IRQTHRESH_LSB_BIT : integer := 16; constant DMASR_IRQTHRESH_MSB_BIT : integer := 23; constant DMASR_IRQDELAY_LSB_BIT : integer := 24; constant DMASR_IRQDELAY_MSB_BIT : integer := 31; -- CURDESC constant CURDESC_LOWER_MSB_BIT : integer := 31; constant CURDESC_LOWER_LSB_BIT : integer := 6; constant CURDESC_RESERVED_BIT5 : integer := 5; constant CURDESC_RESERVED_BIT4 : integer := 4; constant CURDESC_RESERVED_BIT3 : integer := 3; constant CURDESC_RESERVED_BIT2 : integer := 2; constant CURDESC_RESERVED_BIT1 : integer := 1; constant CURDESC_RESERVED_BIT0 : integer := 0; -- TAILDESC constant TAILDESC_LOWER_MSB_BIT : integer := 31; constant TAILDESC_LOWER_LSB_BIT : integer := 6; constant TAILDESC_RESERVED_BIT5 : integer := 5; constant TAILDESC_RESERVED_BIT4 : integer := 4; constant TAILDESC_RESERVED_BIT3 : integer := 3; constant TAILDESC_RESERVED_BIT2 : integer := 2; constant TAILDESC_RESERVED_BIT1 : integer := 1; constant TAILDESC_RESERVED_BIT0 : integer := 0; -- DataMover Command / Status Constants constant DATAMOVER_CMDDONE_BIT : integer := 7; constant DATAMOVER_SLVERR_BIT : integer := 6; constant DATAMOVER_DECERR_BIT : integer := 5; constant DATAMOVER_INTERR_BIT : integer := 4; constant DATAMOVER_TAGMSB_BIT : integer := 3; constant DATAMOVER_TAGLSB_BIT : integer := 0; -- Descriptor Control Bits constant DESC_BLENGTH_LSB_BIT : integer := 0; constant DESC_BLENGTH_MSB_BIT : integer := 22; constant DESC_RSVD23_BIT : integer := 23; constant DESC_RSVD24_BIT : integer := 24; constant DESC_RSVD25_BIT : integer := 25; constant DESC_EOF_BIT : integer := 26; constant DESC_SOF_BIT : integer := 27; constant DESC_RSVD28_BIT : integer := 28; constant DESC_RSVD29_BIT : integer := 29; constant DESC_RSVD30_BIT : integer := 30; constant DESC_IOC_BIT : integer := 31; -- Descriptor Status Bits constant DESC_STS_CMPLTD_BIT : integer := 31; constant DESC_STS_DECERR_BIT : integer := 30; constant DESC_STS_SLVERR_BIT : integer := 29; constant DESC_STS_INTERR_BIT : integer := 28; constant DESC_STS_RXSOF_BIT : integer := 27; constant DESC_STS_RXEOF_BIT : integer := 26; constant DESC_STS_RSVD25_BIT : integer := 25; constant DESC_STS_RSVD24_BIT : integer := 24; constant DESC_STS_RSVD23_BIT : integer := 23; constant DESC_STS_XFRDBYTS_MSB_BIT : integer := 22; constant DESC_STS_XFRDBYTS_LSB_BIT : integer := 0; -- DataMover Command / Status Constants constant DATAMOVER_STS_CMDDONE_BIT : integer := 7; constant DATAMOVER_STS_SLVERR_BIT : integer := 6; constant DATAMOVER_STS_DECERR_BIT : integer := 5; constant DATAMOVER_STS_INTERR_BIT : integer := 4; constant DATAMOVER_STS_TAGMSB_BIT : integer := 3; constant DATAMOVER_STS_TAGLSB_BIT : integer := 0; constant DATAMOVER_STS_TAGEOF_BIT : integer := 1; constant DATAMOVER_STS_TLAST_BIT : integer := 31; constant DATAMOVER_CMD_BTTLSB_BIT : integer := 0; constant DATAMOVER_CMD_BTTMSB_BIT : integer := 22; constant DATAMOVER_CMD_TYPE_BIT : integer := 23; constant DATAMOVER_CMD_DSALSB_BIT : integer := 24; constant DATAMOVER_CMD_DSAMSB_BIT : integer := 29; constant DATAMOVER_CMD_EOF_BIT : integer := 30; constant DATAMOVER_CMD_DRR_BIT : integer := 31; constant DATAMOVER_CMD_ADDRLSB_BIT : integer := 32; -- Note: Bit offset require adding ADDR WIDTH to get to actual bit index constant DATAMOVER_CMD_ADDRMSB_BOFST: integer := 31; constant DATAMOVER_CMD_TAGLSB_BOFST : integer := 32; constant DATAMOVER_CMD_TAGMSB_BOFST : integer := 35; constant DATAMOVER_CMD_RSVLSB_BOFST : integer := 36; constant DATAMOVER_CMD_RSVMSB_BOFST : integer := 39; end axi_dma_pkg; ------------------------------------------------------------------------------- -- PACKAGE BODY ------------------------------------------------------------------------------- package body axi_dma_pkg is ------------------------------------------------------------------------------- -- Function to determine minimum bits required for BTT_SIZE field ------------------------------------------------------------------------------- function required_btt_width ( dwidth : integer; burst_size: integer; btt_width : integer) return integer is variable min_width : integer; begin min_width := clog2((dwidth/8)*burst_size)+1; if(min_width > btt_width)then return min_width; else return btt_width; end if; end function required_btt_width; ------------------------------------------------------------------------------- -- function to return Frequency Hertz parameter based on inclusion of sg engine ------------------------------------------------------------------------------- function hertz_prmtr_select(included : integer; lite_frequency : integer; sg_frequency : integer) return integer is begin -- 1 = Scatter Gather Included -- 0 = Scatter Gather Excluded if(included = 1)then return sg_frequency; else return lite_frequency; end if; end; ------------------------------------------------------------------------------- -- function to enable store and forward based on data width mismatch -- or directly enabled ------------------------------------------------------------------------------- function enable_snf (sf_enabled : integer; axi_data_width : integer; axis_tdata_width : integer) return integer is begin -- If store and forward enable or data widths do not -- match then return 1 to enable snf if( (sf_enabled = 1) or (axi_data_width /= axis_tdata_width))then return 1; else -- coverage off return 0; -- coverage on end if; end; end package body axi_dma_pkg;
gpl-3.0
a55e088a36c65c8ea974ecb98cbde6fc
0.60076
3.742884
false
false
false
false
mistryalok/Zedboard
learning/training/MSD/s05/project_1/project_1.srcs/sources_1/bd/design_1/ip/design_1_axi_timer_0_0/synth/design_1_axi_timer_0_0.vhd
1
9,266
-- (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: 6 LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; LIBRARY axi_timer_v2_0; USE axi_timer_v2_0.axi_timer; 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 2014.4"; 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 2014.4,x_ipVendor=xilinx.com,x_ipLibrary=ip,x_ipName=axi_timer,x_ipVersion=2.0,x_ipCoreRevision=6,x_ipLanguage=VERILOG,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
69c4aec91080a5e16949079f37edb8b2
0.691129
3.278839
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/greth/grethm.vhd
1
6,313
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: grethm -- File: grethm.vhd -- Author: Jiri Gaisler -- Description: Module to select between greth and greth1g ------------------------------------------------------------------------------ library ieee; library grlib; library gaisler; use ieee.std_logic_1164.all; use grlib.stdlib.all; use grlib.amba.all; library techmap; use techmap.gencomp.all; use gaisler.net.all; entity grethm is generic( hindex : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#FFF#; pirq : integer := 0; memtech : integer := 0; ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; slot_time : integer := 128; mdcscaler : integer range 0 to 255 := 25; enable_mdio : integer range 0 to 1 := 0; fifosize : integer range 4 to 64 := 8; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; burstlength : integer range 4 to 128 := 32; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 32 := 0; rmii : integer range 0 to 1 := 0; sim : integer range 0 to 1 := 0; giga : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; ft : integer range 0 to 2 := 0; edclft : integer range 0 to 1 := 1; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0; mdiohold : integer := 1; maxsize : integer := 1500 ); port( rst : in std_ulogic; clk : in std_ulogic; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ethi : in eth_in_type; etho : out eth_out_type ); end entity; architecture rtl of grethm is begin m100 : if giga = 0 generate u0 : greth generic map ( hindex => hindex, pindex => pindex, paddr => paddr, pmask => pmask, pirq => pirq, memtech => memtech, ifg_gap => ifg_gap, attempt_limit => attempt_limit, backoff_limit => backoff_limit, slot_time => slot_time, mdcscaler => mdcscaler, enable_mdio => enable_mdio, fifosize => fifosize, nsync => nsync, edcl => edcl, edclbufsz => edclbufsz, macaddrh => macaddrh, macaddrl => macaddrl, ipaddrh => ipaddrh, ipaddrl => ipaddrl, phyrstadr => phyrstadr, rmii => rmii, oepol => oepol, scanen => scanen, ft => ft, edclft => edclft, mdint_pol => mdint_pol, enable_mdint => enable_mdint, multicast => multicast, ramdebug => ramdebug, mdiohold => mdiohold, maxsize => maxsize ) port map ( rst => rst, clk => clk, ahbmi => ahbmi, ahbmo => ahbmo, apbi => apbi, apbo => apbo, ethi => ethi, etho => etho); end generate; m1000 : if giga = 1 generate u0 : greth_gbit generic map ( hindex => hindex, pindex => pindex, paddr => paddr, pmask => pmask, pirq => pirq, memtech => memtech, ifg_gap => ifg_gap, attempt_limit => attempt_limit, backoff_limit => backoff_limit, slot_time => slot_time, mdcscaler => mdcscaler, nsync => nsync, edcl => edcl, edclbufsz => edclbufsz, burstlength => burstlength, macaddrh => macaddrh, macaddrl => macaddrl, ipaddrh => ipaddrh, ipaddrl => ipaddrl, phyrstadr => phyrstadr, sim => sim, oepol => oepol, scanen => scanen, ft => ft, edclft => edclft, mdint_pol => mdint_pol, enable_mdint => enable_mdint, multicast => multicast, ramdebug => ramdebug, mdiohold => mdiohold) port map ( rst => rst, clk => clk, ahbmi => ahbmi, ahbmo => ahbmo, apbi => apbi, apbo => apbo, ethi => ethi, etho => etho); end generate; end architecture;
gpl-2.0
dab7d9f02c1930217b3c098d7ec918a3
0.468715
4.452045
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-altera-c5ekit/ddr3if.vhd
1
9,531
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA library ieee; use ieee.std_logic_1164.all; library grlib; use grlib.amba.all; use grlib.devices.all; library gaisler; use gaisler.ddrpkg.all; entity ddr3if is generic ( hindex: integer; haddr: integer := 16#400#; hmask: integer := 16#000#; burstlen: integer := 8 ); port ( pll_ref_clk: in std_ulogic; global_reset_n: in std_ulogic; mem_a: out std_logic_vector(13 downto 0); mem_ba: out std_logic_vector(2 downto 0); mem_ck: out std_ulogic; mem_ck_n: out std_ulogic; mem_cke: out std_ulogic; mem_reset_n: out std_ulogic; mem_cs_n: out std_ulogic; mem_dm: out std_logic_vector(3 downto 0); mem_ras_n: out std_ulogic; mem_cas_n: out std_ulogic; mem_we_n: out std_ulogic; mem_dq: inout std_logic_vector(31 downto 0); mem_dqs: inout std_logic_vector(3 downto 0); mem_dqs_n: inout std_logic_vector(3 downto 0); mem_odt: out std_ulogic; oct_rzqin: in std_logic; ahb_clk: in std_ulogic; ahb_rst: in std_ulogic; ahbsi: in ahb_slv_in_type; ahbso: out ahb_slv_out_type ); end; architecture rtl of ddr3if is component ddr3ctrl1 is port ( pll_ref_clk : in std_logic := 'X'; -- clk global_reset_n : in std_logic := 'X'; -- reset_n soft_reset_n : in std_logic := 'X'; -- reset_n afi_clk : out std_logic; -- clk afi_half_clk : out std_logic; -- clk afi_reset_n : out std_logic; -- reset_n afi_reset_export_n : out std_logic; -- reset_n mem_a : out std_logic_vector(13 downto 0); -- mem_a mem_ba : out std_logic_vector(2 downto 0); -- mem_ba mem_ck : out std_logic_vector(0 downto 0); -- mem_ck mem_ck_n : out std_logic_vector(0 downto 0); -- mem_ck_n mem_cke : out std_logic_vector(0 downto 0); -- mem_cke mem_cs_n : out std_logic_vector(0 downto 0); -- mem_cs_n mem_dm : out std_logic_vector(3 downto 0); -- mem_dm mem_ras_n : out std_logic_vector(0 downto 0); -- mem_ras_n mem_cas_n : out std_logic_vector(0 downto 0); -- mem_cas_n mem_we_n : out std_logic_vector(0 downto 0); -- mem_we_n mem_reset_n : out std_logic; -- mem_reset_n mem_dq : inout std_logic_vector(31 downto 0) := (others => 'X'); -- mem_dq mem_dqs : inout std_logic_vector(3 downto 0) := (others => 'X'); -- mem_dqs mem_dqs_n : inout std_logic_vector(3 downto 0) := (others => 'X'); -- mem_dqs_n mem_odt : out std_logic_vector(0 downto 0); -- mem_odt avl_ready : out std_logic; -- waitrequest_n avl_burstbegin : in std_logic := 'X'; -- beginbursttransfer avl_addr : in std_logic_vector(24 downto 0) := (others => 'X'); -- address avl_rdata_valid : out std_logic; -- readdatavalid avl_rdata : out std_logic_vector(127 downto 0); -- readdata avl_wdata : in std_logic_vector(127 downto 0) := (others => 'X'); -- writedata avl_be : in std_logic_vector(15 downto 0) := (others => 'X'); -- byteenable avl_read_req : in std_logic := 'X'; -- read avl_write_req : in std_logic := 'X'; -- write avl_size : in std_logic_vector(2 downto 0) := (others => 'X'); -- burstcount local_init_done : out std_logic; -- local_init_done local_cal_success : out std_logic; -- local_cal_success local_cal_fail : out std_logic; -- local_cal_fail oct_rzqin : in std_logic := 'X'; -- rzqin pll_mem_clk : out std_logic; -- pll_mem_clk pll_write_clk : out std_logic; -- pll_write_clk pll_write_clk_pre_phy_clk : out std_logic; -- pll_write_clk_pre_phy_clk pll_addr_cmd_clk : out std_logic; -- pll_addr_cmd_clk pll_locked : out std_logic; -- pll_locked pll_avl_clk : out std_logic; -- pll_avl_clk pll_config_clk : out std_logic; -- pll_config_clk pll_mem_phy_clk : out std_logic; -- pll_mem_phy_clk afi_phy_clk : out std_logic; -- afi_phy_clk pll_avl_phy_clk : out std_logic -- pll_avl_phy_clk ); end component ddr3ctrl1; signal vcc: std_ulogic; signal afi_clk, afi_half_clk, afi_reset_n: std_ulogic; signal local_init_done, local_cal_success, local_cal_fail: std_ulogic; signal ck_p_arr, ck_n_arr, cke_arr, cs_arr: std_logic_vector(0 downto 0); signal rasn_arr, casn_arr, wen_arr, odt_arr: std_logic_vector(0 downto 0); signal avlsi: ddravl_slv_in_type; signal avlso: ddravl_slv_out_type; begin vcc <= '1'; mem_ck <= ck_p_arr(0); mem_ck_n <= ck_n_arr(0); mem_cke <= cke_arr(0); mem_cs_n <= cs_arr(0); mem_ras_n <= rasn_arr(0); mem_cas_n <= casn_arr(0); mem_we_n <= wen_arr(0); mem_odt <= odt_arr(0); ctrl0: ddr3ctrl1 port map ( pll_ref_clk => pll_ref_clk, global_reset_n => global_reset_n, soft_reset_n => vcc, afi_clk => afi_clk, afi_half_clk => afi_half_clk, afi_reset_n => afi_reset_n, afi_reset_export_n => open, mem_a => mem_a, mem_ba => mem_ba, mem_ck => ck_p_arr, mem_ck_n => ck_n_arr, mem_cke => cke_arr, mem_cs_n => cs_arr, mem_dm => mem_dm, mem_ras_n => rasn_arr, mem_cas_n => casn_arr, mem_we_n => wen_arr, mem_reset_n => mem_reset_n, mem_dq => mem_dq, mem_dqs => mem_dqs, mem_dqs_n => mem_dqs_n, mem_odt => odt_arr, avl_ready => avlso.ready, avl_burstbegin => avlsi.burstbegin, avl_addr => avlsi.addr(24 downto 0), avl_rdata_valid => avlso.rdata_valid, avl_rdata => avlso.rdata(127 downto 0), avl_wdata => avlsi.wdata(127 downto 0), avl_be => avlsi.be(15 downto 0), avl_read_req => avlsi.read_req, avl_write_req => avlsi.write_req, avl_size => avlsi.size(2 downto 0), local_init_done => local_init_done, local_cal_success => local_cal_success, local_cal_fail => local_cal_fail, oct_rzqin => oct_rzqin, pll_mem_clk => open, pll_write_clk => open, pll_write_clk_pre_phy_clk => open, pll_addr_cmd_clk => open, pll_locked => open, pll_avl_clk => open, pll_config_clk => open, pll_mem_phy_clk => open, afi_phy_clk => open, pll_avl_phy_clk => open ); avlso.rdata(avlso.rdata'high downto 128) <= (others => '0'); ahb2avl0: ahb2avl_async generic map ( hindex => hindex, haddr => haddr, hmask => hmask, burstlen => burstlen, nosync => 0, avldbits => 128, avlabits => 25 ) port map ( rst_ahb => ahb_rst, clk_ahb => ahb_clk, ahbsi => ahbsi, ahbso => ahbso, rst_avl => afi_reset_n, clk_avl => afi_clk, avlsi => avlsi, avlso => avlso ); end;
gpl-2.0
41fd77e0e1067138495358eec4543535
0.47078
3.595247
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-nexys4/project_1/project_1.srcs/sources_1/imports/sources/bftLib/round_1.vhdl
1
2,595
--///////////////////////////////////////////////////////////////////////// --// Copyright (c) 2008 Xilinx, Inc. All rights reserved. --// --// XILINX CONFIDENTIAL PROPERTY --// This document contains proprietary information which is --// protected by copyright. All rights are reserved. This notice --// refers to original work by Xilinx, Inc. which may be derivitive --// of other work distributed under license of the authors. In the --// case of derivitive work, nothing in this notice overrides the --// original author's license agreeement. Where applicable, the --// original license agreement is included in it's original --// unmodified form immediately below this header. --// --// Xilinx, Inc. --// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A --// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS --// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR --// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION --// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE --// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. --// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO --// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO --// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE --// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY --// AND FITNESS FOR A PARTICULAR PURPOSE. --// --///////////////////////////////////////////////////////////////////////// -- This is round_1 of the FFT calculation -- Step size is 1 so X and X +1 are mixed together -- X0 with X1, X2 with X3 and etc -- U is a constant with a bogus value - you will want to change it library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_ARITH.all; use IEEE.STD_LOGIC_SIGNED.all; library bftLib; use bftLib.bftPackage.all; entity round_1 is port ( clk: in std_logic; x : in xType; xOut : out xType ); end entity round_1; architecture aR1 of round_1 is constant u : uType := (X"0123", X"4567", X"89AB", X"CDEF", X"0123", X"4567", X"89AB", X"CDEF"); begin transformLoop: for N in 0 to 7 generate ct: entity bftLib.coreTransform(aCT) generic map (DATA_WIDTH=> DATA_WIDTH) port map (clk => clk, x =>x(2*N), xStep=>x(2*N+1), u=>u(N), xOut=>xOut(2*N), xOutStep =>xOut(2*N+1)); end generate transformLoop; end architecture aR1;
gpl-2.0
048269c23b2e48a1b33149bb5187776b
0.628902
3.937785
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/greth/greth.vhd
1
12,217
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: greth -- File: greth.vhd -- Author: Marko Isomaki -- Description: Ethernet Media Access Controller with Ethernet Debug -- Communication Link ------------------------------------------------------------------------------ library ieee; library grlib; library gaisler; use ieee.std_logic_1164.all; use grlib.stdlib.all; use grlib.amba.all; use grlib.devices.all; library techmap; use techmap.gencomp.all; use gaisler.net.all; use gaisler.ethernet_mac.all; library eth; use eth.ethcomp.all; entity greth is generic( hindex : integer := 0; pindex : integer := 0; paddr : integer := 0; pmask : integer := 16#FFF#; pirq : integer := 0; memtech : integer := 0; ifg_gap : integer := 24; attempt_limit : integer := 16; backoff_limit : integer := 10; slot_time : integer := 128; mdcscaler : integer range 0 to 255 := 25; enable_mdio : integer range 0 to 1 := 0; fifosize : integer range 4 to 512 := 8; nsync : integer range 1 to 2 := 2; edcl : integer range 0 to 3 := 0; edclbufsz : integer range 1 to 64 := 1; macaddrh : integer := 16#00005E#; macaddrl : integer := 16#000000#; ipaddrh : integer := 16#c0a8#; ipaddrl : integer := 16#0035#; phyrstadr : integer range 0 to 32 := 0; rmii : integer range 0 to 1 := 0; oepol : integer range 0 to 1 := 0; scanen : integer range 0 to 1 := 0; ft : integer range 0 to 2 := 0; edclft : integer range 0 to 2 := 0; mdint_pol : integer range 0 to 1 := 0; enable_mdint : integer range 0 to 1 := 0; multicast : integer range 0 to 1 := 0; ramdebug : integer range 0 to 2 := 0; mdiohold : integer := 1; maxsize : integer := 1518); port( rst : in std_ulogic; clk : in std_ulogic; ahbmi : in ahb_mst_in_type; ahbmo : out ahb_mst_out_type; apbi : in apb_slv_in_type; apbo : out apb_slv_out_type; ethi : in eth_in_type; etho : out eth_out_type ); end entity; architecture rtl of greth is function getfifosize(edcl, fifosize, ebufsize : in integer) return integer is begin if (edcl /= 0) and (ebufsize > fifosize) then return ebufsize; else return fifosize; end if; end function; constant fabits : integer := log2(fifosize); type szvct is array (0 to 6) of integer; constant ebuf : szvct := (64, 128, 128, 256, 256, 256, 256); constant eabits : integer := log2(edclbufsz) + 8; constant bufsize : std_logic_vector(2 downto 0) := conv_std_logic_vector(log2(edclbufsz), 3); constant ebufsize : integer := ebuf(log2(edclbufsz)); constant txfifosize : integer := getfifosize(edcl, fifosize, ebufsize); constant txfabits : integer := log2(txfifosize); constant REVISION : amba_version_type := 0; constant pconfig : apb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_ETHMAC, 0, REVISION, pirq), 1 => apb_iobar(paddr, pmask)); constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_ETHMAC, 0, revision, 0), others => zero32); constant ehconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_EDCLMST, 0, REVISION, 0), others => zero32); signal irq : std_ulogic; --rx ahb fifo signal rxrenable : std_ulogic; signal rxraddress : std_logic_vector(10 downto 0); signal rxwrite : std_ulogic; signal rxwdata : std_logic_vector(31 downto 0); signal rxwaddress : std_logic_vector(10 downto 0); signal rxrdata : std_logic_vector(31 downto 0); --tx ahb fifo signal txrenable : std_ulogic; signal txraddress : std_logic_vector(10 downto 0); signal txwrite : std_ulogic; signal txwdata : std_logic_vector(31 downto 0); signal txwaddress : std_logic_vector(10 downto 0); signal txrdata : std_logic_vector(31 downto 0); --edcl buf signal erenable : std_ulogic; signal eraddress : std_logic_vector(15 downto 0); signal ewritem : std_ulogic; signal ewritel : std_ulogic; signal ewaddressm : std_logic_vector(15 downto 0); signal ewaddressl : std_logic_vector(15 downto 0); signal ewdata : std_logic_vector(31 downto 0); signal erdata : std_logic_vector(31 downto 0); signal lmdio_oe : std_ulogic; -- Fix for wider bus signal hwdata : std_logic_vector(31 downto 0); signal hrdata : std_logic_vector(31 downto 0); begin ethc0: grethc generic map( ifg_gap => ifg_gap, attempt_limit => attempt_limit, backoff_limit => backoff_limit, mdcscaler => mdcscaler, enable_mdio => enable_mdio, fifosize => fifosize, nsync => nsync, edcl => edcl, edclbufsz => edclbufsz, macaddrh => macaddrh, macaddrl => macaddrl, ipaddrh => ipaddrh, ipaddrl => ipaddrl, phyrstadr => phyrstadr, rmii => rmii, oepol => oepol, scanen => scanen, mdint_pol => mdint_pol, enable_mdint => enable_mdint, multicast => multicast, edclsepahbg => 0, ramdebug => ramdebug, mdiohold => mdiohold, maxsize => maxsize) port map( rst => rst, clk => clk, --ahb mst in hgrant => ahbmi.hgrant(hindex), hready => ahbmi.hready, hresp => ahbmi.hresp, hrdata => hrdata, --ahb mst out hbusreq => ahbmo.hbusreq, hlock => ahbmo.hlock, htrans => ahbmo.htrans, haddr => ahbmo.haddr, hwrite => ahbmo.hwrite, hsize => ahbmo.hsize, hburst => ahbmo.hburst, hprot => ahbmo.hprot, hwdata => hwdata, --edcl ahb mst in ehgrant => ahbmi.hgrant(hindex), ehready => ahbmi.hready, ehresp => ahbmi.hresp, ehrdata => hrdata, --edcl ahb mst out ehbusreq => open, ehlock => open, ehtrans => open, ehaddr => open, ehwrite => open, ehsize => open, ehburst => open, ehprot => open, ehwdata => open, --apb slv in psel => apbi.psel(pindex), penable => apbi.penable, paddr => apbi.paddr, pwrite => apbi.pwrite, pwdata => apbi.pwdata, --apb slv out prdata => apbo.prdata, --irq irq => irq, --rx ahb fifo rxrenable => rxrenable, rxraddress => rxraddress, rxwrite => rxwrite, rxwdata => rxwdata, rxwaddress => rxwaddress, rxrdata => rxrdata, --tx ahb fifo txrenable => txrenable, txraddress => txraddress, txwrite => txwrite, txwdata => txwdata, txwaddress => txwaddress, txrdata => txrdata, --edcl buf erenable => erenable, eraddress => eraddress, ewritem => ewritem, ewritel => ewritel, ewaddressm => ewaddressm, ewaddressl => ewaddressl, ewdata => ewdata, erdata => erdata, --ethernet input signals rmii_clk => ethi.rmii_clk, tx_clk => ethi.tx_clk, rx_clk => ethi.rx_clk, rxd => ethi.rxd(3 downto 0), rx_dv => ethi.rx_dv, rx_er => ethi.rx_er, rx_col => ethi.rx_col, rx_crs => ethi.rx_crs, mdio_i => ethi.mdio_i, phyrstaddr => ethi.phyrstaddr, mdint => ethi.mdint, --ethernet output signals reset => etho.reset, txd => etho.txd(3 downto 0), tx_en => etho.tx_en, tx_er => etho.tx_er, mdc => etho.mdc, mdio_o => etho.mdio_o, mdio_oe => lmdio_oe, --scantest testrst => ahbmi.testrst, testen => ahbmi.testen, testoen => ahbmi.testoen, edcladdr => ethi.edcladdr, edclsepahb => ethi.edclsepahb, edcldisable => ethi.edcldisable, speed => etho.speed); etho.txd(7 downto 4) <= "0000"; etho.mdio_oe <= ahbmi.testoen when (scanen = 1) and (ahbmi.testen = '1') else lmdio_oe; etho.gbit <= '0'; etho.tx_clk <= '0'; -- driven in rgmii component irqdrv : process(irq) begin apbo.pirq <= (others => '0'); apbo.pirq(pirq) <= irq; end process; hrdata <= ahbreadword(ahbmi.hrdata); ahbmo.hwdata <= ahbdrivedata(hwdata); ahbmo.hconfig <= hconfig; ahbmo.hindex <= hindex; ahbmo.hirq <= (others => '0'); apbo.pconfig <= pconfig; apbo.pindex <= pindex; ------------------------------------------------------------------------------- -- FIFOS ---------------------------------------------------------------------- ------------------------------------------------------------------------------- nft : if ft = 0 generate tx_fifo0 : syncram_2p generic map(tech => memtech, abits => txfabits, dbits => 32, sepclk => 0) port map(clk, txrenable, txraddress(txfabits-1 downto 0), txrdata, clk, txwrite, txwaddress(txfabits-1 downto 0), txwdata); rx_fifo0 : syncram_2p generic map(tech => memtech, abits => fabits, dbits => 32, sepclk => 0) port map(clk, rxrenable, rxraddress(fabits-1 downto 0), rxrdata, clk, rxwrite, rxwaddress(fabits-1 downto 0), rxwdata); end generate; ------------------------------------------------------------------------------- -- EDCL buffer ram ------------------------------------------------------------ ------------------------------------------------------------------------------- edclramnft : if (edcl /= 0) and (edclft = 0) generate r0 : syncram_2p generic map (memtech, eabits, 16) port map( clk, erenable, eraddress(eabits-1 downto 0), erdata(31 downto 16), clk, ewritem, ewaddressm(eabits-1 downto 0), ewdata(31 downto 16)); r1 : syncram_2p generic map (memtech, eabits, 16) port map( clk, erenable, eraddress(eabits-1 downto 0), erdata(15 downto 0), clk, ewritel, ewaddressl(eabits-1 downto 0), ewdata(15 downto 0)); end generate; -- pragma translate_off bootmsg : report_version generic map ( "greth" & tost(hindex) & ": 10/100 Mbit Ethernet MAC rev " & tost(REVISION) & tost(hindex) & ", EDCL " & tost(edcl) & ", buffer " & tost(edclbufsz) & " kbyte " & tost(txfifosize) & " txfifo," & " irq " & tost(pirq) ); -- pragma translate_on end architecture;
gpl-2.0
7b2a24df4e329627d3c8637fc353b6f7
0.523533
4.169625
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/techmap/maps/clkgen.vhd
1
9,778
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: clkgen -- File: clkgen.vhd -- Author: Jiri Gaisler Gaisler Research -- Description: Clock generator with tech selection ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.all; use techmap.allclkgen.all; entity clkgen is generic ( tech : integer := DEFFABTECH; clk_mul : integer := 1; clk_div : integer := 1; sdramen : integer := 0; noclkfb : integer := 1; pcien : integer := 0; pcidll : integer := 0; pcisysclk: integer := 0; freq : integer := 25000; -- clock frequency in KHz clk2xen : integer := 0; clksel : integer := 0; -- enable clock select clk_odiv : integer := 1; -- Proasic3/Fusion output divider clkA clkb_odiv: integer := 0; -- Proasic3/Fusion output divider clkB clkc_odiv: integer := 0); -- Proasic3/Fusion output divider clkC port ( clkin : in std_logic; pciclkin: in std_logic; clk : out std_logic; -- main clock clkn : out std_logic; -- inverted main clock clk2x : out std_logic; -- 2x clock sdclk : out std_logic; -- SDRAM clock pciclk : out std_logic; -- PCI clock cgi : in clkgen_in_type; cgo : out clkgen_out_type; clk4x : out std_logic; -- 4x clock clk1xu : out std_logic; -- unscaled 1X clock clk2xu : out std_logic; -- unscaled 2X clock clkb : out std_logic; -- Proasic3/Fusion clkB clkc : out std_logic; -- Proasic3/Fusion clkC clk8x : out std_logic); -- 8x clock end; architecture struct of clkgen is signal intclk, sdintclk : std_ulogic; signal lock : std_ulogic; begin gen : if (has_clkgen(tech) = 0) generate sdintclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin; sdclk <= sdintclk; intclk <= sdintclk -- pragma translate_off after 1 ns -- create 1 ns skew between clk and sdclk -- pragma translate_on ; clk1xu <= intclk; pciclk <= pciclkin; clk <= intclk; clkn <= not intclk; cgo.clklock <= '1'; cgo.pcilock <= '1'; clk2x <= '0'; clk4x <= '0'; clkb <= '0'; clkc <= '0'; clk8x <= '0'; end generate; xc2v : if (tech = virtex2) or (tech = virtex4) generate v : clkgen_virtex2 generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu); end generate; xc5l : if (tech = virtex5) or (tech = virtex6) generate v : clkgen_virtex5 generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu); end generate; xc7l : if (tech =virtex7) or (tech =kintex7) or (tech =artix7) or (tech =zynq7000) generate v : clkgen_virtex7 generic map (clk_mul, clk_div, freq) port map (clkin, clk, clkn, clk2x ,cgi, cgo); end generate; xc3s : if (tech = spartan3) or (tech = spartan3e) or (tech = spartan6) generate v : clkgen_spartan3 generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu); end generate; alt : if (tech = altera) or (tech = stratix1) generate v : clkgen_altera_mf generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo); end generate; strat2 : if (tech = stratix2) generate v : clkgen_stratixii generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo); end generate; cyc3 : if (tech = cyclone3) generate v : clkgen_cycloneiii generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo); end generate; stra3 : if (tech = stratix3) or (tech = stratix4) generate v : clkgen_stratixiii generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo); end generate; act : if (tech = axdsp) or (tech = proasic) generate intclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin; sdclk <= '0'; pciclk <= pciclkin; clk <= intclk; clkn <= '0'; cgo.clklock <= '1'; cgo.pcilock <= '1'; clk2x <= '0'; end generate; axc : if (tech = axcel) generate pll_disabled : if (clk_mul = clk_div) generate intclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin; sdclk <= '0'; pciclk <= pciclkin; clk <= intclk; clkn <= '0'; cgo.clklock <= '1'; cgo.pcilock <= '1'; clk2x <= '0'; end generate; pll_enabled : if (clk_mul /= clk_div) generate clk2x <= '0'; pll : clkgen_axcelerator generic map ( clk_mul => clk_mul, clk_div => clk_div, sdramen => sdramen, sdinvclk => 0, pcien => pcien, pcidll => pcidll, pcisysclk => pcisysclk, freq => freq) port map( clkin => clkin, pciclkin => pciclkin, clk => clk, clkn => clkn, sdclk => sdclk, pciclk => pciclk, cgi => cgi, cgo => cgo); end generate; end generate; lib18t : if (tech = rhlib18t) generate v : clkgen_rh_lib18t generic map (clk_mul, clk_div) port map (cgi.pllrst, intclk, clk, sdclk, clk2x, clk4x); intclk <= pciclkin when (PCISYSCLK = 1 and PCIEN /= 0) else clkin; pciclk <= pciclkin; clkn <= '0'; cgo.clklock <= '1'; cgo.pcilock <= '1'; end generate; ap3 : if tech = apa3 generate v : clkgen_proasic3 generic map (clk_mul, clk_div, clk_odiv, pcien, pcisysclk, freq, clkb_odiv, clkc_odiv) port map (clkin, pciclkin, clk, sdclk, pciclk, cgi, cgo, clkb, clkc); clk2x <= '0'; end generate; ap3e : if tech = apa3e generate v : clkgen_proasic3e generic map (clk_mul, clk_div, clk_odiv, pcien, pcisysclk, freq, clkb_odiv, clkc_odiv) port map (clkin, pciclkin, clk, sdclk, pciclk, cgi, cgo, clkb, clkc); clk2x <= '0'; end generate; ap3l : if tech = apa3l generate v : clkgen_proasic3l generic map (clk_mul, clk_div, clk_odiv, pcien, pcisysclk, freq, clkb_odiv, clkc_odiv) port map (clkin, pciclkin, clk, sdclk, pciclk, cgi, cgo, clkb, clkc); clk2x <= '0'; end generate; fus : if tech = actfus generate v : clkgen_fusion generic map (clk_mul, clk_div, clk_odiv, pcien, pcisysclk, freq, clkb_odiv, clkc_odiv) port map (clkin, pciclkin, clk, sdclk, pciclk, cgi, cgo, clkb, clkc); clk2x <= '0'; end generate; dr : if (tech = rhumc) generate v : clkgen_rhumc port map (clkin, clk, clk2x, sdclk, pciclk, cgi, cgo, clk4x, clk1xu, clk2xu); clk8x <= '0'; end generate; saed : if (tech = saed32) generate v : clkgen_saed32 port map (clkin, clk, clk2x, sdclk, pciclk, cgi, cgo, clk4x, clk1xu, clk2xu); end generate; dar : if (tech = dare) generate v : clkgen_dare generic map (noclkfb) port map (clkin, clk, clk2x, sdclk, pciclk, cgi, cgo, clk4x, clk1xu, clk2xu, clk8x); end generate; nextreme90 : if tech = easic90 generate pll0 : clkgen_easic90 generic map ( clk_mul => clk_mul, clk_div => clk_div, freq => freq, pcisysclk => pcisysclk, pcien => pcien) port map (clkin, pciclkin, clk, clk2x, clk4x, clkn, lock); cgo.clklock <= lock; cgo.pcilock <= lock; end generate; n2x : if tech = easic45 generate v : clkgen_n2x generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel, 0) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu, open); end generate; ut13 : if (tech = ut130) generate v : clkgen_ut130hbd generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu); end generate; ut90nhbd : if (tech = ut90) generate v : clkgen_ut90nhbd generic map (clk_mul, clk_div, sdramen, noclkfb, pcien, pcidll, pcisysclk, freq, clk2xen, clksel) port map (clkin, pciclkin, clk, clkn, clk2x, sdclk, pciclk, cgi, cgo, clk1xu, clk2xu); end generate; end;
gpl-2.0
cee54860f4a8dab6e9273d0654d6a6bc
0.607384
3.452684
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/stdlib/stdlib.vhd
1
18,229
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Package: stdlib -- File: stdlib.vhd -- Author: Jiri Gaisler - Gaisler Research -- Description: Package for common VHDL functions ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; -- pragma translate_off use std.textio.all; -- pragma translate_on library grlib; use grlib.version.all; package stdlib is constant LIBVHDL_VERSION : integer := grlib_version; constant LIBVHDL_BUILD : integer := grlib_build; -- pragma translate_off constant LIBVHDL_DATE : string := grlib_date; -- pragma translate_on constant zero32 : std_logic_vector(31 downto 0) := (others => '0'); constant zero64 : std_logic_vector(63 downto 0) := (others => '0'); constant zero128 : std_logic_vector(127 downto 0) := (others => '0'); constant one32 : std_logic_vector(31 downto 0) := (others => '1'); constant one64 : std_logic_vector(63 downto 0) := (others => '1'); constant one128 : std_logic_vector(127 downto 0) := (others => '1'); type log2arr is array(0 to 512) of integer; constant log2 : log2arr := ( 0,0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, others => 9); constant log2x : log2arr := ( 0,1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, others => 9); function log2ext(i: integer) return integer; function decode(v : std_logic_vector) return std_logic_vector; function genmux(s,v : std_logic_vector) return std_ulogic; function xorv(d : std_logic_vector) return std_ulogic; function orv(d : std_logic_vector) return std_ulogic; function andv(d : std_logic_vector) return std_ulogic; function notx(d : std_logic_vector) return boolean; function notx(d : std_ulogic) return boolean; function "-" (d : std_logic_vector; i : integer) return std_logic_vector; function "-" (i : integer; d : std_logic_vector) return std_logic_vector; function "+" (d : std_logic_vector; i : integer) return std_logic_vector; function "+" (i : integer; d : std_logic_vector) return std_logic_vector; function "-" (d : std_logic_vector; i : std_ulogic) return std_logic_vector; function "+" (d : std_logic_vector; i : std_ulogic) return std_logic_vector; function "-" (a, b : std_logic_vector) return std_logic_vector; function "+" (a, b : std_logic_vector) return std_logic_vector; function "*" (a, b : std_logic_vector) return std_logic_vector; function unsigned_mul (a, b : std_logic_vector) return std_logic_vector; function signed_mul (a, b : std_logic_vector) return std_logic_vector; function mixed_mul (a, b : std_logic_vector; sign : std_logic) return std_logic_vector; --function ">" (a, b : std_logic_vector) return boolean; function "<" (i : integer; b : std_logic_vector) return boolean; function conv_integer(v : std_logic_vector) return integer; function conv_integer(v : std_logic) return integer; function conv_std_logic_vector(i : integer; w : integer) return std_logic_vector; function conv_std_logic_vector_signed(i : integer; w : integer) return std_logic_vector; function conv_std_logic(b : boolean) return std_ulogic; attribute sync_set_reset : string; attribute async_set_reset : string; -- Reporting and diagnostics -- pragma translate_off function tost(v:std_logic_vector) return string; function tost(v:std_logic) return string; function tost(i : integer) return string; function tost_any(s: std_ulogic) return string; function tost_bits(s: std_logic_vector) return string; function tost(b: boolean) return string; function tost(r: real) return string; procedure print(s : string); component report_version generic (msg1, msg2, msg3, msg4 : string := ""; mdel : integer := 4); end component; component report_design generic (msg1, fabtech, memtech : string := ""; mdel : integer := 4); end component; -- pragma translate_on end; package body stdlib is function notx(d : std_logic_vector) return boolean is variable res : boolean; begin res := true; -- pragma translate_off res := not is_x(d); -- pragma translate_on return (res); end; function notx(d : std_ulogic) return boolean is variable res : boolean; begin res := true; -- pragma translate_off res := not is_x(d); -- pragma translate_on return (res); end; -- generic decoder function decode(v : std_logic_vector) return std_logic_vector is variable res : std_logic_vector((2**v'length)-1 downto 0); variable i : integer range res'range; begin res := (others => '0'); i := 0; if notx(v) then i := to_integer(unsigned(v)); end if; res(i) := '1'; return(res); end; -- generic multiplexer function genmux(s,v : std_logic_vector) return std_ulogic is variable res : std_logic_vector(v'length-1 downto 0); variable i : integer range res'range; begin res := v; i := 0; if notx(s) then i := to_integer(unsigned(s)); end if; return(res(i)); end; -- vector XOR function xorv(d : std_logic_vector) return std_ulogic is variable tmp : std_ulogic; begin tmp := '0'; for i in d'range loop tmp := tmp xor d(i); end loop; return(tmp); end; -- vector OR function orv(d : std_logic_vector) return std_ulogic is variable tmp : std_ulogic; begin tmp := '0'; for i in d'range loop tmp := tmp or d(i); end loop; return(tmp); end; -- vector AND function andv(d : std_logic_vector) return std_ulogic is variable tmp : std_ulogic; begin tmp := '1'; for i in d'range loop tmp := tmp and d(i); end loop; return(tmp); end; -- unsigned multiplication function "*" (a, b : std_logic_vector) return std_logic_vector is variable z : std_logic_vector(a'length+b'length-1 downto 0); begin -- pragma translate_off if notx(a&b) then -- pragma translate_on return(std_logic_vector(unsigned(a) * unsigned(b))); -- pragma translate_off else z := (others =>'X'); return(z); end if; -- pragma translate_on end; -- signed multiplication function signed_mul (a, b : std_logic_vector) return std_logic_vector is variable z : std_logic_vector(a'length+b'length-1 downto 0); begin -- pragma translate_off if notx(a&b) then -- pragma translate_on return(std_logic_vector(signed(a) * signed(b))); -- pragma translate_off else z := (others =>'X'); return(z); end if; -- pragma translate_on end; -- unsigned multiplication function unsigned_mul (a, b : std_logic_vector) return std_logic_vector is variable z : std_logic_vector(a'length+b'length-1 downto 0); begin -- pragma translate_off if notx(a&b) then -- pragma translate_on return(std_logic_vector(unsigned(a) * unsigned(b))); -- pragma translate_off else z := (others =>'X'); return(z); end if; -- pragma translate_on end; -- signed/unsigned multiplication function mixed_mul (a, b : std_logic_vector; sign : std_logic) return std_logic_vector is variable z : std_logic_vector(a'length+b'length-1 downto 0); begin -- pragma translate_off if notx(a&b) then -- pragma translate_on if sign = '0' then return(std_logic_vector(unsigned(a) * unsigned(b))); else return(std_logic_vector(signed(a) * signed(b))); end if; -- pragma translate_off else z := (others =>'X'); return(z); end if; -- pragma translate_on end; -- unsigned addition function "+" (a, b : std_logic_vector) return std_logic_vector is variable x : std_logic_vector(a'length-1 downto 0); variable y : std_logic_vector(b'length-1 downto 0); begin -- pragma translate_off if notx(a&b) then -- pragma translate_on return(std_logic_vector(unsigned(a) + unsigned(b))); -- pragma translate_off else x := (others =>'X'); y := (others =>'X'); if (x'length > y'length) then return(x); else return(y); end if; end if; -- pragma translate_on end; function "+" (i : integer; d : std_logic_vector) return std_logic_vector is variable x : std_logic_vector(d'length-1 downto 0); begin -- pragma translate_off if notx(d) then -- pragma translate_on return(std_logic_vector(unsigned(d) + i)); -- pragma translate_off else x := (others =>'X'); return(x); end if; -- pragma translate_on end; function "+" (d : std_logic_vector; i : integer) return std_logic_vector is variable x : std_logic_vector(d'length-1 downto 0); begin -- pragma translate_off if notx(d) then -- pragma translate_on return(std_logic_vector(unsigned(d) + i)); -- pragma translate_off else x := (others =>'X'); return(x); end if; -- pragma translate_on end; function "+" (d : std_logic_vector; i : std_ulogic) return std_logic_vector is variable x : std_logic_vector(d'length-1 downto 0); variable y : std_logic_vector(0 downto 0); begin y(0) := i; -- pragma translate_off if notx(d) then -- pragma translate_on return(std_logic_vector(unsigned(d) + unsigned(y))); -- pragma translate_off else x := (others =>'X'); return(x); end if; -- pragma translate_on end; -- unsigned subtraction function "-" (a, b : std_logic_vector) return std_logic_vector is variable x : std_logic_vector(a'length-1 downto 0); variable y : std_logic_vector(b'length-1 downto 0); begin -- pragma translate_off if notx(a&b) then -- pragma translate_on return(std_logic_vector(unsigned(a) - unsigned(b))); -- pragma translate_off else x := (others =>'X'); y := (others =>'X'); if (x'length > y'length) then return(x); else return(y); end if; end if; -- pragma translate_on end; function "-" (d : std_logic_vector; i : integer) return std_logic_vector is variable x : std_logic_vector(d'length-1 downto 0); begin -- pragma translate_off if notx(d) then -- pragma translate_on return(std_logic_vector(unsigned(d) - i)); -- pragma translate_off else x := (others =>'X'); return(x); end if; -- pragma translate_on end; function "-" (i : integer; d : std_logic_vector) return std_logic_vector is variable x : std_logic_vector(d'length-1 downto 0); begin -- pragma translate_off if notx(d) then -- pragma translate_on return(std_logic_vector(i - unsigned(d))); -- pragma translate_off else x := (others =>'X'); return(x); end if; -- pragma translate_on end; function "-" (d : std_logic_vector; i : std_ulogic) return std_logic_vector is variable x : std_logic_vector(d'length-1 downto 0); variable y : std_logic_vector(0 downto 0); begin y(0) := i; -- pragma translate_off if notx(d) then -- pragma translate_on return(std_logic_vector(unsigned(d) - unsigned(y))); -- pragma translate_off else x := (others =>'X'); return(x); end if; -- pragma translate_on end; function ">=" (a, b : std_logic_vector) return boolean is begin return(unsigned(a) >= unsigned(b)); end; function "<" (i : integer; b : std_logic_vector) return boolean is begin return( i < to_integer(unsigned(b))); end; function ">" (a, b : std_logic_vector) return boolean is begin return(unsigned(a) > unsigned(b)); end; function conv_integer(v : std_logic_vector) return integer is begin if notx(v) then return(to_integer(unsigned(v))); else return(0); end if; end; function conv_integer(v : std_logic) return integer is begin if notx(v) then if v = '1' then return(1); else return(0); end if; else return(0); end if; end; function conv_std_logic_vector(i : integer; w : integer) return std_logic_vector is variable tmp : std_logic_vector(w-1 downto 0); begin tmp := std_logic_vector(to_unsigned(i, w)); return(tmp); end; function conv_std_logic_vector_signed(i : integer; w : integer) return std_logic_vector is variable tmp : std_logic_vector(w-1 downto 0); begin tmp := std_logic_vector(to_signed(i, w)); return(tmp); end; function conv_std_logic(b : boolean) return std_ulogic is begin if b then return('1'); else return('0'); end if; end; function log2ext(i: integer) return integer is -- variable v: std_logic_vector(31 downto 0); begin -- workaround for DC bug -- if i=0 then return 0; end if; -- v := std_logic_vector(to_unsigned((i-1),v'length)); -- for x in v'high downto v'low loop -- if v(x)='1' then return x+1; end if; -- end loop; -- return 0; for x in 1 to 32 loop if (2**x > i) then return (x-1); end if; end loop; return 32; end; -- pragma translate_off subtype nibble is std_logic_vector(3 downto 0); function todec(i:integer) return character is begin case i is when 0 => return('0'); when 1 => return('1'); when 2 => return('2'); when 3 => return('3'); when 4 => return('4'); when 5 => return('5'); when 6 => return('6'); when 7 => return('7'); when 8 => return('8'); when 9 => return('9'); when others => return('0'); end case; end; function tohex(n:nibble) return character is begin case n is when "0000" => return('0'); when "0001" => return('1'); when "0010" => return('2'); when "0011" => return('3'); when "0100" => return('4'); when "0101" => return('5'); when "0110" => return('6'); when "0111" => return('7'); when "1000" => return('8'); when "1001" => return('9'); when "1010" => return('a'); when "1011" => return('b'); when "1100" => return('c'); when "1101" => return('d'); when "1110" => return('e'); when "1111" => return('f'); when others => return('X'); end case; end; function tost(v:std_logic_vector) return string is constant vlen : natural := v'length; --' constant slen : natural := (vlen+3)/4; variable vv : std_logic_vector(0 to slen*4-1) := (others => '0'); variable s : string(1 to slen); variable nz : boolean := false; variable index : integer := -1; begin vv(slen*4-vlen to slen*4-1) := v; for i in 0 to slen-1 loop if (vv(i*4 to i*4+3) = "0000") and nz and (i /= (slen-1)) then index := i; else nz := false; s(i+1) := tohex(vv(i*4 to i*4+3)); end if; end loop; if ((index +2) = slen) then return(s(slen to slen)); else return(string'("0x") & s(index+2 to slen)); end if; --' end; function tost(v:std_logic) return string is begin if to_x01(v) = '1' then return("1"); else return("0"); end if; end; function tost_any(s: std_ulogic) return string is begin case s is when '1' => return "1"; when '0' => return "0"; when '-' => return "-"; when 'U' => return "U"; when 'X' => return "X"; when 'Z' => return "Z"; when 'H' => return "H"; when 'L' => return "L"; when 'W' => return "W"; end case; end; function tost_bits(s: std_logic_vector) return string is constant len: natural := s'length; variable str: string(1 to len); variable i: integer; begin i := 1; for x in s'range loop str(i to i) := tost_any(s(x)); i := i+1; end loop; return str; end; function tost(b: boolean) return string is begin if b then return "true"; else return "false"; end if; end tost; function tost(i : integer) return string is variable L : line; variable s, x : string(1 to 128); variable n, tmp : integer := 0; begin tmp := i; if i < 0 then tmp := -i; end if; loop s(128-n) := todec(tmp mod 10); tmp := tmp / 10; n := n+1; if tmp = 0 then exit; end if; end loop; x(1 to n) := s(129-n to 128); if i < 0 then return "-" & x(1 to n); end if; return(x(1 to n)); end; function tost(r: real) return string is variable x: real; variable i,j: integer; variable s: string(1 to 30); variable c: character; begin if r = 0.0 then return "0.0000"; elsif r < 0.0 then return "-" & tost(-r); elsif r < 0.001 then x:=r; i:=0; while x<1.0 loop x:=x*10.0; i:=i+1; end loop; return tost(x) & "e-" & tost(i); elsif r >= 1000000.0 then x:=10000000.0; i:=6; while r>=x loop x:=x*10.0; i:=i+1; end loop; return tost(10.0*r/x) & "e+" & tost(i); else i:=0; x:=r+0.00005; while x >= 10.0 loop x:=x/10.0; i:=i+1; end loop; j := 1; while i > -5 loop if x >= 9.0 then c:='9'; x:=x-9.0; elsif x >= 8.0 then c:='8'; x:=x-8.0; elsif x >= 7.0 then c:='7'; x:=x-7.0; elsif x >= 6.0 then c:='6'; x:=x-6.0; elsif x >= 5.0 then c:='5'; x:=x-5.0; elsif x >= 4.0 then c:='4'; x:=x-4.0; elsif x >= 3.0 then c:='3'; x:=x-3.0; elsif x >= 2.0 then c:='2'; x:=x-2.0; elsif x >= 1.0 then c:='1'; x:=x-1.0; else c:='0'; end if; s(j) := c; j:=j+1; if i=0 then s(j):='.'; j:=j+1; end if; i:=i-1; x := x * 10.0; end loop; return s(1 to j-1); end if; end tost; procedure print(s : string) is variable L : line; begin L := new string'(s); writeline(output, L); end; -- pragma translate_on end;
gpl-2.0
27b5b95752106fc452d2569b612e78cf
0.631521
2.769523
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-ml510/svga2ch7301c.vhd
3
10,192
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Entity: svga2ch7301c -- File: svga2ch7301c.vhd -- Author: Jan Andersson - Aeroflex Gaisler AB -- [email protected] -- -- Description: Converter inteneded to connect a SVGACTRL core to a Chrontel -- CH7301C DVI transmitter. Multiplexes data and generates clocks. -- Tailored for use on the Xilinx ML50x boards with Leon3/GRLIB -- template designs. -- -- This multiplexer has been developed for use with the Chrontel CH7301C DVI -- transmitter. Supported multiplexed formats are, as in the CH7301 datasheet: -- -- IDF Description -- 0 12-bit multiplexed RGB input (24-bit color), (scheme 1) -- 1 12-bit multiplexed RGB2 input (24-bit color), (scheme 2) -- 2 8-bit multiplexed RGB input (16-bit color, 565) -- 3 8-bit multiplexed RGB input (15-bit color, 555) -- -- This core assumes a 100 MHz input clock on the 'clk' input. -- -- If the generic 'dynamic' is non-zero the core uses the value vgao.bitdepth -- to decide if multiplexing should be done according to IDF 0 or IDF 2. -- vago.bitdepth = "11" gives IDF 0, others give IDF2. -- The 'idf' generic is not used when the 'dynamic' generic is non-zero. -- Note that if dynamic selection is enabled you will need to reconfigure -- the DVI transmitter when the VGA core changes bit depth. -- library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.misc.all; library grlib; use grlib.stdlib.all; -- pragma translate_off library unisim; use unisim.BUFG; use unisim.DCM; -- pragma translate_on library techmap; use techmap.gencomp.all; entity svga2ch7301c is generic ( tech : integer := 0; idf : integer := 0; dynamic : integer := 0 ); port ( clk : in std_ulogic; rstn : in std_ulogic; clksel : in std_logic_vector(1 downto 0); vgao : in apbvga_out_type; vgaclk_fb : in std_ulogic; clk25_fb : in std_ulogic; clk40_fb : in std_ulogic; clk65_fb : in std_ulogic; vgaclk : out std_ulogic; clk25 : out std_ulogic; clk40 : out std_ulogic; clk65 : out std_ulogic; dclk_p : out std_ulogic; dclk_n : out std_ulogic; locked : out std_ulogic; data : out std_logic_vector(11 downto 0); hsync : out std_ulogic; vsync : out std_ulogic; de : out std_ulogic ); end svga2ch7301c; architecture rtl of svga2ch7301c is component BUFG port (O : out std_logic; I : in std_logic); end component; component BUFGMUX port ( O : out std_ulogic; I0 : in std_ulogic; I1 : in std_ulogic; S : in std_ulogic); end component; component DCM generic ( CLKDV_DIVIDE : real := 2.0; CLKFX_DIVIDE : integer := 1; CLKFX_MULTIPLY : integer := 4; CLKIN_DIVIDE_BY_2 : boolean := false; CLKIN_PERIOD : real := 10.0; CLKOUT_PHASE_SHIFT : string := "NONE"; CLK_FEEDBACK : string := "1X"; DESKEW_ADJUST : string := "SYSTEM_SYNCHRONOUS"; DFS_FREQUENCY_MODE : string := "LOW"; DLL_FREQUENCY_MODE : string := "LOW"; DSS_MODE : string := "NONE"; DUTY_CYCLE_CORRECTION : boolean := true; FACTORY_JF : bit_vector := X"C080"; PHASE_SHIFT : integer := 0; STARTUP_WAIT : boolean := false ); port ( CLKFB : in std_logic; CLKIN : in std_logic; DSSEN : in std_logic; PSCLK : in std_logic; PSEN : in std_logic; PSINCDEC : in std_logic; RST : in std_logic; CLK0 : out std_logic; CLK90 : out std_logic; CLK180 : out std_logic; CLK270 : out std_logic; CLK2X : out std_logic; CLK2X180 : out std_logic; CLKDV : out std_logic; CLKFX : out std_logic; CLKFX180 : out std_logic; LOCKED : out std_logic; PSDONE : out std_logic; STATUS : out std_logic_vector (7 downto 0)); end component; constant VERSION : integer := 1; constant CLKIN_PERIOD_ST : string := "10.0"; attribute CLKIN_PERIOD : string; attribute CLKIN_PERIOD of dll1: label is CLKIN_PERIOD_ST; attribute CLKIN_PERIOD of dll2: label is CLKIN_PERIOD_ST; signal clk_l, clk_m, clk_n, clk_o : std_logic; signal dll0lock, dll1lock, dll2lock : std_logic; signal dllrst : std_ulogic; signal vcc, gnd : std_logic; signal d0, d1 : std_logic_vector(11 downto 0); signal red, green, blue : std_logic_vector(7 downto 0); signal lvgaclk, lclk40, lclk65, lclk40_65 : std_ulogic; signal clkval : std_logic_vector(1 downto 0); begin -- rtl vcc <= '1'; gnd <= '0'; ----------------------------------------------------------------------------- -- RGB data multiplexer ----------------------------------------------------------------------------- red <= vgao.video_out_r; green <= vgao.video_out_g; blue <= vgao.video_out_b; static: if dynamic = 0 generate idf0: if (idf = 0) generate d0 <= green(3 downto 0) & blue(7 downto 0); d1 <= red(7 downto 0) & green(7 downto 4); end generate; idf1: if (idf = 1) generate d0 <= green(4 downto 2) & blue(7 downto 3) & green(0) & blue(2 downto 0); d1 <= red(7 downto 3) & green(7 downto 5) & red(2 downto 0) & green(1); end generate; idf2: if (idf = 2) generate d0(11 downto 4) <= green(4 downto 2) & blue(7 downto 3); d0(3 downto 0) <= (others => '0'); d1(11 downto 4) <= red(7 downto 3) & green(7 downto 5); d1(3 downto 0) <= (others => '0'); data(3 downto 0) <= (others => '0'); end generate; idf3: if (idf = 3) generate d0(11 downto 4) <= green(5 downto 3) & blue(7 downto 3); d0(3 downto 0) <= (others => '0'); d1(11 downto 4) <= '0' & red(7 downto 3) & green(7 downto 6); d1(3 downto 0) <= (others => '0'); data(3 downto 0) <= (others => '0'); end generate idf3; -- DDR regs dataregs: for i in 11 downto (4*(idf/2)) generate ddr_oreg0 : ddr_oreg generic map (tech) port map (q => data(i), c1 => vgaclk_fb, c2 => gnd, ce => vcc, d1 => d0(i), d2 => d1(i), r => gnd, s => gnd); end generate; end generate; nostatic: if dynamic /= 0 generate d0 <= green(3 downto 0) & blue(7 downto 0) when vgao.bitdepth = "11" else green(4 downto 2) & blue(7 downto 3) & "0000"; d1 <= red(7 downto 0) & green(7 downto 4) when vgao.bitdepth = "11" else red(7 downto 3) & green(7 downto 5) & "0000"; dataregs: for i in 11 downto 0 generate ddr_oreg0 : ddr_oreg generic map (tech) port map (q => data(i), c1 => vgaclk_fb, c2 => gnd, ce => vcc, d1 => d0(i), d2 => d1(i), r => gnd, s => gnd); end generate; end generate; ----------------------------------------------------------------------------- -- Sync signals ----------------------------------------------------------------------------- process (vgaclk_fb) begin -- process if rising_edge(vgaclk_fb) then hsync <= vgao.hsync; vsync <= vgao.vsync; de <= vgao.blank; end if; end process; ----------------------------------------------------------------------------- -- Clock generation ----------------------------------------------------------------------------- ddroreg_p : ddr_oreg generic map (tech) port map (q => dclk_p, c1 => vgaclk_fb, c2 => gnd, ce => vcc, d1 => vcc, d2 => gnd, r => gnd, s => gnd); ddroreg_n : ddr_oreg generic map (tech) port map (q => dclk_n, c1 => vgaclk_fb, c2 => gnd, ce => vcc, d1 => gnd, d2 => vcc, r => gnd, s => gnd); -- Clock selection bufg00 : BUFG port map (I => lvgaclk, O => vgaclk); lvgaclk <= clk25_fb when clksel(1) = '0' else lclk40_65; lclk40_65 <= lclk40 when clksel(0) = '0' else lclk65; bufg01 : BUFG port map (I => clk40_fb, O => lclk40); bufg02 : BUFG port map (I => clk65_fb, O => lclk65); dllrst <= not rstn; -- Generate clocks clkdiv : process(clk_m, rstn) begin if (rstn and dll1lock) = '0' then clkval <= "00"; elsif rising_edge(clk_m) then clkval <= clkval + 1; end if; end process; clk25 <= clkval(1); dll0lock <= '1'; bufg03 : BUFG port map (I => clk_l, O => clk_m); dll1 : DCM generic map (CLKFX_MULTIPLY => 4, CLKFX_DIVIDE => 10, DFS_FREQUENCY_MODE => "LOW", DLL_FREQUENCY_MODE => "LOW") port map ( CLKIN => clk, CLKFB => clk_m, DSSEN => gnd, PSCLK => gnd, PSEN => gnd, PSINCDEC => gnd, RST => dllrst, CLK0 => clk_l, CLKFX => clk40, LOCKED => dll1lock); bufg04 : BUFG port map (I => clk_n, O => clk_o); dll2 : DCM generic map (CLKFX_MULTIPLY => 13, CLKFX_DIVIDE => 20, DFS_FREQUENCY_MODE => "LOW", DLL_FREQUENCY_MODE => "LOW") port map ( CLKIN => clk, CLKFB => clk_o, DSSEN => gnd, PSCLK => gnd, PSEN => gnd, PSINCDEC => gnd, RST => dllrst, CLK0 => clk_n, CLKFX => clk65, LOCKED => dll2lock); locked <= dll0lock and dll1lock and dll2lock; end rtl;
gpl-2.0
f199684442b0882be83ceea6e5c37003
0.554454
3.56613
false
false
false
false
zxcmehran/FPGADisplay-ipcore
hdl/vhdl/display_handler.vhd
1
24,535
-- -- -- FPGA Display Handler IP Core By Mehran Ahadi (http://mehran.ahadi.me) -- This IP allows you to draw shapes and print texts on VGA screen. -- Copyright (C) 2015-2016 Mehran Ahadi -- This work is released under MIT License. -- -- Main IP File -- ------------------------------------------------------------------------------ -- display_handler.vhd - entity/architecture pair ------------------------------------------------------------------------------ -- IMPORTANT: -- DO NOT MODIFY THIS FILE EXCEPT IN THE DESIGNATED SECTIONS. -- -- SEARCH FOR --USER TO DETERMINE WHERE CHANGES ARE ALLOWED. -- -- TYPICALLY, THE ONLY ACCEPTABLE CHANGES INVOLVE ADDING NEW -- PORTS AND GENERICS THAT GET PASSED THROUGH TO THE INSTANTIATION -- OF THE USER_LOGIC ENTITY. ------------------------------------------------------------------------------ -- -- *************************************************************************** -- ** Copyright (c) 1995-2008 Xilinx, Inc. All rights reserved. ** -- ** ** -- ** Xilinx, Inc. ** -- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" ** -- ** AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND ** -- ** SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, ** -- ** OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, ** -- ** APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION ** -- ** THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, ** -- ** AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE ** -- ** FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY ** -- ** WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE ** -- ** IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR ** -- ** REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF ** -- ** INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ** -- ** FOR A PARTICULAR PURPOSE. ** -- ** ** -- *************************************************************************** -- ------------------------------------------------------------------------------ -- Filename: display_handler.vhd -- Version: 1.00.a -- Description: Top level design, instantiates library components and user logic. -- Date: Mon Aug 08 23:53:04 2016 (by Create and Import Peripheral Wizard) -- VHDL Standard: VHDL'93 ------------------------------------------------------------------------------ -- 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: "*_com" -- pipelined or register delay signals: "*_d#" -- counter signals: "*cnt*" -- clock enable signals: "*_ce" -- internal version of output port: "*_i" -- device pins: "*_pin" -- ports: "- Names begin with Uppercase" -- processes: "*_PROCESS" -- component instantiations: "<ENTITY_>I_<#|FUNC>" ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; library proc_common_v2_00_a; use proc_common_v2_00_a.proc_common_pkg.all; use proc_common_v2_00_a.ipif_pkg.all; library plbv46_slave_single_v1_00_a; use plbv46_slave_single_v1_00_a.plbv46_slave_single; library display_handler_v1_00_a; use display_handler_v1_00_a.user_logic; ------------------------------------------------------------------------------ -- Entity section ------------------------------------------------------------------------------ -- Definition of Generics: -- C_BASEADDR -- PLBv46 slave: base address -- C_HIGHADDR -- PLBv46 slave: high address -- C_SPLB_AWIDTH -- PLBv46 slave: address bus width -- C_SPLB_DWIDTH -- PLBv46 slave: data bus width -- C_SPLB_NUM_MASTERS -- PLBv46 slave: Number of masters -- C_SPLB_MID_WIDTH -- PLBv46 slave: master ID bus width -- C_SPLB_NATIVE_DWIDTH -- PLBv46 slave: internal native data bus width -- C_SPLB_P2P -- PLBv46 slave: point to point interconnect scheme -- C_SPLB_SUPPORT_BURSTS -- PLBv46 slave: support bursts -- C_SPLB_SMALLEST_MASTER -- PLBv46 slave: width of the smallest master -- C_SPLB_CLK_PERIOD_PS -- PLBv46 slave: bus clock in picoseconds -- C_INCLUDE_DPHASE_TIMER -- PLBv46 slave: Data Phase Timer configuration; 0 = exclude timer, 1 = include timer -- C_FAMILY -- Xilinx FPGA family -- C_MEM0_BASEADDR -- User memory space 0 base address -- C_MEM0_HIGHADDR -- User memory space 0 high address -- -- Definition of Ports: -- SPLB_Clk -- PLB main bus clock -- SPLB_Rst -- PLB main bus reset -- PLB_ABus -- PLB address bus -- PLB_UABus -- PLB upper address bus -- PLB_PAValid -- PLB primary address valid indicator -- PLB_SAValid -- PLB secondary address valid indicator -- PLB_rdPrim -- PLB secondary to primary read request indicator -- PLB_wrPrim -- PLB secondary to primary write request indicator -- PLB_masterID -- PLB current master identifier -- PLB_abort -- PLB abort request indicator -- PLB_busLock -- PLB bus lock -- PLB_RNW -- PLB read/not write -- PLB_BE -- PLB byte enables -- PLB_MSize -- PLB master data bus size -- PLB_size -- PLB transfer size -- PLB_type -- PLB transfer type -- PLB_lockErr -- PLB lock error indicator -- PLB_wrDBus -- PLB write data bus -- PLB_wrBurst -- PLB burst write transfer indicator -- PLB_rdBurst -- PLB burst read transfer indicator -- PLB_wrPendReq -- PLB write pending bus request indicator -- PLB_rdPendReq -- PLB read pending bus request indicator -- PLB_wrPendPri -- PLB write pending request priority -- PLB_rdPendPri -- PLB read pending request priority -- PLB_reqPri -- PLB current request priority -- PLB_TAttribute -- PLB transfer attribute -- Sl_addrAck -- Slave address acknowledge -- Sl_SSize -- Slave data bus size -- Sl_wait -- Slave wait indicator -- Sl_rearbitrate -- Slave re-arbitrate bus indicator -- Sl_wrDAck -- Slave write data acknowledge -- Sl_wrComp -- Slave write transfer complete indicator -- Sl_wrBTerm -- Slave terminate write burst transfer -- Sl_rdDBus -- Slave read data bus -- Sl_rdWdAddr -- Slave read word address -- Sl_rdDAck -- Slave read data acknowledge -- Sl_rdComp -- Slave read transfer complete indicator -- Sl_rdBTerm -- Slave terminate read burst transfer -- Sl_MBusy -- Slave busy indicator -- Sl_MWrErr -- Slave write error indicator -- Sl_MRdErr -- Slave read error indicator -- Sl_MIRQ -- Slave interrupt indicator ------------------------------------------------------------------------------ entity display_handler is generic ( -- ADD USER GENERICS BELOW THIS LINE --------------- w_pixels: integer := 640; w_fp: integer := 16; w_synch: integer := 96; w_bp: integer := 48; w_syncval: std_logic := '0'; h_pixels: integer := 480; h_fp: integer := 9; h_synch: integer := 2; h_bp: integer := 29; h_syncval: std_logic := '0'; display_clk_m: integer := 2; display_clk_d: integer := 8; -- ADD USER GENERICS ABOVE THIS LINE --------------- -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol parameters, do not add to or delete C_BASEADDR : std_logic_vector := X"FFFFFFFF"; C_HIGHADDR : std_logic_vector := X"00000000"; C_SPLB_AWIDTH : integer := 32; C_SPLB_DWIDTH : integer := 128; C_SPLB_NUM_MASTERS : integer := 8; C_SPLB_MID_WIDTH : integer := 3; C_SPLB_NATIVE_DWIDTH : integer := 32; C_SPLB_P2P : integer := 0; C_SPLB_SUPPORT_BURSTS : integer := 0; C_SPLB_SMALLEST_MASTER : integer := 32; C_SPLB_CLK_PERIOD_PS : integer := 10000; C_INCLUDE_DPHASE_TIMER : integer := 1; C_FAMILY : string := "virtex5"; C_MEM0_BASEADDR : std_logic_vector := X"FFFFFFFF"; C_MEM0_HIGHADDR : std_logic_vector := X"00000000" -- DO NOT EDIT ABOVE THIS LINE --------------------- ); port ( -- ADD USER PORTS BELOW THIS LINE ------------------ CLK: in STD_LOGIC; R : out STD_LOGIC_VECTOR(7 downto 0); G : out STD_LOGIC_VECTOR(7 downto 0); B : out STD_LOGIC_VECTOR(7 downto 0); PIXEL_CLK : out STD_LOGIC; COMP_SYNCH : out STD_LOGIC; OUT_BLANK_Z : out STD_LOGIC; HSYNC : out STD_LOGIC; VSYNC : out STD_LOGIC; PS2_CLK : in STD_LOGIC; PS2_DATA : in STD_LOGIC; -- ADD USER PORTS ABOVE THIS LINE ------------------ -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol ports, do not add to or delete SPLB_Clk : in std_logic; SPLB_Rst : in std_logic; PLB_ABus : in std_logic_vector(0 to 31); PLB_UABus : in std_logic_vector(0 to 31); PLB_PAValid : in std_logic; PLB_SAValid : in std_logic; PLB_rdPrim : in std_logic; PLB_wrPrim : in std_logic; PLB_masterID : in std_logic_vector(0 to C_SPLB_MID_WIDTH-1); PLB_abort : in std_logic; PLB_busLock : in std_logic; PLB_RNW : in std_logic; PLB_BE : in std_logic_vector(0 to C_SPLB_DWIDTH/8-1); PLB_MSize : in std_logic_vector(0 to 1); PLB_size : in std_logic_vector(0 to 3); PLB_type : in std_logic_vector(0 to 2); PLB_lockErr : in std_logic; PLB_wrDBus : in std_logic_vector(0 to C_SPLB_DWIDTH-1); PLB_wrBurst : in std_logic; PLB_rdBurst : in std_logic; PLB_wrPendReq : in std_logic; PLB_rdPendReq : in std_logic; PLB_wrPendPri : in std_logic_vector(0 to 1); PLB_rdPendPri : in std_logic_vector(0 to 1); PLB_reqPri : in std_logic_vector(0 to 1); PLB_TAttribute : in std_logic_vector(0 to 15); Sl_addrAck : out std_logic; Sl_SSize : out std_logic_vector(0 to 1); Sl_wait : out std_logic; Sl_rearbitrate : out std_logic; Sl_wrDAck : out std_logic; Sl_wrComp : out std_logic; Sl_wrBTerm : out std_logic; Sl_rdDBus : out std_logic_vector(0 to C_SPLB_DWIDTH-1); Sl_rdWdAddr : out std_logic_vector(0 to 3); Sl_rdDAck : out std_logic; Sl_rdComp : out std_logic; Sl_rdBTerm : out std_logic; Sl_MBusy : out std_logic_vector(0 to C_SPLB_NUM_MASTERS-1); Sl_MWrErr : out std_logic_vector(0 to C_SPLB_NUM_MASTERS-1); Sl_MRdErr : out std_logic_vector(0 to C_SPLB_NUM_MASTERS-1); Sl_MIRQ : out std_logic_vector(0 to C_SPLB_NUM_MASTERS-1) -- DO NOT EDIT ABOVE THIS LINE --------------------- ); attribute SIGIS : string; attribute SIGIS of SPLB_Clk : signal is "CLK"; attribute SIGIS of SPLB_Rst : signal is "RST"; end entity display_handler; ------------------------------------------------------------------------------ -- Architecture section ------------------------------------------------------------------------------ architecture IMP of display_handler is ------------------------------------------ -- Array of base/high address pairs for each address range ------------------------------------------ constant ZERO_ADDR_PAD : std_logic_vector(0 to 31) := (others => '0'); constant USER_SLV_BASEADDR : std_logic_vector := C_BASEADDR; constant USER_SLV_HIGHADDR : std_logic_vector := C_HIGHADDR; constant IPIF_ARD_ADDR_RANGE_ARRAY : SLV64_ARRAY_TYPE := ( ZERO_ADDR_PAD & USER_SLV_BASEADDR, -- user logic slave space base address ZERO_ADDR_PAD & USER_SLV_HIGHADDR, -- user logic slave space high address ZERO_ADDR_PAD & C_MEM0_BASEADDR, -- user logic memory space 0 base address ZERO_ADDR_PAD & C_MEM0_HIGHADDR -- user logic memory space 0 high address ); ------------------------------------------ -- Array of desired number of chip enables for each address range ------------------------------------------ constant USER_SLV_NUM_REG : integer := 2; constant USER_NUM_REG : integer := USER_SLV_NUM_REG; constant USER_NUM_MEM : integer := 1; constant IPIF_ARD_NUM_CE_ARRAY : INTEGER_ARRAY_TYPE := ( 0 => pad_power2(USER_SLV_NUM_REG), -- number of ce for user logic slave space 1 => 1 -- number of ce for user logic memory space 0 (always 1 chip enable) ); ------------------------------------------ -- Ratio of bus clock to core clock (for use in dual clock systems) -- 1 = ratio is 1:1 -- 2 = ratio is 2:1 ------------------------------------------ constant IPIF_BUS2CORE_CLK_RATIO : integer := 1; ------------------------------------------ -- Width of the slave data bus (32 only) ------------------------------------------ constant USER_SLV_DWIDTH : integer := C_SPLB_NATIVE_DWIDTH; constant IPIF_SLV_DWIDTH : integer := C_SPLB_NATIVE_DWIDTH; ------------------------------------------ -- Width of the slave address bus (32 only) ------------------------------------------ constant USER_SLV_AWIDTH : integer := C_SPLB_AWIDTH; ------------------------------------------ -- Index for CS/CE ------------------------------------------ constant USER_SLV_CS_INDEX : integer := 0; constant USER_SLV_CE_INDEX : integer := calc_start_ce_index(IPIF_ARD_NUM_CE_ARRAY, USER_SLV_CS_INDEX); constant USER_MEM0_CS_INDEX : integer := 1; constant USER_CS_INDEX : integer := USER_MEM0_CS_INDEX; constant USER_CE_INDEX : integer := USER_SLV_CE_INDEX; ------------------------------------------ -- IP Interconnect (IPIC) signal declarations ------------------------------------------ signal ipif_Bus2IP_Clk : std_logic; signal ipif_Bus2IP_Reset : std_logic; signal ipif_IP2Bus_Data : std_logic_vector(0 to IPIF_SLV_DWIDTH-1); signal ipif_IP2Bus_WrAck : std_logic; signal ipif_IP2Bus_RdAck : std_logic; signal ipif_IP2Bus_Error : std_logic; signal ipif_Bus2IP_Addr : std_logic_vector(0 to C_SPLB_AWIDTH-1); signal ipif_Bus2IP_Data : std_logic_vector(0 to IPIF_SLV_DWIDTH-1); signal ipif_Bus2IP_RNW : std_logic; signal ipif_Bus2IP_BE : std_logic_vector(0 to IPIF_SLV_DWIDTH/8-1); signal ipif_Bus2IP_CS : std_logic_vector(0 to ((IPIF_ARD_ADDR_RANGE_ARRAY'length)/2)-1); signal ipif_Bus2IP_RdCE : std_logic_vector(0 to calc_num_ce(IPIF_ARD_NUM_CE_ARRAY)-1); signal ipif_Bus2IP_WrCE : std_logic_vector(0 to calc_num_ce(IPIF_ARD_NUM_CE_ARRAY)-1); signal user_Bus2IP_RdCE : std_logic_vector(0 to USER_NUM_REG-1); signal user_Bus2IP_WrCE : std_logic_vector(0 to USER_NUM_REG-1); signal user_IP2Bus_Data : std_logic_vector(0 to USER_SLV_DWIDTH-1); signal user_IP2Bus_RdAck : std_logic; signal user_IP2Bus_WrAck : std_logic; signal user_IP2Bus_Error : std_logic; begin ------------------------------------------ -- instantiate plbv46_slave_single ------------------------------------------ PLBV46_SLAVE_SINGLE_I : entity plbv46_slave_single_v1_00_a.plbv46_slave_single generic map ( C_ARD_ADDR_RANGE_ARRAY => IPIF_ARD_ADDR_RANGE_ARRAY, C_ARD_NUM_CE_ARRAY => IPIF_ARD_NUM_CE_ARRAY, C_SPLB_P2P => C_SPLB_P2P, C_BUS2CORE_CLK_RATIO => IPIF_BUS2CORE_CLK_RATIO, C_SPLB_MID_WIDTH => C_SPLB_MID_WIDTH, C_SPLB_NUM_MASTERS => C_SPLB_NUM_MASTERS, C_SPLB_AWIDTH => C_SPLB_AWIDTH, C_SPLB_DWIDTH => C_SPLB_DWIDTH, C_SIPIF_DWIDTH => IPIF_SLV_DWIDTH, C_INCLUDE_DPHASE_TIMER => C_INCLUDE_DPHASE_TIMER, C_FAMILY => C_FAMILY ) port map ( SPLB_Clk => SPLB_Clk, SPLB_Rst => SPLB_Rst, PLB_ABus => PLB_ABus, PLB_UABus => PLB_UABus, PLB_PAValid => PLB_PAValid, PLB_SAValid => PLB_SAValid, PLB_rdPrim => PLB_rdPrim, PLB_wrPrim => PLB_wrPrim, PLB_masterID => PLB_masterID, PLB_abort => PLB_abort, PLB_busLock => PLB_busLock, PLB_RNW => PLB_RNW, PLB_BE => PLB_BE, PLB_MSize => PLB_MSize, PLB_size => PLB_size, PLB_type => PLB_type, PLB_lockErr => PLB_lockErr, PLB_wrDBus => PLB_wrDBus, PLB_wrBurst => PLB_wrBurst, PLB_rdBurst => PLB_rdBurst, PLB_wrPendReq => PLB_wrPendReq, PLB_rdPendReq => PLB_rdPendReq, PLB_wrPendPri => PLB_wrPendPri, PLB_rdPendPri => PLB_rdPendPri, PLB_reqPri => PLB_reqPri, PLB_TAttribute => PLB_TAttribute, Sl_addrAck => Sl_addrAck, Sl_SSize => Sl_SSize, Sl_wait => Sl_wait, Sl_rearbitrate => Sl_rearbitrate, Sl_wrDAck => Sl_wrDAck, Sl_wrComp => Sl_wrComp, Sl_wrBTerm => Sl_wrBTerm, Sl_rdDBus => Sl_rdDBus, Sl_rdWdAddr => Sl_rdWdAddr, Sl_rdDAck => Sl_rdDAck, Sl_rdComp => Sl_rdComp, Sl_rdBTerm => Sl_rdBTerm, Sl_MBusy => Sl_MBusy, Sl_MWrErr => Sl_MWrErr, Sl_MRdErr => Sl_MRdErr, Sl_MIRQ => Sl_MIRQ, Bus2IP_Clk => ipif_Bus2IP_Clk, Bus2IP_Reset => ipif_Bus2IP_Reset, IP2Bus_Data => ipif_IP2Bus_Data, IP2Bus_WrAck => ipif_IP2Bus_WrAck, IP2Bus_RdAck => ipif_IP2Bus_RdAck, IP2Bus_Error => ipif_IP2Bus_Error, Bus2IP_Addr => ipif_Bus2IP_Addr, Bus2IP_Data => ipif_Bus2IP_Data, Bus2IP_RNW => ipif_Bus2IP_RNW, Bus2IP_BE => ipif_Bus2IP_BE, Bus2IP_CS => ipif_Bus2IP_CS, Bus2IP_RdCE => ipif_Bus2IP_RdCE, Bus2IP_WrCE => ipif_Bus2IP_WrCE ); ------------------------------------------ -- instantiate User Logic ------------------------------------------ USER_LOGIC_I : entity display_handler_v1_00_a.user_logic generic map ( -- MAP USER GENERICS BELOW THIS LINE --------------- w_pixels =>w_pixels, w_fp =>w_fp, w_synch =>w_synch, w_bp =>w_bp, w_syncval =>w_syncval, h_pixels =>h_pixels, h_fp =>h_fp, h_synch =>h_synch, h_bp =>h_bp, h_syncval =>h_syncval, display_clk_m =>display_clk_m, display_clk_d =>display_clk_d, -- MAP USER GENERICS ABOVE THIS LINE --------------- C_SLV_AWIDTH => USER_SLV_AWIDTH, C_SLV_DWIDTH => USER_SLV_DWIDTH, C_NUM_REG => USER_NUM_REG, C_NUM_MEM => USER_NUM_MEM ) port map ( -- MAP USER PORTS BELOW THIS LINE ------------------ CLK => CLK, R => R, G => G, B => B, PIXEL_CLK => PIXEL_CLK, COMP_SYNCH => COMP_SYNCH, OUT_BLANK_Z => OUT_BLANK_Z, HSYNC => HSYNC, VSYNC => VSYNC, -- MAP USER PORTS ABOVE THIS LINE ------------------ Bus2IP_Clk => ipif_Bus2IP_Clk, Bus2IP_Reset => ipif_Bus2IP_Reset, Bus2IP_Addr => ipif_Bus2IP_Addr, Bus2IP_CS => ipif_Bus2IP_CS(USER_CS_INDEX to USER_CS_INDEX+USER_NUM_MEM-1), Bus2IP_RNW => ipif_Bus2IP_RNW, Bus2IP_Data => ipif_Bus2IP_Data, Bus2IP_BE => ipif_Bus2IP_BE, Bus2IP_RdCE => user_Bus2IP_RdCE, Bus2IP_WrCE => user_Bus2IP_WrCE, IP2Bus_Data => user_IP2Bus_Data, IP2Bus_RdAck => user_IP2Bus_RdAck, IP2Bus_WrAck => user_IP2Bus_WrAck, IP2Bus_Error => user_IP2Bus_Error ); ------------------------------------------ -- connect internal signals ------------------------------------------ IP2BUS_DATA_MUX_PROC : process( ipif_Bus2IP_CS, user_IP2Bus_Data ) is begin case ipif_Bus2IP_CS is when "10" => ipif_IP2Bus_Data <= user_IP2Bus_Data; when "01" => ipif_IP2Bus_Data <= user_IP2Bus_Data; when others => ipif_IP2Bus_Data <= (others => '0'); end case; end process IP2BUS_DATA_MUX_PROC; ipif_IP2Bus_WrAck <= user_IP2Bus_WrAck; ipif_IP2Bus_RdAck <= user_IP2Bus_RdAck; ipif_IP2Bus_Error <= user_IP2Bus_Error; user_Bus2IP_RdCE <= ipif_Bus2IP_RdCE(USER_CE_INDEX to USER_CE_INDEX+USER_NUM_REG-1); user_Bus2IP_WrCE <= ipif_Bus2IP_WrCE(USER_CE_INDEX to USER_CE_INDEX+USER_NUM_REG-1); end IMP;
mit
0230e426291e6191f114ab1cfbd42460
0.458977
4.220712
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/grlib/stdlib/stdio.vhd
1
9,020
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------------- -- Package: StdIO -- File: stdio.vhd -- Author: Gaisler Research -- Description: Package for common I/O functions -------------------------------------------------------------------------------- -- pragma translate_off library Std; use Std.Standard.all; use Std.TextIO.all; library IEEE; use IEEE.Std_Logic_1164.all; -- pragma translate_on package StdIO is -- pragma translate_off procedure HRead( variable L: inout Line; variable VALUE: out Std_ULogic_Vector; variable GOOD: out Boolean); procedure HRead( variable L: inout Line; variable VALUE: out Std_ULogic_Vector); procedure HRead( variable L: inout Line; variable VALUE: out bit_vector); procedure HRead( variable L: inout Line; variable VALUE: out Std_Logic_Vector; variable GOOD: out Boolean); procedure HRead( variable L: inout Line; variable VALUE: out Std_Logic_Vector); procedure HWrite( variable L: inout Line; constant VALUE: in Std_ULogic_Vector; constant JUSTIFIED: in SIDE := RIGHT; constant FIELD: in WIDTH := 0); procedure HWrite( variable L: inout Line; constant VALUE: in Std_Logic_Vector; constant JUSTIFIED: in SIDE := RIGHT; constant FIELD: in WIDTH := 0); procedure Write( variable L: inout Line; constant VALUE: in Std_ULogic; constant JUSTIFIED: in SIDE := RIGHT; constant FIELD: in WIDTH := 0); -- pragma translate_on end package StdIO; package body StdIO is -- pragma translate_off function ToChar(N: Std_ULogic_Vector(0 to 3)) return Character is begin case N is when "0000" => return('0'); when "0001" => return('1'); when "0010" => return('2'); when "0011" => return('3'); when "0100" => return('4'); when "0101" => return('5'); when "0110" => return('6'); when "0111" => return('7'); when "1000" => return('8'); when "1001" => return('9'); when "1010" => return('A'); when "1011" => return('B'); when "1100" => return('C'); when "1101" => return('D'); when "1110" => return('E'); when "1111" => return('F'); when others => return('X'); end case; end ToChar; function FromChar(C: Character) return Std_ULogic_Vector is variable R: Std_ULogic_Vector(0 to 3); begin case C is when '0' => R := "0000"; when '1' => R := "0001"; when '2' => R := "0010"; when '3' => R := "0011"; when '4' => R := "0100"; when '5' => R := "0101"; when '6' => R := "0110"; when '7' => R := "0111"; when '8' => R := "1000"; when '9' => R := "1001"; when 'A' => R := "1010"; when 'B' => R := "1011"; when 'C' => R := "1100"; when 'D' => R := "1101"; when 'E' => R := "1110"; when 'F' => R := "1111"; when 'a' => R := "1010"; when 'b' => R := "1011"; when 'c' => R := "1100"; when 'd' => R := "1101"; when 'e' => R := "1110"; when 'f' => R := "1111"; when others => R := "XXXX"; end case; return R; end FromChar; procedure HRead( variable L: inout Line; variable VALUE: out Std_ULogic_Vector; variable GOOD: out Boolean) is variable B: Boolean; variable C: Character; constant SL: Integer := VALUE'Length; variable SV: Std_ULogic_Vector(0 to SL-1); variable S: String(1 to SL/4-1); begin if VALUE'Length mod 4 /= 0 then GOOD := False; SV := (others => 'X'); VALUE := SV; return; end if; loop Read(L, C, B); exit when ((C /= ' ') and (C /= CR) and (C /= HT)) or (not B); end loop; SV(0 to 3) := FromChar(C); if Is_X(SV(0 to 3)) or (not B) then GOOD := False; SV := (others => 'X'); VALUE := SV; return; end if; Read(L, S, B); if not B then GOOD := False; SV := (others => 'X'); VALUE := SV; return; end if; for i in 1 to SL/4-1 loop SV(4*i to 4*i+3) := FromChar(S(i)); if Is_X(SV(4*i to 4*i+3)) then GOOD := False; SV := (others => 'X'); VALUE := SV; return; end if; end loop; GOOD := True; VALUE := SV; end HRead; procedure HRead( variable L: inout Line; variable VALUE: out Std_ULogic_Vector) is variable GOOD: Boolean; begin HRead(L, VALUE, GOOD); --assert GOOD -- report "HREAD: access incorrect"; end HRead; procedure HRead( variable L: inout Line; variable VALUE: out bit_vector) is variable GOOD: Boolean; variable V: Std_ULogic_Vector(0 to Value'Length-1); begin HRead(L, V, GOOD); --assert GOOD -- report "HREAD: access incorrect"; VALUE := to_bitvector(V); end HRead; procedure HRead( variable L: inout Line; variable VALUE: out Std_Logic_Vector; variable GOOD: out Boolean) is variable V: Std_ULogic_Vector(0 to Value'Length-1); begin HRead(L, V, GOOD); VALUE := Std_Logic_Vector(V); end HRead; procedure HRead( variable L: inout Line; variable VALUE: out Std_Logic_Vector) is variable GOOD: Boolean; variable V: Std_ULogic_Vector(0 to Value'Length-1); begin HRead(L, V, GOOD); VALUE := Std_Logic_Vector(V); --assert GOOD -- report "HREAD: access incorrect"; end HRead; procedure HWrite( variable L: inout Line; constant VALUE: in Std_ULogic_Vector; constant JUSTIFIED: in SIDE := RIGHT; constant FIELD: in WIDTH := 0) is constant PL: Integer := 4-(VALUE'Length mod 4); constant PV: Std_ULogic_Vector(1 to PL) := (others => '0'); constant TL: Integer := PL + VALUE'Length; constant TV: Std_ULogic_Vector(0 to TL-1) := PV & Value; variable S: String(1 to TL/4); begin if PL /= 4 then for i in 0 to TL/4 -1 loop S(i+1) := ToChar(TV(4*i to 4*i+3)); end loop; Write(L, S(1 to TL/4), JUSTIFIED, FIELD); else for i in 1 to TL/4 -1 loop S(i+1) := ToChar(TV(4*i to 4*i+3)); end loop; Write(L, S(2 to TL/4), JUSTIFIED, FIELD); end if; end HWrite; procedure HWrite( variable L: inout Line; constant VALUE: in Std_Logic_Vector; constant JUSTIFIED: in SIDE := RIGHT; constant FIELD: in WIDTH := 0) is begin HWrite(L, Std_ULogic_Vector(VALUE), JUSTIFIED, FIELD); end HWrite; procedure Write( variable L: inout Line; constant VALUE: in Std_ULogic; constant JUSTIFIED: in SIDE := RIGHT; constant FIELD: in WIDTH := 0) is type Char_Array is array (Std_ULogic) of Character; constant ToChar: Char_Array := "UX01ZWLH-"; begin Write(L, ToChar(VALUE), JUSTIFIED, FIELD); end Write; -- pragma translate_on end package body StdIO;
gpl-2.0
ad7ed4274e716506d10fa77408b42e0c
0.491796
3.87457
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-asic/core_clock_mux.vhd
1
2,789
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: core_clock_mux -- File: core_clock_mux.vhd -- Author: Fredrik Ringhage - Aeroflex Gaisler AB -- Description: Clock muxes for LEONx ASIC ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library techmap; use techmap.gencomp.clkmux; use techmap.gencomp.has_clkmux; entity core_clock_mux is generic( tech : integer; scantest : integer range 0 to 1 := 0 ); port( clksel : in std_logic_vector(1 downto 0); testen : in std_logic; clkin : in std_logic; clk1x : in std_logic; clk2x : in std_logic; clk4x : in std_logic; clkout : out std_ulogic ); end entity; architecture rtl of core_clock_mux is signal sel1x,sel2x,sel4x : std_logic; signal lclkm1o,lclkm2o : std_logic; signal selbypass,seltest : std_logic; begin -- Select testclk or not seltest <= '1' when (testen = '1' and scantest = 1) else '0'; -- Bypass PLL selbypass <= '1' when (clksel = "00" or seltest = '1') else '0'; -- Select PLL clock if not test or bypassed sel1x <= '1' when (clksel(1 downto 0) = "01" and selbypass = '0' and seltest = '0') else '0'; sel2x <= '1' when (clksel(1 downto 0) = "10" and selbypass = '0' and seltest = '0') else '0'; sel4x <= '1' when (clksel(1 downto 0) = "11" and selbypass = '0' and seltest = '0') else '0'; -- Select output clock from PLL (or bypass PLL) lpllclkm1 : clkmux generic map (tech => tech) port map (clkin ,clk1x,sel1x,lclkm1o); lpllclkm2 : clkmux generic map (tech => tech) port map (lclkm1o,clk2x,sel2x,lclkm2o); lpllclkm4 : clkmux generic map (tech => tech) port map (lclkm2o,clk4x,sel4x,clkout ); end architecture;
gpl-2.0
3f129ab8288b71b44f9ba3d8ad426f7d
0.611689
3.571063
false
true
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-xc3s1600e/testbench.vhd
1
9,283
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ -- modified by Thomas Ameseder, Gleichmann Electronics 2004, 2005 to -- support the use of an external AHB slave and different HPE board versions ------------------------------------------------------------------------------ -- further adapted from Hpe_compact to Hpe_mini (Feb. 2005) ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library techmap; use techmap.gencomp.all; library micron; use micron.components.all; use work.config.all; -- configuration use work.debug.all; use std.textio.all; library grlib; use grlib.stdlib.all; use grlib.stdio.all; use grlib.devices.all; entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; clkperiod : integer := 20; -- system clock period romwidth : integer := 16; -- rom data width (8/32) romdepth : integer := 16; -- rom address depth sramwidth : integer := 32; -- ram data width (8/16/32) sramdepth : integer := 18; -- ram address depth srambanks : integer := 2 -- number of ram banks ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sdramfile : string := "ram.srec"; -- sdram contents signal clk : std_logic := '0'; signal Rst : std_logic := '0'; -- Reset constant ct : integer := clkperiod/2; signal address : std_logic_vector(23 downto 0); signal data : std_logic_vector(31 downto 0); signal romsn : std_logic_vector(1 downto 0); signal oen : std_ulogic; signal writen : std_ulogic; signal iosn : std_ulogic; -- ddr memory signal ddr_clk : std_logic; signal ddr_clkb : std_logic; signal ddr_clk_fb : std_logic; signal ddr_cke : std_logic; signal ddr_csb : std_logic; signal ddr_web : std_ulogic; -- ddr write enable signal ddr_rasb : std_ulogic; -- ddr ras signal ddr_casb : std_ulogic; -- ddr cas signal ddr_dm : std_logic_vector (1 downto 0); -- ddr dm signal ddr_dqs : std_logic_vector (1 downto 0); -- ddr dqs signal ddr_ad : std_logic_vector (12 downto 0); -- ddr address signal ddr_ba : std_logic_vector (1 downto 0); -- ddr bank address signal ddr_dq : std_logic_vector (15 downto 0); -- ddr data signal brdyn : std_ulogic; signal bexcn : std_ulogic; signal wdog : std_ulogic; signal dsuen, dsutx, dsurx, dsubre, dsuact : std_ulogic; signal dsurst : std_ulogic; signal test : std_ulogic; signal rtsn, ctsn : std_ulogic; signal error : std_logic; signal pio : std_logic_vector(15 downto 0); signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal clk2 : std_ulogic := '1'; signal plllock : std_ulogic; -- pulled up high, therefore std_logic signal txd, rxd1 : std_logic; signal etx_clk, erx_clk, erx_dv, erx_er, erx_col, erx_crs, etx_en, etx_er : std_logic := '0'; signal erxd, etxd : std_logic_vector(3 downto 0) := (others => '0'); signal emdc, emdio : std_logic; --dummy signal for the mdc,mdio in the phy which is not used constant lresp : boolean := false; signal resoutn : std_logic; signal dsubren : std_ulogic; signal dsuactn : std_ulogic; begin dsubren <= not dsubre; -- clock and reset clk <= not clk after ct * 1 ns; rst <= '1', '0' after 100 ns; dsuen <= '0'; dsubre <= '0'; rxd1 <= 'H'; address(0) <= '0'; ddr_dqs <= (others => 'L'); d3 : entity work.leon3mp port map ( reset => rst, clk_50mhz => clk, errorn => error, address => address(23 downto 0), data => data(31 downto 16), testdata => data(15 downto 0), ddr_clk0 => ddr_clk, ddr_clk0b => ddr_clkb, ddr_clk_fb => ddr_clk_fb, ddr_cke0 => ddr_cke, ddr_cs0b => ddr_csb, ddr_web => ddr_web, ddr_rasb => ddr_rasb, ddr_casb => ddr_casb, ddr_dm => ddr_dm, ddr_dqs => ddr_dqs, ddr_ad => ddr_ad, ddr_ba => ddr_ba, ddr_dq => ddr_dq, dsuen => dsuen, dsubre => dsubre, -- dsuact => dsuactn, dsutx => dsutx, dsurx => dsurx, oen => oen, writen => writen, iosn => iosn, romsn => romsn(0), utxd1 => txd, urxd1 => txd, emdio => emdio, etx_clk => etx_clk, erx_clk => erx_clk, erxd => erxd, erx_dv => erx_dv, erx_er => erx_er, erx_col => erx_col, erx_crs => erx_crs, etxd => etxd, etx_en => etx_en, etx_er => etx_er, emdc => emdc ); ddr_clk_fb <= ddr_clk; u1 : mt46v16m16 generic map (index => -1, fname => sdramfile) port map( Dq => ddr_dq(15 downto 0), Dqs => ddr_dqs(1 downto 0), Addr => ddr_ad, Ba => ddr_ba, Clk => ddr_clk, Clk_n => ddr_clkb, Cke => ddr_cke, Cs_n => ddr_csb, Ras_n => ddr_rasb, Cas_n => ddr_casb, We_n => ddr_web, Dm => ddr_dm(1 downto 0)); prom0 : for i in 0 to (romwidth/8)-1 generate sr0 : sram generic map (index => i+4, abits => romdepth, fname => promfile) port map (address(romdepth downto 1), data(31-i*8 downto 24-i*8), romsn(0), writen, oen); end generate; -- phy0 : if CFG_GRETH > 0 generate -- p0 : phy -- port map(rst, led_cfg, open, etx_clk, erx_clk, erxd, erx_dv, -- erx_er, erx_col, erx_crs, etxd, etx_en, etx_er, emdc); -- end generate; error <= 'H'; -- ERROR pull-up iuerr : process begin wait for 5 us; assert (to_X01(error) = '1') report "*** IU in error mode, simulation halted ***" severity failure; end process; test0 : grtestmod port map ( rst, clk, error, address(21 downto 2), data, iosn, oen, writen, brdyn); data <= buskeep(data) after 5 ns; dsucom : process procedure dsucfg(signal dsurx : in std_ulogic; signal dsutx : out std_ulogic) is variable w32 : std_logic_vector(31 downto 0); variable c8 : std_logic_vector(7 downto 0); constant txp : time := 160 * 1 ns; begin dsutx <= '1'; dsurst <= '1'; wait; wait for 5000 ns; txc(dsutx, 16#55#, txp); -- sync uart -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#00#, 16#ef#, txp); -- -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#20#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#ff#, 16#ff#, txp); -- -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#40#, 16#00#, 16#48#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#00#, 16#12#, txp); -- -- txc(dsutx, 16#c0#, txp); -- txa(dsutx, 16#90#, 16#40#, 16#00#, 16#60#, txp); -- txa(dsutx, 16#00#, 16#00#, 16#12#, 16#10#, txp); -- -- txc(dsutx, 16#80#, txp); -- txa(dsutx, 16#90#, 16#00#, 16#00#, 16#00#, txp); -- rxi(dsurx, w32, txp, lresp); txc(dsutx, 16#a0#, txp); txa(dsutx, 16#40#, 16#00#, 16#00#, 16#00#, txp); rxi(dsurx, w32, txp, lresp); end; begin dsucfg(dsutx, dsurx); wait; end process; end;
gpl-2.0
55e201fa57462c9fd2c1033e2b42fa80
0.529355
3.54313
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/lib/gaisler/pci/ptf/pt_pci_master.vhd
1
19,230
------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- -- Entity: pt_pci_master -- File: pt_pci_master.vhd -- Author: Nils Johan Wessman, Aeroflex Gaisler -- Description: PCI Testbench Master ------------------------------------------------------------------------------ -- pragma translate_off library ieee; use ieee.std_logic_1164.all; library grlib; library gaisler; use gaisler.pt_pkg.all; library grlib; use grlib.stdlib.xorv; use grlib.stdlib.tost; use grlib.testlib.print; entity pt_pci_master is generic ( slot : integer := 0; tval : time := 7 ns); port ( -- PCI signals pciin : in pci_type; pciout : out pci_type; -- Debug interface signals dbgi : in pt_pci_master_in_type; dbgo : out pt_pci_master_out_type ); end pt_pci_master; architecture behav of pt_pci_master is -- NEW => type access_element_type; type access_element_ptr is access access_element_type; type access_element_type is record acc : pt_pci_access_type; nxt : access_element_ptr; end record; constant idle_acc : pt_pci_access_type := ((others => '0'), (others => '0'), (others => '0'), (others => '0'), 0, 0, 0, 0, false, false, false, false, 0, 0); signal pci_core : pt_pci_master_in_type; signal core_pci : pt_pci_master_out_type; -- Description: Insert a access at the "tail" of the linked list of accesses procedure add_acc ( variable acc_head : inout access_element_ptr; variable acc_tail : inout access_element_ptr; signal acc : in pt_pci_access_type) is variable elem : access_element_ptr; begin -- insert_access elem := acc_tail; if elem /= NULL then elem.nxt := new access_element_type'(acc, NULL); acc_tail := elem.nxt; else acc_head := new access_element_type'(acc, NULL); acc_tail := acc_head; end if; end add_acc; -- Description: Get the access at the "head" of the linked list of accesses -- and remove if from the list procedure pop_acc ( variable acc_head : inout access_element_ptr; variable acc_tail : inout access_element_ptr; signal acc : out pt_pci_access_type; variable found : out boolean) is variable elem : access_element_ptr; begin -- pop_access elem := acc_head; if elem /= NULL then found := true; acc <= elem.acc; if elem = acc_tail then acc_head := NULL; acc_tail := NULL; else acc_head := elem.nxt; end if; deallocate(elem); else found := false; acc <= idle_acc; end if; end pop_acc; -- Description: Searches the list for a result to a particular id. procedure get_res ( variable res_head : inout access_element_ptr; variable res_tail : inout access_element_ptr; signal accin : in pt_pci_access_type; signal acc : out pt_pci_access_type; variable found : out boolean) is variable elem, prev : access_element_ptr; variable lfound : boolean := false; begin -- get_result prev := res_head; elem := res_head; while elem /= NULL and not lfound loop -- Check if result is a match for id if accin.id = elem.acc.id then acc <= elem.acc; lfound := true; if prev = res_head then res_head := elem.nxt; else prev.nxt := elem.nxt; end if; if elem = res_tail then res_tail := NULL; end if; deallocate(elem); end if; if not lfound then prev := elem; elem := elem.nxt; end if; end loop; if lfound then found := true; else found := false; acc <= idle_acc; end if; end get_res; -- Description: procedure rm_acc ( variable acc_head : inout access_element_ptr; variable acc_tail : inout access_element_ptr; signal acc : in pt_pci_access_type; constant rmall : in boolean )is variable elem, prev : access_element_ptr; variable lfound : boolean := false; begin -- rm_access prev := acc_head; elem := acc_head; while elem /= NULL and not lfound loop if rmall = true then prev := elem; elem := elem.nxt; deallocate(prev); else if acc.addr = elem.acc.addr then if prev = acc_head then acc_head := elem.nxt; else prev.nxt := elem.nxt; end if; if elem = acc_tail then acc_tail := NULL; end if; deallocate(elem); lfound := true; else prev := elem; elem := elem.nxt; end if; end if; end loop; if rmall = true then acc_head := NULL; acc_tail := NULL; end if; end rm_acc; -- <= NEW type state_type is(idle, addr, data, turn, active, done); type reg_type is record state : state_type; pcien : std_logic_vector(3 downto 0); perren : std_logic_vector(1 downto 0); read : std_logic; grant : std_logic; perr_ad : std_logic_vector(31 downto 0); perr_cbe : std_logic_vector(3 downto 0); devsel_timeout : integer range 0 to 3; pci : pci_type; acc : pt_pci_access_type; parerr : std_logic; end record; signal r,rin : reg_type; begin -- NEW => core_acc : process variable acc_head : access_element_ptr := NULL; variable acc_tail : access_element_ptr := NULL; variable res_head : access_element_ptr := NULL; variable res_tail : access_element_ptr := NULL; variable res_to_find : pt_pci_access_type := idle_acc; variable found : boolean; begin if pci_core.req /= '1' and dbgi.req /= '1' then wait until pci_core.req = '1' or dbgi.req = '1'; end if; if dbgi.req = '1' then dbgo.res_found <= '0'; if dbgi.add = true then add_acc(acc_head, acc_tail, dbgi.acc); elsif dbgi.remove = true then rm_acc(acc_head, acc_tail, dbgi.acc, dbgi.rmall); elsif dbgi.get_res = true then dbgo.valid <= false; get_res(res_head, res_tail, dbgi.acc, dbgo.acc, found); if found = true then dbgo.valid <= true; res_to_find := idle_acc; else res_to_find := dbgi.acc; end if; else dbgo.valid <= false; pop_acc(acc_head, acc_tail, dbgo.acc, found); if found = true then dbgo.valid <= true; end if; end if; dbgo.ack <= '1'; wait until dbgi.req = '0'; dbgo.ack <= '0'; end if; if pci_core.req = '1' then if pci_core.add = true then add_acc(acc_head, acc_tail, pci_core.acc); elsif pci_core.add_res = true then add_acc(res_head, res_tail, pci_core.acc); if res_to_find.valid = true and pci_core.acc.id = res_to_find.id then dbgo.res_found <= '1'; end if; else core_pci.valid <= false; pop_acc(acc_head, acc_tail, core_pci.acc, found); if found = true then core_pci.valid <= true; end if; end if; core_pci.ack <= '1'; wait until pci_core.req = '0'; core_pci.ack <= '0'; end if; end process; -- <= NEW pt_pci_core : process procedure sync_with_core is begin pci_core.req <= '1'; wait until core_pci.ack = '1'; pci_core.req <= '0'; wait until core_pci.ack = '0'; end sync_with_core; function check_data( constant pci_data : std_logic_vector(31 downto 0); constant comp_data : std_logic_vector(31 downto 0); constant cbe : std_logic_vector(3 downto 0)) return boolean is variable res : boolean := true; variable data : std_logic_vector(31 downto 0); begin data := comp_data; if cbe(0) = '1' then data(7 downto 0) := (others => '-'); end if; if cbe(1) = '1' then data(15 downto 8) := (others => '-'); end if; if cbe(2) = '1' then data(23 downto 16) := (others => '-'); end if; if cbe(3) = '1' then data(31 downto 24) := (others => '-'); end if; for i in 0 to 31 loop if pci_data(i) /= data(i) and data(i) /= '-' then res := false; end if; end loop; return res; end check_data; variable v : reg_type; begin if to_x01(pciin.syst.rst) = '0' then v.state := idle; v.pcien := (others => '0'); v.pci := pci_idle; v.pci.ifc.frame := '1'; v.pci.ifc.irdy := '1'; v.read := '0'; v.perren := (others => '0'); v.parerr := '0'; elsif rising_edge(pciin.syst.clk) then v := r; v.grant := to_x01(pciin.ifc.frame) and to_x01(pciin.ifc.irdy) and not r.pci.arb.req(slot) and not to_x01(pciin.arb.gnt(slot)); v.pcien(1) := r.pcien(0); v.pcien(2) := r.pcien(1); v.pci.ad.par := xorv(r.pci.ad.ad & r.pci.ad.cbe & r.parerr); v.perr_ad := pciin.ad.ad; v.perr_cbe := pciin.ad.cbe; v.pci.err.perr := (not xorv(r.perr_ad & r.perr_cbe & to_x01(pciin.ad.par))) or not r.read; v.perren(1) := r.perren(0); case r.state is when idle => if core_pci.valid = true then if r.acc.idle = false then v.pci.arb.req(slot) := '0'; if v.grant = '1' then v.pcien(0) := '1'; v.pci.ifc.frame := '0'; v.pci.ad.ad := core_pci.acc.addr; v.pci.ad.cbe := core_pci.acc.cbe_cmd; if core_pci.acc.parerr = 2 then v.parerr := '1'; else v.parerr := '0'; end if; v.state := addr; v.read := '0'; v.perren := (others => '0'); end if; else -- Idle cycle if r.acc.ws <= 0 then if r.acc.list_res = true then -- store result pci_core.acc <= r.acc; pci_core.add_res <= true; pci_core.add <= false; pci_core.remove <= false; sync_with_core; wait for 1 ps; end if; pci_core.add_res <= false; pci_core.add <= false; pci_core.remove <= false; sync_with_core; v.acc := core_pci.acc; else v.acc.ws := r.acc.ws - 1; end if; end if; else pci_core.add_res <= false; pci_core.add <= false; pci_core.remove <= false; sync_with_core; v.acc := core_pci.acc; end if; when addr => if r.acc.last = true and r.acc.ws <= 0 then v.pci.ifc.frame := '1'; v.pci.arb.req(slot) := '1'; end if; if (r.acc.cbe_cmd = MEM_READ or r.acc.cbe_cmd = MEM_R_MULT or r.acc.cbe_cmd = MEM_R_LINE or r.acc.cbe_cmd = IO_READ or r.acc.cbe_cmd = CONF_READ) then v.read := '1'; end if; if r.acc.ws <= 0 then v.pci.ifc.irdy := '0'; v.pci.ad.ad := r.acc.data; else v.acc.ws := r.acc.ws - 1; v.pci.ad.ad := (others => '-'); end if; v.pci.ad.cbe := r.acc.cbe_data; if core_pci.acc.parerr = 1 then v.parerr := '1'; else v.parerr := '0'; end if; v.state := data; v.devsel_timeout := 0; when data => if r.pci.ifc.irdy = '1' and r.acc.ws /= 0 then v.acc.ws := r.acc.ws - 1; else v.pci.ifc.irdy := '0'; v.pci.ad.ad := r.acc.data; if r.acc.last = true or to_x01(pciin.ifc.stop) = '0' then v.pci.ifc.frame := '1'; v.pci.arb.req(slot) := '1'; end if; end if; if to_x01(pciin.ifc.devsel) = '1' then if r.devsel_timeout < 3 then v.devsel_timeout := r.devsel_timeout + 1; else v.pci.ifc.frame := '1'; v.pci.ifc.irdy := '1'; if r.pci.ifc.frame = '1' then v.pcien(0) := '0'; v.state := idle; if r.acc.list_res = true then -- store result pci_core.acc <= r.acc; -- FIXME: should set Master abort status in this response pci_core.add_res <= true; pci_core.add <= false; pci_core.remove <= false; sync_with_core; wait for 1 ps; end if; pci_core.add_res <= false; pci_core.add <= false; pci_core.remove <= false; sync_with_core; v.acc := core_pci.acc; if r.acc.debug >= 1 then if r.read = '1' then print("ERROR: PCITBM Read[" & tost(r.acc.addr) & "]: MASTER ABORT"); else print("ERROR: PCITBM WRITE[" & tost(r.acc.addr) & "]: MASTER ABORT"); end if; end if; end if; end if; end if; --if to_x01(pciin.ifc.trdy) = '0' and r.pci.ifc.irdy = '0' then if (to_x01(pciin.ifc.trdy) = '0' or (r.acc.cod = 1 and to_x01(pciin.ifc.stop) = '0')) and r.pci.ifc.irdy = '0' then if r.read = '1' then v.perren(0) := '1'; end if; -- only drive perr from read if r.pci.ifc.frame = '1' then -- done v.pcien(0) := '0'; v.pci.ifc.irdy := '1'; if r.acc.list_res = true then -- store result pci_core.acc <= r.acc; if r.read = '1' then pci_core.acc.data <= pciin.ad.ad; end if; pci_core.add_res <= true; pci_core.add <= false; pci_core.remove <= false; sync_with_core; wait for 1 ps; end if; pci_core.add_res <= false; pci_core.add <= false; pci_core.remove <= false; sync_with_core; v.acc := core_pci.acc; v.state := idle; else if r.acc.list_res = true then -- store result pci_core.acc <= r.acc; if r.read = '1' then pci_core.acc.data <= pciin.ad.ad; end if; pci_core.add_res <= true; pci_core.add <= false; pci_core.remove <= false; sync_with_core; wait for 1 ps; end if; pci_core.add_res <= false; pci_core.add <= false; pci_core.remove <= false; sync_with_core; v.acc := core_pci.acc; if core_pci.valid = true then v.pci.ad.cbe := v.acc.cbe_data; if core_pci.acc.parerr = 1 then v.parerr := '1'; else v.parerr := '0'; end if; if v.acc.ws <= 0 then v.pci.ad.ad := v.acc.data; if v.acc.last = true or to_x01(pciin.ifc.stop) = '0' then v.pci.ifc.frame := '1'; v.pci.arb.req(slot) := '1'; end if; else v.pci.ad.ad := (others => '-'); if v.pci.ifc.frame = '0' then v.pci.ifc.irdy := '1'; end if; -- If frame => '1', do not add waitstates (irdey => '1') v.acc.ws := v.acc.ws - 1; end if; else assert false report "No valid acces in list, access required! (no access is marked LAST)" severity FAILURE; end if; end if; if r.acc.debug >= 1 then if r.acc.cod = 1 and to_x01(pciin.ifc.stop) = '0' and to_x01(pciin.ifc.trdy) = '1' then if r.read = '1' then print("PCITBM Read[" & tost(r.acc.addr) & "]: CANCELED ON DISCONNECT"); else print("PCITBM WRITE[" & tost(r.acc.addr) & "]: CANCELED ON DISCONNECT"); end if; else if r.read = '1' then if check_data(pciin.ad.ad, r.pci.ad.ad, r.pci.ad.cbe) = false then print("ERROR: PCITBM Read[" & tost(r.acc.addr) & "]: " & tost(pciin.ad.ad) & " != " & tost(r.pci.ad.ad)); elsif r.acc.debug >= 2 then print("PCITBM Read[" & tost(r.acc.addr) & "]: " & tost(pciin.ad.ad)); end if; else if r.acc.debug >= 2 then print("PCITBM Write[" & tost(r.acc.addr) & "]: " & tost(pciin.ad.ad)); end if; end if; end if; end if; elsif to_x01(pciin.ifc.stop) = '0' and r.pci.ifc.frame = '1' then -- Disconnect v.pcien(0) := '0'; v.pci.ifc.irdy := '1'; v.state := idle; if to_x01(pciin.ifc.devsel) = '1' then if r.acc.list_res = true then -- store result pci_core.acc <= r.acc; -- FIXME: should set Master abort status in this response pci_core.add_res <= true; pci_core.add <= false; pci_core.remove <= false; sync_with_core; wait for 1 ps; end if; pci_core.add_res <= false; pci_core.add <= false; pci_core.remove <= false; sync_with_core; v.acc := core_pci.acc; if r.acc.debug >= 1 then if r.read = '1' then print("ERROR: PCITBM Read[" & tost(r.acc.addr) & "]: TARGET ABORT"); else print("ERROR: PCITBM WRITE[" & tost(r.acc.addr) & "]: TARGET ABORT"); end if; end if; end if; end if; when turn => when active => when done => when others => end case; end if; r <= v; wait on pciin.syst.clk, pciin.syst.rst; end process; pciout.ad.ad <= r.pci.ad.ad after tval when (r.pcien(0) and not r.read) = '1' else (others => 'Z') after tval; pciout.ad.cbe <= r.pci.ad.cbe after tval when r.pcien(0) = '1' else (others => 'Z') after tval; pciout.ad.par <= r.pci.ad.par after tval when (r.pcien(1) = '1' and (r.read = '0' or r.pcien(3 downto 0) = "0011")) else 'Z' after tval; pciout.ifc.frame <= r.pci.ifc.frame after tval when r.pcien(0) = '1' else 'Z' after tval; pciout.ifc.irdy <= r.pci.ifc.irdy after tval when r.pcien(1) = '1' else 'Z' after tval; pciout.err.perr <= r.pci.err.perr after tval when (r.pcien(2) and r.perren(1)) = '1' else 'Z' after tval; pciout.err.serr <= r.pci.err.serr after tval when r.pcien(2) = '1' else 'Z' after tval; -- Unused signals pciout.arb <= arb_const; pciout.arb.req(slot) <= r.pci.arb.req(slot) after tval; -- Unused signals pciout.ifc.trdy <= 'Z'; pciout.ifc.stop <= 'Z'; pciout.ifc.devsel <= 'Z'; pciout.ifc.lock <= 'Z'; pciout.ifc.idsel <= (others => 'Z'); pciout.err.serr <= 'Z'; pciout.syst <= syst_const; pciout.ext64 <= ext64_const; pciout.cache <= cache_const; pciout.int <= (others => 'Z'); end; -- pragma translate_on
gpl-2.0
442c3613798f13784f78408e446f644b
0.528133
3.344348
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-xc7z020/leon3mp.vhd
1
20,546
----------------------------------------------------------------------------- -- LEON3 Zedboard Demonstration design -- Copyright (C) 2012 Fredrik Ringhage, Aeroflex Gaisler ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library grlib, techmap; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; use grlib.config_types.all; use grlib.config.all; use techmap.gencomp.all; use techmap.allclkgen.all; library gaisler; use gaisler.leon3.all; use gaisler.uart.all; use gaisler.misc.all; use gaisler.i2c.all; use gaisler.net.all; use gaisler.jtag.all; -- pragma translate_off use gaisler.sim.all; library unisim; use unisim.all; -- pragma translate_on use work.config.all; entity leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; testahb : boolean := false ); port ( processing_system7_0_MIO : inout std_logic_vector(53 downto 0); processing_system7_0_PS_SRSTB : in std_logic; processing_system7_0_PS_CLK : in std_logic; processing_system7_0_PS_PORB : in std_logic; processing_system7_0_DDR_Clk : inout std_logic; processing_system7_0_DDR_Clk_n : inout std_logic; processing_system7_0_DDR_CKE : inout std_logic; processing_system7_0_DDR_CS_n : inout std_logic; processing_system7_0_DDR_RAS_n : inout std_logic; processing_system7_0_DDR_CAS_n : inout std_logic; processing_system7_0_DDR_WEB_pin : out std_logic; processing_system7_0_DDR_BankAddr : inout std_logic_vector(2 downto 0); processing_system7_0_DDR_Addr : inout std_logic_vector(14 downto 0); processing_system7_0_DDR_ODT : inout std_logic; processing_system7_0_DDR_DRSTB : inout std_logic; processing_system7_0_DDR_DQ : inout std_logic_vector(31 downto 0); processing_system7_0_DDR_DM : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS_n : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_VRN : inout std_logic; processing_system7_0_DDR_VRP : inout std_logic; button : in std_logic_vector(3 downto 0); switch : inout std_logic_vector(7 downto 0); led : out std_logic_vector(7 downto 0) ); end; architecture rtl of leon3mp is constant use_ps_block : boolean := true; constant hconfig : ahb_config_type := ( 0 => ahb_device_reg ( VENDOR_GAISLER, GAISLER_MIG_SERIES7, 0, 0, 0), 4 => ahb_membar(16#000#, '1', '1', 16#F80#), others => zero32); constant maxahbm : integer := CFG_NCPU+CFG_AHB_JTAG; constant maxahbs : integer := 1+CFG_DSU+CFG_AHBROMEN+CFG_AHBRAMEN+1+2; constant maxapbs : integer := CFG_IRQ3_ENABLE+CFG_GPT_ENABLE+CFG_GRGPIO_ENABLE+CFG_AHBSTAT; signal vcc, gnd : std_logic; signal apbi : apb_slv_in_type; signal apbo : apb_slv_out_vector := (others => apb_none); signal ahbsi : ahb_slv_in_type; signal ahbso : ahb_slv_out_vector := (others => ahbs_none); signal ahbmi : ahb_mst_in_type; signal vahbmi : ahb_mst_in_type; signal ahbmo : ahb_mst_out_vector := (others => ahbm_none); signal vahbmo : ahb_mst_out_type; signal clkm, rstn, rstraw, sdclkl : std_ulogic; signal cgi, cgi2 : clkgen_in_type; signal cgo, cgo2 : clkgen_out_type; signal u1i, u2i, dui : uart_in_type; signal u1o, u2o, duo : uart_out_type; signal irqi : irq_in_vector(0 to CFG_NCPU-1); signal irqo : irq_out_vector(0 to CFG_NCPU-1); signal dbgi : l3_debug_in_vector(0 to CFG_NCPU-1); signal dbgo : l3_debug_out_vector(0 to CFG_NCPU-1); signal dsui : dsu_in_type; signal dsuo : dsu_out_type; signal rxd1 : std_logic; signal txd1 : std_logic; signal ethi : eth_in_type; signal etho : eth_out_type; signal egtx_clk :std_ulogic; signal negtx_clk :std_ulogic; signal gpti : gptimer_in_type; signal gpto : gptimer_out_type; signal gpioi : gpio_in_type; signal gpioo : gpio_out_type; signal clklock, elock, ulock : std_ulogic; signal lock, calib_done, clkml, lclk, rst, ndsuact : std_ulogic; signal tck, tckn, tms, tdi, tdo : std_ulogic; signal lcd_datal : std_logic_vector(11 downto 0); signal lcd_hsyncl, lcd_vsyncl, lcd_del, lcd_reset_bl : std_ulogic; signal i2ci, dvi_i2ci : i2c_in_type; signal i2co, dvi_i2co : i2c_out_type; constant BOARD_FREQ : integer := 50000; -- input frequency in KHz constant CPU_FREQ : integer := BOARD_FREQ * CFG_CLKMUL / CFG_CLKDIV; -- cpu frequency in KHz signal stati : ahbstat_in_type; component leon3_zedboard_stub port ( processing_system7_0_MIO : inout std_logic_vector(53 downto 0); processing_system7_0_PS_SRSTB : in std_logic; processing_system7_0_PS_CLK : in std_logic; processing_system7_0_PS_PORB : in std_logic; processing_system7_0_DDR_Clk : inout std_logic; processing_system7_0_DDR_Clk_n : inout std_logic; processing_system7_0_DDR_CKE : inout std_logic; processing_system7_0_DDR_CS_n : inout std_logic; processing_system7_0_DDR_RAS_n : inout std_logic; processing_system7_0_DDR_CAS_n : inout std_logic; processing_system7_0_DDR_WEB_pin : out std_logic; processing_system7_0_DDR_BankAddr : inout std_logic_vector(2 downto 0); processing_system7_0_DDR_Addr : inout std_logic_vector(14 downto 0); processing_system7_0_DDR_ODT : inout std_logic; processing_system7_0_DDR_DRSTB : inout std_logic; processing_system7_0_DDR_DQ : inout std_logic_vector(31 downto 0); processing_system7_0_DDR_DM : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS_n : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_VRN : inout std_logic; processing_system7_0_DDR_VRP : inout std_logic; ahblite_axi_bridge_0_S_AHB_HSEL_pin : in std_logic; ahblite_axi_bridge_0_S_AHB_HADDR_pin : in std_logic_vector(31 downto 0); ahblite_axi_bridge_0_S_AHB_HPROT_pin : in std_logic_vector(3 downto 0); ahblite_axi_bridge_0_S_AHB_HTRANS_pin : in std_logic_vector(1 downto 0); ahblite_axi_bridge_0_S_AHB_HSIZE_pin : in std_logic_vector(2 downto 0); ahblite_axi_bridge_0_S_AHB_HWRITE_pin : in std_logic; ahblite_axi_bridge_0_S_AHB_HBURST_pin : in std_logic_vector(2 downto 0); ahblite_axi_bridge_0_S_AHB_HWDATA_pin : in std_logic_vector(31 downto 0); ahblite_axi_bridge_0_S_AHB_HREADY_OUT_pin : out std_logic; ahblite_axi_bridge_0_S_AHB_HREADY_IN_pin : in std_logic; ahblite_axi_bridge_0_S_AHB_HRDATA_pin : out std_logic_vector(31 downto 0); ahblite_axi_bridge_0_S_AHB_HRESP_pin : out std_logic; processing_system7_0_FCLK_CLK0_pin : out std_logic; processing_system7_0_FCLK_RESET0_N_pin : out std_logic; processing_system7_0_FCLK_CLKTRIG0_N_pin : in std_logic ); end component; begin ---------------------------------------------------------------------- --- Reset and Clock generation ------------------------------------- ---------------------------------------------------------------------- vcc <= '1'; gnd <= '0'; lock <= calib_done ; ---------------------------------------------------------------------- --- AHB CONTROLLER -------------------------------------------------- ---------------------------------------------------------------------- ahb0 : ahbctrl -- AHB arbiter/multiplexer generic map (defmast => CFG_DEFMST, split => CFG_SPLIT, rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO, fpnpen => CFG_FPNPEN, nahbm => maxahbm, nahbs => maxahbs) port map (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso); ---------------------------------------------------------------------- --- LEON3 processor and DSU ----------------------------------------- ---------------------------------------------------------------------- nosh : if CFG_GRFPUSH = 0 generate cpu : for i in 0 to CFG_NCPU-1 generate l3ft : if CFG_LEON3FT_EN /= 0 generate leon3ft0 : leon3ft -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU*(1-CFG_GRFPUSH), CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1, CFG_IUFT_EN, CFG_FPUFT_EN, CFG_CACHE_FT_EN, CFG_RF_ERRINJ, CFG_CACHE_ERRINJ, CFG_DFIXED, CFG_LEON3_NETLIST, CFG_SCAN, CFG_MMU_PAGE) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i), clkm); end generate; l3s : if CFG_LEON3FT_EN = 0 generate u0 : leon3s -- LEON3 processor generic map (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU*(1-CFG_GRFPUSH), CFG_V8, 0, CFG_MAC, pclow, CFG_NOTAG, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN, CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP, CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1, CFG_DFIXED, CFG_SCAN, CFG_MMU_PAGE, CFG_BP) port map (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso, irqi(i), irqo(i), dbgi(i), dbgo(i)); end generate; end generate; end generate; led1_pad : outpad generic map (tech => padtech, level => cmos, voltage => x33v) port map (led(1), dbgo(0).error); dsugen : if CFG_DSU = 1 generate dsu0 : dsu3 -- LEON3 Debug Support Unit generic map (hindex => 2, haddr => 16#900#, hmask => 16#F00#, ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ) port map (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo); dsui.enable <= '1'; dsui_break_pad : inpad generic map (level => cmos, voltage => x18v, tech => padtech) port map (button(0), dsui.break); dsuact_pad : outpad generic map (tech => padtech, level => cmos, voltage => x18v) port map (led(0), ndsuact); ndsuact <= not dsuo.active; end generate; nodsu : if CFG_DSU = 0 generate dsuo.tstop <= '0'; dsuo.active <= '0'; ahbso(2) <= ahbs_none; end generate; ahbjtaggen0 :if CFG_AHB_JTAG = 1 generate ahbjtag0 : ahbjtag generic map(tech => fabtech, hindex => 1) port map(rstn, clkm, tck, tms, tdi, tdo, ahbmi, ahbmo(1), open, open, open, open, open, open, open, gnd); end generate; nojtag : if CFG_AHB_JTAG = 0 generate apbo(1) <= apb_none; end generate; leon3_zedboard_stub_i : leon3_zedboard_stub port map ( processing_system7_0_MIO => processing_system7_0_MIO, processing_system7_0_PS_SRSTB => processing_system7_0_PS_SRSTB, processing_system7_0_PS_CLK => processing_system7_0_PS_CLK, processing_system7_0_PS_PORB => processing_system7_0_PS_PORB, processing_system7_0_DDR_Clk => processing_system7_0_DDR_Clk, processing_system7_0_DDR_Clk_n => processing_system7_0_DDR_Clk_n, processing_system7_0_DDR_CKE => processing_system7_0_DDR_CKE, processing_system7_0_DDR_CS_n => processing_system7_0_DDR_CS_n, processing_system7_0_DDR_RAS_n => processing_system7_0_DDR_RAS_n, processing_system7_0_DDR_CAS_n => processing_system7_0_DDR_CAS_n, processing_system7_0_DDR_WEB_pin => processing_system7_0_DDR_WEB_pin, processing_system7_0_DDR_BankAddr => processing_system7_0_DDR_BankAddr, processing_system7_0_DDR_Addr => processing_system7_0_DDR_Addr, processing_system7_0_DDR_ODT => processing_system7_0_DDR_ODT, processing_system7_0_DDR_DRSTB => processing_system7_0_DDR_DRSTB, processing_system7_0_DDR_DQ => processing_system7_0_DDR_DQ, processing_system7_0_DDR_DM => processing_system7_0_DDR_DM, processing_system7_0_DDR_DQS => processing_system7_0_DDR_DQS, processing_system7_0_DDR_DQS_n => processing_system7_0_DDR_DQS_n, processing_system7_0_DDR_VRN => processing_system7_0_DDR_VRN, processing_system7_0_DDR_VRP => processing_system7_0_DDR_VRP, ahblite_axi_bridge_0_S_AHB_HSEL_pin => ahbsi.hsel(4), ahblite_axi_bridge_0_S_AHB_HADDR_pin => ahbsi.haddr, ahblite_axi_bridge_0_S_AHB_HPROT_pin => ahbsi.hprot, ahblite_axi_bridge_0_S_AHB_HTRANS_pin => ahbsi.htrans, ahblite_axi_bridge_0_S_AHB_HSIZE_pin => ahbsi.hsize, ahblite_axi_bridge_0_S_AHB_HWRITE_pin => ahbsi.hwrite, ahblite_axi_bridge_0_S_AHB_HBURST_pin => ahbsi.hburst, ahblite_axi_bridge_0_S_AHB_HWDATA_pin => ahbsi.hwdata, ahblite_axi_bridge_0_S_AHB_HREADY_OUT_pin => ahbso(4).hready, ahblite_axi_bridge_0_S_AHB_HREADY_IN_pin => ahbsi.hready, ahblite_axi_bridge_0_S_AHB_HRDATA_pin => ahbso(4).hrdata, ahblite_axi_bridge_0_S_AHB_HRESP_pin => ahbso(4).hresp(0), processing_system7_0_FCLK_CLK0_pin => clkm, processing_system7_0_FCLK_RESET0_N_pin => rstn, processing_system7_0_FCLK_CLKTRIG0_N_pin => '0' ); calib_done <= '1'; ahbso(4).hresp(1) <= '0'; ahbso(4).hconfig <= hconfig; ahbso(4).hirq <= (others => '0'); ahbso(4).hindex <= 4; ahbso(4).hsplit <= (others => '0'); ---------------------------------------------------------------------- --- APB Bridge and various periherals ------------------------------- ---------------------------------------------------------------------- apb0 : apbctrl -- AHB/APB bridge generic map (hindex => 1, haddr => CFG_APBADDR, nslaves => 16) port map (rstn, clkm, ahbsi, ahbso(1), apbi, apbo ); irqctrl : if CFG_IRQ3_ENABLE /= 0 generate irqctrl0 : irqmp -- interrupt controller generic map (pindex => 2, paddr => 2, ncpu => CFG_NCPU) port map (rstn, clkm, apbi, apbo(2), irqo, irqi); end generate; irq3 : if CFG_IRQ3_ENABLE = 0 generate x : for i in 0 to CFG_NCPU-1 generate irqi(i).irl <= "0000"; end generate; apbo(2) <= apb_none; end generate; gpt : if CFG_GPT_ENABLE /= 0 generate timer0 : gptimer -- timer unit generic map (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ, sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM, nbits => CFG_GPT_TW, wdog => 0) port map (rstn, clkm, apbi, apbo(3), gpti, gpto); gpti.dhalt <= dsuo.tstop; gpti.extclk <= '0'; end generate; nogpt : if CFG_GPT_ENABLE = 0 generate apbo(3) <= apb_none; end generate; gpio0 : if CFG_GRGPIO_ENABLE /= 0 generate -- GPIO unit grgpio0: grgpio generic map(pindex => 10, paddr => 10, imask => CFG_GRGPIO_IMASK, nbits => CFG_GRGPIO_WIDTH) port map(rst => rstn, clk => clkm, apbi => apbi, apbo => apbo(10), gpioi => gpioi, gpioo => gpioo); pio_pads : for i in 0 to 7 generate pio_pad : iopad generic map (tech => padtech, level => cmos, voltage => x18v) port map (switch(i), gpioo.dout(i), gpioo.oen(i), gpioi.din(i)); end generate; pio_pads2 : for i in 8 to 10 generate pio_pad : inpad generic map (tech => padtech, level => cmos, voltage => x18v) port map (button(i-8+1), gpioi.din(i)); end generate; pio_pads3 : for i in 11 to 14 generate pio_pad : outpad generic map (tech => padtech, level => cmos, voltage => x33v) port map (led(i-11+4), gpioo.dout(i)); end generate; end generate; ua1 : if CFG_UART1_ENABLE /= 0 generate uart1 : apbuart -- UART 1 generic map (pindex => 1, paddr => 1, pirq => 2, console => dbguart, fifosize => CFG_UART1_FIFO) port map (rstn, clkm, apbi, apbo(1), u1i, u1o); u1i.rxd <= rxd1; u1i.ctsn <= '0'; u1i.extclk <= '0'; txd1 <= u1o.txd; serrx_pad : outpad generic map (level => cmos, voltage => x33v, tech => padtech) port map (led(2), rxd1); sertx_pad : outpad generic map (level => cmos, voltage => x33v, tech => padtech) port map (led(3), txd1); end generate; noua0 : if CFG_UART1_ENABLE = 0 generate apbo(1) <= apb_none; end generate; ahbs : if CFG_AHBSTAT = 1 generate -- AHB status register ahbstat0 : ahbstat generic map (pindex => 15, paddr => 15, pirq => 7, nftslv => CFG_AHBSTATN) port map (rstn, clkm, ahbmi, ahbsi, stati, apbi, apbo(15)); end generate; ----------------------------------------------------------------------- --- AHB ROM ---------------------------------------------------------- ----------------------------------------------------------------------- bpromgen : if CFG_AHBROMEN /= 0 generate brom : entity work.ahbrom generic map (hindex => 7, haddr => CFG_AHBRODDR, pipe => CFG_AHBROPIP) port map ( rstn, clkm, ahbsi, ahbso(7)); end generate; ----------------------------------------------------------------------- --- AHB RAM ---------------------------------------------------------- ----------------------------------------------------------------------- ocram : if CFG_AHBRAMEN = 1 generate ahbram0 : ahbram generic map (hindex => 5, haddr => CFG_AHBRADDR, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ, pipe => CFG_AHBRPIPE) port map ( rstn, clkm, ahbsi, ahbso(5)); end generate; ----------------------------------------------------------------------- --- Test report module ---------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off test0_gen : if (testahb = true) generate test0 : ahbrep generic map (hindex => 3, haddr => 16#200#) port map (rstn, clkm, ahbsi, ahbso(3)); end generate; -- pragma translate_on test1_gen : if (testahb = false) generate ahbram0 : ahbram generic map (hindex => 3, haddr => 16#200#, tech => CFG_MEMTECH, kbytes => CFG_AHBRSZ) port map ( rstn, clkm, ahbsi, ahbso(3)); end generate; ----------------------------------------------------------------------- --- Drive unused bus elements --------------------------------------- ----------------------------------------------------------------------- nam1 : for i in (maxahbs+1) to NAHBMST-1 generate ahbmo(i) <= ahbm_none; end generate; ----------------------------------------------------------------------- --- Boot message ---------------------------------------------------- ----------------------------------------------------------------------- -- pragma translate_off x : report_design generic map ( msg1 => "LEON3 Xilinx Zedboard Demonstration design", fabtech => tech_table(fabtech), memtech => tech_table(memtech), mdel => 1 ); -- pragma translate_on end;
gpl-2.0
60628cedc021c77c26a68553418015bb
0.579139
3.487101
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-xc7z020/testbench.vhd
1
8,024
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench -- Copyright (C) 2012 Fredrik Ringhage, Gaisler Research ------------------------------------------------------------------------------ -- This file is a part of the GRLIB VHDL IP LIBRARY -- Copyright (C) 2003 - 2008, Gaisler Research -- Copyright (C) 2008 - 2013, Aeroflex Gaisler -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------ library ieee; use ieee.std_logic_1164.all; library gaisler; use gaisler.libdcom.all; use gaisler.sim.all; library grlib; use grlib.amba.all; use grlib.stdlib.all; use grlib.devices.all; library micron; use micron.all; library techmap; use techmap.gencomp.all; use work.debug.all; use work.config.all; entity testbench is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; testahb : boolean := true ); end; architecture behav of testbench is constant promfile : string := "prom.srec"; -- rom contents constant sramfile : string := "ram.srec"; -- ram contents constant sdramfile : string := "ram.srec"; -- sdram contents signal GND : std_ulogic := '0'; signal VCC : std_ulogic := '1'; signal NC : std_ulogic := 'Z'; signal gclk : std_logic := '0'; signal rst : std_logic := '0'; signal button : std_logic_vector(3 downto 0) := (others => '0'); signal switch : std_logic_vector(7 downto 0); -- I/O port signal led : std_logic_vector(7 downto 0); -- I/O port signal processing_system7_0_MIO : std_logic_vector(53 downto 0); signal processing_system7_0_PS_SRSTB : std_logic; signal processing_system7_0_PS_CLK : std_logic; signal processing_system7_0_PS_PORB : std_logic; signal processing_system7_0_DDR_Clk : std_logic; signal processing_system7_0_DDR_Clk_n : std_logic; signal processing_system7_0_DDR_CKE : std_logic; signal processing_system7_0_DDR_CS_n : std_logic; signal processing_system7_0_DDR_RAS_n : std_logic; signal processing_system7_0_DDR_CAS_n : std_logic; signal processing_system7_0_DDR_WEB_pin : std_logic; signal processing_system7_0_DDR_BankAddr : std_logic_vector(2 downto 0); signal processing_system7_0_DDR_Addr : std_logic_vector(14 downto 0); signal processing_system7_0_DDR_ODT : std_logic; signal processing_system7_0_DDR_DRSTB : std_logic; signal processing_system7_0_DDR_DQ : std_logic_vector(31 downto 0); signal processing_system7_0_DDR_DM : std_logic_vector(3 downto 0); signal processing_system7_0_DDR_DQS : std_logic_vector(3 downto 0); signal processing_system7_0_DDR_DQS_n : std_logic_vector(3 downto 0); signal processing_system7_0_DDR_VRN : std_logic; signal processing_system7_0_DDR_VRP : std_logic; component leon3mp is generic ( fabtech : integer := CFG_FABTECH; memtech : integer := CFG_MEMTECH; padtech : integer := CFG_PADTECH; clktech : integer := CFG_CLKTECH; disas : integer := CFG_DISAS; -- Enable disassembly to console dbguart : integer := CFG_DUART; -- Print UART on console pclow : integer := CFG_PCLOW; testahb : boolean := false ); port ( processing_system7_0_MIO : inout std_logic_vector(53 downto 0); processing_system7_0_PS_SRSTB : in std_logic; processing_system7_0_PS_CLK : in std_logic; processing_system7_0_PS_PORB : in std_logic; processing_system7_0_DDR_Clk : inout std_logic; processing_system7_0_DDR_Clk_n : inout std_logic; processing_system7_0_DDR_CKE : inout std_logic; processing_system7_0_DDR_CS_n : inout std_logic; processing_system7_0_DDR_RAS_n : inout std_logic; processing_system7_0_DDR_CAS_n : inout std_logic; processing_system7_0_DDR_WEB_pin : out std_logic; processing_system7_0_DDR_BankAddr : inout std_logic_vector(2 downto 0); processing_system7_0_DDR_Addr : inout std_logic_vector(14 downto 0); processing_system7_0_DDR_ODT : inout std_logic; processing_system7_0_DDR_DRSTB : inout std_logic; processing_system7_0_DDR_DQ : inout std_logic_vector(31 downto 0); processing_system7_0_DDR_DM : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_DQS_n : inout std_logic_vector(3 downto 0); processing_system7_0_DDR_VRN : inout std_logic; processing_system7_0_DDR_VRP : inout std_logic; button : in std_logic_vector(3 downto 0); switch : inout std_logic_vector(7 downto 0); led : out std_logic_vector(7 downto 0) ); end component; begin -- clock, reset and misc gclk <= not gclk after 5.0 ns; rst <= '1' after 1 us; button <= (others => '0'); switch <= (others => '0'); cpu : leon3mp generic map ( fabtech => fabtech, memtech => memtech, padtech => padtech, clktech => clktech, disas => disas, dbguart => dbguart, pclow => pclow, testahb => testahb ) port map ( processing_system7_0_MIO => processing_system7_0_MIO, processing_system7_0_PS_SRSTB => processing_system7_0_PS_SRSTB, processing_system7_0_PS_CLK => processing_system7_0_PS_CLK, processing_system7_0_PS_PORB => processing_system7_0_PS_PORB, processing_system7_0_DDR_Clk => processing_system7_0_DDR_Clk, processing_system7_0_DDR_Clk_n => processing_system7_0_DDR_Clk_n, processing_system7_0_DDR_CKE => processing_system7_0_DDR_CKE, processing_system7_0_DDR_CS_n => processing_system7_0_DDR_CS_n, processing_system7_0_DDR_RAS_n => processing_system7_0_DDR_RAS_n, processing_system7_0_DDR_CAS_n => processing_system7_0_DDR_CAS_n, processing_system7_0_DDR_WEB_pin => processing_system7_0_DDR_WEB_pin, processing_system7_0_DDR_BankAddr => processing_system7_0_DDR_BankAddr, processing_system7_0_DDR_Addr => processing_system7_0_DDR_Addr, processing_system7_0_DDR_ODT => processing_system7_0_DDR_ODT, processing_system7_0_DDR_DRSTB => processing_system7_0_DDR_DRSTB, processing_system7_0_DDR_DQ => processing_system7_0_DDR_DQ, processing_system7_0_DDR_DM => processing_system7_0_DDR_DM, processing_system7_0_DDR_DQS => processing_system7_0_DDR_DQS, processing_system7_0_DDR_DQS_n => processing_system7_0_DDR_DQS_n, processing_system7_0_DDR_VRN => processing_system7_0_DDR_VRN, processing_system7_0_DDR_VRP => processing_system7_0_DDR_VRP, button => button, switch => switch, led => led ); end ;
gpl-2.0
ed850cf1bb51954a4b4df092cdcaf4f2
0.620264
3.528584
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-avnet-eval-xc4vlx25/config.vhd
1
5,885
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := virtex4; constant CFG_MEMTECH : integer := virtex4; constant CFG_PADTECH : integer := virtex4; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := virtex4; constant CFG_CLKMUL : integer := (7); constant CFG_CLKDIV : integer := (10); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 16#32# + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 1; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (2); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 2; constant CFG_ISETSZ : integer := 16; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 1; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 2; constant CFG_DSETSZ : integer := 16; constant CFG_DLINE : integer := 8; constant CFG_DREPL : integer := 1; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 0; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 0; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 1; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0045#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#000014#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 0; constant CFG_MCTRL_RAM16BIT : integer := 1; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- DDR controller constant CFG_DDRSP : integer := 1; constant CFG_DDRSP_INIT : integer := 1; constant CFG_DDRSP_FREQ : integer := (100); constant CFG_DDRSP_COL : integer := (9); constant CFG_DDRSP_SIZE : integer := (32); constant CFG_DDRSP_RSKEW : integer := (0); -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 32; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 8; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0000#; constant CFG_GRGPIO_WIDTH : integer := (8); -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
39e7ab28a4ea5467e920d10b89c3135d
0.642651
3.623768
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-xilinx-ml40x/config.vhd
1
6,384
----------------------------------------------------------------------------- -- LEON3 Demonstration design test bench configuration -- Copyright (C) 2009 Aeroflex Gaisler ------------------------------------------------------------------------------ library techmap; use techmap.gencomp.all; package config is -- Technology and synthesis options constant CFG_FABTECH : integer := virtex4; constant CFG_MEMTECH : integer := virtex4; constant CFG_PADTECH : integer := virtex4; constant CFG_NOASYNC : integer := 0; constant CFG_SCAN : integer := 0; -- Clock generator constant CFG_CLKTECH : integer := virtex4; constant CFG_CLKMUL : integer := (13); constant CFG_CLKDIV : integer := (20); constant CFG_OCLKDIV : integer := 1; constant CFG_OCLKBDIV : integer := 0; constant CFG_OCLKCDIV : integer := 0; constant CFG_PCIDLL : integer := 0; constant CFG_PCISYSCLK: integer := 0; constant CFG_CLK_NOFB : integer := 0; -- LEON3 processor core constant CFG_LEON3 : integer := 1; constant CFG_NCPU : integer := (1); constant CFG_NWIN : integer := (8); constant CFG_V8 : integer := 16#32# + 4*0; constant CFG_MAC : integer := 0; constant CFG_BP : integer := 0; constant CFG_SVT : integer := 1; constant CFG_RSTADDR : integer := 16#00000#; constant CFG_LDDEL : integer := (1); constant CFG_NOTAG : integer := 0; constant CFG_NWP : integer := (2); constant CFG_PWD : integer := 1*2; constant CFG_FPU : integer := 0 + 16*0 + 32*0; constant CFG_GRFPUSH : integer := 0; constant CFG_ICEN : integer := 1; constant CFG_ISETS : integer := 2; constant CFG_ISETSZ : integer := 8; constant CFG_ILINE : integer := 8; constant CFG_IREPL : integer := 0; constant CFG_ILOCK : integer := 0; constant CFG_ILRAMEN : integer := 0; constant CFG_ILRAMADDR: integer := 16#8E#; constant CFG_ILRAMSZ : integer := 1; constant CFG_DCEN : integer := 1; constant CFG_DSETS : integer := 2; constant CFG_DSETSZ : integer := 4; constant CFG_DLINE : integer := 4; constant CFG_DREPL : integer := 0; constant CFG_DLOCK : integer := 0; constant CFG_DSNOOP : integer := 1 + 0 + 4*0; constant CFG_DFIXED : integer := 16#0#; constant CFG_DLRAMEN : integer := 0; constant CFG_DLRAMADDR: integer := 16#8F#; constant CFG_DLRAMSZ : integer := 1; constant CFG_MMUEN : integer := 1; constant CFG_ITLBNUM : integer := 8; constant CFG_DTLBNUM : integer := 8; constant CFG_TLB_TYPE : integer := 0 + 1*2; constant CFG_TLB_REP : integer := 0; constant CFG_MMU_PAGE : integer := 0; constant CFG_DSU : integer := 1; constant CFG_ITBSZ : integer := 2; constant CFG_ATBSZ : integer := 2; constant CFG_LEON3FT_EN : integer := 0; constant CFG_IUFT_EN : integer := 0; constant CFG_FPUFT_EN : integer := 0; constant CFG_RF_ERRINJ : integer := 0; constant CFG_CACHE_FT_EN : integer := 0; constant CFG_CACHE_ERRINJ : integer := 0; constant CFG_LEON3_NETLIST: integer := 0; constant CFG_DISAS : integer := 0 + 0; constant CFG_PCLOW : integer := 2; -- AMBA settings constant CFG_DEFMST : integer := (0); constant CFG_RROBIN : integer := 1; constant CFG_SPLIT : integer := 1; constant CFG_FPNPEN : integer := 0; constant CFG_AHBIO : integer := 16#FFF#; constant CFG_APBADDR : integer := 16#800#; constant CFG_AHB_MON : integer := 0; constant CFG_AHB_MONERR : integer := 0; constant CFG_AHB_MONWAR : integer := 0; constant CFG_AHB_DTRACE : integer := 0; -- DSU UART constant CFG_AHB_UART : integer := 0; -- JTAG based DSU interface constant CFG_AHB_JTAG : integer := 1; -- Ethernet DSU constant CFG_DSU_ETH : integer := 1 + 0 + 0; constant CFG_ETH_BUF : integer := 2; constant CFG_ETH_IPM : integer := 16#C0A8#; constant CFG_ETH_IPL : integer := 16#0033#; constant CFG_ETH_ENM : integer := 16#020000#; constant CFG_ETH_ENL : integer := 16#00002F#; -- LEON2 memory controller constant CFG_MCTRL_LEON2 : integer := 1; constant CFG_MCTRL_RAM8BIT : integer := 0; constant CFG_MCTRL_RAM16BIT : integer := 0; constant CFG_MCTRL_5CS : integer := 0; constant CFG_MCTRL_SDEN : integer := 0; constant CFG_MCTRL_SEPBUS : integer := 0; constant CFG_MCTRL_INVCLK : integer := 0; constant CFG_MCTRL_SD64 : integer := 0; constant CFG_MCTRL_PAGE : integer := 0 + 0; -- DDR controller constant CFG_DDRSP : integer := 1; constant CFG_DDRSP_INIT : integer := 1; constant CFG_DDRSP_FREQ : integer := (100); constant CFG_DDRSP_COL : integer := (9); constant CFG_DDRSP_SIZE : integer := (64); constant CFG_DDRSP_RSKEW : integer := (0); -- SSRAM controller constant CFG_SSCTRL : integer := 0; constant CFG_SSCTRLP16 : integer := 0; -- AHB status register constant CFG_AHBSTAT : integer := 1; constant CFG_AHBSTATN : integer := (1); -- AHB ROM constant CFG_AHBROMEN : integer := 0; constant CFG_AHBROPIP : integer := 0; constant CFG_AHBRODDR : integer := 16#000#; constant CFG_ROMADDR : integer := 16#000#; constant CFG_ROMMASK : integer := 16#E00# + 16#000#; -- AHB RAM constant CFG_AHBRAMEN : integer := 0; constant CFG_AHBRSZ : integer := 1; constant CFG_AHBRADDR : integer := 16#A00#; constant CFG_AHBRPIPE : integer := 0; -- Gaisler Ethernet core constant CFG_GRETH : integer := 1; constant CFG_GRETH1G : integer := 0; constant CFG_ETH_FIFO : integer := 32; -- UART 1 constant CFG_UART1_ENABLE : integer := 1; constant CFG_UART1_FIFO : integer := 4; -- LEON3 interrupt controller constant CFG_IRQ3_ENABLE : integer := 1; constant CFG_IRQ3_NSEC : integer := 0; -- Modular timer constant CFG_GPT_ENABLE : integer := 1; constant CFG_GPT_NTIM : integer := (2); constant CFG_GPT_SW : integer := (8); constant CFG_GPT_TW : integer := (32); constant CFG_GPT_IRQ : integer := (8); constant CFG_GPT_SEPIRQ : integer := 1; constant CFG_GPT_WDOGEN : integer := 0; constant CFG_GPT_WDOG : integer := 16#0#; -- GPIO port constant CFG_GRGPIO_ENABLE : integer := 1; constant CFG_GRGPIO_IMASK : integer := 16#0FFFE#; constant CFG_GRGPIO_WIDTH : integer := (32); -- I2C master constant CFG_I2C_ENABLE : integer := 1; -- VGA and PS2/ interface constant CFG_KBD_ENABLE : integer := 0; constant CFG_VGA_ENABLE : integer := 0; constant CFG_SVGA_ENABLE : integer := 0; -- AMBA System ACE Interface Controller constant CFG_GRACECTRL : integer := 1; -- GRLIB debugging constant CFG_DUART : integer := 0; end;
gpl-2.0
4c5985b0e5023a8b1c087757a4ac6525
0.64552
3.625213
false
false
false
false
marco-c/leon-nexys2
grlib-gpl-1.3.4-b4140/designs/leon3-digilent-nexys4/project_1/project_1.srcs/sources_1/imports/sources/bft.vhdl
1
11,148
--///////////////////////////////////////////////////////////////////////// --// Copyright (c) 2008 Xilinx, Inc. All rights reserved. --// --// XILINX CONFIDENTIAL PROPERTY --// This document contains proprietary information which is --// protected by copyright. All rights are reserved. This notice --// refers to original work by Xilinx, Inc. which may be derivitive --// of other work distributed under license of the authors. In the --// case of derivitive work, nothing in this notice overrides the --// original author's license agreeement. Where applicable, the --// original license agreement is included in it's original --// unmodified form immediately below this header. --// --// Xilinx, Inc. --// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A --// COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS --// ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR --// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION --// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE --// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. --// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO --// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO --// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE --// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY --// AND FITNESS FOR A PARTICULAR PURPOSE. --// --///////////////////////////////////////////////////////////////////////// library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_ARITH.all; use IEEE.STD_LOGIC_SIGNED.all; library bftLib; use bftLib.bftPackage.all; entity bft is port ( wbClk, bftClk, reset : in std_logic; wbDataForInput :in std_logic; wbWriteOut: in std_logic; wbDataForOutput : out std_logic; wbInputData : in std_logic_vector (31 downto 0); wbOutputData : out std_logic_vector (31 downto 0); error : out std_logic ); attribute fsm_encoding :string; attribute fsm_encoding of bft : entity is "one-hot" ; end entity bft; architecture aBFT of bft is component FifoBuffer port ( din: IN std_logic_VECTOR(31 downto 0); rd_clk: IN std_logic; rd_en: IN std_logic; rst: IN std_logic; wr_clk: IN std_logic; wr_en: IN std_logic; dout: OUT std_logic_VECTOR(31 downto 0); empty: OUT std_logic; full: OUT std_logic); end component; signal rnd1_2, rnd2_3, rnd3_4, toBft, fromBft : xType; type demuxType is array (integer range STAGES/2-1 downto 0) of std_logic_vector (2*DATA_WIDTH-1 downto 0); signal demux : demuxType; type fifoStateType is (s0,s1,s2,s3,s4,s5,s6,s7); type demuxStateType is (stall, run); signal loadState, loadNextState : fifoStateType; signal readState, readNextSTate : fifoStateType; signal demuxState : demuxStateType; signal ingressFifoWrEn: std_logic; signal validForEgressFifo : std_logic_vector (13 downto 0); -- a shiftregister to keep track of valid BFT data. signal loadIngressFifo, ingressFifoFull, ingressFifoEmpty : std_logic_vector (STAGES/2 -1 downto 0); signal egressFifoFull, egressFifoEmpty, readEgressFifo,fifoSelect : std_logic_vector (STAGES/2 -1 downto 0); signal readIngressFifo, loadEgressFoo: std_logic; signal loadEgressFifo : std_logic_vector (7 downto 0); signal wbDataForInputReg : std_logic; --data needs two levels of pipelining. signal wbInputDataStage0, wbInputDataStage1 : std_logic_vector (31 downto 0); begin --get the data back in sync with the enable process (wbClk) begin wbInputDataStage0 <= wbInputData; wbInputDataStage1 <= wbInputDataStage0; end process; --state machine to load data from the WB bus to the input fifos process (wbClk) begin if rising_edge(wbClk) then if (reset = '1') then readIngressFifo <='1'; loadState <= s0; wbDataForInputReg <= '0'; else readIngressFifo <='0'; loadState <= loadNextState; wbDataForInputReg <= wbDataForInput; end if; end if; end process; -- A simple state machine to run the 1 to 4 demux -- loadIngressFifo is later used as a onehot enable to the fifos process ( loadState, wbDataForInputReg) begin case loadState is when s0 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<= X"01"; loadNextState <= s1; else loadIngressFifo<= (others =>'0'); loadNextState <= s0; end if; when s1 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<=X"02"; loadNextState <= s2; else loadIngressFifo<= ( others =>'0'); loadNextState <= s1; end if; when s2 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<=X"04"; loadNextState <= s3; else loadIngressFifo<= ( others =>'0'); loadNextState <= s2; end if; when s3 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<= X"08"; loadNextState <= s4; else loadIngressFifo<= ( others =>'0'); loadNextState <= s3; end if; when s4 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<= X"10"; loadNextState <= s5; else loadIngressFifo<= ( others =>'0'); loadNextState <= s4; end if; when s5 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<= X"20"; loadNextState <= s6; else loadIngressFifo<= ( others =>'0'); loadNextState <= s5; end if; when s6 => loadEgressFoo <='0'; if (wbDataForInputReg='1') then loadIngressFifo<= X"40"; loadNextState <= s7; else loadIngressFifo<= ( others =>'0'); loadNextState <= s6; end if; when s7 => loadEgressFoo <='1'; if (wbDataForInputReg='1') then loadIngressFifo<= X"80"; loadNextState <= s0; else loadIngressFifo<= ( others =>'0'); loadNextState <= s7; end if; when others => end case; end process; process (wbClk) begin if rising_edge(wbClk) then loadEgressFifo(0) <= loadEgressFoo; loadEgressFifo(7 downto 1) <= loadEgressFifo(6 downto 0); end if; end process; --call the processing elements arnd1: entity bftLib.round_1(aR1) port map (clk => bftClk, x => toBft, xOut=>rnd1_2); arnd2: entity bftLib.round_2(aR2) port map (clk => bftClk, x => rnd1_2, xOut=>rnd2_3); arnd3: entity bftLib.round_3(aR3) port map (clk => bftClk, x => rnd2_3, xOut=>rnd3_4); arnd4: entity bftLib.round_4(aR4) port map (clk => bftClk, x => rnd3_4, xOut=>fromBft); process (wbClk) begin if rising_edge(wbClk) then ingressFifoWrEn <= not(wbDataForInput); end if; end process; process (bftClk) begin if rising_edge(bftClk) then if (reset = '1') then validForEgressFifo <= (others => '0'); else validForEgressFifo(0) <= not wbDataForInput; validForEgressFifo (13 downto 1) <= validForEgressFifo(12 downto 0); end if; end if; end process; --buffer the inputs ingressLoop : FOR N in 0 to STAGES/2 -1 generate ingressFifo: FifoBuffer port map (rd_clk => bftClk, wr_clk =>wbClk, din =>wbInputDataStage1, rd_en =>ingressFifoWrEn, rst =>reset, wr_en =>loadIngressFifo(N), dout(31 downto 16) =>toBft(2*N+1), dout(15 downto 0) =>toBft(2*N), empty=> ingressFifoEmpty(N) , full => ingressFifoFull(N)); end generate ingressLoop; --buffer the outputs egressLoop : for N in 0 to STAGES/2 -1 generate egressFifo: FifoBuffer port map (rd_clk => wbClk, wr_clk =>bftClk, din(31 downto 16) => fromBft(2*N+1), din(15 downto 0) => fromBft(2*N), rd_en =>readEgressFifo(N), rst =>reset, wr_en =>validForEgressFifo(9), dout =>deMux(N) , empty=> egressFifoEmpty(N) , full => egressFifoFull(N)); end generate egressLoop; --gennerate an error if full process (wbClk) begin if rising_edge(wbClk) then error <= egressFifoFull(7) or egressFifoFull(6) or egressFifoFull(5) or egressFifoFull(4) or egressFifoFull(3) or egressFifoFull(2) or egressFifoFull(1) or egressFifoFull(0) ; end if; end process; -- muxout the output -- start when output fifo has data (!empty) -- stops when the output fifo goes empty --use wbWriteOut (inverted from wb_we_i) as initiator. process (wbClk) begin if rising_edge(wbClk) then if (reset = '1') then wbDataForOutput <= '0'; demuxState <=stall; wbOutputData <= (others => '0'); fifoSelect <= (others => '0'); -- readEgressFifo <= (others => '0'); else case demuxState is when stall => wbDataForOutput <= '0'; wbOutputData <= (others => '0'); if (wbWriteOut = '1') then demuxState <= run; fifoSelect <= X"01"; else demuxState <= stall; end if; when run => fifoSelect <= fifoSelect(STAGES/2 -2 downto 0)&fifoSelect(STAGES/2 -1); wbDataForOutput <= '1'; case fifoSelect is when X"01"=> wbOutputData <=deMux(0); when X"02"=> wbOutputData <=deMux(1); when X"04"=> wbOutputData <=deMux(2); when X"08"=> wbOutputData <=deMux(3); when X"10"=> wbOutputData <=deMux(4); when X"20"=> wbOutputData <=deMux(5); when X"40"=> wbOutputData <=deMux(6); when X"80"=> wbOutputData <=deMux(7); when others => end case; if (egressFifoEmpty(7) = '1') then demuxState <= stall; wbDataForOutput <= '0'; wbOutputData <= (others => '0'); end if; when others => end case; end if; end if; end process; -- enable the read fifo process (fifoSelect) begin readEgressFifo <= fifoSelect; end process; end architecture aBFT;
gpl-2.0
94cc77485a897eb9d557d452e9f743a2
0.564047
3.876217
false
false
false
false