OpenCores
URL https://opencores.org/ocsvn/rio/rio/trunk

Subversion Repositories rio

[/] [rio/] [branches/] [parallelSymbols/] [bench/] [vhdl/] [TestRioSerial.vhd] - Diff between revs 18 and 26

Show entire file | Details | Blame | View Log

Rev 18 Rev 26
Line 66... Line 66...
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
architecture TestRioSerialImpl of TestRioSerial is
architecture TestRioSerialImpl of TestRioSerial is
 
 
  component TestSwitchPort is
  component TestSwitchPort is
    generic(
    generic(
      NUMBER_WORDS : natural range 1 to 8 := 1);
      NUMBER_WORDS : natural range 1 to 4 := 1);
    port(
    port(
      clk : in std_logic;
      clk : in std_logic;
      areset_n : in std_logic;
      areset_n : in std_logic;
 
 
      frameValid_i : in std_logic_vector(0 to 63);
      frameValid_i : in std_logic_vector(0 to 63);
Line 91... Line 91...
      readWindowNext_i : in std_logic;
      readWindowNext_i : in std_logic;
 
 
      readContentEmpty_o : out std_logic;
      readContentEmpty_o : out std_logic;
      readContent_i : in std_logic;
      readContent_i : in std_logic;
      readContentEnd_o : out std_logic;
      readContentEnd_o : out std_logic;
      readContentData_o : out std_logic_vector(31 downto 0);
      readContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
 
 
      writeFrameFull_o : out std_logic;
      writeFrameFull_o : out std_logic;
      writeFrame_i : in std_logic;
      writeFrame_i : in std_logic;
      writeFrameAbort_i : in std_logic;
      writeFrameAbort_i : in std_logic;
      writeContent_i : in std_logic;
      writeContent_i : in std_logic;
      writeContentData_i : in std_logic_vector(31 downto 0));
      writeContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
  end component;
  end component;
 
 
  component RioSerial is
  component RioSerial is
    generic(
    generic(
      TIMEOUT_WIDTH : natural);
      TIMEOUT_WIDTH : natural := 20;
 
      NUMBER_WORDS : natural range 1 to 4 := 1);
    port(
    port(
      clk : in std_logic;
      clk : in std_logic;
      areset_n : in std_logic;
      areset_n : in std_logic;
 
 
      portLinkTimeout_i : in std_logic_vector(TIMEOUT_WIDTH-1 downto 0);
      portLinkTimeout_i : in std_logic_vector(TIMEOUT_WIDTH-1 downto 0);
Line 131... Line 132...
      readWindowReset_o : out std_logic;
      readWindowReset_o : out std_logic;
      readWindowNext_o : out std_logic;
      readWindowNext_o : out std_logic;
      readContentEmpty_i : in std_logic;
      readContentEmpty_i : in std_logic;
      readContent_o : out std_logic;
      readContent_o : out std_logic;
      readContentEnd_i : in std_logic;
      readContentEnd_i : in std_logic;
      readContentData_i : in std_logic_vector(31 downto 0);
      readContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
 
 
      writeFrameFull_i : in std_logic;
      writeFrameFull_i : in std_logic;
      writeFrame_o : out std_logic;
      writeFrame_o : out std_logic;
      writeFrameAbort_o : out std_logic;
      writeFrameAbort_o : out std_logic;
      writeContent_o : out std_logic;
      writeContent_o : out std_logic;
      writeContentData_o : out std_logic_vector(31 downto 0);
      writeContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
 
 
      portInitialized_i : in std_logic;
      portInitialized_i : in std_logic;
      outboundSymbolFull_i : in std_logic;
      outboundSymbolFull_i : in std_logic;
      outboundSymbolWrite_o : out std_logic;
      outboundSymbolWrite_o : out std_logic;
      outboundSymbol_o : out std_logic_vector(((2+32)-1) downto 0);
      outboundSymbolType_o : out std_logic_vector(2*NUMBER_WORDS-1 downto 0);
 
      outboundSymbol_o : out std_logic_vector(32*NUMBER_WORDS-1 downto 0);
      inboundSymbolEmpty_i : in std_logic;
      inboundSymbolEmpty_i : in std_logic;
      inboundSymbolRead_o : out std_logic;
      inboundSymbolRead_o : out std_logic;
      inboundSymbol_i : in std_logic_vector(((2+32)-1) downto 0));
      inboundSymbolType_i : in std_logic_vector(2*NUMBER_WORDS-1 downto 0);
 
      inboundSymbol_i : in std_logic_vector(32*NUMBER_WORDS-1 downto 0));
  end component;
  end component;
 
 
  constant NUMBER_WORDS : natural range 1 to 4 := 1;
  constant NUMBER_WORDS : natural range 1 to 4 := 2;
 
 
  signal clk : std_logic;
  signal clk : std_logic;
  signal areset_n : std_logic;
  signal areset_n : std_logic;
 
 
  signal portLinkTimeout : std_logic_vector(10 downto 0);
  signal portLinkTimeout : std_logic_vector(10 downto 0);
Line 170... Line 173...
  signal outboundAckIdRead : std_logic_vector(4 downto 0);
  signal outboundAckIdRead : std_logic_vector(4 downto 0);
 
 
  signal portInitialized : std_logic;
  signal portInitialized : std_logic;
  signal outboundSymbolFull : std_logic;
  signal outboundSymbolFull : std_logic;
  signal outboundSymbolWrite : std_logic;
  signal outboundSymbolWrite : std_logic;
  signal outboundSymbol : std_logic_vector((2+32)-1 downto 0);
  signal outboundSymbolType : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
 
  signal outboundSymbol : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
  signal inboundSymbolEmpty : std_logic;
  signal inboundSymbolEmpty : std_logic;
  signal inboundSymbolRead : std_logic;
  signal inboundSymbolRead : std_logic;
  signal inboundSymbol : std_logic_vector((2+32)-1 downto 0);
  signal inboundSymbolType : std_logic_vector(2*NUMBER_WORDS-1 downto 0);
 
  signal inboundSymbol : std_logic_vector(32*NUMBER_WORDS-1 downto 0);
 
 
  signal readFrameEmpty : std_logic;
  signal readFrameEmpty : std_logic;
  signal readFrame : std_logic;
  signal readFrame : std_logic;
  signal readFrameRestart : std_logic;
  signal readFrameRestart : std_logic;
  signal readFrameAborted : std_logic;
  signal readFrameAborted : std_logic;
Line 185... Line 190...
  signal readWindowReset : std_logic;
  signal readWindowReset : std_logic;
  signal readWindowNext : std_logic;
  signal readWindowNext : std_logic;
  signal readContentEmpty : std_logic;
  signal readContentEmpty : std_logic;
  signal readContent : std_logic;
  signal readContent : std_logic;
  signal readContentEnd : std_logic;
  signal readContentEnd : std_logic;
  signal readContentData : std_logic_vector(31 downto 0);
  signal readContentData : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
 
 
  signal writeFrameFull : std_logic;
  signal writeFrameFull : std_logic;
  signal writeFrame : std_logic;
  signal writeFrame : std_logic;
  signal writeFrameAbort : std_logic;
  signal writeFrameAbort : std_logic;
  signal writeContent : std_logic;
  signal writeContent : std_logic;
  signal writeContentData : std_logic_vector(31 downto 0);
  signal writeContentData : std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
 
 
  signal frameValid : std_logic_vector(0 to 63);
  signal frameValid : std_logic_vector(0 to 63);
  signal frameWrite : RioFrameArray(0 to 63);
  signal frameWrite : RioFrameArray(0 to 63);
  signal frameComplete : std_logic_vector(0 to 63);
  signal frameComplete : std_logic_vector(0 to 63);
  signal frameExpected : std_logic;
  signal frameExpected : std_logic;
Line 219... Line 224...
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  -- Serial protocol test driver.
  -- Serial protocol test driver.
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  TestDriver: process
  TestDriver: process
 
 
 
    variable inboundSymbolIndex : natural := 0;
 
    variable outboundSymbolIndex : natural := 0;
 
 
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    -- Procedure to receive a symbol.
    -- Procedure to receive a symbol.
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    procedure ReceiveSymbol(
    procedure ReceiveSymbol(
      constant symbolType : in std_logic_vector(1 downto 0);
      constant symbolType : in std_logic_vector(1 downto 0);
      constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000";
      constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000";
      constant acceptIdle : in boolean := true) is
      constant acceptIdle : in boolean := true) is
    begin
    begin
      outboundSymbolFull <= '0';
      outboundSymbolFull <= '0';
 
 
 
      if (outboundSymbolIndex = NUMBER_WORDS) then
 
        outboundSymbolIndex := 0;
      wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
      wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
 
      end if;
 
 
      if (acceptIdle) then
      if (acceptIdle) then
        while ((outboundSymbol(33 downto 32) = SYMBOL_IDLE) and
        while ((outboundSymbolType(2*(outboundSymbolIndex+1)-1 downto 2*(outboundSymbolIndex)) = SYMBOL_IDLE) and
               (symbolType /= SYMBOL_IDLE)) loop
               (symbolType /= SYMBOL_IDLE)) loop
 
          outboundSymbolIndex := outboundSymbolIndex + 1;
 
          if (outboundSymbolIndex = NUMBER_WORDS) then
 
            outboundSymbolIndex := 0;
          wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
          wait until clk'event and clk = '1' and outboundSymbolWrite = '1';
 
          end if;
        end loop;
        end loop;
      end if;
      end if;
 
 
      assert symbolType = outboundSymbol(33 downto 32)
      assert symbolType = outboundSymbolType(2*(outboundSymbolIndex+1)-1 downto 2*(outboundSymbolIndex))
        report "Missmatching symbol type:expected=" &
        report "Missmatching symbol type:expected=" &
        integer'image(to_integer(unsigned(symbolType))) &
        integer'image(to_integer(unsigned(symbolType))) &
        " got=" &
        " got=" &
        integer'image(to_integer(unsigned(outboundSymbol(33 downto 32))))
        integer'image(to_integer(unsigned(outboundSymbolType(2*(outboundSymbolIndex+1)-1 downto 2*(outboundSymbolIndex)))))
        severity error;
        severity error;
 
 
      if (outboundSymbol(33 downto 32) = SYMBOL_CONTROL) then
      if (outboundSymbolType(2*(outboundSymbolIndex+1)-1 downto 2*(outboundSymbolIndex)) = SYMBOL_CONTROL) then
        assert symbolContent(31 downto 8) = outboundSymbol(31 downto 8)
        assert symbolContent(31 downto 8) = outboundSymbol(32*(outboundSymbolIndex+1)-1 downto 32*outboundSymbolIndex+8)
          report "Missmatching symbol content:expected=" &
          report "Missmatching symbol content:expected=" &
          integer'image(to_integer(unsigned(symbolContent(31 downto 8)))) &
          integer'image(to_integer(unsigned(symbolContent(31 downto 8)))) &
          " got=" &
          " got=" &
          integer'image(to_integer(unsigned(outboundSymbol(31 downto 8))))
          integer'image(to_integer(unsigned(outboundSymbol(32*(outboundSymbolIndex+1)-1 downto 32*outboundSymbolIndex+8))))
          severity error;
          severity error;
      elsif (outboundSymbol(33 downto 32) = SYMBOL_DATA) then
      elsif (outboundSymbolType(2*(outboundSymbolIndex+1)-1 downto 2*(outboundSymbolIndex)) = SYMBOL_DATA) then
        assert symbolContent(31 downto 0) = outboundSymbol(31 downto 0)
        assert symbolContent(31 downto 0) = outboundSymbol(32*(outboundSymbolIndex+1)-1 downto 32*outboundSymbolIndex)
          report "Missmatching symbol content:expected=" &
          report "Missmatching symbol content:expected=" &
          integer'image(to_integer(unsigned(symbolContent(31 downto 0)))) &
          integer'image(to_integer(unsigned(symbolContent(31 downto 0)))) &
          " got=" &
          " got=" &
          integer'image(to_integer(unsigned(outboundSymbol(31 downto 0))))
          integer'image(to_integer(unsigned(outboundSymbol(32*(outboundSymbolIndex+1)-1 downto 32*outboundSymbolIndex))))
          severity error;
          severity error;
      end if;
      end if;
 
 
 
      outboundSymbolIndex := outboundSymbolIndex + 1;
      outboundSymbolFull <= '1';
      outboundSymbolFull <= '1';
    end procedure;
    end procedure;
 
 
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    -- Procedure to send a symbol.
    -- Procedure to send a symbol.
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    procedure SendSymbol(
    procedure SendSymbol(
      constant symbolType : in std_logic_vector(1 downto 0);
      constant symbolType : in std_logic_vector(1 downto 0);
      constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000") is
      constant symbolContent : in std_logic_vector(31 downto 0) := x"00000000";
 
      constant flush : in boolean := false) is
    begin
    begin
      inboundSymbolEmpty <= '0';
      inboundSymbolEmpty <= '0';
      inboundSymbol <= symbolType & symbolContent;
      inboundSymbolType(2*(inboundSymbolIndex+1)-1 downto 2*inboundSymbolIndex) <= symbolType;
 
      inboundSymbol(32*(inboundSymbolIndex+1)-1 downto 32*inboundSymbolIndex) <= symbolContent;
 
 
 
      inboundSymbolIndex := inboundSymbolIndex + 1;
 
      if (flush or (inboundSymbolIndex = NUMBER_WORDS)) then
      wait until clk'event and clk = '1' and inboundSymbolRead = '1';
      wait until clk'event and clk = '1' and inboundSymbolRead = '1';
 
        inboundSymbolIndex := 0;
 
        inboundSymbolType <= (others=>'0');
 
        inboundSymbol <= (others=>'0');
 
      end if;
 
 
      inboundSymbolEmpty <= '1';
      inboundSymbolEmpty <= '1';
    end procedure;
    end procedure;
 
 
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    -- Process variables.
    -- Process variables.
Line 301... Line 327...
    outputPortEnable <= '1';
    outputPortEnable <= '1';
 
 
    portInitialized <= '0';
    portInitialized <= '0';
    outboundSymbolFull <= '1';
    outboundSymbolFull <= '1';
    inboundSymbolEmpty <= '1';
    inboundSymbolEmpty <= '1';
 
    inboundSymbolType <= (others=>'0');
    inboundSymbol <= (others => '0');
    inboundSymbol <= (others => '0');
 
 
    localAckIdWrite <= '0';
    localAckIdWrite <= '0';
    clrOutstandingAckId <= '0';
    clrOutstandingAckId <= '0';
    inboundAckIdWrite <= (others=>'0');
    inboundAckIdWrite <= (others=>'0');
Line 356... Line 383...
    -- Initialize the port to trigger a change of state.
    -- Initialize the port to trigger a change of state.
    portInitialized <= '1';
    portInitialized <= '1';
 
 
    -- The transmitter should send idle sequences at startup and a status once
    -- The transmitter should send idle sequences at startup and a status once
    -- in a while.
    -- in a while.
    for i in 0 to 256 loop
    -- REMARK: Find out why 4 additional idle are sent...
 
    for i in 0 to 259 loop
      ReceiveSymbol(SYMBOL_IDLE);
      ReceiveSymbol(SYMBOL_IDLE);
    end loop;
    end loop;
    ReceiveSymbol(SYMBOL_CONTROL,
    ReceiveSymbol(SYMBOL_CONTROL,
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                                         STYPE1_NOP, "000"),
                                         STYPE1_NOP, "000"),
Line 401... Line 429...
    -- Initialize the port to trigger a change of state.
    -- Initialize the port to trigger a change of state.
    portInitialized <= '1';
    portInitialized <= '1';
 
 
    -- The transmitter should send idle sequences at startup and a status once
    -- The transmitter should send idle sequences at startup and a status once
    -- in a while.
    -- in a while.
    for i in 0 to 256 loop
    for i in 0 to 259 loop
      ReceiveSymbol(SYMBOL_IDLE);
      ReceiveSymbol(SYMBOL_IDLE);
    end loop;
    end loop;
    ReceiveSymbol(SYMBOL_CONTROL,
    ReceiveSymbol(SYMBOL_CONTROL,
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                  RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                                         STYPE1_NOP, "000"),
                                         STYPE1_NOP, "000"),
Line 435... Line 463...
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    PrintR("TG_RioSerial-TC2-Step3");
    PrintR("TG_RioSerial-TC2-Step3");
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
 
 
    -- A received error-free status triggers transmission of status symbols in
    -- A received error-free status triggers transmission of status symbols in
    -- a more rapid past.
    -- a more rapid pace.
    SendSymbol(SYMBOL_CONTROL,
    SendSymbol(SYMBOL_CONTROL,
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                                      STYPE1_NOP, "000"));
                                      STYPE1_NOP, "000"),
 
               true);
 
 
    -- The transmitter should send at least 15 additional statuses after
    -- The transmitter should send at least 15 additional statuses after
    -- receiving an error free status.
    -- receiving an error free status.
    for j in 0 to 15 loop
    for j in 0 to 15 loop
      for i in 0 to 15 loop
      for i in 0 to 15 loop
