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

Subversion Repositories gpio

[/] [gpio/] [trunk/] [bench/] [verilog/] [tb_tasks.v] - Diff between revs 56 and 63

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

Rev 56 Rev 63
Line 42... Line 42...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.10  2003/12/17 13:00:14  gorand
 
// added ECLK and NEC registers, all tests passed.
 
//
// Revision 1.9  2003/11/30 12:28:19  gorand
// Revision 1.9  2003/11/30 12:28:19  gorand
// small "names" modification...
// small "names" modification...
//
//
// Revision 1.8  2003/11/19 14:22:43  gorand
// Revision 1.8  2003/11/19 14:22:43  gorand
// small changes, to satisfy VATS..
// small changes, to satisfy VATS..
Line 163... Line 166...
//
//
task setaux;
task setaux;
input   [31:0] val;
input   [31:0] val;
 
 
begin
begin
 
`ifdef GPIO_RGPIO_AUX
        #100 gpio_testbench.wb_master.wr(`GPIO_RGPIO_AUX<<sh_addr, val, 4'b1111);
        #100 gpio_testbench.wb_master.wr(`GPIO_RGPIO_AUX<<sh_addr, val, 4'b1111);
 
`endif //  GPIO_RGPIO_AUX
end
end
 
 
endtask
endtask
 
 
//
//
Line 199... Line 204...
//
//
task seteclk;
task seteclk;
input   [31:0] val;
input   [31:0] val;
 
 
begin
begin
 
`ifdef GPIO_RGPIO_ECLK
        #100 gpio_testbench.wb_master.wr(`GPIO_RGPIO_ECLK<<sh_addr, val, 4'b1111);
        #100 gpio_testbench.wb_master.wr(`GPIO_RGPIO_ECLK<<sh_addr, val, 4'b1111);
 
`endif //  GPIO_RGPIO_ECLK
end
end
 
 
endtask
endtask
 
 
//
//
Line 211... Line 218...
//
//
task setnec;
task setnec;
input   [31:0] val;
input   [31:0] val;
 
 
begin
begin
 
`ifdef GPIO_RGPIO_NEC
        #100 gpio_testbench.wb_master.wr(`GPIO_RGPIO_NEC<<sh_addr, val, 4'b1111);
        #100 gpio_testbench.wb_master.wr(`GPIO_RGPIO_NEC<<sh_addr, val, 4'b1111);
 
`endif // GPIO_RGPIO_NEC
end
end
 
 
endtask
endtask
 
 
// Display RGPIO_IN register
// Display RGPIO_IN register
Line 288... Line 297...
//
//
task showaux;
task showaux;
 
 
reg     [31:0] tmp;
reg     [31:0] tmp;
begin
begin
 
`ifdef GPIO_RGPIO_AUX
        #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_AUX<<sh_addr, tmp);
        #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_AUX<<sh_addr, tmp);
        $write(" RGPIO_AUX:%h", tmp);
        $write(" RGPIO_AUX:%h", tmp);
 
`endif // GPIO_RGPIO_AUX
end
end
 
 
endtask
endtask
 
 
//
//
Line 327... Line 338...
//
//
task showeclk;
task showeclk;
 
 
reg [31:0] tmp;
reg [31:0] tmp;
begin
begin
 
`ifdef GPIO_RGPIO_ECLK
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_ECLK<<sh_addr, tmp);
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_ECLK<<sh_addr, tmp);
  $write(" RGPIO_ECLK:%h", tmp);
  $write(" RGPIO_ECLK:%h", tmp);
 
`endif //  GPIO_RGPIO_ECLK
end
end
 
 
endtask
endtask
 
 
//
//
Line 340... Line 353...
//
//
task shownec;
task shownec;
 
 
reg [31:0] tmp;
reg [31:0] tmp;
begin
begin
 
`ifdef GPIO_RGPIO_NEC
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_NEC<<sh_addr, tmp);
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_NEC<<sh_addr, tmp);
  $write(" RGPIO_NEC:%h", tmp);
  $write(" RGPIO_NEC:%h", tmp);
 
