Commit 8aa6037c authored by Denia Bouhired-Ferrag's avatar Denia Bouhired-Ferrag

Moved inverter channel logic inside conv-common-gw. This includes inv-channel…

Moved inverter channel logic inside conv-common-gw. This includes inv-channel LEDs. Also now using negative logic for all LEDs
parent 62d70283
......@@ -70,10 +70,10 @@ entity conv_ttl_rs485 is
vme_gap_i : in std_logic;
-- Channel enable
global_oen_o : out std_logic;
ttl_oen_o : out std_logic;
inv_oen_o : out std_logic;
rs485_oen_o : out std_logic;
global_oen_o : out std_logic;
ttl_oen_o : out std_logic;
inv_oen_o : out std_logic;
rs485_oen_o : out std_logic;
-- Front panel channels
ttl_n_i : in std_logic_vector(5 downto 0);
......@@ -91,8 +91,8 @@ entity conv_ttl_rs485 is
oterm_en_o : out std_logic_vector(5 downto 0);
-- Channel leds
led_front_o : out std_logic_vector(5 downto 0);
led_inv_o : out std_logic_vector(3 downto 0);
led_front_n_o : out std_logic_vector(5 downto 0);
led_front_inv_n_o : out std_logic_vector(3 downto 0);
led_rear_n_o : out std_logic_vector(5 downto 0);
-- SPI interface to on-board flash chip
......@@ -181,6 +181,8 @@ architecture arch of conv_ttl_rs485 is
signal rs485_fs : std_logic_vector(c_nr_chans-1 downto 0);
signal pulse_in : std_logic_vector(c_nr_chans-1 downto 0);
signal pulse_out : std_logic_vector(c_nr_chans-1 downto 0);
signal inv_pulse_in_n : std_logic_vector(c_nr_inv_chans-1 downto 0);
signal inv_pulse_out : std_logic_vector(c_nr_inv_chans-1 downto 0);
signal pulse_ttl : std_logic_vector(c_nr_chans-1 downto 0);
signal pulse_rs485 : std_logic_vector(c_nr_chans-1 downto 0);
signal inhibit_first_pulse : std_logic;
......@@ -210,7 +212,7 @@ architecture arch of conv_ttl_rs485 is
-- Channel LED signals
signal led_pulse : std_logic_vector(c_nr_chans-1 downto 0);
signal led_inv_pulse : std_logic_vector(c_nr_chans-1 downto 0);
-- I2C LEDs
signal led_i2c : std_logic;
signal led_i2c_err : std_logic;
......@@ -326,18 +328,18 @@ begin
generic map
(
-- Number of repeater channels
g_nr_chans => c_nr_chans,
g_board_id => c_board_id,
g_gwvers => c_gwvers,
g_pgen_fixed_width => false,
g_pgen_gf_len => 1,
g_with_pulse_cnt => true,
g_with_pulse_timetag => true,
g_with_man_trig => true,
g_man_trig_pwidth => 24,
g_with_thermometer => true,
g_bicolor_led_columns => c_bicolor_led_cols,
g_bicolor_led_lines => c_bicolor_led_lines
g_nr_chans => c_nr_chans,
g_board_id => c_board_id,
g_gwvers => c_gwvers,
g_pgen_fixed_width => false,
g_pgen_gf_len => 1,
g_with_pulse_cnt => true,
g_with_pulse_timetag => true,
g_with_man_trig => true,
g_man_trig_pwidth => 24,
g_with_thermometer => true,
g_bicolor_led_columns => c_bicolor_led_cols,
g_bicolor_led_lines => c_bicolor_led_lines
)
port map
(
......@@ -373,9 +375,16 @@ begin
pulse_front_i => pulse_ttl,
pulse_rear_i => pulse_rs485,
pulse_o => pulse_out,
-- Inverted pulse I/O
inv_pulse_i_n => inv_pulse_in_n,
inv_pulse_o => inv_pulse_out,
-- Channel leds
led_pulse_o => led_pulse,
-- inverted channel leds
led_inv_pulse_o => led_inv_pulse,
-- I2C interface
scl_i => scl_i,
......@@ -455,9 +464,17 @@ begin
-- Front and rear panel outputs
ttl_o <= pulse_out when sw_ttl = '1' else
not pulse_out;
inv_o <= inv_n_i;
rs485_o <= pulse_out;
-- LED outputs
led_front_n_o <= not led_pulse;
led_front_inv_n_o <= not led_inv_pulse;
led_rear_n_o <= not led_pulse;
-- INV-TTL outputs
inv_pulse_in_n <= inv_n_i;
inv_o <= inv_pulse_out;
-- Channel terminations
sw_iterm_en <= sw_gp(1);
sw_oterm_en <= sw_gp(2);
......@@ -466,43 +483,43 @@ begin
-- Process to flash INV-TTL LEDs on the falling edge of the INV-TTL input
-- LED flash length: 26 ms
gen_inv_ttl_leds : for i in 0 to 3 generate
inv_n(i) <= inv_n_i(i);
p_pulse_led : process (clk_20_i) is
begin
if rising_edge(clk_20_i) then
if (rst_20_n = '0') then
inv_n_d0(i) <= '0';
inv_n_fedge_p(i) <= '0';
led_inv_cnt(i) <= (others => '0');
led_inv(i) <= '0';
else
inv_n_d0(i) <= inv_n(i);
inv_n_fedge_p(i) <= (not inv_n(i)) and inv_n_d0(i);
case led_inv(i) is
when '0' =>
if (inv_n_fedge_p(i) = '1') then
led_inv(i) <= '1';
end if;
when '1' =>
led_inv_cnt(i) <= led_inv_cnt(i) + 1;
if (led_inv_cnt(i) = (led_inv_cnt(i)'range => '1')) then
led_inv(i) <= '0';
end if;
when others =>
led_inv(i) <= '0';
end case;
end if;
end if;
end process p_pulse_led;
end generate gen_inv_ttl_leds;
-- gen_inv_ttl_leds : for i in 0 to 3 generate
-- inv_n(i) <= inv_n_i(i);
-- p_pulse_led : process (clk_20_i) is
-- begin
-- if rising_edge(clk_20_i) then
-- if (rst_20_n = '0') then
-- inv_n_d0(i) <= '0';
-- inv_n_fedge_p(i) <= '0';
-- led_inv_cnt(i) <= (others => '0');
-- led_inv(i) <= '0';
-- else
-- inv_n_d0(i) <= inv_n(i);
-- inv_n_fedge_p(i) <= (not inv_n(i)) and inv_n_d0(i);
-- case led_inv(i) is
-- when '0' =>
-- if (inv_n_fedge_p(i) = '1') then
-- led_inv(i) <= '1';
-- end if;
-- when '1' =>
-- led_inv_cnt(i) <= led_inv_cnt(i) + 1;
-- if (led_inv_cnt(i) = (led_inv_cnt(i)'range => '1')) then
-- led_inv(i) <= '0';
-- end if;
-- when others =>
-- led_inv(i) <= '0';
-- end case;
-- end if;
-- end if;
-- end process p_pulse_led;
-- end generate gen_inv_ttl_leds;
-- LED outputs
led_front_o <= led_pulse;
led_inv_o <= led_inv;
led_rear_n_o <= not led_pulse;
-- led_front_o <= led_pulse;
-- led_inv_o <= led_inv;
-- led_rear_n_o <= not led_pulse;
--============================================================================
-- External logic for bicolor LED control
......
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