Jump to content

Help in resolving this error?


Recommended Posts

Hello all UVM geeks,

 

I am getting the following error.

 

 Error: monitor71.sv(69): The actual (dataout) and formal (bytestream) for a ref must be equivalent types.

 

Can someone please help me in resolving this error? I want to decode 10bits data received from DUT into 8bits by using 10b8b decoder, which I have used but its giving error when I am trying to put each 10bits received (after collecting them into an array) and then putting each 10bits into decoder to get 8bits and then unpack bytes to create packets. Code is also given below. Its kinda urgent,

 


`include "uvm_macros.svh"

 import uvm_pkg::*;

 

class monitor extends uvm_monitor; 

        //Registration of monitor with the factory.

       `uvm_component_utils(monitor)

 

        virtual dut_if dut_vi; 

         

        // uvm_analysis_port #(transaction) Montr2Sb_port;

       uvm_analysis_port #(transaction) Montr2Agnt_port;  

       

                         

          //constructor by using keyword new

       function new(string name, uvm_component parent);

            super.new(name, parent);

       endfunction: new

               

            

       function void build_phase(uvm_phase phase);

            super.build_phase(phase);  

            assert( uvm_config_db #(virtual dut_if)::get(this, "", "dut_vi", dut_vi) );

            Montr2Agnt_port = new("Montr2Ag", this);            

       endfunction : build_phase

       

       

      task run_phase(uvm_phase phase);

         transaction pkt; 

              fork

              

              forever

               begin

                bit [9:0] bq[$],bytestream[];

                bit [9:0] dataout[];

              

                int j;

                int pkt_len = 13; 

              //  bit [9:0] unsigned bq[$];

               // bit[9:0] unsigned bytestream[]; //keep it like this as the unpack_bytes take unsigned bytestream[].This works too.

             $display("san14- Display of the packet contents %h",dut_vi.data);

             

               

               repeat(3)@(dut_vi.clock); //keep repeat(3) at 3 only in order to match the first byte.Its needed

              

              for ( int j = 0; j < pkt_len ; j++) 

              

                begin

                       $display("san- Display of the packet contents %h",dut_vi.data);

                       

                       @(dut_vi.clock);  

                       $display("san12- Display of the packet contents %h",dut_vi.data);

                       bq.push_back(dut_vi.data);  //getting data from dut_if and putting in queue by pushing in it

                       

                       @( dut_vi.clock); 

                       $display("san11- Display of the queue contents %p",bq);

                       

                       uvm_report_info(get_full_name(),"Ready to Get out of the Foreach/For loop ...",UVM_LOW);

                end

                 

               uvm_report_info(get_full_name(),"Got out of the Foreach loop ...",UVM_LOW);

               

               $display("san31- Display of the queue contents %h",bq.size());

               bytestream = new[bq.size()] (bq);  //(bq)

               

               $display("san32- Display of the bytes array contents %h",bytestream);

               pkt = transaction::type_id::create("pkt1");

               uvm_report_info(get_full_name(),"Started unpacking of received bytes ...",UVM_LOW); 

               decode(bytestream);

               void'(pkt.unpack_bytes(dataout)); //ERROR IS POINTING AT THIS LINE.

               

               pkt.print();

               uvm_report_info(get_full_name(),"Completed unpacking of received bytes ...",UVM_LOW);

               //pkt.print();

               Montr2Agnt_port.write(pkt);

               

               $display("san34- Display of the bytes array contents %h",bytestream);          

                

                uvm_report_info(get_full_name(),"Sending received packet from monitor to the Scoreboard ...",UVM_LOW);

                

              end

             join

       endtask: run_phase 

         

      

             

   

    virtual function decode(bytestream);

        

        bit [9:0]bytestream[]; 

        

        uvm_report_info(get_full_name(),"Decoding Each 10bits into 8bits ...",UVM_LOW); 

             

        foreach (bytestream[k])       

          begin          

           

           bit dispin ;

           

           bit [9:0] dataout ;  //output bytes of decoder

        

            reg[9:0] datain = bytestream[k];

           logic code_err ;

           logic disp_err ;

 

           logic ai = datain[0] ;

           logic bi = datain[1] ;

           logic ci = datain[2] ;

           logic di = datain[3] ;

           logic ei = datain[4] ;

           logic ii = datain[5] ;

           logic fi = datain[6] ;

           logic gi = datain[7] ;

           logic hi = datain[8] ;

           logic ji = datain[9] ;

 

           logic aeqb = (ai & bi) | (!ai & !bi) ;

           logic ceqd = (ci & di) | (!ci & !di) ;

           logic p22 = (ai & bi & !ci & !di) |

              (ci & di & !ai & !bi) |

              ( !aeqb & !ceqd) ;

           logic p13 = ( !aeqb & !ci & !di) |

              ( !ceqd & !ai & !bi) ;

           logic p31 = ( !aeqb & ci & di) |

              ( !ceqd & ai & bi) ;

 

           //logic p40;

            //datain = pout;

           logic p40 = ai & bi & ci & di ;

           logic p04 = !ai & !bi & !ci & !di ;

 

           logic disp6a = p31 | (p22 & dispin) ; // pos disp if p22 and was pos, or p31.

           logic disp6a2 = p31 & dispin ;  // disp is ++ after 4 bits

           logic disp6a0 = p13 & ! dispin ; // -- disp after 4 bits

             

           logic disp6b = (((ei & ii & ! disp6a0) | (disp6a & (ei | ii)) | disp6a2 |

           (ei & ii & di)) & (ei | ii | di)) ;

 

              // The 5B/6B decoding special cases where ABCDE != abcde

 

           logic p22bceeqi = p22 & bi & ci & (ei == ii) ;

           logic p22bncneeqi = p22 & !bi & !ci & (ei == ii) ;

           logic p13in = p13 & !ii ;

           logic p31i = p31 & ii ;

           logic p13dei = p13 & di & ei & ii ;

           logic p22aceeqi = p22 & ai & ci & (ei == ii) ;

           logic p22ancneeqi = p22 & !ai & !ci & (ei == ii) ;

           logic p13en = p13 & !ei ;

           logic anbnenin = !ai & !bi & !ei & !ii ;

           logic abei = ai & bi & ei & ii ;

           logic cdei = ci & di & ei & ii ;

           logic cndnenin = !ci & !di & !ei & !ii ;

 

              //non-zero disparity cases:

           logic p22enin = p22 & !ei & !ii ;

           logic p22ei = p22 & ei & ii ;

                //logic p13in = p12 & !ii ;

                //logic p31i = p31 & ii ;

           logic p31dnenin = p31 & !di & !ei & !ii ;

                //logic p13dei = p13 & di & ei & ii ;

           logic p31e = p31 & ei ;

 

           logic compa = p22bncneeqi | p31i | p13dei | p22ancneeqi | 

          p13en | abei | cndnenin ;

           logic compb = p22bceeqi | p31i | p13dei | p22aceeqi | 

          p13en | abei | cndnenin ;

           logic compc = p22bceeqi | p31i | p13dei | p22ancneeqi | 

          p13en | anbnenin | cndnenin ;

           logic compd = p22bncneeqi | p31i | p13dei | p22aceeqi |

          p13en | abei | cndnenin ;

           logic compe = p22bncneeqi | p13in | p13dei | p22ancneeqi | 

          p13en | anbnenin | cndnenin ;

 

           logic ao = ai ^ compa ;

           logic bo = bi ^ compb ;

           logic co = ci ^ compc ;

           logic d0 = di ^ compd ;

           logic eo = ei ^ compe ;

 

           logic feqg = (fi & gi) | (!fi & !gi) ;

           logic heqj = (hi & ji) | (!hi & !ji) ;

           logic fghj22 = (fi & gi & !hi & !ji) |

          (!fi & !gi & hi & ji) |

          ( !feqg & !heqj) ;

           logic fghjp13 = ( !feqg & !hi & !ji) |

          ( !heqj & !fi & !gi) ;

           logic fghjp31 = ( (!feqg) & hi & ji) |

          ( !heqj & fi & gi) ;

 

           logic dispout = (fghjp31 | (disp6b & fghj22) | (hi & ji)) & (hi | ji) ;

 

           logic ko = ( (ci & di & ei & ii) | ( !ci & !di & !ei & !ii) |

          (p13 & !ei & ii & gi & hi & ji) |

          (p31 & ei & !ii & !gi & !hi & !ji)) ;

 

           logic alt7 =   (fi & !gi & !hi & // 1000 cases, where disp6b is 1

          ((dispin & ci & di & !ei & !ii) | ko |

           (dispin & !ci & di & !ei & !ii))) |

          (!fi & gi & hi & // 0111 cases, where disp6b is 0

          (( !dispin & !ci & !di & ei & ii) | ko |

           ( !dispin & ci & !di & ei & ii))) ;

 

           logic k28 = (ci & di & ei & ii) | ! (ci | di | ei | ii) ;

                  // k28 with positive disp into fghi - .1, .2, .5, and .6 special cases

           logic k28p = ! (ci | di | ei | ii) ;

           logic fo = (ji & !fi & (hi | !gi | k28p)) |

             (fi & !ji & (!hi | gi | !k28p)) |

             (k28p & gi & hi) |

             (!k28p & !gi & !hi) ;

           logic go = (ji & !fi & (hi | !gi | !k28p)) |

             (fi & !ji & (!hi | gi |k28p)) |

             (!k28p & gi & hi) |

             (k28p & !gi & !hi) ;

           logic ho = ((ji ^ hi) & ! ((!fi & gi & !hi & ji & !k28p) | (!fi & gi & hi & !ji & k28p) | 

             (fi & !gi & !hi & ji & !k28p) | (fi & !gi & hi & !ji & k28p))) |

             (!fi & gi & hi & ji) | (fi & !gi & !hi & !ji) ;

 

           logic disp6p = (p31 & (ei | ii)) | (p22 & ei & ii) ;

           logic disp6n = (p13 & ! (ei & ii)) | (p22 & !ei & !ii) ;

           logic disp4p = fghjp31 ;

           logic disp4n = fghjp13 ;

 

           //assign 

           code_err = p40 | p04 | (fi & gi & hi & ji) | (!fi & !gi & !hi & !ji) |

             (p13 & !ei & !ii) | (p31 & ei & ii) | 

             (ei & ii & fi & gi & hi) | (!ei & !ii & !fi & !gi & !hi) | 

             (ei & !ii & gi & hi & ji) | (!ei & ii & !gi & !hi & !ji) |

             (!p31 & ei & !ii & !gi & !hi & !ji) |

             (!p13 & !ei & ii & gi & hi & ji) |

             (((ei & ii & !gi & !hi & !ji) | 

               (!ei & !ii & gi & hi & ji)) &

              ! ((ci & di & ei) | (!ci & !di & !ei))) |

             (disp6p & disp4p) | (disp6n & disp4n) |

             (ai & bi & ci & !ei & !ii & ((!fi & !gi) | fghjp13)) |

             (!ai & !bi & !ci & ei & ii & ((fi & gi) | fghjp31)) |

             (fi & gi & !hi & !ji & disp6p) |

             (!fi & !gi & hi & ji & disp6n) |

             (ci & di & ei & ii & !fi & !gi & !hi) |

             (!ci & !di & !ei & !ii & fi & gi & hi) ;

 

           //assign 

            dataout = {ko, ho, go, fo, eo, d0, co, bo, ao} ;

 

              // my disp err fires for any legal codes that violate disparity, may fire for illegal codes

            //assign 

            disp_err = ((dispin & disp6p) | (disp6n & !dispin) |

               (dispin & !disp6n & fi & gi) |

               (dispin & ai & bi & ci) |

               (dispin & !disp6n & disp4p) |

               (!dispin & !disp6p & !fi & !gi) |

               (!dispin & !ai & !bi & !ci) |

               (!dispin & !disp6p & disp4n) |

               (disp6p & disp4p) | (disp6n & disp4n)) ;

               

             uvm_report_info(get_full_name(),"Decoded Each 10bits into 8bits ...",UVM_LOW);

             $display("SM02- Display of the Decoded data contents %h",dataout);

          end

      endfunction: decode 

 

 endclass: monitor

 

[\code]

 

Thanks,
Link to comment
Share on other sites

Have you checked the UVM class reference?  The function prototype for unpack_bytes is

 

function int unpack_bytes(ref byte unsigned bytestream[], input uvm_packer packer = null);
 

 

You declared dataout (the actual) as an array of 10-bit values, which does not match in type with the bytestream argument (the formal), which is typed as an array of 8-bit values in the prototype.

 

You need to pass in an array of bytes.  You'll probably have to design your own 10b8b conversion in your decoder before unpacking into your packet.

Link to comment
Share on other sites

Hello mea1201,

You are so right. I also sensed that protptype of unpack_bytes and now corrected the error. Now I am trying to pass the array of bytes (the output of decoder) to unpack_bytes, but its not working. I made the changes accordingly in decoder function and created new function drive to create the array of bytes(the output of decoder), as shown in the code below.

The issue is drive function is not getting the input from decoder and hence I am not able to pass the array of bytes to unpack_bytes. Also if I try to create the array of bytes in the decode fucntion, it gives me error:-  ** Error: monitor711.sv(294): Cannot assign an unpacked type to a packed type. 

 

Can u please have a look at it and help me out please. I truly appreciate your help.

 

 
 
`include "uvm_macros.svh"
 import uvm_pkg::*;
 
class monitor extends uvm_monitor; 
        //Registration of monitor with the factory.
       `uvm_component_utils(monitor)
 
        virtual dut_if dut_vi; 
         
       uvm_analysis_port #(transaction) Montr2Agnt_port;         
                         
          //constructor by using keyword new
       function new(string name, uvm_component parent);
            super.new(name, parent);
       endfunction: new               
            
       function void build_phase(uvm_phase phase);
            super.build_phase(phase);  
            assert( uvm_config_db #(virtual dut_if)::get(this, "", "dut_vi", dut_vi) );
            Montr2Agnt_port = new("Montr2Ag", this);            
       endfunction : build_phase
       
      
      
      task run_phase(uvm_phase phase);
         transaction pkt;         
           fork              
            forever
              begin
               
                bit [7:0] decdrout1;
                bit [7:0] decdrout2[];                 
                int j;
                int pkt_len = 8; 
                bit [9:0] bq[$]; 
                bit[9:0] bytes[]; 
                $display("san14- Display of the packet contents %h",dut_vi.data);  //%d
             
               
               repeat(2)@(dut_vi.clock); 
               
               for ( int j = 0; j < pkt_len ; j++) // this gives more than 8 bytes but doesnt print pkts.works with this 8 too
              
                begin
                       $display("san- Display of the packet contents %h",dut_vi.data); 
                      
                       @(dut_vi.clock);  
                       $display("san12- Display of the packet contents %h",dut_vi.data); 
                       bq.push_back(dut_vi.data); 
                       
                       @( dut_vi.clock); 
                       $display("san11- Display of the queue contents %p",bq);  //%p
                       
                       uvm_report_info(get_full_name(),"Ready to Get out of the Foreach/For loop ...",UVM_LOW);
                end
                 
               uvm_report_info(get_full_name(),"Got out of the Foreach loop ...",UVM_LOW);
               
               $display("san31- Display of the queue contents %h",bq.size()); 
               bytes = new[bq.size()] (bq);  
               
               $display("san32- Display of the bytes array contents %p",bytes); //%h
               pkt = transaction::type_id::create("pkt1");
               
               decode(bytes);  // BYTES ARE THE INCOMING BYTES FROM DRIVER THROUGH INTERFACE
               drive(decdrout1);  //decdrout1 IS THE OUTPUT OF DECODE FUNCTION ABOVE
               
               uvm_report_info(get_full_name(),"Started unpacking of received bytes ...",UVM_LOW); 
               
               void'(pkt.unpack_bytes(decdrout2)); // decdrout2 IS THE OUTPUT OF DRIVE FUNCTION
               
               pkt.print();
               uvm_report_info(get_full_name(),"Completed unpacking of received bytes ...",UVM_LOW);
               
               Montr2Agnt_port.write(pkt);
               
               $display("san34- Display of the bytes array contents %p",bytes); //%h           
                
                uvm_report_info(get_full_name(),"Sending received packet from monitor to the Scoreboard ...",UVM_LOW);
                
              end
             join
       endtask: run_phase   
   
 
            
    virtual function decode(bytes); //(input bytes, output decdrout2); //,decdrout1);  //task
       
        bit [9:0]bytes[];
        $display("san35- Display of the bytes array received inside the decoder %p",bytes); //%h
        uvm_report_info(get_full_name(),"Received All 10bits into the Decoder ...",UVM_LOW); 
       
      // bit [7:0] decdrout2[];
      // bit [7:0] decdrout1;
       uvm_report_info(get_full_name(),"Decoding Each 10bits into 8bits ...",UVM_LOW); 
       
       foreach (bytes[k])       
          begin          
           
           bit dispin ;
           
           bit [8:0] dataout ; 
           bit [7:0] decdrout1;
           bit [7:0] decdrout2[];
         
           bit[7:0]queue[$]; 
           
           reg[9:0] datain = bytes[k];
           logic code_err ;
           logic disp_err ;
 
           logic ai = datain[0] ;
           logic bi = datain[1] ;
           logic ci = datain[2] ;
           logic di = datain[3] ;
           logic ei = datain[4] ;
           logic ii = datain[5] ;
           logic fi = datain[6] ;
           logic gi = datain[7] ;
           logic hi = datain[8] ;
           logic ji = datain[9] ;
 
           logic aeqb = (ai & bi) | (!ai & !bi) ;
           logic ceqd = (ci & di) | (!ci & !di) ;
           logic p22 = (ai & bi & !ci & !di) |
               (ci & di & !ai & !bi) |
               ( !aeqb & !ceqd) ;
           logic p13 = ( !aeqb & !ci & !di) |
               ( !ceqd & !ai & !bi) ;
           logic p31 = ( !aeqb & ci & di) |
               ( !ceqd & ai & bi) ;
 
           //logic p40;
            //datain = pout;
           logic p40 = ai & bi & ci & di ;
           logic p04 = !ai & !bi & !ci & !di ;
 
           logic disp6a = p31 | (p22 & dispin) ; // pos disp if p22 and was pos, or p31.
           logic disp6a2 = p31 & dispin ;  // disp is ++ after 4 bits
           logic disp6a0 = p13 & ! dispin ; // -- disp after 4 bits
             
           logic disp6b = (((ei & ii & ! disp6a0) | (disp6a & (ei | ii)) | disp6a2 |
            (ei & ii & di)) & (ei | ii | di)) ;
 
              // The 5B/6B decoding special cases where ABCDE != abcde
 
           logic p22bceeqi = p22 & bi & ci & (ei == ii) ;
           logic p22bncneeqi = p22 & !bi & !ci & (ei == ii) ;
           logic p13in = p13 & !ii ;
           logic p31i = p31 & ii ;
           logic p13dei = p13 & di & ei & ii ;
           logic p22aceeqi = p22 & ai & ci & (ei == ii) ;
           logic p22ancneeqi = p22 & !ai & !ci & (ei == ii) ;
           logic p13en = p13 & !ei ;
           logic anbnenin = !ai & !bi & !ei & !ii ;
           logic abei = ai & bi & ei & ii ;
           logic cdei = ci & di & ei & ii ;
           logic cndnenin = !ci & !di & !ei & !ii ;
 
               //non-zero disparity cases:
           logic p22enin = p22 & !ei & !ii ;
           logic p22ei = p22 & ei & ii ;
                //logic p13in = p12 & !ii ;
                //logic p31i = p31 & ii ;
           logic p31dnenin = p31 & !di & !ei & !ii ;
                //logic p13dei = p13 & di & ei & ii ;
           logic p31e = p31 & ei ;
 
           logic compa = p22bncneeqi | p31i | p13dei | p22ancneeqi | 
          p13en | abei | cndnenin ;
           logic compb = p22bceeqi | p31i | p13dei | p22aceeqi | 
          p13en | abei | cndnenin ;
           logic compc = p22bceeqi | p31i | p13dei | p22ancneeqi | 
          p13en | anbnenin | cndnenin ;
           logic compd = p22bncneeqi | p31i | p13dei | p22aceeqi |
          p13en | abei | cndnenin ;
           logic compe = p22bncneeqi | p13in | p13dei | p22ancneeqi | 
          p13en | anbnenin | cndnenin ;
 
           logic ao = ai ^ compa ;
           logic bo = bi ^ compb ;
           logic co = ci ^ compc ;
           logic d0 = di ^ compd ;
           logic eo = ei ^ compe ;
 
           logic feqg = (fi & gi) | (!fi & !gi) ;
           logic heqj = (hi & ji) | (!hi & !ji) ;
           logic fghj22 = (fi & gi & !hi & !ji) |
          (!fi & !gi & hi & ji) |
          ( !feqg & !heqj) ;
           logic fghjp13 = ( !feqg & !hi & !ji) |
           ( !heqj & !fi & !gi) ;
           logic fghjp31 = ( (!feqg) & hi & ji) |
           ( !heqj & fi & gi) ;
 
           logic dispout = (fghjp31 | (disp6b & fghj22) | (hi & ji)) & (hi | ji) ;
 
           logic ko = ( (ci & di & ei & ii) | ( !ci & !di & !ei & !ii) |
          (p13 & !ei & ii & gi & hi & ji) |
          (p31 & ei & !ii & !gi & !hi & !ji)) ;
 
           logic alt7 =   (fi & !gi & !hi & // 1000 cases, where disp6b is 1
           ((dispin & ci & di & !ei & !ii) | ko |
            (dispin & !ci & di & !ei & !ii))) |
           (!fi & gi & hi & // 0111 cases, where disp6b is 0
           (( !dispin & !ci & !di & ei & ii) | ko |
            ( !dispin & ci & !di & ei & ii))) ;
 
           logic k28 = (ci & di & ei & ii) | ! (ci | di | ei | ii) ;
                  // k28 with positive disp into fghi - .1, .2, .5, and .6 special cases
           logic k28p = ! (ci | di | ei | ii) ;
           logic fo = (ji & !fi & (hi | !gi | k28p)) |
              (fi & !ji & (!hi | gi | !k28p)) |
              (k28p & gi & hi) |
              (!k28p & !gi & !hi) ;
           logic go = (ji & !fi & (hi | !gi | !k28p)) |
              (fi & !ji & (!hi | gi |k28p)) |
              (!k28p & gi & hi) |
              (k28p & !gi & !hi) ;
           logic ho = ((ji ^ hi) & ! ((!fi & gi & !hi & ji & !k28p) | (!fi & gi & hi & !ji & k28p) | 
              (fi & !gi & !hi & ji & !k28p) | (fi & !gi & hi & !ji & k28p))) |
              (!fi & gi & hi & ji) | (fi & !gi & !hi & !ji) ;
 
           logic disp6p = (p31 & (ei | ii)) | (p22 & ei & ii) ;
           logic disp6n = (p13 & ! (ei & ii)) | (p22 & !ei & !ii) ;
           logic disp4p = fghjp31 ;
           logic disp4n = fghjp13 ;
 
           //assign 
           code_err = p40 | p04 | (fi & gi & hi & ji) | (!fi & !gi & !hi & !ji) |
              (p13 & !ei & !ii) | (p31 & ei & ii) | 
              (ei & ii & fi & gi & hi) | (!ei & !ii & !fi & !gi & !hi) | 
              (ei & !ii & gi & hi & ji) | (!ei & ii & !gi & !hi & !ji) |
              (!p31 & ei & !ii & !gi & !hi & !ji) |
              (!p13 & !ei & ii & gi & hi & ji) |
              (((ei & ii & !gi & !hi & !ji) | 
                (!ei & !ii & gi & hi & ji)) &
               ! ((ci & di & ei) | (!ci & !di & !ei))) |
              (disp6p & disp4p) | (disp6n & disp4n) |
              (ai & bi & ci & !ei & !ii & ((!fi & !gi) | fghjp13)) |
              (!ai & !bi & !ci & ei & ii & ((fi & gi) | fghjp31)) |
              (fi & gi & !hi & !ji & disp6p) |
              (!fi & !gi & hi & ji & disp6n) |
              (ci & di & ei & ii & !fi & !gi & !hi) |
              (!ci & !di & !ei & !ii & fi & gi & hi) ;
 
           //assign 
            dataout = {ko, ho, go, fo, eo, d0, co, bo, ao} ;  //actual output of Decoder
            
            decdrout1 = {ho, go, fo, eo, d0, co, bo, ao}; //OUTPUT OF DECODER ADDED BY ME
          
            
            $display("SM02- Display of the Decoded data contents %h",dataout);
            $display("SM04- Display of the Decoded data contents %h",decdrout1); //%b decdrout1
              
              // my disp err fires for any legal codes that violate disparity, may fire for illegal codes
            //assign 
            disp_err = ((dispin & disp6p) | (disp6n & !dispin) |
                (dispin & !disp6n & fi & gi) |
                (dispin & ai & bi & ci) |
                (dispin & !disp6n & disp4p) |
                (!dispin & !disp6p & !fi & !gi) |
                (!dispin & !ai & !bi & !ci) |
                (!dispin & !disp6p & disp4n) |
                (disp6p & disp4p) | (disp6n & disp4n)) ;
                
             uvm_report_info(get_full_name(),"Decoded Each 10bits into 8bits ...",UVM_LOW);
             $display("SM03- Display of the Decoded data contents %h",decdrout1);
         // end
          uvm_report_info(get_full_name(),"Decoded completely 10bits into 8bits ...",UVM_LOW);
         
       /*  for ( int j = 0; j < 8 ; j++)    //I TRIED TO CREATE ARRAY OF DECODER OUTPUT BYTES HERE ALSO BUT ITS NOT WORKING
         // foreach(decdrout1[i])  //added later
           //bit[8:0]queue[$];//,decodbytes[]; // added later
          begin
             
              queue.push_back(decdrout1);
              
              $display("san111- Display of the queue contents %p",queue);
             // decdrout2 = new[queue.size()] (queue);
             // $display("SM22- Display of the bytes array contents %h",decdrout2); 
           //  return decdrout2;
          end
         
 
// $display("SM11- Display of the queue contents %h",queue.size()); 
           decdrout2 = new[queue.size()] (queue);
          $display("SM22- Display of the bytes array contents %h",decdrout2); 
         // return decdrout1;
          decdrout2 = { << byte {decdrout1}}; //,decdrout2}};
          //decdrout2 = { >> {decdrout2,decdrout2,decdrout2,decdrout2,decdrout2,decdrout2,decdrout2,decdrout2}};
          //decdrout2 = { >> {decdrout1,decdrout1,decdrout1,decdrout1,decdrout1,decdrout1,decdrout1,decdrout1}};
          return decdrout2;  
         end 
        // return decdrout2; //newcrc;
        //decdrout2 = new[queue.size()] (queue); */
        end
      endfunction: decode 
     
 
    
       virtual function drive(input decdrout1); 
          
           bit [7:0] queue[$],decdrout2[];          
           int i ;  
          
          $display("SM44- Display of the bytes contents %h",decdrout1);
          uvm_report_info(get_full_name(),"Creating pkt from decoder output bytes ...",UVM_LOW);
          for ( i=0; i<8; i++)
          // foreach(decdrout1[i])  
           begin
       uvm_report_info(get_full_name(),"33Received decoder bytes ...",UVM_LOW);
       
       queue.push_back(decdrout1);
       
       $display("san111- Display of the queue contents %p",queue);
       uvm_report_info(get_full_name(),"44Received decoder bytes ....",UVM_LOW);
           end  
           decdrout2 = new[queue.size()] (queue);
           $display("SM22- Display of the bytes array to go into unpack function contents %h",decdrout2);
         endfunction : drive   
 
 endclass: monitor
          
         
 
Result log file portion:-
 
 
 san35- Display of the bytes array received inside the decoder '{561, 340, 540, 472, 613, 820, 440, 677}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Received All 10bits into the Decoder ...
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoding Each 10bits into 8bits ...
# SM02- Display of the Decoded data contents 0f1
# SM04- Display of the Decoded data contents f1
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents f1
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 0a4
# SM04- Display of the Decoded data contents a4
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents a4
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 0fc
# SM04- Display of the Decoded data contents fc
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents fc
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 0e8
# SM04- Display of the Decoded data contents e8
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents e8
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 025
# SM04- Display of the Decoded data contents 25
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents 25
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 074
# SM04- Display of the Decoded data contents 74
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents 74
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 0c7
# SM04- Display of the Decoded data contents c7
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents c7
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM02- Display of the Decoded data contents 045
# SM04- Display of the Decoded data contents 45
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded Each 10bits into 8bits ...
# SM03- Display of the Decoded data contents 45
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Decoded completely 10bits into 8bits ...
# SM44- Display of the bytes contents 0
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Creating pkt from decoder output bytes ...
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0, 0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0, 0, 0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0, 0, 0, 0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0, 0, 0, 0, 0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 33Received decoder bytes ...
# san111- Display of the queue contents '{0, 0, 0, 0, 0, 0, 0, 0}
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] 44Received decoder bytes ....
# SM22- Display of the bytes array to go into unpack function contents 00 00 00 00 00 00 00 00
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Started unpacking of received bytes ...
# UVM_ERROR @ 900: reporter [PCKSZ] 8 bits needed to unpack integral, yet only 0 available.
# UVM_ERROR @ 900: reporter [PCKSZ] 8 bits needed to unpack integral, yet only 0 available.
# UVM_ERROR @ 900: reporter [PCKSZ] 16 bits needed to unpack integral, yet only 0 available.
# UVM_ERROR @ 900: reporter [PCKSZ] 8 bits needed to unpack integral, yet only 0 available.
# san998-tran- Display of the payload size 00000001
# san999-tran- Display of the payload size 00000001
# UVM_ERROR @ 900: reporter [PCKSZ] 16 bits needed to unpack integral, yet only 0 available.
# UVM_ERROR @ 900: reporter [PCKSZ] 8 bits needed to unpack integral, yet only 0 available.
# ------------------------------------------
# Name       Type               Size  Value 
# ------------------------------------------
# pkt1       transaction        -     @737  
#   sync     integral           8     'h0   
#   sof      integral           8     'h0   
#   header   integral           16    'h0   
#   payload  da(integral)       1     -     
#     [0]    integral           8     'h0   
#   crc      integral           16    'h0   
#   eof      integral           8     'h0   
# ------------------------------------------
# UVM_INFO @ 900: uvm_test_top.env_h.agent_h.monitor_h [uvm_test_top.env_h.agent_h.monitor_h] Completed unpacking of received bytes ...
# ---------------------------------------------------------------------------------------------------
# Name                           Type               Size  Value                                      
# ---------------------------------------------------------------------------------------------------
# tx                             transaction        -     @704                                       
#   sync                         integral           8     'hf1                                       
#   sof                          integral           8     'ha4                                       
#   header                       integral           16    'hfce8                                     
#   payload                      da(integral)       1     -                                          
#     [0]                        integral           8     'h25                                       
#   crc                          integral           16    'h74c7                                     
#   eof                          integral           8     'h45                                       
#   begin_time                   time               64    0                                          
#   end_time                     time               64    0                                          
#   depth                        int                32    'd2                                        
#   parent sequence (name)       string             3     sq1                                        
#   parent sequence (full name)  string             43    uvm_test_top.env_h.agent_h.sequencer1_h.sq1
#   sequencer                    string             39    uvm_test_top.env_h.agent_h.sequencer1_h    
# ---------------------------------------------------------------------------------------------------
# UVM_INFO @ 900: uvm_test_top.env_h.scoreboard_h [uvm_test_top.env_h.scoreboard_h] The Received packets are being popped out from the queue 
# UVM_INFO @ 900: reporter [MISCMP] Miscompare for pkt1.sync: lhs = 'h0 : rhs = 'hf1
# UVM_INFO @ 900: reporter [MISCMP] 1 Miscompare(s) for object tx@704 vs. pkt1@737
# UVM_ERROR @ 900: uvm_test_top.env_h.scoreboard_h [scoreboard] Sent packet and received packet mismatched
# san34- Display of the bytes array contents '{561, 340, 540, 472, 613, 820, 440, 677}
 
 
 
 
 

 

Thanks for your help. I appreciate it.

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.

×
×
  • Create New...