API_READ_IN : in std_logic;
ADDRESS_REJECTED : out std_logic;
API_SEND_OUT : out std_logic;
- ADDRESS_OUT : out std_logic_vector(15 downto 0)
+ ADDRESS_OUT : out std_logic_vector(15 downto 0);
+ STAT_DEBUG : out std_logic_vector(15 downto 0)
);
end entity;
type sending_state_t is (sending_idle, send_uid_1, send_uid_2, send_ack_address);
signal sending_state : sending_state_t;
+signal sending_state_bits : std_logic_vector(1 downto 0);
signal buf_ADDRESS_OUT : std_logic_vector(15 downto 0);
begin
end case;
end process;
+ sending_state_bits <= "00" when sending_state = send_uid_1 else
+ "01" when sending_state = send_uid_2 else
+ "10" when sending_state = send_ack_address else
+ "11" ;--when sending_state = sending_idle;
+
process(CLK)
begin
API_PACKET_NUM_OUT <= buf_API_PACKET_NUM_OUT;
ADDRESS_OUT <= buf_ADDRESS_OUT;
+
+
+
+
+STAT_DEBUG(2 downto 0) <= ram_read_addr1(2 downto 0);
+STAT_DEBUG(6 downto 3) <= ram_read_addr2;
+STAT_DEBUG(7) <= API_DATAREADY_IN;
+STAT_DEBUG(9 downto 8) <= state(1 downto 0);
+STAT_DEBUG(11 downto 10) <= sending_state_bits;
+STAT_DEBUG(15 downto 12) <= "0000"; --added by regio!
+
+-- STAT_ADDR_DEBUG(12) <= buf_API_DATAREADY_OUT; --dataready out of Regio
+-- STAT_ADDR_DEBUG(13) <= ADR_REJECTED;
+-- STAT_ADDR_DEBUG(14) <= ADR_SEND_OUT;
+-- STAT_ADDR_DEBUG(15) <= ADR_DATAREADY_OUT; --dataready out of addresses
+
end architecture;
\ No newline at end of file
MED_STAT_OP : out std_logic_vector (15 downto 0);
CTRL_MPLEX : in std_logic_vector (31 downto 0);
IOBUF_CTRL_GEN : in std_logic_vector (4*32-1 downto 0);
- STAT_ONEWIRE : out std_logic_vector (31 downto 0)
+ STAT_ONEWIRE : out std_logic_vector (31 downto 0);
+ STAT_ADDR_DEBUG : out std_logic_vector (15 downto 0)
);
end entity;
EXT_REG_DATA_OUT : out std_logic_vector(31 downto 0);
EXT_REG_WRITE_IN : in std_logic;
EXT_REG_ADDR_IN : in std_logic_vector(7 downto 0);
- STAT : out std_logic_vector(31 downto 0)
+ STAT : out std_logic_vector(31 downto 0);
+ STAT_ADDR_DEBUG : out std_logic_vector(15 downto 0)
);
end component;
EXT_REG_DATA_OUT => REGIO_EXT_REG_DATA_OUT,
EXT_REG_WRITE_IN => REGIO_EXT_REG_WRITE_IN,
EXT_REG_ADDR_IN => REGIO_EXT_REG_ADDR_IN,
- STAT => REGIO_REGIO_STAT
+ STAT => REGIO_REGIO_STAT,
+ STAT_ADDR_DEBUG => STAT_ADDR_DEBUG
);
gen_no1wire : if REGIO_USE_1WIRE_INTERFACE = 0 generate
buf_IDRAM_DATA_IN <= REGIO_IDRAM_DATA_IN;
EXT_REG_DATA_OUT : out std_logic_vector(31 downto 0);
EXT_REG_WRITE_IN : in std_logic;
EXT_REG_ADDR_IN : in std_logic_vector(7 downto 0);
- STAT : out std_logic_vector(31 downto 0)
+ STAT : out std_logic_vector(31 downto 0);
+ STAT_ADDR_DEBUG : out std_logic_vector(15 downto 0)
);
end entity;
API_READ_IN : in std_logic;
ADDRESS_REJECTED : out std_logic;
API_SEND_OUT : out std_logic;
- ADDRESS_OUT : out std_logic_vector(15 downto 0)
+ ADDRESS_OUT : out std_logic_vector(15 downto 0);
+ STAT_DEBUG : out std_logic_vector(15 downto 0)
);
end component;
signal combined_API_READ_OUT : std_logic;
signal dat_data_counter : std_logic_vector(15 downto 0);
signal next_dat_data_counter : std_logic_vector(15 downto 0);
+ signal combined_API_SEND_OUT : std_logic;
+ signal combined_API_DATA_OUT : std_logic_vector(c_DATA_WIDTH-1 downto 0);
+ signal combined_API_DATAREADY_OUT : std_logic;
+ signal combined_API_PACKET_NUM_OUT: std_logic_vector(c_NUM_WIDTH-1 downto 0);
+ signal buf_STAT_ADDR_DEBUG : std_logic_vector(15 downto 0);
begin
RAM_ADDR_IN => IDRAM_ADDR_IN,
RAM_WR_IN => IDRAM_WR_IN,
ADDRESS_REJECTED => ADR_REJECTED,
- ADDRESS_OUT => MY_ADDRESS_OUT
+ ADDRESS_OUT => MY_ADDRESS_OUT,
+ STAT_DEBUG => buf_STAT_ADDR_DEBUG
);
+ STAT_ADDR_DEBUG(11 downto 0) <= buf_STAT_ADDR_DEBUG(11 downto 0);
+ STAT_ADDR_DEBUG(12) <= buf_API_DATAREADY_OUT;
+ STAT_ADDR_DEBUG(13) <= ADR_REJECTED;
+ STAT_ADDR_DEBUG(14) <= ADR_SEND_OUT;
+ STAT_ADDR_DEBUG(15) <= ADR_DATAREADY_OUT;
buf_DAT_ADDR_OUT <= address;
buf_DAT_DATA_OUT <= saved_Reg_high & saved_Reg_low;
when ADDRESS_RECV =>
ADR_DATAREADY_IN <= API_DATAREADY_IN;
- ADR_READ_IN <= '0';
+ ADR_READ_IN <= API_READ_IN;
if ADR_REJECTED = '1' then
next_state <= SEND_REPLY_SHORT_TRANSFER;
- elsif ADR_DATAREADY_OUT = '1' then
+ elsif ADR_DATAREADY_OUT = '1' and ADR_SEND_OUT = '1' then
next_state <= ADDRESS_ACK;
end if;
when ADDRESS_ACK =>
ADR_READ_IN <= API_READ_IN;
- next_API_SEND_OUT <= ADR_SEND_OUT;
- next_API_DATAREADY_OUT <= ADR_DATAREADY_OUT;
- next_API_DATA_OUT <= ADR_DATA_OUT;
+ ADR_DATAREADY_IN <= API_DATAREADY_IN;
+-- next_API_SEND_OUT <= ADR_SEND_OUT;
+-- next_API_DATAREADY_OUT <= ADR_DATAREADY_OUT;
+-- next_API_DATA_OUT <= ADR_DATA_OUT;
if ADR_SEND_OUT = '0' then
next_state <= SEND_REPLY_DATA_finish;
end if;
process(CLK)
begin
if rising_edge(CLK) then
- buf_API_DATAREADY_OUT <= next_API_DATAREADY_OUT;
- if current_state = ADDRESS_ACK then
- buf_API_PACKET_NUM_OUT <= ADR_PACKET_NUM_OUT;
+ if RESET = '1' then
+ buf_API_DATA_OUT <= (others => '0');
+ buf_API_DATAREADY_OUT <= '0';
else
- buf_API_PACKET_NUM_OUT <= next_packet_counter;
+ buf_API_DATAREADY_OUT <= next_API_DATAREADY_OUT;
+ if current_state = ADDRESS_ACK then
+ buf_API_PACKET_NUM_OUT <= ADR_PACKET_NUM_OUT;
+ else
+ buf_API_PACKET_NUM_OUT <= next_packet_counter;
+ end if;
+ buf_API_DATA_OUT <= next_API_DATA_OUT;
end if;
- buf_API_DATA_OUT <= next_API_DATA_OUT;
end if;
end process;
end process;
- --combine read_out of regio and addresses
- process(current_state, ADR_READ_OUT, buf_API_READ_OUT)
+ --combine signals from regio and addresses
+ process(current_state, ADR_READ_OUT, buf_API_READ_OUT, ADR_SEND_OUT, ADR_DATA_OUT, ADR_DATAREADY_OUT,
+ ADR_PACKET_NUM_OUT, buf_API_SEND_OUT, buf_API_DATA_OUT, buf_API_DATAREADY_OUT, buf_API_PACKET_NUM_OUT)
begin
- if current_state = ADDRESS_RECV then
+ if current_state = ADDRESS_RECV or current_state = ADDRESS_ACK then
combined_API_READ_OUT <= ADR_READ_OUT;
+ combined_API_SEND_OUT <= ADR_SEND_OUT;
+ combined_API_DATA_OUT <= ADR_DATA_OUT;
+ combined_API_DATAREADY_OUT <= ADR_DATAREADY_OUT;
+ combined_API_PACKET_NUM_OUT <= ADR_PACKET_NUM_OUT;
else
combined_API_READ_OUT <= buf_API_READ_OUT;
+ combined_API_SEND_OUT <= buf_API_SEND_OUT;
+ combined_API_DATA_OUT <= buf_API_DATA_OUT;
+ combined_API_DATAREADY_OUT <= buf_API_DATAREADY_OUT;
+ combined_API_PACKET_NUM_OUT <= buf_API_PACKET_NUM_OUT;
end if;
end process;
buf_API_ERROR_PATTERN_OUT(4) <= dont_understand;
buf_API_ERROR_PATTERN_OUT(3 downto 0) <= (others => '0');
- API_READ_OUT <= combined_API_READ_OUT;
- API_SEND_OUT <= buf_API_SEND_OUT;
- API_DATAREADY_OUT <= buf_API_DATAREADY_OUT;
- API_PACKET_NUM_OUT <= buf_API_PACKET_NUM_OUT;
- API_DATA_OUT <= buf_API_DATA_OUT;
+ API_READ_OUT <= combined_API_READ_OUT;
+ API_SEND_OUT <= combined_API_SEND_OUT;
+ API_DATAREADY_OUT <= combined_API_DATAREADY_OUT;
+ API_PACKET_NUM_OUT <= combined_API_PACKET_NUM_OUT;
+ API_DATA_OUT <= combined_API_DATA_OUT;
API_SHORT_TRANSFER_OUT <= buf_API_SHORT_TRANSFER_OUT;
API_DTYPE_OUT <= saved_operation;
API_ERROR_PATTERN_OUT <= buf_API_ERROR_PATTERN_OUT;