`endif //  GPIO_RGPIO_NEC
end
end
 
 
endtask
endtask
 
 
 
 
Line 434... Line 449...
//
//
task getaux;
task getaux;
output  [31:0]   tmp;
output  [31:0]   tmp;
 
 
begin
begin
 
`ifdef GPIO_RGPIO_AUX
        #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_AUX<<sh_addr, tmp);
        #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_AUX<<sh_addr, tmp);
 
`endif //  GPIO_RGPIO_AUX
end
end
 
 
endtask
endtask
 
 
//
//
Line 470... Line 487...
//
//
task geteclk;
task geteclk;
output  [31:0]  tmp;
output  [31:0]  tmp;
 
 
begin
begin
 
`ifdef GPIO_RGPIO_ECLK
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_ECLK<<sh_addr, tmp);
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_ECLK<<sh_addr, tmp);
 
`endif //  GPIO_RGPIO_ECLK
end
end
 
 
endtask
endtask
 
 
//
//
Line 482... Line 501...
//
//
task getnec;
task getnec;
output  [31:0]  tmp;
output  [31:0]  tmp;
 
 
begin
begin
 
`ifdef GPIO_RGPIO_NEC
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_NEC<<sh_addr, tmp);
  #100 gpio_testbench.wb_master.rd(`GPIO_RGPIO_NEC<<sh_addr, tmp);
 
`endif //  GPIO_RGPIO_NEC
end
end
 
 
endtask
endtask
 
 
//
//
Line 573... Line 594...
        gpio_testbench.gpio_mon.set_gpioin(r3);
        gpio_testbench.gpio_mon.set_gpioin(r3);
 
 
        // Wait for WB clock
        // Wait for WB clock
        @(posedge gpio_testbench.clk);
        @(posedge gpio_testbench.clk);
        @(posedge gpio_testbench.clk);
        @(posedge gpio_testbench.clk);
 
        @(posedge gpio_testbench.clk);
 
        @(posedge gpio_testbench.clk);
 
 
        // Read RGPIO_IN
        // Read RGPIO_IN
        getin(l3);
        getin(l3);
 
 
        //
        //
Line 768... Line 791...
 
 
                // Read gpio_oen
                // Read gpio_oen
                gpio_testbench.gpio_mon.get_gpiooen(l2);
                gpio_testbench.gpio_mon.get_gpiooen(l2);
 
 
                // Compare gpio_oen and RGPIO_OE. Should be exactly opposite.
                // Compare gpio_oen and RGPIO_OE. Should be exactly opposite.
                if (l1 != ~l2)
                if (l1 != l2)
                        err = err + 1;
                        err = err + 1;
        end
        end
 
 
        // Phase 6
        // Phase 6
        //
        //
Line 782... Line 805...
                $display(" OK");
                $display(" OK");
        else
        else
                failed;
                failed;
 
 
        $write("  Testing auxiliary feature ...");
        $write("  Testing auxiliary feature ...");
 
`ifdef GPIO_AUX_IMPLEMENT
        //
        //
        // Phase 7
        // Phase 7
        //
        //
        // Compare RGPIO_OUT, gpio_out, RGPIO_AUX and gpio_aux
        // Compare RGPIO_OUT, gpio_out, RGPIO_AUX and gpio_aux
        //
        //
Line 826... Line 849...
        if (!err)
        if (!err)
                $display(" OK");
                $display(" OK");
        else
        else
                failed;
                failed;
 
 
 
`else
 
        $display("  Not implemented !!");
 
`endif //  GPIO_AUX_IMPLEMENT
 
 
end
end
endtask
endtask
 
 
//
//
// Test interrupts
// Test interrupts
Line 884... Line 911...
 
 
                // Advance time
                // Advance time
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
 
                @(posedge gpio_testbench.clk);
 
                @(posedge gpio_testbench.clk);
 
 
                // Sample interrupt request. Should be one.
                // Sample interrupt request. Should be one.
                l2 = gpio_testbench.gpio_top.wb_inta_o;
                l2 = gpio_testbench.gpio_top.wb_inta_o;
 
 
                // Clear interrupt request
                // Clear interrupt request
