---------------------------------------------------------------------------------------
-- Title          : Wishbone slave core for DDS RF distribution WB Slave
---------------------------------------------------------------------------------------
-- File           : dds_wbgen2_pkg.vhd
-- Author         : auto-generated by wbgen2 from dds_wb_slave.wb
-- Created        : Thu May 16 10:47:05 2013
-- Standard       : VHDL'87
---------------------------------------------------------------------------------------
-- THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE dds_wb_slave.wb
-- DO NOT HAND-EDIT UNLESS IT'S ABSOLUTELY NECESSARY!
---------------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.wbgen2_pkg.all;

package dds_wbgen2_pkg is
  
  
  -- Input registers (user design -> WB slave)
  
  type t_dds_in_registers is record
    cr_wr_link_i                             : std_logic;
    cr_wr_time_i                             : std_logic;
    gpior_pll_sdio_i                         : std_logic;
    gpior_pll_vcxo_sdo_i                     : std_logic;
    gpior_adc_sdo_i                          : std_logic;
    pd_fifo_wr_req_i                         : std_logic;
    pd_fifo_data_i                           : std_logic_vector(15 downto 0);
    tune_fifo_rd_req_i                       : std_logic;
    i2cr_scl_in_i                            : std_logic;
    i2cr_sda_in_i                            : std_logic;
    hit_cnt_hit_cnt_i                        : std_logic_vector(23 downto 0);
    miss_cnt_miss_cnt_i                      : std_logic_vector(23 downto 0);
    rx_cnt_rx_cnt_i                          : std_logic_vector(23 downto 0);
    tx_cnt_tx_cnt_i                          : std_logic_vector(23 downto 0);
    end record;
  
  constant c_dds_in_registers_init_value: t_dds_in_registers := (
    cr_wr_link_i => '0',
    cr_wr_time_i => '0',
    gpior_pll_sdio_i => '0',
    gpior_pll_vcxo_sdo_i => '0',
    gpior_adc_sdo_i => '0',
    pd_fifo_wr_req_i => '0',
    pd_fifo_data_i => (others => '0'),
    tune_fifo_rd_req_i => '0',
    i2cr_scl_in_i => '0',
    i2cr_sda_in_i => '0',
    hit_cnt_hit_cnt_i => (others => '0'),
    miss_cnt_miss_cnt_i => (others => '0'),
    rx_cnt_rx_cnt_i => (others => '0'),
    tx_cnt_tx_cnt_i => (others => '0')
    );
    
    -- Output registers (WB slave -> user design)
    
    type t_dds_out_registers is record
      cr_test_o                                : std_logic;
      cr_slave_o                               : std_logic;
      cr_master_o                              : std_logic;
      cr_adc_bb_enable_o                       : std_logic;
      cr_clk_id_o                              : std_logic_vector(15 downto 0);
      gpior_pll_sys_cs_n_o                     : std_logic;
      gpior_pll_sys_reset_n_o                  : std_logic;
      gpior_pll_sclk_o                         : std_logic;
      gpior_pll_sdio_o                         : std_logic;
      gpior_pll_sdio_load_o                    : std_logic;
      gpior_pll_sdio_dir_o                     : std_logic;
      gpior_pll_vcxo_reset_n_o                 : std_logic;
      gpior_pll_vcxo_cs_n_o                    : std_logic;
      gpior_pll_vcxo_function_o                : std_logic;
      gpior_adf_ce_o                           : std_logic;
      gpior_adf_clk_o                          : std_logic;
      gpior_adf_le_o                           : std_logic;
      gpior_adf_data_o                         : std_logic;
      gpior_adc_sdi_o                          : std_logic;
      gpior_adc_cnv_o                          : std_logic;
      gpior_adc_sck_o                          : std_logic;
      pd_fifo_wr_full_o                        : std_logic;
      pd_fifo_wr_empty_o                       : std_logic;
      tune_fifo_rd_empty_o                     : std_logic;
      tune_fifo_data_o                         : std_logic_vector(31 downto 0);
      freq_hi_o                                : std_logic_vector(31 downto 0);
      freq_lo_o                                : std_logic_vector(31 downto 0);
      gain_o                                   : std_logic_vector(15 downto 0);
      rstr_pll_rst_o                           : std_logic;
      rstr_sw_rst_o                            : std_logic;
      i2cr_scl_out_o                           : std_logic;
      i2cr_sda_out_o                           : std_logic;
      pir_kp_o                                 : std_logic_vector(15 downto 0);
      pir_ki_o                                 : std_logic_vector(15 downto 0);
      dlyr_delay_o                             : std_logic_vector(15 downto 0);
      phaser_phase_o                           : std_logic_vector(15 downto 0);
      macl_macl_o                              : std_logic_vector(31 downto 0);
      mach_mach_o                              : std_logic_vector(15 downto 0);
      end record;
    
    constant c_dds_out_registers_init_value: t_dds_out_registers := (
      cr_test_o => '0',
      cr_slave_o => '0',
      cr_master_o => '0',
      cr_adc_bb_enable_o => '0',
      cr_clk_id_o => (others => '0'),
      gpior_pll_sys_cs_n_o => '0',
      gpior_pll_sys_reset_n_o => '0',
      gpior_pll_sclk_o => '0',
      gpior_pll_sdio_o => '0',
      gpior_pll_sdio_load_o => '0',
      gpior_pll_sdio_dir_o => '0',
      gpior_pll_vcxo_reset_n_o => '0',
      gpior_pll_vcxo_cs_n_o => '0',
      gpior_pll_vcxo_function_o => '0',
      gpior_adf_ce_o => '0',
      gpior_adf_clk_o => '0',
      gpior_adf_le_o => '0',
      gpior_adf_data_o => '0',
      gpior_adc_sdi_o => '0',
      gpior_adc_cnv_o => '0',
      gpior_adc_sck_o => '0',
      pd_fifo_wr_full_o => '0',
      pd_fifo_wr_empty_o => '0',
      tune_fifo_rd_empty_o => '0',
      tune_fifo_data_o => (others => '0'),
      freq_hi_o => (others => '0'),
      freq_lo_o => (others => '0'),
      gain_o => (others => '0'),
      rstr_pll_rst_o => '0',
      rstr_sw_rst_o => '0',
      i2cr_scl_out_o => '0',
      i2cr_sda_out_o => '0',
      pir_kp_o => (others => '0'),
      pir_ki_o => (others => '0'),
      dlyr_delay_o => (others => '0'),
      phaser_phase_o => (others => '0'),
      macl_macl_o => (others => '0'),
      mach_mach_o => (others => '0')
      );
    function "or" (left, right: t_dds_in_registers) return t_dds_in_registers;
    function f_x_to_zero (x:std_logic) return std_logic;
    function f_x_to_zero (x:std_logic_vector) return std_logic_vector;
