Jump to content

Help Required for Scoreboard Code


shine2828
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

Respected Shine2828,

I do not quite correspond to the profile you expect from a user on this forum, but will try to answer your question:

 

The run_phase function runs two processes in parallel (in the fork ... join block). One is writing to the ram model when a write transaction is available at the write fifo.  The other process is checking (read and verify) the real read data against the data in the ram model when a read transaction is available in the read fifo.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...