video_tasks.v 3.75 KB
task vi_test;
//  test debug socket
    begin
       test_selected <= HIGH;
       repeat (10) @(posedge clock);

       config_rdram;

       // put some data in the dram first
       // write_word(BUS_ADDRESS_DRAM,    3, 32'h0ad00da0);
       // write_word(BUS_ADDRESS_DRAM+4,  3, 32'h1ad11da1);
       // write_word(BUS_ADDRESS_DRAM+8,  3, 32'h2ad22da2);
       // write_word(BUS_ADDRESS_DRAM+12, 3, 32'h3ad33da3);
       // write_word(BUS_ADDRESS_DRAM+16, 3, 32'h4ad44da4);

       // write registers in video controller
       read_word(BUS_ADDRESS_VI_CTRL, 3);
       if (data[0] !== 32'h00000000)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_ORIGIN, 3,	32'h00001000);
       read_word(BUS_ADDRESS_VI_ORIGIN, 3);
       if (data[0] !== 32'h00001000)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_WIDTH, 3,	32'h00000400);
       read_word(BUS_ADDRESS_VI_WIDTH, 3);
       if (data[0] !== 32'h00000400)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_V_INT, 3,	32'h000003FF);
       read_word(BUS_ADDRESS_VI_V_INT, 3);
       if (data[0] !== 32'h000003FF)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_BURST, 3, 	32'h00820404);
       read_word(BUS_ADDRESS_VI_BURST, 3);
       if (data[0] !== 32'h00820404)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_V_SYNC, 3, 	32'h00000010);
       read_word(BUS_ADDRESS_VI_V_SYNC, 3);
       if (data[0] !== 32'h00000010)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_H_SYNC, 3,	32'h00000100);
       read_word(BUS_ADDRESS_VI_H_SYNC, 3);
       if (data[0] !== 32'h00000100)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_LEAP, 3,	32'h01000100);
       read_word(BUS_ADDRESS_VI_LEAP, 3);
       if (data[0] !== 32'h01000100)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_H_START, 3,	32'h00200040);
       read_word(BUS_ADDRESS_VI_H_START, 3);
       if (data[0] !== 32'h00200040)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_V_START, 3,	32'h0005000D);
       read_word(BUS_ADDRESS_VI_V_START, 3);
       if (data[0] !== 32'h0005000D)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_V_BURST, 3,	32'h0005000D);
       read_word(BUS_ADDRESS_VI_V_BURST, 3);
       if (data[0] !== 32'h0005000D)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_X_SCALE, 3,	32'h00000400);
       read_word(BUS_ADDRESS_VI_X_SCALE, 3);
       if (data[0] !== 32'h00000400)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_Y_SCALE, 3,	32'h00000200);
       read_word(BUS_ADDRESS_VI_Y_SCALE, 3);
       if (data[0] !== 32'h00000200)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_CTRL, 3,	32'h0000015E);
       read_word(BUS_ADDRESS_VI_CTRL, 3);
       if (data[0] !== 32'h0000015E)
          $display ("ERROR task vi_test read data is %h ",data[0]);
       write_word(BUS_ADDRESS_VI_V_CURRENT, 3,	32'h00000000); // clr int

       read_word(BUS_ADDRESS_VI_V_CURRENT, 3); // need some read 

       //  wait for a while and watch dma
       repeat (6000) @(posedge clock);

       read_word(BUS_ADDRESS_VI_V_CURRENT, 3);

       // while (data[0]) begin
       //   read_word(BUS_ADDRESS_SI_STATUS, 3);
       // end
       // dma status (data[0]) is done, so read data from dram

       $finish;
    end
endtask