Line 977... Line 1006...
 
 
                // Advance time
                // Advance time
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
                @(posedge gpio_testbench.clk);
 
                @(posedge gpio_testbench.clk);
 
                @(posedge gpio_testbench.clk);
 
 
                // Sample interrupt request. Should be one.
                // Sample interrupt request. Should be one.
                l2 = gpio_testbench.gpio_top.wb_inta_o;
                l2 = gpio_testbench.gpio_top.wb_inta_o;
 
 
                // Clear interrupt request
                // Clear interrupt request
Line 1041... Line 1072...
        gpio_testbench.gpio_mon.set_gpioeclk(0);
        gpio_testbench.gpio_mon.set_gpioeclk(0);
        $display;
        $display;
        $display("###");
        $display("###");
        $display("### GPIO IP Core Verification ###");
        $display("### GPIO IP Core Verification ###");
        $display("###");
        $display("###");
 
 
 
`ifdef GPIO_IMPLEMENTED
 
 
        $display;
        $display;
        $display("I. Testing correct operation of RGPIO_CTRL control bits");
        $display("I. Testing correct operation of RGPIO_CTRL control bits");
        $display;
        $display;
 
 
 
 
        $write("  Testing control bit RGPIO_CTRL[ECLK] ...");
 
        local_errs = 0;
        local_errs = 0;
 
#1
 
 
 
  gpio_testbench.text = "Test INTS";
 
        test_ints;
 
 
 
        $display;
 
        $display("II. Testing modes of operation ...");
 
        $display;
 
 
 
  gpio_testbench.text = "Test simple";
 
        test_simple;
 
  gpio_testbench.text = "Test ptrig";
 
        test_ptrig;
 
 
 
 
 
        $display;
 
        $display("III. Testing registers external clock");
 
        $display;
 
 
 
`ifdef GPIO_CLKPAD
 
        $write("  Testing control register ECLK ...");
 
  gpio_testbench.text = "Test ECLK";
        for (i = 0; i < 10 * `GPIO_VERIF_INTENSITY; i = i + 1)
        for (i = 0; i < 10 * `GPIO_VERIF_INTENSITY; i = i + 1)
                test_eclk;
                test_eclk;
        if (local_errs == 0)
        if (local_errs == 0)
                $display(" OK");
                $display(" OK");
        else
        else
                failed;
                failed;
 
 
 
        $write("  Testing control register NEC ...");
        $write("  Testing control bit RGPIO_CTRL[NEC] ...");
 
        local_errs = 0;
        local_errs = 0;
 
  gpio_testbench.text = "Test NEC";
        for (i = 0; i < 10 * `GPIO_VERIF_INTENSITY; i = i + 1)
        for (i = 0; i < 10 * `GPIO_VERIF_INTENSITY; i = i + 1)
                test_nec;
                test_nec;
        if (local_errs == 0)
        if (local_errs == 0)
                $display(" OK");
                $display(" OK");
        else
        else
                failed;
                failed;
 
`else
        test_ints;
        $display("  External clock not enabled!!");
 
`endif // GPIO_CLKPAD
 
 
        $display;
        $display;
        $display("II. Testing modes of operation ...");
        $display("###");
 
        $display("### FAILED TESTS: %d ###", nr_failed);
 
        $display("###");
        $display;
        $display;
 
 
        test_simple;
`else
        test_ptrig;
 
 
 
        $display;
 
        $display("###");
        $display("###");
        $display("### FAILED TESTS: %d ###", nr_failed);
        $display("### GPIO not implemented ");
        $display("###");
        $display("###");
        $display;
  nr_failed = 1;
 
 
 
`endif //  GPIO_IMPLEMENTED
//      $finish;
//      $finish;
  if ( nr_failed == 0 )
  if ( nr_failed == 0 )
    begin
    begin
    $display ("report (%h)", 32'hdeaddead ) ;
    $display ("report (%h)", 32'hdeaddead ) ;
    $display ("exit (00000000)" ) ;
    $display ("exit (00000000)" ) ;

powered by: WebSVN 2.1.0

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