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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [axis_video_frame/] [legacy/] [avf_rx.sv] - Rev 45

Compare with Previous | Blame | View Log

//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
//////////////////////////////////////////////////////////////////////

import axis_video_frame_bfm_pkg::*;

module
  avf_rx
  #(
    BYTES_PER_PIXEL  = 2,
    AVF_OUTPUTS      = 4,
    AVF_TILES        = 1
  )
  (
    ref axis_video_frame_bfm_class f_tx_h[AVF_TILES],
    ref axis_video_frame_bfm_class f_rx_h[AVF_TILES]
  );

  // --------------------------------------------------------------------
  //
  localparam AVF_VERTICAL_BLANKING = 20;

  task automatic
    init_avf_rx;

      f_rx_h[0].run_rx_q(RIGHT_DOWN);
      f_rx_h[1].run_rx_q(RIGHT_UP);
      f_rx_h[2].run_rx_q(LEFT_DOWN);
      f_rx_h[3].run_rx_q(LEFT_UP);

  endtask: init_avf_rx


  // --------------------------------------------------------------------
  //
  task
    wait_for_rx_frames
    (
      input int unsigned count
    );

    repeat(count)
      @(f_rx_h[0].rx_frame_done);

  endtask: wait_for_rx_frames


  // --------------------------------------------------------------------
  //
  semaphore get_frame_semaphore = new(1);
  logic get_frame_active = 0;

  task automatic
    get_frame;

      if(get_frame_semaphore.try_get() == 0)
      begin
        $display("^^^ %16.t | %m | ERROR! Already getting a frame.", $time);
        return;
      end

      $display("^^^ %16.t | %m | getting a frame.", $time);
      get_frame_active = 1;

      fork
      begin

        f_rx_h[0].avf_fork_rx(RIGHT_DOWN);
        f_rx_h[1].avf_fork_rx(RIGHT_UP);
        f_rx_h[2].avf_fork_rx(LEFT_DOWN);
        f_rx_h[3].avf_fork_rx(LEFT_UP);

        wait fork;
        get_frame_active = 0;
        $display("^^^ %16.t | %m | Got a frame.", $time);
        get_frame_semaphore.put();

      end
      join_none


  endtask: get_frame


  // --------------------------------------------------------------------
  //
  import video_frame_pkg::*;

  function automatic
    int compare_frame;

    int mismatch_count[AVF_TILES];

    $display("^^^ %16.t | %m", $time);

    foreach(f_rx_h[i])
      mismatch_count[i] = f_rx_h[i].f_h.compare(8, f_tx_h[i].f_h);


  endfunction: compare_frame


  // --------------------------------------------------------------------
  //


endmodule




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.