Line 479... Line 508...
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
    PrintR("TG_RioSerial-TC2-Step5");
    PrintR("TG_RioSerial-TC2-Step5");
    ---------------------------------------------------------------------------
    ---------------------------------------------------------------------------
 
 
    -- Make the link fully initialized by sending 7 additional statuses.
    -- Make the link fully initialized by sending 7 additional statuses.
    for i in 0 to 6 loop
    for i in 0 to 5 loop
      SendSymbol(SYMBOL_CONTROL,
      SendSymbol(SYMBOL_CONTROL,
                 RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                 RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
                                        STYPE1_NOP, "000"));
                                        STYPE1_NOP, "000"));
    end loop;
    end loop;
 
    SendSymbol(SYMBOL_CONTROL,
 
               RioControlSymbolCreate(STYPE0_STATUS, "00000", "11111",
 
                                      STYPE1_NOP, "000"),
 
               true);
 
 
    -- Tick the transmitter by reading it and check that the link is initialized.
    -- Tick the transmitter by reading it and check that the link is initialized.
    ReceiveSymbol(SYMBOL_IDLE);
    ReceiveSymbol(SYMBOL_IDLE);
    ReceiveSymbol(SYMBOL_IDLE);
    ReceiveSymbol(SYMBOL_IDLE);
    ReceiveSymbol(SYMBOL_IDLE);
    ReceiveSymbol(SYMBOL_IDLE);
