Jump to content

shine2828

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by shine2828

  1. Rsepected All,

     

    I found that there are many senior & well rich (by knowledge) engineers/ scientists exist over here in this forum. So I thought to take a chance to share my doubt in area of UVM as a student.

     

    I understand that I may not be even competant upto your level or you may find my doubt as silly. But your guidance & help is highly expected to my studies.

     

    A portion of code I have pasted below. Can anybody please guide me that what exactly this code means (especially run phase) ? 

     

    I expect that senior/junior fellow in a group will justify my humble request.

     

    Thanks,

     

    Code :

     

    function void ram_scoreboard::memory_write(wr_xtn wd);

               if(wd.write)

              begin

         ref_data[wd.addr] = wd.data;

         end

          endfunction : memory_write

     

           //-------  memory_read() method  -------//

     

          function bit ram_scoreboard::memory_read(ref rd_xtn rd);

                if(rd.read)

                 begin

                if(ref_data.exists(rd.addr))

                begin

            rd.data = ref_data[rd.addr] ;

             return(1);

                end

                else

                begin

              return(0);

            end                        

            end

          endfunction : memory_read 

     

     //-----------------  run() phase  -------------------//

     

           task ram_scoreboard::run_phase(uvm_phase phase);

             fork

             forever begin

                fifo_wrh.get(wr_data);

                 memory_write(wr_data);

                     end


               forever begin

                fifo_rdh.get(rd_data);

                 check_data(rd_data);

                       end

             join

           endtask


            //Explore method check_data

           function void ram_scoreboard::check_data(rd_xtn rd);

                rd_xtn ref_xtn;

                // Copy of read XTN

                $cast( ref_xtn, rd.clone());

          if(mem_read(ref_xtn))

                begin

                      //compare

                if(rd.compare(ref_xtn))

                begin

                `uvm_info(get_type_name(), $sformatf("Scoreboard - Data Match successful"), UVM_MEDIUM)

                           end

                else 

                `uvm_error(get_type_name(), $sformatf("\n Scoreboard Error [Data Mismatch]: \n Received Transaction:\n %s \n Expected Transaction: \n %s",rd.sprint(), ref_xtn.sprint()))

                end

                else

                uvm_report_info(get_type_name(), $psprintf("No Data written in the address=%d \n %s",rd.addr, rd.sprint()));

        endfunction

     

×
×
  • Create New...