data/full_repos/permissive/141038711/tb/apb_decode_test.v
 line:41: before: ","
1: b'%Error: data/full_repos/permissive/141038711/tb/apb_decode_test.v:58: syntax error, unexpected \'@\'\n      @(posedge pclk)\n      ^\n%Warning-STMTDLY: data/full_repos/permissive/141038711/tb/apb_decode_test.v:81: Unsupported: Ignoring delay on this delayed statement.\n            #1 $stop;\n            ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/141038711/tb/apb_decode_test.v:104: Unsupported: Ignoring delay on this delayed statement.\n            #1 $stop;\n            ^\n%Warning-STMTDLY: data/full_repos/permissive/141038711/tb/apb_decode_test.v:124: Unsupported: Ignoring delay on this delayed statement.\n            #1 $stop;\n            ^\n%Warning-STMTDLY: data/full_repos/permissive/141038711/tb/apb_decode_test.v:133: Unsupported: Ignoring delay on this delayed statement.\n      #500 $stop;\n      ^\n%Error: Exiting due to 1 error(s), 4 warning(s)\n'
module apb_decode_test;

localparam CLK_PERIOD=100;

localparam PORTS     = 4;
localparam BOTREGION = 1024;
localparam REGION    = 3072;
localparam TOP_DEFAULT  = 0;

                            

wire        [ 31:0] paddr;
wire                pwrite;
wire                psel;
wire                penable;
wire        [ 31:0] pwdata;
wire        [ 31:0] prdata;
wire                pready;
wire                pslverr;
   

wire         [31:0] m_paddr;
wire                m_pwrite;
wire [PORTS-1:0] m_psel;
wire                m_penable;
wire        [ 31:0] m_pwdata;
reg       [31:0] m_prdata [0:PORTS-1];
reg  [PORTS-1:0] m_pready;
reg  [PORTS-1:0] m_pslverr;

   assign paddr[31:16] = 16'h0; 