Line 533... Line 566...
 
 
    -- Check that the frame has been received in the frame buffer.
    -- Check that the frame has been received in the frame buffer.
    wait until frameReceived = '1';
    wait until frameReceived = '1';
    frameExpected <= '0';
    frameExpected <= '0';
 
 
    -- Receive an idle symbol left in the FIFO before the ack was generated.
 
    ReceiveSymbol(SYMBOL_IDLE);
 
 
 
    -- Receive acknowledge for the transmitted frame.
    -- Receive acknowledge for the transmitted frame.
    ReceiveSymbol(SYMBOL_CONTROL,
    ReceiveSymbol(SYMBOL_CONTROL,
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
                  RioControlSymbolCreate(STYPE0_PACKET_ACCEPTED, "00000", "11111",
                                         STYPE1_NOP, "000"));
                                         STYPE1_NOP, "000"));
 
 
Line 2270... Line 2300...
  -- Instantiate the uart.
  -- Instantiate the uart.
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
 
 
  TestPort: TestSwitchPort
  TestPort: TestSwitchPort
    generic map(
    generic map(
      NUMBER_WORDS=>1)
      NUMBER_WORDS=>NUMBER_WORDS)
    port map(
    port map(
      clk=>clk, areset_n=>areset_n,
      clk=>clk, areset_n=>areset_n,
      frameValid_i=>frameValid, frameWrite_i=>frameWrite, frameComplete_o=>frameComplete,
      frameValid_i=>frameValid, frameWrite_i=>frameWrite, frameComplete_o=>frameComplete,
      frameExpected_i=>frameExpected, frameRead_i=>frameRead, frameReceived_o=>frameReceived,
      frameExpected_i=>frameExpected, frameRead_i=>frameRead, frameReceived_o=>frameReceived,
      readFrameEmpty_o=>readFrameEmpty, readFrame_i=>readFrame,
      readFrameEmpty_o=>readFrameEmpty, readFrame_i=>readFrame,
Line 2286... Line 2316...
      writeFrameFull_o=>writeFrameFull, writeFrame_i=>writeFrame, writeFrameAbort_i=>writeFrameAbort,
      writeFrameFull_o=>writeFrameFull, writeFrame_i=>writeFrame, writeFrameAbort_i=>writeFrameAbort,
      writeContent_i=>writeContent, writeContentData_i=>writeContentData);
      writeContent_i=>writeContent, writeContentData_i=>writeContentData);
 
 
  TestPhy: RioSerial
  TestPhy: RioSerial
    generic map(
    generic map(
      TIMEOUT_WIDTH=>11)
      TIMEOUT_WIDTH=>11,
 
      NUMBER_WORDS=>NUMBER_WORDS)
    port map(
    port map(
      clk=>clk, areset_n=>areset_n,
      clk=>clk, areset_n=>areset_n,
      portLinkTimeout_i=>portLinkTimeout,
      portLinkTimeout_i=>portLinkTimeout,
      linkInitialized_o=>linkInitialized,
      linkInitialized_o=>linkInitialized,
      inputPortEnable_i=>inputPortEnable,
      inputPortEnable_i=>inputPortEnable,
Line 2301... Line 2332...
      outstandingAckId_i=>outstandingAckIdWrite,
      outstandingAckId_i=>outstandingAckIdWrite,
      outboundAckId_i=>outboundAckIdWrite,
      outboundAckId_i=>outboundAckIdWrite,
      inboundAckId_o=>inboundAckIdRead,
      inboundAckId_o=>inboundAckIdRead,
      outstandingAckId_o=>outstandingAckIdRead,
      outstandingAckId_o=>outstandingAckIdRead,
      outboundAckId_o=>outboundAckIdRead,
      outboundAckId_o=>outboundAckIdRead,
      readFrameEmpty_i=>readFrameEmpty, readFrame_o=>readFrame, readFrameRestart_o=>readFrameRestart,
      readFrameEmpty_i=>readFrameEmpty,
 
      readFrame_o=>readFrame,
 
      readFrameRestart_o=>readFrameRestart,
      readFrameAborted_i=>readFrameAborted,
      readFrameAborted_i=>readFrameAborted,
      readWindowEmpty_i=>readWindowEmpty,
      readWindowEmpty_i=>readWindowEmpty,
      readWindowReset_o=>readWindowReset, readWindowNext_o=>readWindowNext,
      readWindowReset_o=>readWindowReset,
 
      readWindowNext_o=>readWindowNext,
      readContentEmpty_i=>readContentEmpty,
      readContentEmpty_i=>readContentEmpty,
      readContent_o=>readContent, readContentEnd_i=>readContentEnd, readContentData_i=>readContentData,
      readContent_o=>readContent,
      writeFrameFull_i=>writeFrameFull, writeFrame_o=>writeFrame, writeFrameAbort_o=>writeFrameAbort,
      readContentEnd_i=>readContentEnd,
      writeContent_o=>writeContent, writeContentData_o=>writeContentData,
      readContentData_i=>readContentData,
 
      writeFrameFull_i=>writeFrameFull,
 
      writeFrame_o=>writeFrame,
 
      writeFrameAbort_o=>writeFrameAbort,
 
      writeContent_o=>writeContent,
 
      writeContentData_o=>writeContentData,
      portInitialized_i=>portInitialized,
      portInitialized_i=>portInitialized,
      outboundSymbolFull_i=>outboundSymbolFull,
      outboundSymbolFull_i=>outboundSymbolFull,
      outboundSymbolWrite_o=>outboundSymbolWrite,
      outboundSymbolWrite_o=>outboundSymbolWrite,
 
      outboundSymbolType_o=>outboundSymbolType,
      outboundSymbol_o=>outboundSymbol,
      outboundSymbol_o=>outboundSymbol,
      inboundSymbolEmpty_i=>inboundSymbolEmpty,
      inboundSymbolEmpty_i=>inboundSymbolEmpty,
      inboundSymbolRead_o=>inboundSymbolRead,
      inboundSymbolRead_o=>inboundSymbolRead,
 
      inboundSymbolType_i=>inboundSymbolType,
      inboundSymbol_i=>inboundSymbol);
      inboundSymbol_i=>inboundSymbol);
 
 
end architecture;
end architecture;
 
 
 
 
Line 2337... Line 2378...
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- 
-- 
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
entity TestSwitchPort is
entity TestSwitchPort is
  generic(
  generic(
    NUMBER_WORDS : natural range 1 to 8 := 1);
    NUMBER_WORDS : natural range 1 to 4 := 1);
  port(
  port(
    clk : in std_logic;
    clk : in std_logic;
    areset_n : in std_logic;
    areset_n : in std_logic;
 
 
    frameValid_i : in std_logic_vector(0 to 63);
    frameValid_i : in std_logic_vector(0 to 63);
Line 2362... Line 2403...
    readWindowNext_i : in std_logic;
    readWindowNext_i : in std_logic;
 
 
    readContentEmpty_o : out std_logic;
    readContentEmpty_o : out std_logic;
    readContent_i : in std_logic;
    readContent_i : in std_logic;
    readContentEnd_o : out std_logic;
    readContentEnd_o : out std_logic;
    readContentData_o : out std_logic_vector(31 downto 0);
    readContentData_o : out std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0);
 
 
    writeFrameFull_o : out std_logic;
    writeFrameFull_o : out std_logic;
    writeFrame_i : in std_logic;
    writeFrame_i : in std_logic;
    writeFrameAbort_i : in std_logic;
    writeFrameAbort_i : in std_logic;
    writeContent_i : in std_logic;
    writeContent_i : in std_logic;
    writeContentData_i : in std_logic_vector(31 downto 0));
    writeContentData_i : in std_logic_vector(2+(32*NUMBER_WORDS-1) downto 0));
