Commit e58dc553 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez

Fix indentation.

parent ea659890
Subproject commit f0519a1f5f7f2261b861e6a6d4562e2bec875fb4 Subproject commit 4e5e3dfc01e395a81d9403bd1e150560972685f7
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Entity: dummy_time -- Entity: dummy_time
-- File: dummy_time.vhd -- File: dummy_time.vhd
-- Description: ¿? -- Description: ¿?
-- Author: Javier Diaz (jdiaz@atc.ugr.es) -- Author: Javier Diaz (jdiaz@atc.ugr.es)
-- Date: 8 March 2012 -- Date: 8 March 2012
-- Version: 0.01 -- Version: 0.01
-- To do: -- To do:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- GNU LESSER GENERAL PUBLIC LICENSE -- GNU LESSER GENERAL PUBLIC LICENSE
-- ----------------------------------- -- -----------------------------------
-- This source file is free software; you can redistribute it and/or modify it -- This source file 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 -- under the terms of the GNU Lesser General Public License as published by the
-- Free Software Foundation; either version 2.1 of the License, or (at your -- Free Software Foundation; either version 2.1 of the License, or (at your
-- option) any later version. -- option) any later version.
-- This source is distributed in the hope that it will be useful, but WITHOUT -- This source is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License -- 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 -- for more details. You should have received a copy of the GNU Lesser General
-- Public License along with this source; if not, download it from -- Public License along with this source; if not, download it from
-- http://www.gnu.org/licenses/lgpl-2.1.html -- http://www.gnu.org/licenses/lgpl-2.1.html
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
library ieee;
library ieee; use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
--use IEEE.NUMERIC_STD.ALL; --use IEEE.NUMERIC_STD.ALL;
use ieee.std_logic_unsigned.all; use ieee.std_logic_unsigned.all;
entity dummy_time is
port(clk_sys : in std_logic; -- data output reference clock 125MHz
rst_n : in std_logic; -- system reset
-- utc time in seconds
tm_utc : out std_logic_vector(39 downto 0);
-- number of clk_ref_i cycles
tm_cycles : out std_logic_vector(27 downto 0));
end dummy_time;
architecture Behavioral of dummy_time is
signal OneSecond : std_logic;
signal init_time : std_logic;
signal tm_cycles_Aux : std_logic_vector(27 downto 0);
signal tm_utc_Aux : std_logic_vector(39 downto 0);
constant MaxCountcycles1 : std_logic_vector(27 downto 0) := "0111011100110101100100111111"; --125.000.000-1
constant MaxCountcycles2 : std_logic_vector(27 downto 0) := "0111011100110101100101000000"; --125.000.000
constant AllOnesUTC : std_logic_vector(39 downto 0) := (others => '1');
begin
---------------------------------------
-- Process to count cycles in a second
---------------------------------------
P_CountTM_cycles :
process(rst_n, clk_sys)
begin
if(rst_n = '0') then
tm_cycles_Aux <= (others => '0');
oneSecond <= '0';
init_time <= '0';
elsif(rising_Edge(Clk_sys)) then
if (Tm_cycles_Aux /= MaxCountcycles2) then
tm_cycles_Aux <= tm_cycles_Aux + 1;
else
tm_cycles_Aux <= (others => '0');
end if;
if(Tm_cycles_Aux = MaxCountcycles1) then
OneSecond <= '1';
else
OneSecond <= '0';
end if;
init_time <= '1';
end if;
end process P_CountTM_cycles;
P_CountTM_UTC :
process(rst_n, clk_sys)
begin
if(rst_n = '0') then
tm_utc_Aux <= (others => '0');
elsif(rising_edge(Clk_sys)) then
if (OneSecond = '1') then
if (tm_utc_Aux /= AllOnesUTC) then
tm_utc_Aux <= tm_utc_Aux + 1;
else
tm_utc_Aux <= (others => '0');
end if;
end if;
end if;
end process P_CountTM_UTC;
tm_cycles <= tm_cycles_Aux when init_time = '1' else (others => '1');
tm_utc <= tm_utc_Aux when init_time = '1' else (others => '1');
entity dummy_time is end Behavioral;
port(clk_sys : in std_logic; -- data output reference clock 125MHz
rst_n: in std_logic; -- system reset
-- utc time in seconds
tm_utc : out std_logic_vector(39 downto 0);
-- number of clk_ref_i cycles
tm_cycles : out std_logic_vector(27 downto 0));
end dummy_time;
architecture Behavioral of dummy_time is
signal OneSecond: std_logic;
signal init_time: std_logic;
signal tm_cycles_Aux: std_logic_vector(27 downto 0);
signal tm_utc_Aux: std_logic_vector(39 downto 0);
constant MaxCountcycles1: std_logic_vector(27 downto 0) :="0111011100110101100100111111"; --125.000.000-1
constant MaxCountcycles2: std_logic_vector(27 downto 0) :="0111011100110101100101000000"; --125.000.000
constant AllOnesUTC: std_logic_vector(39 downto 0):=(others=>'1');
begin
---------------------------------------
-- Process to count cycles in a second
---------------------------------------
P_CountTM_cycles:
process(rst_n, clk_sys)
begin
if(rst_n = '0') then
tm_cycles_Aux <= (others=>'0');
oneSecond <= '0';
init_time <= '0';
elsif(rising_Edge(Clk_sys)) then
if (Tm_cycles_Aux /= MaxCountcycles2) then
tm_cycles_Aux <= tm_cycles_Aux + 1;
else
tm_cycles_Aux <= (others=>'0');
end if;
if(Tm_cycles_Aux = MaxCountcycles1) then
OneSecond <= '1';
else
OneSecond <= '0';
end if;
init_time <= '1';
end if;
end process P_CountTM_cycles;
P_CountTM_UTC:
process(rst_n, clk_sys)
begin
if(rst_n = '0') then
tm_utc_Aux <= (others=>'0');
elsif(rising_edge(Clk_sys)) then
if (OneSecond='1') then
if (tm_utc_Aux /= AllOnesUTC) then
tm_utc_Aux <= tm_utc_Aux + 1;
else
tm_utc_Aux <= (others=>'0');
end if;
end if;
end if;
end process P_CountTM_UTC;
tm_cycles <= tm_cycles_Aux when init_time = '1' else (others=>'1');
tm_utc <= tm_utc_Aux when init_time = '1' else (others=>'1');
end Behavioral;
...@@ -27,111 +27,107 @@ ...@@ -27,111 +27,107 @@
-- http://www.gnu.org/licenses/lgpl-2.1.html -- http://www.gnu.org/licenses/lgpl-2.1.html
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
library ieee; library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
entity immed_pulse_counter is entity immed_pulse_counter is
generic ( generic (
-- reference clock frequency -- reference clock frequency
pulse_length_width : integer := 28 pulse_length_width : integer := 28
); );
port ( port (
clk_i : in std_logic; clk_i : in std_logic;
rst_n_i : in std_logic; -- asynchronous system reset rst_n_i : in std_logic; -- asynchronous system reset
pulse_start_i : in std_logic; -- asynchronous strobe for pulse generation pulse_start_i : in std_logic; -- asynchronous strobe for pulse generation
pulse_length_i : in std_logic_vector(pulse_length_width-1 downto 0); -- asynchronous signal pulse_length_i : in std_logic_vector(pulse_length_width-1 downto 0); -- asynchronous signal
pulse_output_o : out std_logic pulse_output_o : out std_logic
); );
end immed_pulse_counter; end immed_pulse_counter;
architecture rtl of immed_pulse_counter is architecture rtl of immed_pulse_counter is
-- Internal registers to hold pulse duration -- Internal registers to hold pulse duration
signal counter : unsigned (pulse_length_width-1 downto 0); signal counter : unsigned (pulse_length_width-1 downto 0);
-- Signals for states -- Signals for states
type counter_state is (WAIT_ST, COUNTING); type counter_state is (WAIT_ST, COUNTING);
signal state : counter_state; signal state : counter_state;
-- Signal for synchronization (in fact they are not so necessary for current system...) -- Signal for synchronization (in fact they are not so necessary for current system...)
signal pulse_start_d0, pulse_start_d1, pulse_start_d2, pulse_start_d3 : std_logic; signal pulse_start_d0, pulse_start_d1, pulse_start_d2, pulse_start_d3 : std_logic;
signal nozerolength, nozerolength_aux : boolean; signal nozerolength, nozerolength_aux : boolean;
-- Aux
constant zeros : std_logic_vector(pulse_length_width-1 downto 0) := (others=>'0');
begin -- architecture rtl
-- Aux
constant zeros : std_logic_vector(pulse_length_width-1 downto 0) := (others => '0');
begin -- architecture rtl
synchronization: process(clk_i, rst_n_i) synchronization : process(clk_i, rst_n_i)
begin begin
if (rst_n_i='0') then if (rst_n_i = '0') then
pulse_start_d0 <='0'; pulse_start_d0 <= '0';
pulse_start_d1 <='0'; pulse_start_d1 <= '0';
pulse_start_d2 <='0'; pulse_start_d2 <= '0';
pulse_start_d3 <='0'; pulse_start_d3 <= '0';
elsif rising_edge(clk_i) then elsif rising_edge(clk_i) then
pulse_start_d0<=pulse_start_i; pulse_start_d0 <= pulse_start_i;
pulse_start_d1<=pulse_start_d0; pulse_start_d1 <= pulse_start_d0;
pulse_start_d2<=pulse_start_d1; pulse_start_d2 <= pulse_start_d1;
pulse_start_d3<=pulse_start_d2; pulse_start_d3 <= pulse_start_d2;
nozerolength_aux<=pulse_length_i/=zeros; nozerolength_aux <= pulse_length_i /= zeros;
if (pulse_start_d2='1' and pulse_start_d1='0') then if (pulse_start_d2 = '1' and pulse_start_d1 = '0') then
nozerolength<=nozerolength_aux; nozerolength <= nozerolength_aux;
end if; end if;
end if; end if;
end process; end process;
state_process : process(clk_i, rst_n_i) state_process : process(clk_i, rst_n_i)
begin begin
if (rst_n_i='0') then if (rst_n_i = '0') then
counter <=(others=>'0'); counter <= (others => '0');
state <=WAIT_ST; state <= WAIT_ST;
elsif rising_edge(clk_i) then elsif rising_edge(clk_i) then
case state is case state is
when WAIT_ST => when WAIT_ST =>
if pulse_start_d3='1' and nozerolength then if pulse_start_d3 = '1' and nozerolength then
state <=COUNTING; state <= COUNTING;
counter <=unsigned(pulse_length_i)-1; counter <= unsigned(pulse_length_i)-1;
else else
state<=WAIT_ST; state <= WAIT_ST;
end if; end if;
when COUNTING => when COUNTING =>
if (counter=0) then if (counter = 0) then
state <= WAIT_ST; state <= WAIT_ST;
else else
state <= COUNTING; state <= COUNTING;
counter<=counter-1; counter <= counter-1;
end if; end if;
when others => when others =>
state<=WAIT_ST; state <= WAIT_ST;
end case; end case;
end if; end if;
end process; end process;
output_process:process(counter, state) output_process : process(counter, state)
begin begin
if (rst_n_i='0') then if (rst_n_i = '0') then
pulse_output_o <='0'; pulse_output_o <= '0';
else else
case state is case state is
when WAIT_ST => when WAIT_ST =>
pulse_output_o <='0'; pulse_output_o <= '0';
when COUNTING => when COUNTING =>
pulse_output_o <='1'; pulse_output_o <= '1';
when others => when others =>
pulse_output_o <='0'; pulse_output_o <= '0';
end case; end case;
end if; end if;
end process; end process;
end architecture rtl; end architecture rtl;
...@@ -39,7 +39,7 @@ use ieee.std_logic_1164.all; ...@@ -39,7 +39,7 @@ use ieee.std_logic_1164.all;
use ieee.numeric_std.all; use ieee.numeric_std.all;
entity pulse_gen_pl is entity pulse_gen_pl is
generic ( generic (
-- reference clock frequency -- reference clock frequency
g_ref_clk_rate : integer := 125000000); g_ref_clk_rate : integer := 125000000);
...@@ -96,10 +96,10 @@ architecture rtl of pulse_gen_pl is ...@@ -96,10 +96,10 @@ architecture rtl of pulse_gen_pl is
signal trig_valid_ref_p1 : std_logic; signal trig_valid_ref_p1 : std_logic;
-- Aux -- Aux
constant zeros : std_logic_vector(27 downto 0) := (others => '0'); constant zeros : std_logic_vector(27 downto 0) := (others => '0');
signal counter : unsigned (27 downto 0); signal counter : unsigned (27 downto 0);
signal nozerolength : boolean; signal nozerolength : boolean;
begin -- architecture rtl begin -- architecture rtl
-- Get trigger time into internal registers -- Get trigger time into internal registers
...@@ -215,5 +215,5 @@ begin -- architecture rtl ...@@ -215,5 +215,5 @@ begin -- architecture rtl
end if; end if;
end if; end if;
end process gen_out; end process gen_out;
end architecture rtl; end architecture rtl;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- Author : Javier Díaz -- Author : Javier Díaz
-- Company : Seven Solutions -- Company : Seven Solutions
-- Created : 2012-07-25 -- Created : 2012-07-25
-- Last update: 2012-07-25 -- Last update: 2019-08-27
-- Platform : FPGA-generic -- Platform : FPGA-generic
-- Standard : VHDL -- Standard : VHDL
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
...@@ -33,32 +33,32 @@ entity wr_dio is ...@@ -33,32 +33,32 @@ entity wr_dio is
generic ( generic (
g_interface_mode : t_wishbone_interface_mode := CLASSIC; g_interface_mode : t_wishbone_interface_mode := CLASSIC;
g_address_granularity : t_wishbone_address_granularity := WORD g_address_granularity : t_wishbone_address_granularity := WORD
); );
port ( port (
clk_sys_i : in std_logic; clk_sys_i : in std_logic;
clk_ref_i : in std_logic; clk_ref_i : in std_logic;
rst_n_i : in std_logic; rst_n_i : in std_logic;
dio_clk_i : in std_logic; dio_clk_i : in std_logic;
dio_pps_i : in std_logic; dio_pps_i : in std_logic;
dio_in_i : in std_logic_vector(4 downto 0); dio_in_i : in std_logic_vector(4 downto 0);
dio_out_o : out std_logic_vector(4 downto 0); dio_out_o : out std_logic_vector(4 downto 0);
dio_oe_n_o : out std_logic_vector(4 downto 0); dio_oe_n_o : out std_logic_vector(4 downto 0);
dio_term_en_o : out std_logic_vector(4 downto 0); dio_term_en_o : out std_logic_vector(4 downto 0);
dio_onewire_b : inout std_logic; dio_onewire_b : inout std_logic;
dio_sdn_n_o : out std_logic; dio_sdn_n_o : out std_logic;
dio_sdn_ck_n_o : out std_logic; dio_sdn_ck_n_o : out std_logic;
dio_led_top_o : out std_logic; dio_led_top_o : out std_logic;
dio_led_bot_o : out std_logic; dio_led_bot_o : out std_logic;
dio_scl_b : inout std_logic; dio_scl_b : inout std_logic;
dio_sda_b : inout std_logic; dio_sda_b : inout std_logic;
dio_ga_o : out std_logic_vector(1 downto 0); dio_ga_o : out std_logic_vector(1 downto 0);
dio_int : out std_logic; dio_int : out std_logic;
tm_time_valid_i : in std_logic; tm_time_valid_i : in std_logic;
tm_seconds_i : in std_logic_vector(39 downto 0); tm_seconds_i : in std_logic_vector(39 downto 0);
tm_cycles_i : in std_logic_vector(27 downto 0); tm_cycles_i : in std_logic_vector(27 downto 0);
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Wishbone bus -- Wishbone bus
...@@ -73,15 +73,15 @@ entity wr_dio is ...@@ -73,15 +73,15 @@ entity wr_dio is
wb_ack_o : out std_logic; wb_ack_o : out std_logic;
wb_stall_o : out std_logic; wb_stall_o : out std_logic;
wb_irq_o : out std_logic; wb_irq_o : out std_logic;
-- Debug signals for chipscope -- Debug signals for chipscope
TRIG0 : out std_logic_vector(31 downto 0); TRIG0 : out std_logic_vector(31 downto 0);
TRIG1 : out std_logic_vector(31 downto 0); TRIG1 : out std_logic_vector(31 downto 0);
TRIG2 : out std_logic_vector(31 downto 0); TRIG2 : out std_logic_vector(31 downto 0);
TRIG3 : out std_logic_vector(31 downto 0) TRIG3 : out std_logic_vector(31 downto 0)
); );
end wr_dio; end wr_dio;
architecture rtl of wr_dio is architecture rtl of wr_dio is
...@@ -111,10 +111,10 @@ architecture rtl of wr_dio is ...@@ -111,10 +111,10 @@ architecture rtl of wr_dio is
dio_scl_b : inout std_logic; dio_scl_b : inout std_logic;
dio_sda_b : inout std_logic; dio_sda_b : inout std_logic;
dio_ga_o : out std_logic_vector(1 downto 0); dio_ga_o : out std_logic_vector(1 downto 0);
tm_time_valid_i : in std_logic; tm_time_valid_i : in std_logic;
tm_seconds_i : in std_logic_vector(39 downto 0); tm_seconds_i : in std_logic_vector(39 downto 0);
tm_cycles_i : in std_logic_vector(27 downto 0); tm_cycles_i : in std_logic_vector(27 downto 0);
TRIG0 : out std_logic_vector(31 downto 0); TRIG0 : out std_logic_vector(31 downto 0);
...@@ -122,18 +122,18 @@ architecture rtl of wr_dio is ...@@ -122,18 +122,18 @@ architecture rtl of wr_dio is
TRIG2 : out std_logic_vector(31 downto 0); TRIG2 : out std_logic_vector(31 downto 0);
TRIG3 : out std_logic_vector(31 downto 0); TRIG3 : out std_logic_vector(31 downto 0);
slave_i : in t_wishbone_slave_in; slave_i : in t_wishbone_slave_in;
slave_o : out t_wishbone_slave_out; slave_o : out t_wishbone_slave_out;
dio_int : out std_logic dio_int : out std_logic
); );
end component; --DIO core end component; --DIO core
signal wb_out : t_wishbone_slave_out; signal wb_out : t_wishbone_slave_out;
signal wb_in : t_wishbone_slave_in; signal wb_in : t_wishbone_slave_in;
-------------------------------------------------------------------------------
begin
U_WRAPPER_DIO : xwr_dio begin
U_WRAPPER_DIO : xwr_dio
generic map ( generic map (
g_interface_mode => g_interface_mode, g_interface_mode => g_interface_mode,
g_address_granularity => g_address_granularity) g_address_granularity => g_address_granularity)
...@@ -143,39 +143,39 @@ U_WRAPPER_DIO : xwr_dio ...@@ -143,39 +143,39 @@ U_WRAPPER_DIO : xwr_dio
clk_ref_i => clk_ref_i, clk_ref_i => clk_ref_i,
rst_n_i => rst_n_i, rst_n_i => rst_n_i,
dio_clk_i => dio_clk_i, dio_clk_i => dio_clk_i,
dio_pps_i => dio_pps_i, dio_pps_i => dio_pps_i,
dio_in_i => dio_in_i, dio_in_i => dio_in_i,
dio_out_o => dio_out_o, dio_out_o => dio_out_o,
dio_oe_n_o => dio_oe_n_o, dio_oe_n_o => dio_oe_n_o,
dio_term_en_o => dio_term_en_o, dio_term_en_o => dio_term_en_o,
dio_onewire_b => dio_onewire_b, dio_onewire_b => dio_onewire_b,
dio_sdn_n_o => dio_sdn_n_o, dio_sdn_n_o => dio_sdn_n_o,
dio_sdn_ck_n_o => dio_sdn_ck_n_o, dio_sdn_ck_n_o => dio_sdn_ck_n_o,
dio_led_top_o => dio_led_top_o, dio_led_top_o => dio_led_top_o,
dio_led_bot_o => dio_led_bot_o, dio_led_bot_o => dio_led_bot_o,
dio_scl_b => dio_scl_b, dio_scl_b => dio_scl_b,
dio_sda_b => dio_sda_b, dio_sda_b => dio_sda_b,
dio_ga_o => dio_ga_o, dio_ga_o => dio_ga_o,
tm_time_valid_i => tm_time_valid_i, tm_time_valid_i => tm_time_valid_i,
tm_seconds_i => tm_seconds_i, tm_seconds_i => tm_seconds_i,
tm_cycles_i => tm_cycles_i, tm_cycles_i => tm_cycles_i,
slave_i => wb_in, slave_i => wb_in,
slave_o => wb_out, slave_o => wb_out,
dio_int => dio_int dio_int => dio_int
-- Chipscope, debugging signals -- Chipscope, debugging signals
--TRIG0 => TRIG0, --TRIG0 => TRIG0,
--TRIG1 => TRIG1, --TRIG1 => TRIG1,
--TRIG2 => TRIG2, --TRIG2 => TRIG2,
--TRIG3 => TRIG3, --TRIG3 => TRIG3,
); );
wb_in.cyc <= wb_cyc_i; wb_in.cyc <= wb_cyc_i;
wb_in.stb <= wb_stb_i; wb_in.stb <= wb_stb_i;
wb_in.we <= wb_we_i; wb_in.we <= wb_we_i;
...@@ -185,7 +185,7 @@ U_WRAPPER_DIO : xwr_dio ...@@ -185,7 +185,7 @@ U_WRAPPER_DIO : xwr_dio
wb_dat_o <= wb_out.dat; wb_dat_o <= wb_out.dat;
wb_ack_o <= wb_out.ack; wb_ack_o <= wb_out.ack;
wb_stall_o <= wb_out.stall; wb_stall_o <= wb_out.stall;
-----------------------------------------------------------------------------------
end rtl; end rtl;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- Author : Javier Díaz -- Author : Javier Díaz
-- Company : Seven Solutions, UGR -- Company : Seven Solutions, UGR
-- Created : 2012-07-18 -- Created : 2012-07-18
-- Last update: 2012-06-19 -- Last update: 2019-08-27
-- Platform : FPGA-generics -- Platform : FPGA-generics
-- Standard : VHDL -- Standard : VHDL
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
...@@ -36,92 +36,92 @@ package wr_dio_pkg is ...@@ -36,92 +36,92 @@ package wr_dio_pkg is
-- DIO -- DIO
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
constant c_xwr_dio_sdb : t_sdb_product := ( constant c_xwr_dio_sdb : t_sdb_product := (
vendor_id => x"00000000000075CB", -- SEVEN SOLUTIONS vendor_id => x"00000000000075CB", -- SEVEN SOLUTIONS
device_id => x"00000002", device_id => x"00000002",
version => x"00000002", version => x"00000002",
date => x"20120720", date => x"20120720",
name => "WR-DIO-Core "); name => "WR-DIO-Core ");
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- DIO REGISTERS - (basic slave from wbgen2) -- DIO REGISTERS - (basic slave from wbgen2)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
constant c_xwr_dio_wb_sdb : t_sdb_device := ( constant c_xwr_dio_wb_sdb : t_sdb_device := (
abi_class => x"0000", -- undocumented device abi_class => x"0000", -- undocumented device
abi_ver_major => x"01", abi_ver_major => x"01",
abi_ver_minor => x"01", abi_ver_minor => x"01",
wbd_endian => c_sdb_endian_big, wbd_endian => c_sdb_endian_big,
wbd_width => x"7", -- 8/16/32-bit port granularity wbd_width => x"7", -- 8/16/32-bit port granularity
sdb_component => ( sdb_component => (
addr_first => x"0000000000000000", addr_first => x"0000000000000000",
addr_last => x"00000000000000ff", addr_last => x"00000000000000ff",
product => ( product => (
vendor_id => x"00000000000075CB", -- SEVEN SOLUTIONS vendor_id => x"00000000000075CB", -- SEVEN SOLUTIONS
device_id => x"00000001", device_id => x"00000001",
version => x"00000002", version => x"00000002",
date => x"20120709", date => x"20120709",
name => "WR-DIO-Registers "))); name => "WR-DIO-Registers ")));
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- SDB re-declaration of bridges function to include product info -- SDB re-declaration of bridges function to include product info
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Use the f_xwb_bridge_*_sdb to bridge a crossbar to another -- Use the f_xwb_bridge_*_sdb to bridge a crossbar to another
function f_xwb_bridge_product_manual_sdb( -- take a manual bus size function f_xwb_bridge_product_manual_sdb( -- take a manual bus size
g_size : t_wishbone_address; g_size : t_wishbone_address;
g_sdb_addr : t_wishbone_address; g_sdb_addr : t_wishbone_address;
g_sdb_product : t_sdb_product) return t_sdb_bridge; g_sdb_product : t_sdb_product) return t_sdb_bridge;
function f_xwb_bridge_product_layout_sdb( -- determine bus size from layout function f_xwb_bridge_product_layout_sdb( -- determine bus size from layout
g_wraparound : boolean := true; g_wraparound : boolean := true;
g_layout : t_sdb_record_array; g_layout : t_sdb_record_array;
g_sdb_addr : t_wishbone_address; g_sdb_addr : t_wishbone_address;
g_sdb_product : t_sdb_product) return t_sdb_bridge; g_sdb_product : t_sdb_product) return t_sdb_bridge;
end wr_dio_pkg; end wr_dio_pkg;
package body wr_dio_pkg is package body wr_dio_pkg is
function f_xwb_bridge_product_manual_sdb( function f_xwb_bridge_product_manual_sdb(
g_size : t_wishbone_address; g_size : t_wishbone_address;
g_sdb_addr : t_wishbone_address; g_sdb_addr : t_wishbone_address;
g_sdb_product: t_sdb_product) return t_sdb_bridge g_sdb_product : t_sdb_product) return t_sdb_bridge
is is
variable result : t_sdb_bridge; variable result : t_sdb_bridge;
begin begin
result.sdb_child := (others => '0'); result.sdb_child := (others => '0');
result.sdb_child(c_wishbone_address_width-1 downto 0) := g_sdb_addr; result.sdb_child(c_wishbone_address_width-1 downto 0) := g_sdb_addr;
result.sdb_component.addr_first := (others => '0'); result.sdb_component.addr_first := (others => '0');
result.sdb_component.addr_last := (others => '0'); result.sdb_component.addr_last := (others => '0');
result.sdb_component.addr_last(c_wishbone_address_width-1 downto 0) := g_size; result.sdb_component.addr_last(c_wishbone_address_width-1 downto 0) := g_size;
result.sdb_component.product.vendor_id := g_sdb_product.vendor_id; -- GSI result.sdb_component.product.vendor_id := g_sdb_product.vendor_id; -- GSI
result.sdb_component.product.device_id := g_sdb_product.device_id; result.sdb_component.product.device_id := g_sdb_product.device_id;
result.sdb_component.product.version := g_sdb_product.version; result.sdb_component.product.version := g_sdb_product.version;
result.sdb_component.product.date := g_sdb_product.date; result.sdb_component.product.date := g_sdb_product.date;
result.sdb_component.product.name := g_sdb_product.name; result.sdb_component.product.name := g_sdb_product.name;
return result; return result;
end f_xwb_bridge_product_manual_sdb; end f_xwb_bridge_product_manual_sdb;
function f_xwb_bridge_product_layout_sdb( function f_xwb_bridge_product_layout_sdb(
g_wraparound : boolean := true; g_wraparound : boolean := true;
g_layout : t_sdb_record_array; g_layout : t_sdb_record_array;
g_sdb_addr : t_wishbone_address; g_sdb_addr : t_wishbone_address;
g_sdb_product: t_sdb_product) return t_sdb_bridge g_sdb_product : t_sdb_product) return t_sdb_bridge
is is
alias c_layout : t_sdb_record_array(g_layout'length-1 downto 0) is g_layout; alias c_layout : t_sdb_record_array(g_layout'length-1 downto 0) is g_layout;
-- How much space does the ROM need? -- How much space does the ROM need?
constant c_used_entries : natural := c_layout'length + 1; constant c_used_entries : natural := c_layout'length + 1;
constant c_rom_entries : natural := 2**f_ceil_log2(c_used_entries); -- next power of 2 constant c_rom_entries : natural := 2**f_ceil_log2(c_used_entries); -- next power of 2
constant c_sdb_bytes : natural := c_sdb_device_length / 8; constant c_sdb_bytes : natural := c_sdb_device_length / 8;
constant c_rom_bytes : natural := c_rom_entries * c_sdb_bytes; constant c_rom_bytes : natural := c_rom_entries * c_sdb_bytes;
-- Step 2. Find the size of the bus -- Step 2. Find the size of the bus
function f_bus_end return unsigned is function f_bus_end return unsigned is
variable result : unsigned(63 downto 0); variable result : unsigned(63 downto 0);
variable sdb_component : t_sdb_component; variable sdb_component : t_sdb_component;
begin begin
if not g_wraparound then if not g_wraparound then
...@@ -131,12 +131,12 @@ package body wr_dio_pkg is ...@@ -131,12 +131,12 @@ package body wr_dio_pkg is
end loop; end loop;
else else
-- The ROM will be an addressed slave as well -- The ROM will be an addressed slave as well
result := (others => '0'); result := (others => '0');
result(c_wishbone_address_width-1 downto 0) := unsigned(g_sdb_addr); result(c_wishbone_address_width-1 downto 0) := unsigned(g_sdb_addr);
result := result + to_unsigned(c_rom_bytes, 64) - 1; result := result + to_unsigned(c_rom_bytes, 64) - 1;
for i in c_layout'range loop for i in c_layout'range loop
sdb_component := f_sdb_extract_component(c_layout(i)(447 downto 8)); sdb_component := f_sdb_extract_component(c_layout(i)(447 downto 8));
if unsigned(sdb_component.addr_last) > result then if unsigned(sdb_component.addr_last) > result then
result := unsigned(sdb_component.addr_last); result := unsigned(sdb_component.addr_last);
end if; end if;
...@@ -148,10 +148,10 @@ package body wr_dio_pkg is ...@@ -148,10 +148,10 @@ package body wr_dio_pkg is
end if; end if;
return result; return result;
end f_bus_end; end f_bus_end;
constant bus_end : unsigned(63 downto 0) := f_bus_end; constant bus_end : unsigned(63 downto 0) := f_bus_end;
begin begin
return f_xwb_bridge_product_manual_sdb(std_logic_vector(f_bus_end(c_wishbone_address_width-1 downto 0)), g_sdb_addr, g_sdb_product); return f_xwb_bridge_product_manual_sdb(std_logic_vector(f_bus_end(c_wishbone_address_width-1 downto 0)), g_sdb_addr, g_sdb_product);
end f_xwb_bridge_product_layout_sdb; end f_xwb_bridge_product_layout_sdb;
end wr_dio_pkg; end wr_dio_pkg;
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment