data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv
 line:6: before: "import"
1: b'%Error: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:6: syntax error, unexpected IDENTIFIER, expecting PACKAGE-IDENTIFIER or STRING\nimport avalon_mm_pkg::*; \n       ^~~~~~~~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:60: Unsupported: Ignoring delay on this delayed statement.\n        #200 reset_n = 1\'b1; \n        ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:61: Unsupported: Ignoring delay on this delayed statement.\n        #50; \n        ^\n%Error: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:65: syntax error, unexpected \'@\'\n          @(posedge clk); \n          ^\n%Warning-STMTDLY: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:78: Unsupported: Ignoring delay on this delayed statement.\n        #2.5 clk <= ~clk; \n        ^\n%Error: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:174: Unsupported: fork statements\n        fork : get_response_block \n        ^~~~\n%Error: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:177: syntax error, unexpected \'@\'\n            @(posedge clk); \n            ^\n%Error: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:180: syntax error, unexpected \'@\'\n          repeat (100) @(posedge clk); \n                       ^\n%Error: data/full_repos/permissive/116866011/PipeCNN/project/efi_testbench.sv:185: Unsupported: disable fork statements\n        disable fork; \n        ^~~~~~~\n%Error: Exiting due to 6 error(s), 3 warning(s)\n'
module efi_testbench; 
 
    localparam MAX_WIDTH=`MAX_WIDTH; 
    localparam NUM_SNKS=`NUM_SNKS; 
    localparam NUM_SRCS=`NUM_SRCS; 
 


    import "DPI-C" context task dpi_init( input int num_efis, input int max_width, input int debug); 
    import "DPI-C" context task dpi_update(); 
    import "DPI-C" context task dpi_close(); 
    import "DPI-C" context task dpi_efi_return(input bit [31:0] id, input bit [MAX_WIDTH-1:0] data); 
 
    export "DPI-C" task dpi_efi_call; 

 
    reg clk; 
    reg reset_n; 
 
    integer i; 
 

    logic [NUM_SNKS-1:0] snk_valid; 
    logic [MAX_WIDTH-1:0] snk_data[NUM_SNKS]; 
    logic [NUM_SNKS-1:0] snk_ready; 
 

    logic [NUM_SRCS-1:0] src_valid; 
    logic [MAX_WIDTH-1:0] src_data[NUM_SRCS]; 
    logic [NUM_SRCS-1:0] src_ready; 
 

    initial 
    begin 
        `ifdef DEBUG_VERBOSITY 

            set_verbosity( VERBOSITY_INFO ); 
        `else 
            set_verbosity( VERBOSITY_WARNING ); 
        `endif 
    end 
 
    initial 
    begin 
        reset_n = 1'b0; 
        #200 reset_n = 1'b1; 
        #50; 
        dpi_init(NUM_SRCS, MAX_WIDTH, (get_verbosity() >= VERBOSITY_INFO)); 
        forever begin 
          dpi_update(); 
          @(posedge clk); 
        end 
    end 
 
    final 
    begin 

    end 
 

    initial 
        clk = 1'b1; 
    always 
        #2.5 clk <= ~clk; 
 
   genvar s; 
   generate 
   for ( s=0; s<NUM_SNKS; s=s+1) 
   begin : src_bfm 
     altera_avalon_st_source_bfm #( 
       .ST_SYMBOL_W(1), 
       .ST_NUMSYMBOLS(MAX_WIDTH) 
     ) st_source ( 
       .clk(clk), 
       .reset(!resetn), 
       .src_data(snk_data[s]), 
       .src_channel(), 
       .src_valid(snk_valid[s]), 
       .src_startofpacket(), 
       .src_endofpacket(), 
       .src_error(), 
       .src_empty(), 
       .src_ready(snk_ready[s]) 
     ); 
   end 
   endgenerate 
 
   generate 
   for ( s=0; s<NUM_SRCS; s=s+1) 
   begin : snk_bfm 
     altera_avalon_st_sink_bfm #( 
       .ST_SYMBOL_W(1), 
       .ST_NUMSYMBOLS(MAX_WIDTH) 
     ) st_sink ( 
       .clk(clk), 
       .reset(!resetn), 
       .sink_data(src_data[s]), 
       .sink_channel(), 
       .sink_valid(src_valid[s]), 
       .sink_startofpacket(), 
       .sink_endofpacket(), 
       .sink_error(), 
       .sink_empty(), 
       .sink_ready(src_ready[s])); 
 

    always@(posedge clk) 
    begin 
      if (snk_bfm[s].st_sink.get_transaction_queue_size() > 0) 
      begin 
        logic [MAX_WIDTH-1:0] return_val; 
 
        snk_bfm[s].st_sink.pop_transaction(); 
        return_val = snk_bfm[s].st_sink.get_transaction_data(); 
        if(get_verbosity() >= VERBOSITY_INFO) 
          $display( "%0d: Received from channel %2d value = 0x%h", $time, s, return_val); 
        dpi_efi_return( s, return_val ); 
      end 
    end 

    initial 
    begin 
      snk_bfm[s].st_sink.init(); 
      snk_bfm[s].st_sink.set_ready(1'b1); 
    end 
 
   end 
   endgenerate 
 
 

    task dpi_efi_call; 
        input bit [31:0] id; 
        input bit [MAX_WIDTH-1:0] data; 
 
        if(get_verbosity() >= VERBOSITY_INFO) 
            $display( "%0d: Writing to channel %2d with value = 0x%h", $time, id, data ); 
 
        case (id) 
          'hdeadbeef : begin 
            dpi_close(); 
            $finish; 
          end 
          0 : channel_write_src0(data); 
 
          default : begin 
            $display ("%0d: Invalid call id called: %d",$time,id); 
            dpi_close(); 
            $finish; 
          end 
        endcase 
    endtask

    task channel_write_src0;
        input [MAX_WIDTH-1:0] data; 
        src_bfm[0].st_source.set_transaction_data(data); 
        src_bfm[0].st_source.push_transaction(); 
 

        fork : get_response_block 
        begin 
          while(src_bfm[0].st_source.get_response_queue_size() == 0) 
            @(posedge clk); 
        end 
        begin 
          repeat (100) @(posedge clk); 
          print(VERBOSITY_ERROR, "No response received"); 
          $stop; 
        end 
        join_any : get_response_block 
        disable fork; 
 

        src_bfm[0].st_source.pop_response(); 
    endtask

mult_add_fix8bx4 mult_add_fix8bx40 ( 
  .clock ( clk ),
  .resetn ( reset_n ),
  .iready ( src_ready[0] ),
  .dataa_0 ( snk_data[0][7:0] ),
  .datab_0 ( snk_data[0][15:8] ),
  .dataa_1 ( snk_data[0][23:16] ),
  .datab_1 ( snk_data[0][31:24] ),
  .dataa_2 ( snk_data[0][39:32] ),
  .datab_2 ( snk_data[0][47:40] ),
  .dataa_3 ( snk_data[0][55:48] ),
  .datab_3 ( snk_data[0][63:56] ),
  .ivalid ( snk_valid[0] ),
  .ovalid ( src_valid[0] ),
  .result ( src_data[0] ),
  .oready ( snk_ready[0] )
);
endmodule
module efi_testbench;
 
 
    localparam MAX_WIDTH=`MAX_WIDTH; 
    localparam NUM_SNKS=`NUM_SNKS; 
    localparam NUM_SRCS=`NUM_SRCS; 
 


    import "DPI-C" context task dpi_init( input int num_efis, input int max_width, input int debug); 
    import "DPI-C" context task dpi_update(); 
    import "DPI-C" context task dpi_close(); 
    import "DPI-C" context task dpi_efi_return(input bit [31:0] id, input bit [MAX_WIDTH-1:0] data); 
 
    export "DPI-C" task dpi_efi_call; 

 
    reg clk; 
    reg reset_n; 
 
    integer i; 
 

    logic [NUM_SNKS-1:0] snk_valid; 
    logic [MAX_WIDTH-1:0] snk_data[NUM_SNKS]; 
    logic [NUM_SNKS-1:0] snk_ready; 
 

    logic [NUM_SRCS-1:0] src_valid; 
    logic [MAX_WIDTH-1:0] src_data[NUM_SRCS]; 
    logic [NUM_SRCS-1:0] src_ready; 
 

    initial 
    begin 
        `ifdef DEBUG_VERBOSITY 

            set_verbosity( VERBOSITY_INFO ); 
        `else 
            set_verbosity( VERBOSITY_WARNING ); 
        `endif 
    end 
 
    initial 
    begin 
        reset_n = 1'b0; 
        #200 reset_n = 1'b1; 
        #50; 
        dpi_init(NUM_SRCS, MAX_WIDTH, (get_verbosity() >= VERBOSITY_INFO)); 
        forever begin 
          dpi_update(); 
          @(posedge clk); 
        end 
    end 
 
    final 
    begin 

    end 
 

    initial 
        clk = 1'b1; 
    always 
        #2.5 clk <= ~clk; 
 
   genvar s; 
   generate 
   for ( s=0; s<NUM_SNKS; s=s+1) 
   begin : src_bfm 
     altera_avalon_st_source_bfm #( 
       .ST_SYMBOL_W(1), 
       .ST_NUMSYMBOLS(MAX_WIDTH) 
     ) st_source ( 
       .clk(clk), 
       .reset(!resetn), 
       .src_data(snk_data[s]), 
       .src_channel(), 
       .src_valid(snk_valid[s]), 
       .src_startofpacket(), 
       .src_endofpacket(), 
       .src_error(), 
       .src_empty(), 
       .src_ready(snk_ready[s]) 
     ); 
   end 
   endgenerate 
 
   generate 
   for ( s=0; s<NUM_SRCS; s=s+1) 
   begin : snk_bfm 
     altera_avalon_st_sink_bfm #( 
       .ST_SYMBOL_W(1), 
       .ST_NUMSYMBOLS(MAX_WIDTH) 
     ) st_sink ( 
       .clk(clk), 
       .reset(!resetn), 
       .sink_data(src_data[s]), 
       .sink_channel(), 
       .sink_valid(src_valid[s]), 
       .sink_startofpacket(), 
       .sink_endofpacket(), 
       .sink_error(), 
       .sink_empty(), 
       .sink_ready(src_ready[s])); 
 

    always@(posedge clk) 
    begin 
      if (snk_bfm[s].st_sink.get_transaction_queue_size() > 0) 
      begin 
        logic [MAX_WIDTH-1:0] return_val; 
 
        snk_bfm[s].st_sink.pop_transaction(); 
        return_val = snk_bfm[s].st_sink.get_transaction_data(); 
        if(get_verbosity() >= VERBOSITY_INFO) 
          $display( "%0d: Received from channel %2d value = 0x%h", $time, s, return_val); 
        dpi_efi_return( s, return_val ); 
      end 
    end 

    initial 
    begin 
      snk_bfm[s].st_sink.init(); 
      snk_bfm[s].st_sink.set_ready(1'b1); 
    end 
 
   end 
   endgenerate 
 
 

    task dpi_efi_call; 
        input bit [31:0] id; 
        input bit [MAX_WIDTH-1:0] data; 
 
        if(get_verbosity() >= VERBOSITY_INFO) 
            $display( "%0d: Writing to channel %2d with value = 0x%h", $time, id, data ); 
 
        case (id) 
          'hdeadbeef : begin 
            dpi_close(); 
            $finish; 
          end 
          0 : channel_write_src0(data); 
 
          default : begin 
            $display ("%0d: Invalid call id called: %d",$time,id); 
            dpi_close(); 
            $finish; 
          end 
        endcase 
    endtask

    task channel_write_src0;
        input [MAX_WIDTH-1:0] data; 
        src_bfm[0].st_source.set_transaction_data(data); 
        src_bfm[0].st_source.push_transaction(); 
 

        fork : get_response_block 
        begin 
          while(src_bfm[0].st_source.get_response_queue_size() == 0) 
            @(posedge clk); 
        end 
        begin 
          repeat (100) @(posedge clk); 
          print(VERBOSITY_ERROR, "No response received"); 
          $stop; 
        end 
        join_any : get_response_block 
        disable fork; 
 

        src_bfm[0].st_source.pop_response(); 
    endtask

mult_add_fix8bx4 mult_add_fix8bx40 ( 
  .clock ( clk ),
  .resetn ( reset_n ),
  .iready ( src_ready[0] ),
  .dataa_0 ( snk_data[0][7:0] ),
  .datab_0 ( snk_data[0][15:8] ),
  .dataa_1 ( snk_data[0][23:16] ),
  .datab_1 ( snk_data[0][31:24] ),
  .dataa_2 ( snk_data[0][39:32] ),
  .datab_2 ( snk_data[0][47:40] ),
  .dataa_3 ( snk_data[0][55:48] ),
  .datab_3 ( snk_data[0][63:56] ),
  .ivalid ( snk_valid[0] ),
  .ovalid ( src_valid[0] ),
  .result ( src_data[0] ),
  .oready ( snk_ready[0] )
);
endmodule