end entity;
end entity;
 
 
 
 
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- 
-- 
Line 2385... Line 2426...
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  FrameSender: process
  FrameSender: process
    variable frameComplete : std_logic_vector(0 to 63);
    variable frameComplete : std_logic_vector(0 to 63);
    variable frameIndex : natural range 0 to 70;
    variable frameIndex : natural range 0 to 70;
    variable backIndex, frontIndex : natural range 0 to 63;
    variable backIndex, frontIndex : natural range 0 to 63;
 
    variable remaining : natural;
  begin
  begin
    readFrameEmpty_o <= '1';
    readFrameEmpty_o <= '1';
    readFrameAborted_o <= '0';
    readFrameAborted_o <= '0';
    readWindowEmpty_o <= '1';
    readWindowEmpty_o <= '1';
    readContentEmpty_o <= '1';
    readContentEmpty_o <= '1';
Line 2454... Line 2496...
        readContentData_o <= (others=>'U');
        readContentData_o <= (others=>'U');
      end if;
      end if;
 
 
      if (readContent_i = '1') then
      if (readContent_i = '1') then
        assert frameValid_i(frontIndex) = '1' report "Unexpected content read." severity error;
        assert frameValid_i(frontIndex) = '1' report "Unexpected content read." severity error;
        readContentData_o <= frameWrite_i(frontIndex).payload(frameIndex);
        remaining := frameWrite_i(frontIndex).length - frameIndex;
 
        if (remaining > NUMBER_WORDS) then
 
          readContentData_o(2+(32*NUMBER_WORDS-1) downto 2+(32*NUMBER_WORDS-1)-1) <= std_logic_vector(to_unsigned(NUMBER_WORDS, 2));
 
          remaining := NUMBER_WORDS;
 
        else
 
          readContentData_o(2+(32*NUMBER_WORDS-1) downto 2+(32*NUMBER_WORDS-1)-1) <= std_logic_vector(to_unsigned(remaining, 2));
 
        end if;
 
 
 
        for i in 0 to remaining-1 loop
 
          readContentData_o((NUMBER_WORDS*32-1)-32*i downto (NUMBER_WORDS-1)*32-32*i) <= frameWrite_i(frontIndex).payload(frameIndex);
        frameIndex := frameIndex + 1;
        frameIndex := frameIndex + 1;
 
        end loop;
 
 
        if (frameIndex /= frameWrite_i(frontIndex).length) then
        if (frameIndex /= frameWrite_i(frontIndex).length) then
          readContentEnd_o <= '0';
          readContentEnd_o <= '0';
        else
        else
          readContentEnd_o <= '1';
          readContentEnd_o <= '1';
        end if;
        end if;