integer a,adrs;
time    now,later;


   initial
   begin 
      
      if (TOP_DEFAULT)
         $display("Testbench gives two errors you should ignore");
         
      m_pready   = {PORTS{1'b1}};
      m_pslverr  = 'b0;
      a = 0;
      for (adrs=BOTREGION; adrs<BOTREGION+PORTS*REGION; adrs=adrs+REGION)
      begin
         m_prdata[a]  = a+1;
         a = a + 1;
      end
      @(posedge pclk)
         #(CLK_PERIOD*5) ;  
         

      for (adrs=0; adrs<1024*16; adrs=adrs+1024)
      begin
         apb_bus0.write(adrs,32'h11223344);
         if (TOP_DEFAULT)
            a = 4;
         else  
            a = 0;
         if (adrs>=1024 && adrs<4096)
            a = 1;
          if (adrs>=4096 && adrs<7168)
            a = 2;
          if (adrs>=7168 && adrs<10240)
            a = 3;
          if (adrs>=10240 && adrs<13312)
            a = 4;
         apb_bus0.read(adrs,a); 
         if (a==0 && !pslverr)
         begin
            $display("%m@%0t: Slave error missing",$time);
            #1 $stop;
         end
      end

      for (adrs=1020; adrs<1024*16; adrs=adrs+1024)
      begin
         apb_bus0.write(adrs,32'h11223344);
         if (TOP_DEFAULT)
            a = 4;
         else  
            a = 0;
         if (adrs>=1024 && adrs<4096)
            a = 1;
          if (adrs>=4096 && adrs<7168)
            a = 2;
          if (adrs>=7168 && adrs<10240)
            a = 3;
          if (adrs>=10240 && adrs<13312)
            a = 4;
         apb_bus0.read(adrs,a); 
         if (a==0 && !pslverr)
         begin
            $display("%m@%0t: Slave error missing",$time);
            #1 $stop;
         end
      end
      apb_bus0.delay(3);
      

      for (a=0; a<4; a=a+1)
      begin

         m_pready[a] <= 1'b0;
         m_pready[a] <= #(CLK_PERIOD*50) 1'b1;
         now  = $time;
         adrs = 1024 + a*3072;
         apb_bus0.write(adrs,32'h11223344);
         apb_bus0.delay(3);

         later = $time;
         if (later-now < CLK_PERIOD*50)
         begin
            $display("%m@%0t: pready %d did not seem to work",$time,a);
            #1 $stop;
         end
      end
            
      if (apb_bus0.errors==0 || (TOP_DEFAULT && apb_bus0.errors==2))
         $display("apb_decode test passed");
      else
         $display("apb_decode test failed");
         
      #500 $stop;
      
   end


apb_decode
   #(
      .PORTS     (PORTS)   ,
      .BOTREGION (BOTREGION),  
      .REGION    (REGION),    
      .TOP_DEFAULT  (TOP_DEFAULT)
   )
apb_decode_0 (

      .s_paddr  (paddr),
      .s_pwrite (pwrite),
      .s_psel   (psel),
      .s_penable(penable),
      .s_pwdata (pwdata),
      .s_prdata (prdata),
      .s_pready (pready),
      .s_pslverr(pslverr),
   

      .m_paddr  (m_paddr),
      .m_pwrite (m_pwrite),
      .m_psel   (m_psel),
      .m_penable(m_penable),
      .m_pwdata (m_pwdata),
      .m_prdata ( {m_prdata[3],
                   m_prdata[2],
                   m_prdata[1],
                   m_prdata[0]}                   
                ),
      .m_pready (m_pready),
      .m_pslverr(m_pslverr) 
   );
   
apb_bus 
#(.CLKPER(CLK_PERIOD)
 )
apb_bus0 (

      .pclk     (pclk),
      .paddr    (paddr[15:0]),
      .pwrite   (pwrite),
      .psel     (psel),
      .penable  (penable),
      .pwdata   (pwdata),
      .prdata   (prdata),
      .pready   (pready),
      .pslverr  (pslverr)
      ); 
   

endmodule
module apb_decode_test;


localparam CLK_PERIOD=100;

localparam PORTS     = 4;
localparam BOTREGION = 1024;
localparam REGION    = 3072;
localparam TOP_DEFAULT  = 0;

                            

wire        [ 31:0] paddr;
wire                pwrite;
wire                psel;
wire                penable;
wire        [ 31:0] pwdata;
wire        [ 31:0] prdata;
wire                pready;
wire                pslverr;
   

wire         [31:0] m_paddr;
wire                m_pwrite;
wire [PORTS-1:0] m_psel;
wire                m_penable;
wire        [ 31:0] m_pwdata;
reg       [31:0] m_prdata [0:PORTS-1];
reg  [PORTS-1:0] m_pready;
reg  [PORTS-1:0] m_pslverr;

   assign paddr[31:16] = 16'h0; 

integer a,adrs;
time    now,later;


   initial
   begin 
      
      if (TOP_DEFAULT)
         $display("Testbench gives two errors you should ignore");
         
      m_pready   = {PORTS{1'b1}};
      m_pslverr  = 'b0;
      a = 0;
      for (adrs=BOTREGION; adrs<BOTREGION+PORTS*REGION; adrs=adrs+REGION)
      begin
         m_prdata[a]  = a+1;
         a = a + 1;
      end
      @(posedge pclk)
         #(CLK_PERIOD*5) ;  
         

      for (adrs=0; adrs<1024*16; adrs=adrs+1024)
      begin
         apb_bus0.write(adrs,32'h11223344);
         if (TOP_DEFAULT)
            a = 4;
         else  
            a = 0;
         if (adrs>=1024 && adrs<4096)
            a = 1;
          if (adrs>=4096 && adrs<7168)
            a = 2;
          if (adrs>=7168 && adrs<10240)
            a = 3;
          if (adrs>=10240 && adrs<13312)
            a = 4;
         apb_bus0.read(adrs,a); 
         if (a==0 && !pslverr)
         begin
            $display("%m@%0t: Slave error missing",$time);
            #1 $stop;
         end
      end

      for (adrs=1020; adrs<1024*16; adrs=adrs+1024)
      begin
         apb_bus0.write(adrs,32'h11223344);
         if (TOP_DEFAULT)
            a = 4;
         else  
            a = 0;
         if (adrs>=1024 && adrs<4096)
            a = 1;
          if (adrs>=4096 && adrs<7168)
            a = 2;
          if (adrs>=7168 && adrs<10240)
            a = 3;
          if (adrs>=10240 && adrs<13312)
            a = 4;
         apb_bus0.read(adrs,a); 
         if (a==0 && !pslverr)
         begin
            $display("%m@%0t: Slave error missing",$time);
            #1 $stop;
         end
      end
      apb_bus0.delay(3);
      

      for (a=0; a<4; a=a+1)
      begin

         m_pready[a] <= 1'b0;
         m_pready[a] <= #(CLK_PERIOD*50) 1'b1;
         now  = $time;
         adrs = 1024 + a*3072;
         apb_bus0.write(adrs,32'h11223344);
         apb_bus0.delay(3);

         later = $time;
         if (later-now < CLK_PERIOD*50)
         begin
            $display("%m@%0t: pready %d did not seem to work",$time,a);
            #1 $stop;
         end
      end
            
      if (apb_bus0.errors==0 || (TOP_DEFAULT && apb_bus0.errors==2))
         $display("apb_decode test passed");
      else
         $display("apb_decode test failed");
         
      #500 $stop;
      
   end


apb_decode
   #(
      .PORTS     (PORTS)   ,
      .BOTREGION (BOTREGION),  
      .REGION    (REGION),    
      .TOP_DEFAULT  (TOP_DEFAULT)
   )
apb_decode_0 (

      .s_paddr  (paddr),
      .s_pwrite (pwrite),
      .s_psel   (psel),
      .s_penable(penable),
      .s_pwdata (pwdata),
      .s_prdata (prdata),
      .s_pready (pready),
      .s_pslverr(pslverr),
   

      .m_paddr  (m_paddr),
      .m_pwrite (m_pwrite),
      .m_psel   (m_psel),
      .m_penable(m_penable),
      .m_pwdata (m_pwdata),
      .m_prdata ( {m_prdata[3],
                   m_prdata[2],
                   m_prdata[1],
                   m_prdata[0]}                   
                ),
      .m_pready (m_pready),
      .m_pslverr(m_pslverr) 
   );
   
apb_bus 
#(.CLKPER(CLK_PERIOD)
 )
apb_bus0 (

      .pclk     (pclk),
      .paddr    (paddr[15:0]),
      .pwrite   (pwrite),
      .psel     (psel),
      .penable  (penable),
      .pwdata   (pwdata),
      .prdata   (prdata),
      .pready   (pready),
      .pslverr  (pslverr)
      ); 
   

endmodule