Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

waitrequest signal for Avalon MM Slave

I have created a custom Avalon MM Slave component with SOPC v10.1 which uses chipselect_n, read_n, write_n, address/data, and waitrequest. Long story short I need it to be variable wait states so that's why I need the waitrequest signal. In my first implementation my slave logic asserts waitrequest asynchronously when selected (based on chipselect_n) and then de-asserts when my Slave has the data ready. But in signal tap I see the chip select from the master never deasserts and the R/W hangs (using FS2 console the indication is that the CPU is hung). so my question is how can I assert waitrequest asynchronously (as the avalon spec shows) and then deassert it synchronously based on my logic? I had written this very simple snippet that does not work because when "my_logic_done" goes high...chipselect is still low and so the async preset takes priority. any way around this? the big issue is that the Avalon spec shows the waitrequest immediately (async) with read/write/chipselect.

process (rst_n, chipselect_n, clk)

begin

if (rst_n = '0') then

waitrequest = '0';

elsif (chipselect_n = '0') then

waitrequest = '1';

elsif rising_edge (clk) then

if (my_logic_done = '1') then --this is a single clock-wide pulse

waitrequest = '0';

end if;

end if;

end process;

any ideas??

11 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The nios cpu always asserts all 4 byte enables during read cycles - it discards the unwanted bytes internally. For writes is only asserts the required byte enables.

    This means that the bus width adapter inserted before an 8-bit slave will always generate 4 read cycles. (For writes, it might generate the cycles with no byte enables!)

    The usual way around this is to make the device be a 32bit slave that ignores the high bits.