Line 2481... Line 2534...
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  FrameReader: process
  FrameReader: process
    type StateType is (STATE_IDLE, STATE_READ, STATE_UPDATE);
    type StateType is (STATE_IDLE, STATE_READ, STATE_UPDATE);
    variable state : StateType;
    variable state : StateType;
    variable frameIndex : natural range 0 to 69;
    variable frameIndex : natural range 0 to 69;
 
    variable words : natural range 0 to 4;
  begin
  begin
    writeFrameFull_o <= '1';
    writeFrameFull_o <= '1';
    frameReceived_o <= '0';
    frameReceived_o <= '0';
    wait until areset_n = '1';
    wait until areset_n = '1';
 
 
Line 2514... Line 2568...
          end if;
          end if;
          if (writeFrameAbort_i = '1') then
          if (writeFrameAbort_i = '1') then
            frameIndex := 0;
            frameIndex := 0;
          end if;
          end if;
          if (writeContent_i = '1') then
          if (writeContent_i = '1') then
            assert writeContentData_i(32*NUMBER_WORDS-1 downto 0) = frameRead_i.payload(frameIndex)
            words := to_integer(unsigned(writeContentData_i(2+(32*NUMBER_WORDS-1) downto 2+(32*NUMBER_WORDS-1)-1)));
 
            for i in 0 to words loop
 
              assert writeContentData_i((NUMBER_WORDS*32-1)-32*i downto (NUMBER_WORDS-1)*32-32*i) = frameRead_i.payload(frameIndex)
              report "Unexpected frame content received." severity error;
              report "Unexpected frame content received." severity error;
            frameIndex := frameIndex + 1;
            frameIndex := frameIndex + 1;
 
            end loop;
          end if;
          end if;
          if (frameExpected_i = '0') then
          if (frameExpected_i = '0') then
            state := STATE_IDLE;
            state := STATE_IDLE;
          end if;
          end if;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.