RESET_IN : in std_logic;
SIGNAL_IN : in std_logic_vector(CHANNELS-1 downto 0);
- SELECT_IN : in std_logic_vector(3 downto 0);
DATA_OUT : out std_logic_vector(31 downto 0);
READ_IN : in std_logic := '0';
EMPTY_OUT : out std_logic := '0'
buffer_empty_0(c) <= '0';
end if;
end if;
+ if buffer_read(c) = '1' then
+ buffer_empty_1(c) <= '1';
+ end if;
if buffer_empty_0(c) = '0' and buffer_empty_1(c) = '1' then
buffer_data(c)(1) <= buffer_data(c)(0);
buffer_empty_0(c) <= '1';
buffer_empty_1(c) <= '0';
end if;
- if buffer_read(c) = '1' then
- buffer_empty_1(c) <= '1';
- end if;
+
end process;
variable chan : integer range 0 to 16 := 0;
begin
wait until rising_edge(CLK);
--- chan := to_integer(unsigned(SELECT_IN));
fifo_real_write <= '0';
buffer_read <= (others => '0');
if buffer_empty_1(chan) = '0' then
signal pwm_addr_i : std_logic_vector(4 downto 0);
signal input_hold : std_logic_vector(7 downto 0);
- signal input_reg_0, input_reg_1, input_reg_2 : std_logic_vector(7 downto 0);
+ signal input_reg_0, input_reg_1, input_reg_2, input_i : std_logic_vector(7 downto 0);
-- signal edge_rising, edge_falling : std_logic_vector(3 downto 0);
-- signal pulser : std_logic;
signal timer_i : unsigned(31 downto 0) := (others => '0');
signal led_highz : std_logic;
- type led_timer_t is array(0 to 3) of unsigned(5 downto 0);
+ type led_timer_t is array(0 to 3) of unsigned(7 downto 0);
signal led_timer : led_timer_t;
signal led_state : std_logic_vector(3 downto 0);
signal led_clk_en : std_logic;
signal select_i : std_logic_vector(3 downto 0);
signal readcounter : unsigned(15 downto 0);
signal uart_debug : std_logic_vector(15 downto 0);
+ signal input_disable : std_logic_vector(7 downto 0);
+
begin
clk_i <= CLK;
case uart_addr is
when x"00" => uart_tx_data <= x"000000" & config & config_reg;
when x"01" => uart_tx_data <= x"00000" & "00" & CBUS & TRG & input_reg_2;
--- when x"10" => uart_tx_data <= reg;
+ when x"11" =>
+ uart_tx_data <= x"000000" & input_disable;
when x"d0" =>
f_read <= '1';
bus_ready <= '0';
case uart_addr is
when x"00" =>
config_reg <= uart_rx_data(3 downto 0);
- when x"10" =>
- select_i <= uart_rx_data(3 downto 0);
+ when x"11" =>
+ input_disable <= uart_rx_data(7 downto 0);
when x"80" =>
pwm_write_i <= '1';
pwm_data_i <= uart_rx_data(15 downto 0);
input_hold <= INPUT or (input_hold and not input_reg_0);
-
+input_i <= INPUT and not input_disable;
---------------------------------------------------------------------------
-- Input Counter
port map(
CLK => clk_i,
RESET_IN => '0',
- SIGNAL_IN(7 downto 0) => INPUT(7 downto 0),
+ SIGNAL_IN(7 downto 0) => input_i(7 downto 0),
SIGNAL_IN(8) => TRG,
- SELECT_IN => select_i,
DATA_OUT => f_data,
READ_IN => f_read,
EMPTY_OUT => f_empty
);
-
-
---------------------------------------------------------------------------
-- LED
---------------------------------------------------------------------------
PROC_LED_STATE : process begin
wait until rising_edge(clk_i);
- if timer_i(18 downto 0) = 0 then
+ if timer_i(15 downto 0) = 0 then
led_clk_en <= '1';
else
led_clk_en <= '0';
end if;
for i in 0 to 3 loop
- if (input_reg_2(i) xor input_reg_1(i)) = '1' and (led_timer(i)(4 downto 2) > 0) then
+ if (input_reg_2(i) xor input_reg_1(i)) = '1' and (led_timer(i)(7 downto 5) > 0) then
led_state(i) <= not led_state(i);
led_timer(i) <= 0;
- elsif led_timer(i)(4) = '1' then
+ elsif led_timer(i)(7) = '1' then
led_state(i) <= input_reg_1(i);
elsif led_clk_en = '1' then
led_timer(i) <= led_timer(i) + 1;
-
+--
-- THE_SED : entity work.sedcheck
-- port map(
-- CLK => clk_i,