Commit 82bc89b2 authored by Denia Bouhired-Ferrag's avatar Denia Bouhired-Ferrag

further merge of simulations with remote branch

parents 771ca3df ed12cb0e
......@@ -81,14 +81,20 @@ architecture behav of testbench is
signal sscl, ssda : std_logic_vector(C_NR_SLAVES-1 downto 0);
signal scl, sda : std_logic;
signal rst_copm : std_logic;
signal rst_copm, rst_cnt : std_logic := '0';
type cnt_ch_array is array (C_NR_CHANS-1 downto 0) of integer;
signal fp_rp_same, fp_rp_oppos : cnt_ch_array;
signal in_out_oppos, in_out_same : cnt_ch_array;
signal pulse_cnt_ttl, pulse_cnt_rs485 : cnt_ch_array;
signal inv_err : cnt_ch_array;
signal fp_rp_same_err : cnt_ch_array;
signal fp_rp_oppos_err : cnt_ch_array;
signal in_out_oppos_err : cnt_ch_array;
signal in_out_same_err : cnt_ch_array;
signal pulse_cnt_ttl, pulse_cnt_rs485: cnt_ch_array;
signal inv_err : cnt_ch_array;
signal rtm_db9_ch0_err : integer;
signal rtm_db9_ch1_err : integer;
signal test_id : string(7 downto 1);
type cnt_inv_ch_array is array (C_NR_INV_CHANS-1 downto 0) of integer;
type cnt_inv_ch_array is array (C_NR_INV_CHANS-1 downto 0) of integer;
--==============================================================================
......@@ -270,41 +276,53 @@ begin
--============================================================================
-- Check if ttl_out matches rs485_out
-- Check if TTL_out, TTL_IN and RS485 match or are opposite
--============================================================================
compare_front_rear_pulses: process (clk_125)
begin
if rising_edge (clk_125) then
if vme_sysreset_n = '0' or rst_copm = '1' then
fp_rp_same <= (others=> (0));
fp_rp_oppos <= (others=> (0));
in_out_same <= (others=> (0));
in_out_oppos <= (others=> (0));
fp_rp_same_err <= (others=> (0));
fp_rp_oppos_err <= (others=> (0));
in_out_same_err <= (others=> (0));
in_out_oppos_err <= (others=> (0));
rtm_db9_ch0_err <= 0;
rtm_db9_ch1_err <= 0;
else
for i in 0 to C_NR_CHANS-1 loop
for i in 0 to C_NR_CHANS-1 loop -- loop: 7 channels
if ttl_out(i) /= rs485_out(i) then
fp_rp_same(i) <= fp_rp_same(i)+1;
fp_rp_same_err(i) <= fp_rp_same_err(i)+1;
end if;
if ttl_out(i) /= not rs485_out(i) then
fp_rp_oppos(i) <= fp_rp_oppos(i)+1;
fp_rp_oppos_err(i) <= fp_rp_oppos_err(i)+1;
end if;
if ttl_out(i) /= not ttl_n_in(i) then
in_out_oppos(i) <= in_out_oppos(i)+1;
in_out_oppos_err(i) <= in_out_oppos_err(i)+1;
end if;
if ttl_out(i) /= ttl_n_in(i) then
in_out_same(i) <= in_out_same(i)+1;
in_out_same_err(i) <= in_out_same_err(i)+1;
end if;
end loop;
if (rs485_out(0) /= rs485_out(1)) or (ttl_out(0) /= rs485_out(0)) then
rtm_db9_ch0_err <= rtm_db9_ch0_err+1;
end if;
if (rs485_out(4) /= rs485_out(5)) or (ttl_out(1) /= rs485_out(4)) then
rtm_db9_ch1_err <= rtm_db9_ch1_err+1;
end if;
end if;
end if;
end process;
--============================================================================
-- Check INV channels
-- Check INV channels
--============================================================================
compare_inv_i_inv_o: process (clk_125)
begin
......@@ -312,7 +330,7 @@ begin
if vme_sysreset_n = '0' then
inv_err <= (others=> (0));
else
for i in 0 to C_NR_INV_CHANS-1 loop
for i in 0 to C_NR_INV_CHANS-1 loop -- loop: 4 INV channels
if inv_n_in(i) /= inv_out(i) then
inv_err(i) <= inv_err(i)+1;
end if;
......@@ -321,62 +339,63 @@ begin
end if;
end process;
--============================================================================
-- pulse counter
--============================================================================
pulse_counter_ttl: process (ttl_out)
pulse_counter_ttl: process (ttl_out, vme_sysreset_n, rst_cnt)
begin
if vme_sysreset_n = '0' then
if vme_sysreset_n = '0' or rst_cnt = '1' then
pulse_cnt_ttl <= (others=> (0));
end if;
else
--for i in 0 to C_NR_CHANS-1 loop
if rising_edge(ttl_out(0)) then
pulse_cnt_ttl(0) <= pulse_cnt_ttl(0) +1;
end if;
if rising_edge(ttl_out(1)) then
pulse_cnt_ttl(1) <= pulse_cnt_ttl(1) +1;
end if;
if rising_edge(ttl_out(2)) then
pulse_cnt_ttl(2) <= pulse_cnt_ttl(2) +1;
end if;
if rising_edge(ttl_out(3)) then
pulse_cnt_ttl(3) <= pulse_cnt_ttl(3) +1;
end if;
if rising_edge(ttl_out(4)) then
pulse_cnt_ttl(4) <= pulse_cnt_ttl(4) +1;
end if;
if rising_edge(ttl_out(5)) then
pulse_cnt_ttl(5) <= pulse_cnt_ttl(5) +1;
end if;
if rising_edge(ttl_out(0)) then
pulse_cnt_ttl(0) <= pulse_cnt_ttl(0) +1;
end if;
if rising_edge(ttl_out(1)) then
pulse_cnt_ttl(1) <= pulse_cnt_ttl(1) +1;
end if;
if rising_edge(ttl_out(2)) then
pulse_cnt_ttl(2) <= pulse_cnt_ttl(2) +1;
end if;
if rising_edge(ttl_out(3)) then
pulse_cnt_ttl(3) <= pulse_cnt_ttl(3) +1;
end if;
if rising_edge(ttl_out(4)) then
pulse_cnt_ttl(4) <= pulse_cnt_ttl(4) +1;
end if;
if rising_edge(ttl_out(5)) then
pulse_cnt_ttl(5) <= pulse_cnt_ttl(5) +1;
end if;
--end loop;
end if;
end process pulse_counter_ttl;
pulse_counter_rs485: process (rs485_out)
pulse_counter_rs485: process (rs485_out, vme_sysreset_n, rst_cnt)
begin
if vme_sysreset_n = '0' then
if vme_sysreset_n = '0' or rst_cnt = '1' then
pulse_cnt_rs485 <= (others=> (0));
end if;
else
--for i in 0 to C_NR_CHANS-1 loop
if rising_edge(rs485_out(0)) then
pulse_cnt_rs485(0) <= pulse_cnt_rs485(0) +1;
end if;
if rising_edge(rs485_out(1)) then
pulse_cnt_rs485(1) <= pulse_cnt_rs485(1) +1;
end if;
if rising_edge(rs485_out(2)) then
pulse_cnt_rs485(2) <= pulse_cnt_rs485(2) +1;
end if;
if rising_edge(rs485_out(3)) then
pulse_cnt_rs485(3) <= pulse_cnt_rs485(3) +1;
end if;
if rising_edge(rs485_out(4)) then
pulse_cnt_rs485(4) <= pulse_cnt_rs485(4) +1;
end if;
if rising_edge(rs485_out(5)) then
pulse_cnt_rs485(5) <= pulse_cnt_rs485(5) +1;
end if;
--end loop;
if rising_edge(rs485_out(0)) then
pulse_cnt_rs485(0) <= pulse_cnt_rs485(0) +1;
end if;
if rising_edge(rs485_out(1)) then
pulse_cnt_rs485(1) <= pulse_cnt_rs485(1) +1;
end if;
if rising_edge(rs485_out(2)) then
pulse_cnt_rs485(2) <= pulse_cnt_rs485(2) +1;
end if;
if rising_edge(rs485_out(3)) then
pulse_cnt_rs485(3) <= pulse_cnt_rs485(3) +1;
end if;
if rising_edge(rs485_out(4)) then
pulse_cnt_rs485(4) <= pulse_cnt_rs485(4) +1;
end if;
if rising_edge(rs485_out(5)) then
pulse_cnt_rs485(5) <= pulse_cnt_rs485(5) +1;
end if;
--end loop;
end if;
end process pulse_counter_rs485;
--============================================================================
......@@ -394,6 +413,7 @@ begin
variable nb_pulses_to_send_bar : integer := 6;
variable glitch_filter_en : std_logic := '0'; -- glitch filter disabled
variable ttl_out_bar_en : std_logic := '0'; -- TTLbar disabled
variable rtm : std_logic_vector(5 downto 0) := C_NO_RTM;
variable err_cnt, err : integer := 0;
variable time_intrvl, rst_timetag : integer := 0;
variable pulse_timetag : integer := 0;
......@@ -408,7 +428,7 @@ begin
-- Board settings
print_now("----------------------------------------------------------------");
print_now("---> Configure board settings");
settings_config (glitch_filter_en, ttl_out_bar_en, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
---------------------------------------------------------------------------
-- VME reset
......@@ -423,6 +443,7 @@ begin
---------------------------------------------------------------------------
-- I2C readings
test_id <= "TEST 1 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 01: I2C reg reading");
print_now("----------------------------------------------------------------");
......@@ -437,6 +458,7 @@ begin
---------------------------------------------------------------------------
-- I2C writing
test_id <= "TEST 2 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 02: I2C reg writing");
print_now("----------------------------------------------------------------");
......@@ -451,6 +473,7 @@ begin
---------------------------------------------------------------------------
-- Pulses to the front TTL input
test_id <= "TEST 3 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 03: Sending TTL pulses and checking the outputs");
print_now("----------------------------------------------------------------");
......@@ -471,7 +494,7 @@ begin
-- Check if TTL_N_IN out and TTL_O out are opposite
print_now("Check that TTL_O(0) is the inverted TTL_N_IN(0)");
if in_out_oppos(0) = 0 then
if in_out_oppos_err(0) = 0 then
print_now("[OK] TTL_O(0) is exactly the inverted TTL_N_IN(0)");
else
print_now("[ERR] TTL_O(0) is not exactly the inverted TTL_N_IN(0)");
......@@ -480,7 +503,7 @@ begin
-- Check if TTL out and RS485 out are the same
print_now("Check that the pulses arrived to the RS485_O(0)");
if fp_rp_same(0) = 0 then
if fp_rp_same_err(0) = 0 then
print_now("[OK] RS485_O(0) matches TTL_O(0)");
else
print_now("[ERR] RS485_O(0) does not match TTL_O(0)");
......@@ -492,6 +515,7 @@ begin
---------------------------------------------------------------------------
-- Counters reading
test_id <= "TEST 4 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 04: Reading of the pulse counters through I2C");
print_now("----------------------------------------------------------------");
......@@ -536,6 +560,7 @@ begin
---------------------------------------------------------------------------
-- Pulses to the rear RS485 input
test_id <= "TEST 5 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 05: Sending pulses to the RS485 and checking the outputs");
print_now("----------------------------------------------------------------");
......@@ -558,7 +583,7 @@ begin
-- Check if TTL out and RS485 out are the same
print_now("Check that the pulses arrived to the TTL_O(0)");
if fp_rp_same(0) = 0 then
if fp_rp_same_err(0) = 0 then
print_now("[OK] RS485_O(0) matches TTL_O(0)");
else
print_now("[ERR] RS485_O(0) does not match TTL_O(0)");
......@@ -570,6 +595,7 @@ begin
---------------------------------------------------------------------------
-- Counters reading
test_id <= "TEST 6 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 06: Reading of the pulse counters through I2C");
print_now("----------------------------------------------------------------");
......@@ -594,6 +620,7 @@ begin
---------------------------------------------------------------------------
-- Timetag reading
test_id <= "TEST 7 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 07: Reading of the timetag register through I2C");
print_now("----------------------------------------------------------------");
......@@ -616,6 +643,7 @@ begin
---------------------------------------------------------------------------
-- INV channels
test_id <= "TEST 8 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 08: INV channel check");
print_now("----------------------------------------------------------------");
......@@ -637,6 +665,7 @@ begin
---------------------------------------------------------------------------
-- Glitch filter test
test_id <= "TEST 9 ";
print_now("----------------------------------------------------------------");
print_now("---> Test 09: Test Glitch filter");
print_now("----------------------------------------------------------------");
......@@ -645,10 +674,10 @@ begin
print_now("---> Configure board settings");
glitch_filter_en := '1';
ttl_out_bar_en := '0';
settings_config (glitch_filter_en, ttl_out_bar_en, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
wait for 2 us; -- ML: does not work without this wait, no idea way?
print_now_s_i("Sending pulses 50ns-long each to TTL_N_I(3): ", nb_pulses_to_send_fp);
generate_pulse (ttl_n_in(3), nb_pulses_to_send_fp, "fp", rs485_fs_n_in(3), 50ns, 20ns);
generate_pulse (ttl_n_in(3), nb_pulses_to_send_fp, "fp", rs485_fs_n_in(3), 50ns, 50ns);
-- Checking if any pulse was passed to the output
print_now("Check that the glitches were filtered and there is no pulse in the TTL_O(3) output");
......@@ -664,6 +693,7 @@ begin
---------------------------------------------------------------------------
-- TTL bar test
test_id <= "TEST 10";
print_now("----------------------------------------------------------------");
print_now("---> Test 10: Test TTL BAR");
print_now("----------------------------------------------------------------");
......@@ -672,16 +702,17 @@ begin
print_now("---> Configure board settings");
glitch_filter_en := '0';
ttl_out_bar_en := '1';
settings_config (glitch_filter_en, ttl_out_bar_en, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
rst_copm <= '1';
wait for 2 us; -- ML: does not work without this wait, no idea way?
rst_copm <= '0';
print_now_s_i("Sending pulses to TTL_N_IN(5): ", nb_pulses_to_send_bar);
generate_pulse (ttl_n_in(5), nb_pulses_to_send_bar, "fp", rs485_fs_n_in(5), 200ns, 200ns);
-- Check if TTL_N_IN out and TTL_O out are the same
-- Check if TTL_N_IN is the opposite of TTL_O; Note: TTLbar does not invert the output!
print_now("Check that TTL_O(5) matches TTL_N_IN(5)");
if in_out_same(5) = 0 then
if in_out_oppos_err(5) = 0 then
print_now("[OK] TTL_O(5) matches TTL_N_IN(5)");
else
print_now("[ERR] TTL_O(5) does not match TTL_N_IN(5)");
......@@ -693,6 +724,181 @@ begin
---------------------------------------------------------------------------
-- Glitch filter enabled with TTL bar test
test_id <= "TEST 11";
print_now("----------------------------------------------------------------");
print_now("---> Test 11: Test glitch filter enabled with TTL BAR");
print_now("----------------------------------------------------------------");
---------------------------------------------------------------------------
-- Change board settings
print_now("---> Configure board settings");
glitch_filter_en := '1';
ttl_out_bar_en := '1';
nb_pulses_to_send_bar := 2;
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
rst_copm <= '1';
rst_cnt <= '1';
wait for 2 us; -- ML: does not work without this wait, no idea way?
rst_copm <= '0';
rst_cnt <= '0';
-- create a 50ns glitch during a 450ns pulse: ------|____|-|____|------
print_now("Sending a 50ns glitch during a 450ns pulse to TTL_N_IN(5)");
generate_pulse (ttl_n_in(5), nb_pulses_to_send_bar, "fp", rs485_fs_n_in(5), 200ns, 50ns);
-- Checking that a single pulse passed to the output
print_now("Check that the 50ns glitch within the 450ns pulse was filtered out and a single 450ns pulse arrived to the output");
if pulse_cnt_ttl(5) = 1 then
print_now("[OK] Glitch filter filtered the glitch");
else
print_now_s_i("[ERR] Number of pulses measured at TTL_O(5): ",pulse_cnt_ttl(5));
err_cnt := err_cnt + 1;
end if;
---------------------------------------------------------------------------
print_now_s_i("Errors so far: ", err_cnt);
---------------------------------------------------------------------------
---------------------------------------------------------------------------
-- Glitch filter disabled with TTL bar testt
test_id <= "TEST 12";
print_now("----------------------------------------------------------------");
print_now("---> Test 12: Test glitch filter disable with TTL BAR");
print_now("----------------------------------------------------------------");
---------------------------------------------------------------------------
-- Change board settings
print_now("---> Configure board settings");
glitch_filter_en := '0';
ttl_out_bar_en := '1';
nb_pulses_to_send_bar := 2;
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
rst_copm <= '1';
rst_cnt <= '1';
wait for 2 us; -- ML: does not work without this wait, no idea way?
rst_copm <= '0';
rst_cnt <= '0';
-- create a 50ns glitch during a 450ns pulse: ------|____|-|____|------
print_now("Sending a 50ns glitch during a 450ns pulse to TTL_N_IN(5)");
generate_pulse (ttl_n_in(5), nb_pulses_to_send_bar, "fp", rs485_fs_n_in(5), 200ns, 50ns);
-- Checking that the glitch passed to the output
print_now("Check that the 50ns glitch within the 450ns pulse passed to the output");
if pulse_cnt_ttl(5) = 2 then
print_now("[OK] Glitch filter correctly disabled");
else
print_now_s_i("[ERR] Number of pulses measured at TTL_O(5): ",pulse_cnt_ttl(5));
err_cnt := err_cnt + 1;
end if;
---------------------------------------------------------------------------
print_now_s_i("Errors so far: ", err_cnt);
---------------------------------------------------------------------------
-- DB9 RTM test from TTL_N_IN -> RS485_O
test_id <= "TEST 13";
print_now("----------------------------------------------------------------");
print_now("---> Test 13: Test RS485 outputs with DB9 RTM");
print_now("----------------------------------------------------------------");
---------------------------------------------------------------------------
-- Change board settings
print_now("---> Configure board settings");
glitch_filter_en := '0';
ttl_out_bar_en := '0';
nb_pulses_to_send_fp := 2;
rtm := C_RTM_DB9;
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
rst_copm <= '1';
rst_cnt <= '1';
wait for 2 us; -- ML: does not work without this wait, no idea way?
rst_copm <= '0';
rst_cnt <= '0';
-- generate pulses
print_now_s_i("Sending pulses to TTL_N_IN(0): ", nb_pulses_to_send_fp);
generate_pulse (ttl_n_in(0), nb_pulses_to_send_fp, "fp", rs485_fs_n_in(0), 200ns, 200ns);
nb_pulses_to_send_fp := 4;
print_now_s_i("Sending pulses to TTL_N_IN(1): ", nb_pulses_to_send_fp);
generate_pulse (ttl_n_in(1), nb_pulses_to_send_fp, "fp", rs485_fs_n_in(1), 200ns, 200ns);
-- Check that the TTL_N_IN(0) pulses arrived to both Rear Panel Channel 1 and Rear Panel Channel 2
print_now("Check that the TTL_N_IN(0) pulses arrived to the RS485_O(0) and RS485_O(1)");
if rtm_db9_ch0_err = 0 then
print_now("[OK] RS485_O(0) and RS485_O(1) match TTL_O(0)");
else
print_now("[ERR] RS485_O(0) or RS485_O(1) do not match TTL_O(0)");
err_cnt := err_cnt + 1;
end if;
-- Check that the TTL_N_IN(1) pulses arrived to both Rear Panel Channel 1 and Rear Panel Channel 2 have
print_now("Check that the TTL_N_IN(1) pulses arrived to the RS485_O(4) and RS485_O(5)");
if rtm_db9_ch1_err = 0 then
print_now("[OK] RS485_O(4) and RS485_O(5) match TTL_O(1)");
else
print_now("[ERR] RS485_O(4) or RS485_O(5) do not match TTL_O(1)");
err_cnt := err_cnt + 1;
end if;
---------------------------------------------------------------------------
print_now_s_i("Errors so far: ", err_cnt);
---------------------------------------------------------------------------
---------------------------------------------------------------------------
-- DB9 RTM test from RS485_N_I -> TTL_O
test_id <= "TEST 14";
print_now("----------------------------------------------------------------");
print_now("---> Test 14: Test TTL outputs with DB9 RTM");
print_now("----------------------------------------------------------------");
---------------------------------------------------------------------------
-- Change board settings
print_now("---> Configure board settings");
glitch_filter_en := '0';
ttl_out_bar_en := '0';
nb_pulses_to_send_rp := 10;
rtm := C_RTM_DB9;
settings_config (glitch_filter_en, ttl_out_bar_en, rtm, sw_gp_n_in, sw_other_in, pcbrev, rtm_in);
rst_copm <= '1';
rst_cnt <= '1';
wait for 2 us; -- ML: does not work without this wait, no idea way?
rst_copm <= '0';
rst_cnt <= '0';
-- generate pulses
print_now_s_i("Sending pulses to RS485_N_I(4): ", nb_pulses_to_send_rp);
generate_pulse (rs485_n_in(4), nb_pulses_to_send_rp, "rp", rs485_fs_n_in(4), 200ns, 200ns);
print_now("Check that the pulses arrived to the RS485_O(4)");
if pulse_cnt_rs485(4) = nb_pulses_to_send_rp then
print_now_s_i("[OK] Number of pulses measured at RS485_O(4) :",pulse_cnt_rs485(4));
else
print_now_s_i("[ERR] Number of pulses measured in the RS485_O(4) : ",pulse_cnt_rs485(4));
err_cnt := err_cnt + 1;
end if;
-- Check that the RS485_N_I(4) pulses arrived to RS485_OUT(4), RS485_OUT(5) and TTL_O(1)
print_now("Check that the RS485_N_I(4) pulses arrived to RS485_OUT(4), RS485_OUT(5) and TTL_O(1)");
if rtm_db9_ch1_err = 0 then
print_now("[OK] TTL_O(1) and RS485_N_I(5) match RS485_N_I(4)");
else
print_now("[ERR] TTL_O(1) or RS485_OUT(5) does not match RS485_OUT(4)");
err_cnt := err_cnt + 1;
end if;
---------------------------------------------------------------------------
print_now_s_i("Errors so far: ", err_cnt);
---------------------------------------------------------------------------
print("*****************************************************************************");
print(" Tests Summary");
print("*****************************************************************************");
......
......@@ -47,7 +47,8 @@ package testbench_pkg is
constant C_NR_MASTERS : positive := 1;
constant C_NR_SLAVES : positive := 1;
constant C_RTM : std_logic_vector(5 downto 0) := "010101";
constant C_NO_RTM : std_logic_vector(5 downto 0) := "000000";
constant C_RTM_DB9 : std_logic_vector(5 downto 0) := "000101";
constant C_INITIAL_TST_VALUE : std_logic_vector(31 downto 0) := x"FFFFFFF0";
constant C_I2C_MASTER_SLV_ADDR: std_logic_vector(6 downto 0) := "1011110";
......@@ -259,6 +260,7 @@ end component conv_ttl_rs485;
procedure settings_config (constant glitch_filter_en : in std_logic;
constant ttl_out_bar_en : in std_logic;
constant rtm_value : in std_logic_vector(5 downto 0);
signal sw_gp_n : out std_logic_vector(7 downto 0);
signal sw_other : out std_logic_vector(31 downto 0);
signal pcbrev : out std_logic_vector(5 downto 0);
......@@ -297,23 +299,30 @@ package body testbench_pkg is
--==================================================================================================
procedure settings_config (constant glitch_filter_en : in std_logic;
constant ttl_out_bar_en : in std_logic;
signal sw_gp_n : out std_logic_vector(7 downto 0);
signal sw_other : out std_logic_vector(31 downto 0);
signal pcbrev : out std_logic_vector(5 downto 0);
signal rtm : out std_logic_vector(5 downto 0)) is
constant rtm_value : in std_logic_vector(5 downto 0);
signal sw_gp_n : out std_logic_vector(7 downto 0);
signal sw_other : out std_logic_vector(31 downto 0);
signal pcbrev : out std_logic_vector(5 downto 0);
signal rtm : out std_logic_vector(5 downto 0)) is
begin
sw_gp_n(0) <= not glitch_filter_en;
if glitch_filter_en = '1' then
print_now("Glitch filter enabled");
print_now("- Glitch filter enabled");
else
print_now("Glitch filter disabled");
print_now("- Glitch filter disabled");
end if;
sw_gp_n(7) <= ttl_out_bar_en;
if ttl_out_bar_en = '1' then
print_now("TTL output BAR enabled");
print_now("- TTL output BAR enabled");
else
print_now("- TTL output BAR disabled");
end if;
if rtm_value = C_RTM_DB9 then
print_now("- DB9 RTM plugged in");
else
print_now("TTL output BAR disabled");
print_now("- No particular RTM");
end if;
--print_now_s_std("RTMP & RTMM set to x", C_RTM);
......@@ -321,7 +330,9 @@ package body testbench_pkg is
sw_gp_n(6 downto 1) <= (others => '0'); -- not used
sw_other <= (others => '0'); -- not used
pcbrev <= "111100"; -- not used
rtm <= C_RTM; -- not used
rtm <= rtm_value;
end procedure;
----------------------------------------------------------------------------------------------------
......
......@@ -49,6 +49,7 @@ use work.wishbone_pkg.all;
use work.conv_common_gw_pkg.all;
entity conv_ttl_rs485 is
generic (g_simul : boolean := FALSE);
port
(
-- Clocks
......@@ -280,8 +281,6 @@ begin
rs485_fs(i) <= rs485_n_i(i) nor rs485_fs_n_i(i);
pulse_rs485_mapped(i) <= (not rs485_n_i(i)) when rs485_fs(i) = '0' else '0';
pulse_rs485(0) <= pulse_rs485_mapped(0);
pulse_rs485(1) <= pulse_rs485_mapped(4) when rtmp_i = "101" else pulse_rs485_mapped(1);
pulse_rs485(2) <= pulse_rs485_mapped(2) when rtmp_i = "101" else pulse_rs485_mapped(2);
......@@ -345,7 +344,7 @@ begin
cmp_conv_common : conv_common_gw
generic map
(
g_simul => g_simul,
g_nr_chans => c_nr_chans,
g_board_id => c_board_id,
g_gwvers => c_gwvers,
......@@ -480,7 +479,6 @@ begin
bicolor_led_line_oen_o => bicolor_led_line_oen
);
ttl_o <= pulse_out when sw_ttl = '1' else
not pulse_out;
-- rs485_o (1 downto 0) <= pulse_out (1 downto 0);
......@@ -493,7 +491,6 @@ begin
-- channel 4 copies channel 2
-- rs485_o (3 downto 2) <= pulse_out (1 downto 0) when rtmp_i = "101" or rtmp_i = "100"
-- else pulse_out (3 downto 2);
-- rs485_o (5 downto 4) <= pulse_out (5 downto 4);
--============================================================================
......@@ -507,8 +504,6 @@ begin
rs485_o(4) <= pulse_out(1) when rtmp_i = "101" else pulse_out(4);
rs485_o(5) <= pulse_out(1) when rtmp_i = "101" else pulse_out(5);
-- LED outputs
-- Boards earlier than v4 do not use -ve logic for LEDs.
-- For these LED pulse signals are still in +ve logic.
......
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