Quantcast
Channel: Cadence Functional Verification
Viewing all articles
Browse latest Browse all 652

List of TLM Analysis Ports: Where Is This Packet Coming From?

$
0
0

Let’s say that you got an invitation from the police station nearest your home to be there the next day at 14:00. Hmm…. What could it be about? You check the letter and envelope for more information, but it does not say which department sent it. Well, it makes a big difference if the invitation was from the “lost and found” department, which means you will probably get something back, or if it came from “investigations department” which might mean you are in trouble. Yes indeed, the context or the source could make a big difference. And that’s the point.  

To what is this similar in the Specman world? Well, if you were attempting to use a list of input TLM analysis ports (interface_port of tlm_analysis), before Specman 18.03 you had no way of knowing which exact port from the list got the data; the write method only provided you with the data received, without any context. As of Specman 18.03, you also get the context.

 But before we move on with the new syntax, let’s start first with some background. If you do not need this background, feel free to “jump” to the last paragraph.

TLM analysis ports are mainly used to connect monitors to other monitors, to checkers and to scoreboards. If the DUT has one input and one output, your scoreboard would have one Add port connected to the monitor (collecting the data sent to the DUT), and one Match port connected to the monitor (collecting the data received from the DUT). But if the DUT has more than one input and one output interface? Then you need to instantiate, for example, 3 Add ports and 3 Match ports and implement a different write method for each.

unit MySCBD{

add_port_0 : in interface_port of tlm_analysis of (packet) using suffix=_0 is instance;

add_port_1 : in interface_port of tlm_analysis of (packet) using suffix=_1 is instance;

//….add additional declaration for the rest of the ports

write_0(p:packet) is {

   // implementation for items coming from DUT output #0

};

write_1(p:packet) is {

   // implementation for items coming from DUT output #1

};

//…add additional write methods for the rest of the ports

  

Well, this is a lot of code and in the Specman world, we do not like a lot of code.  It is true that if you were using UVM-e Scoreboard, you could already use macros doing most of the work for you, but it is still an overhead. Moreover, what if the environment topology is configurable – in some tests the DUT has 3 outputs, and in some – 4. How would you write the code for this? Can you avoid writing additional code? In few seconds (or few lines to be more accurate…) you will see how easily it can be done. 

 You don’t have to instantiate each port, there is a way to make your life simpler- you could define a list of tlm_analysis ports even before Specman 18.03, however look at the following code and search for information which is missing:

 

unit MySCBD{

addPorts : list of in interface_port of tlm_analysis of (packet) using suffix=_Add is instance;

keep addPorts .size() == 3;

 

matchPorts : list of in interface_port of tlm_analysis of (packet) using suffix=_Match is instance;

keep matchPorts.size() == 3;

 

connect_ports() is also {

      //connect the ports to the monitors

    };

 

write_Add(p:packet) is {

       // implementation for item coming from an Add port

 };

   

write_Match(p:packet) is {

    // implementation for item coming from a Match port };

 

First, you can see that using lists of ports it is easy to add a port- you just need to change the constraint on the list size. However, back to my question of what is missing- you get the data in the write method, but you do not know from which port it was coming from (remember the first paragraph of getting an envelope without knowing the exact source?)…

 Starting from Specman 18.03, you do have a way of knowing the source, meaning from which port this was received. What you need to do is to add the using context option to the definition of the list of ports, and implement the new write method which, in addition to the data, provides the relevant port which received the data. Now you can respond differently according to the source of this data.

 

unit MySCBD{

addPorts : list of in interface_port of tlm_analysis of (packet) using suffix=_Add using context  is instance;

keep addPorts .size() == 3;

 

matchPorts : list of in interface_port of tlm_analysis of (packet) using suffix=_Match using context  is instance;

keep matchPorts.size() == 3;

connect_ports() is also {

      //connect the ports to the monitors

    };

 

 write_Add(p:packet, port: any_interface_port) is {

 

    // implementation for item coming from an Add port

        if (port == addPorts [0] ) {

            //….

        } else if (port == addPorts [1] ) {

           //…

        } else{

          //…

        }

 };

   

 write_Match(p:packet,port: any_interface_port) is {

    // implementation for item coming from an Match port

        if (port == matchPorts [0] ) {

            //….

        } else if (port == matchPorts [1] ) {

           //…

        } else{

          //…

        }

 };

 

 I strongly recommend you check out the What’s New? section to find out what else we have added in Specman 18.03.

 

Orit Kirshenberg

Specman team


Viewing all articles
Browse latest Browse all 652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>