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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_11/] [bench/] [verilog/] [tb_eth_top.v] - Diff between revs 41 and 49

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 41 Rev 49
Line 39... Line 39...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.7  2002/02/06 14:11:35  mohor
 
// non-DMA host interface added. Select the right configutation in eth_defines.
 
//
// Revision 1.6  2001/12/08 12:36:00  mohor
// Revision 1.6  2001/12/08 12:36:00  mohor
// TX_BD_NUM register added instead of the RB_BD_ADDR.
// TX_BD_NUM register added instead of the RB_BD_ADDR.
//
//
// Revision 1.5  2001/10/19 11:24:04  mohor
// Revision 1.5  2001/10/19 11:24:04  mohor
// Number of addresses (wb_adr_i) minimized.
// Number of addresses (wb_adr_i) minimized.
Line 701... Line 704...
 
 
  WishboneWrite(32'h00000800, {26'h0, `ETH_MODER_ADR<<2});     // r_Rst = 1
  WishboneWrite(32'h00000800, {26'h0, `ETH_MODER_ADR<<2});     // r_Rst = 1
  WishboneWrite(32'h00000000, {26'h0, `ETH_MODER_ADR<<2});     // r_Rst = 0
  WishboneWrite(32'h00000000, {26'h0, `ETH_MODER_ADR<<2});     // r_Rst = 0
  WishboneWrite(32'h00000080, {26'h0, `ETH_TX_BD_NUM_ADR<<2}); // r_RxBDAddress = 0x80
  WishboneWrite(32'h00000080, {26'h0, `ETH_TX_BD_NUM_ADR<<2}); // r_RxBDAddress = 0x80
 
 
  WishboneWrite(32'h0002A443, {26'h0, `ETH_MODER_ADR<<2});     // RxEn, Txen, FullD, CrcEn, Pad, DmaEn, r_IFG
  WishboneWrite(32'h00022043, {26'h0, `ETH_MODER_ADR<<2});     // RxEn, Txen, CrcEn, Pad, DmaEn, r_IFG
 
 
  WishboneWrite(32'h00000004, {26'h0, `ETH_CTRLMODER_ADR<<2}); //r_TxFlow = 1
  WishboneWrite(32'h00000004, {26'h0, `ETH_CTRLMODER_ADR<<2}); //r_TxFlow = 1
 
 
 
  WishboneWrite(32'h12345678, {26'h0, `ETH_HASH0_ADR<<2});
 
  WishboneWrite(32'h98765432, {26'h0, `ETH_HASH1_ADR<<2});
 
  WishboneRead({26'h0, `ETH_HASH0_ADR<<2});   // Read from HASH0 register
 
  WishboneRead({26'h0, `ETH_HASH1_ADR<<2});   // Read from HASH1 register
 
 
 
 
  SendPacket(16'h0010, 1'b0);
  SendPacket(16'h0007, 1'b0);
  SendPacket(16'h0011, 1'b0);
  SendPacket(16'h0011, 1'b0);
  SendPacket(16'h0012, 1'b0);
  SendPacket(16'h0012, 1'b0);
  SendPacket(16'h0013, 1'b0);
  SendPacket(16'h0013, 1'b0);
  SendPacket(16'h0014, 1'b0);
  SendPacket(16'h0014, 1'b0);
 
 
Line 722... Line 730...
  SendPacket(16'h0045, 1'b0);
  SendPacket(16'h0045, 1'b0);
  SendPacket(16'h0025, 1'b0);
  SendPacket(16'h0025, 1'b0);
  SendPacket(16'h0017, 1'b0);
  SendPacket(16'h0017, 1'b0);
 
 
//  ReceivePacket(16'h0012, 1'b1, 1'b0);    // Initializes RxBD and then Sends a control packet on the MRxD[3:0] signals.
//  ReceivePacket(16'h0012, 1'b1, 1'b0);    // Initializes RxBD and then Sends a control packet on the MRxD[3:0] signals.
  ReceivePacket(16'h0015, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h000b, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h0016, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h0016, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h0017, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h0017, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h0018, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
  ReceivePacket(16'h0018, 1'b0, 1'b0);    // Initializes RxBD and then generates traffic on the MRxD[3:0] signals.
 
 
  repeat(5000) @ (posedge MRxClk);        // Waiting some time for all accesses to finish before reading out the statuses.
  repeat(5000) @ (posedge MRxClk);        // Waiting some time for all accesses to finish before reading out the statuses.
Line 750... Line 758...
  WishboneRead({22'h01, (10'h87<<2)});       // Read from RxBD register
  WishboneRead({22'h01, (10'h87<<2)});       // Read from RxBD register
 
 
  #100000 $stop;
  #100000 $stop;
end
end
 
 
//integer ijk;
integer ijk;
 
 
//initial
initial
//ijk = 0;    // for stoping generation of the m_wb_ack_i signal at the right moment so we get underrun
ijk = 0;    // for stoping generation of the m_wb_ack_i signal at the right moment so we get underrun
 
 
// Answering to master Wishbone requests
// Answering to master Wishbone requests
 
//wire [31:0] daatax = 32'h87654321;
 
//wire [31:0] daatay = 32'h00edcba9;
 
 
always @ (posedge WB_CLK_I)
always @ (posedge WB_CLK_I)
begin
begin
  if(m_wb_cyc_o & m_wb_stb_o) // Add valid address range
  if(m_wb_cyc_o & m_wb_stb_o) // Add valid address range
    begin
    begin
      repeat(3) @ (posedge WB_CLK_I);
      repeat(3) @ (posedge WB_CLK_I);
        begin
        begin
//          if(ijk==41)
          if(ijk==6) // mama
 
            MColl = 1;
 
//          if(ijk==9)
 
          else
 
            MColl = 0;
//            begin
//            begin
//              repeat(1000) @ (posedge WB_CLK_I);
//              repeat(1000) @ (posedge WB_CLK_I);
//            end
//            end
//          else
//          else
            m_wb_ack_i <=#Tp 1'b1;
            m_wb_ack_i <=#Tp 1'b1;
          if(~m_wb_we_o)
          if(~m_wb_we_o)
            begin
            begin
              #Tp m_wb_dat_i = m_wb_adr_o + 1'b1; // For easier following of the data
              #Tp m_wb_dat_i = m_wb_adr_o + 1'b1; // For easier following of the data
 
//                #Tp m_wb_dat_i = ijk? daatay : daatax;
              $fdisplay(mcd1, "(%0t) master read (0x%0x) = 0x%0x", $time, m_wb_adr_o, m_wb_dat_i);
              $fdisplay(mcd1, "(%0t) master read (0x%0x) = 0x%0x", $time, m_wb_adr_o, m_wb_dat_i);
//              ijk = ijk + 1;
 
            end
            end
          else
          else
            $fdisplay(mcd2, "(%0t) master write (0x%0x) = 0x%0x", $time, m_wb_adr_o, m_wb_dat_o);
            $fdisplay(mcd2, "(%0t) master write (0x%0x) = 0x%0x", $time, m_wb_adr_o, m_wb_dat_o);
        end
        end
      @ (posedge WB_CLK_I);
      @ (posedge WB_CLK_I);
 
      ijk = ijk + 1;
      m_wb_ack_i <=#Tp 1'b0;
      m_wb_ack_i <=#Tp 1'b0;
    end
    end
end
end
 
 
// Generating error
// Generating error
Line 902... Line 918...
    TempAddr = {22'h01, ((TxBDIndex + 1'b1)<<2)};
    TempAddr = {22'h01, ((TxBDIndex + 1'b1)<<2)};
    TempData = 32'h78563411;
    TempData = 32'h78563411;
    WishboneWrite(TempData, TempAddr); // buffer pointer
    WishboneWrite(TempData, TempAddr); // buffer pointer
 
 
 
 
    TempAddr = {22'h01, (TxBDIndex<<2)};  // igor !!! zbrisi spodnjo vrstico
    TempAddr = {22'h01, (TxBDIndex<<2)};
//    TempAddr = {22'h01, 10'b1010010100};
 
 
 
    TempData = {Length[15:0], 1'b1, 1'b0, Wrap, 3'h0, ControlFrame, 1'b0, TxBDIndex[7:0]};  // Ready and Wrap = 1
    TempData = {Length[15:0], 1'b1, 1'b0, Wrap, 3'h0, ControlFrame, 1'b0, TxBDIndex[7:0]};  // Ready and Wrap = 1
 
 
    #1;
    #1;
//    if(TxBDIndex == 6)    // Only 4 buffer descriptors are used
//    if(TxBDIndex == 6)    // Only 4 buffer descriptors are used
Line 969... Line 984...
task GetDataOnMRxD;
task GetDataOnMRxD;
  input [15:0] Len;
  input [15:0] Len;
  input abort;
  input abort;
  integer tt;
  integer tt;
 
 
 
//  reg [87:0] ddata;
 
 
  begin
  begin
 
//    ddata = 88'h50727196edcba987654321;
 
 
    @ (posedge MRxClk);
    @ (posedge MRxClk);
    MRxDV=1'b1;
    MRxDV=1'b1;
 
 
    for(tt=0; tt<15; tt=tt+1)
    for(tt=0; tt<15; tt=tt+1)
    begin
    begin
Line 990... Line 1009...
        RxAbort<=#1 abort;
        RxAbort<=#1 abort;
      @ (posedge MRxClk);
      @ (posedge MRxClk);
      MRxD=tt[7:4];
      MRxD=tt[7:4];
      RxAbort<=#1 0;
      RxAbort<=#1 0;
    end
    end
 
/*
 
    for(tt=0; tt<Len; tt=tt+1)
 
    begin
 
      @ (posedge MRxClk);
 
      MRxD=ddata[3:0];
 
      $display("MRxD=0x%0x", MRxD);
 
      if(tt==9)
 
        RxAbort<=#1 abort;
 
      @ (posedge MRxClk);
 
      MRxD=ddata[7:4];
 
      $display("MRxD=0x%0x", MRxD);
 
      ddata[87:0] = {8'h0, ddata[87:8]};
 
 
 
      RxAbort<=#1 0;
 
    end
 
*/
    @ (posedge MRxClk);
    @ (posedge MRxClk);
    MRxDV=1'b0;
    MRxDV=1'b0;
  end
  end
endtask
endtask
 
 

powered by: WebSVN 2.1.0

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