end package;

package body dds_wbgen2_pkg is
function f_x_to_zero (x:std_logic) return std_logic is
begin
if(x = 'X' or x = 'U') then
return '0';
else
return x;
end if; 
end function;
function f_x_to_zero (x:std_logic_vector) return std_logic_vector is
variable tmp: std_logic_vector(x'length-1 downto 0);
begin
for i in 0 to x'length-1 loop
if(x(i) = 'X' or x(i) = 'U') then
tmp(i):= '0';
else
tmp(i):=x(i);
end if; 
end loop; 
return tmp;
end function;
function "or" (left, right: t_dds_in_registers) return t_dds_in_registers is
variable tmp: t_dds_in_registers;
begin
tmp.cr_wr_link_i := f_x_to_zero(left.cr_wr_link_i) or f_x_to_zero(right.cr_wr_link_i);
tmp.cr_wr_time_i := f_x_to_zero(left.cr_wr_time_i) or f_x_to_zero(right.cr_wr_time_i);
tmp.gpior_pll_sdio_i := f_x_to_zero(left.gpior_pll_sdio_i) or f_x_to_zero(right.gpior_pll_sdio_i);
tmp.gpior_pll_vcxo_sdo_i := f_x_to_zero(left.gpior_pll_vcxo_sdo_i) or f_x_to_zero(right.gpior_pll_vcxo_sdo_i);
tmp.gpior_adc_sdo_i := f_x_to_zero(left.gpior_adc_sdo_i) or f_x_to_zero(right.gpior_adc_sdo_i);
tmp.pd_fifo_wr_req_i := f_x_to_zero(left.pd_fifo_wr_req_i) or f_x_to_zero(right.pd_fifo_wr_req_i);
tmp.pd_fifo_data_i := f_x_to_zero(left.pd_fifo_data_i) or f_x_to_zero(right.pd_fifo_data_i);
tmp.tune_fifo_rd_req_i := f_x_to_zero(left.tune_fifo_rd_req_i) or f_x_to_zero(right.tune_fifo_rd_req_i);
tmp.i2cr_scl_in_i := f_x_to_zero(left.i2cr_scl_in_i) or f_x_to_zero(right.i2cr_scl_in_i);
tmp.i2cr_sda_in_i := f_x_to_zero(left.i2cr_sda_in_i) or f_x_to_zero(right.i2cr_sda_in_i);
tmp.hit_cnt_hit_cnt_i := f_x_to_zero(left.hit_cnt_hit_cnt_i) or f_x_to_zero(right.hit_cnt_hit_cnt_i);
tmp.miss_cnt_miss_cnt_i := f_x_to_zero(left.miss_cnt_miss_cnt_i) or f_x_to_zero(right.miss_cnt_miss_cnt_i);
tmp.rx_cnt_rx_cnt_i := f_x_to_zero(left.rx_cnt_rx_cnt_i) or f_x_to_zero(right.rx_cnt_rx_cnt_i);
tmp.tx_cnt_tx_cnt_i := f_x_to_zero(left.tx_cnt_tx_cnt_i) or f_x_to_zero(right.tx_cnt_tx_cnt_i);
return tmp;
end function;
end package body;
