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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [io/] [ip/] [io_ps2/] [sim/] [icarus/] [mouse_default/] [test_define] - Rev 131

Compare with Previous | Blame | View Log

`include "../../testbenches/elab/io_ps2_mouse_tb/sw/mb.v"

initial
 begin
 $display("              ");
 $display("          ===================================================");
 $display("%t  Test Start",$realtime);
 $display("          ===================================================");
 $display("              ");
 test.reading = 8'h00;

 test.cg.next(20);
 
 test.cg.next(10);
 fork
 begin


test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end

// send ff to device
 test.bus.u_write(ps2_data, 8'hff);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(1000);

 

// receive fa
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h40)  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_cmp(ps2_data, 8'hfa);    
 test.cg.next(1000);

// receive aa
 test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h40)  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_cmp(ps2_data, 8'haa);   
 test.cg.next(1000);

// receive 00
 test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h40)  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_cmp(ps2_data, 8'h00);
 test.cg.next(1000);


// send f3 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hf3);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);


// send c8 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hc8);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);

// send f3 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hf3);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);




// send 64 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'h64);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);



// send f3 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hf3);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);



// send 50 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'h50);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);

 test.cg.next(10000);


// send f2 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hf2);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);



// receive fa
 test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h40)  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_cmp(ps2_data, 8'hfa);
 test.cg.next(1000);




// send e8 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'he8);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);



// send 03 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'h03);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);



// send f3 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hf3);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);


// send 28 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'h28);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);

// send f4 to device
test.start   = 1'b1;
 test.bus.u_read(status, test.reading);
 while(test.start )
   begin
    test.bus.u_read(status, test.reading);
    if( test.reading & 8'h80)  test.start = 1;
    else                  test.start = 0;
    test.cg.next(100);
   end
 test.bus.u_write(ps2_data, 8'hf4);
 test.bus.u_write(cntrl, 8'h02);
  test.cg.next(5000);
 test.bus.u_write(cntrl, 8'h00);
 test.cg.next(100);
 test.bus.u_write(cntrl, 8'h01);


 test.cg.next(1000);


 end
 begin
 test.ps2_model.rcv_byte(8'hff,1'b1);
 test.cg.next(5000);
 test.ps2_model.send_byte(8'hfa);
 test.cg.next(20000);
 test.ps2_model.send_byte(8'haa);
 test.cg.next(20000);
 test.ps2_model.send_byte(8'h00);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hf3,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hc8,1'b0);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hf3,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'h64,1'b0);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hf3,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'h50,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hf2,1'b0);
 test.cg.next(5000);
 test.ps2_model.send_byte(8'hfa);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'he8,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'h03,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hf3,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'h28,1'b1);
 test.cg.next(2000);
 test.ps2_model.rcv_byte(8'hf4,1'b0);

// Now send mice packets
 test.ps2_model.send_byte(8'h12);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'h34);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'h56);
 test.cg.next(2000);
 
 test.ps2_model.send_byte(8'h78);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'h9a);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'hbc);
 test.cg.next(2000);

 test.ps2_model.send_byte(8'hde);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'hf0);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'h01);
 test.cg.next(2000);

 test.ps2_model.send_byte(8'h23);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'h45);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'h67);
 test.cg.next(2000);

 test.ps2_model.send_byte(8'h89);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'hab);
 test.cg.next(2000);
 test.ps2_model.send_byte(8'hcd);
 test.cg.next(2000);


 end
 join



test.cg.exit;
end







Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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