Trung tâm đào tạo thiết kế vi mạch Semicon


  • ĐĂNG KÝ TÀI KHOẢN ĐỂ TRUY CẬP NHIỀU TÀI LIỆU HƠN!
  • Create an account
    *
    *
    *
    *
    *
    Fields marked with an asterisk (*) are required.
semicon_lab.jpg

Methods Part-I

E-mail Print PDF
Introduction to Methods
e methods are similar to C functions, Verilog tasks, functions, and VHDL processes. There are two types of methods in e language.
Regular Method : Execute within a single point of simulation time (within zero time)
Time Consuming Method : Executes over multiple cycles.
TCMs are used to synchronize processes in an e program with processes or events in the DUT. Within a single e program, multiple TCMs can execute ether in sequence or concurrently, along parallel but separate threads. A TCM can also have internal branches, which are multiple action blocks executing concurrently.
  • Methods defined in one module can later be overwritten, modified or enhanced in subsequent modules using the extend mechanism. This is something that makes e language more powerful compared to VERA or C++ based verification.
    Implementing an e method is usually done in e. However, you might want to write a C routine and convert it into an e method. You can do this by declaring an e method that is implemented in C. We can also use Verilog task and function in e.
  • Defining and Extending Methods

    • There are two ways to define a method is [ C routine ]
    • is undefined | empty
      There are two ways to extend a method
    • is also | first | only
    • You can also use is to extend a method in the following cases:
    • The method was previously introduced with is undefined or is empty and has not been previously extended in this struct or in any struct that inherits from this struct.
    • The method was previously introduced (and perhaps extended) in a struct that this struct inherits from, as long as the method has not already been extended in this struct or in any struct that inherits from this struct using like.
      We will see all this is detail below.

    Is

    We define pure e method for first time using is. A TCM is a time-consuming method that is distinguished from a regular method by the presence of @event and can use time-consuming actions such as sync and wait.

    Syntax :
    method-name ([parameter-list]) [: return-type]@event is {action;...}
    Below is simple example which shows how to declare a regular method.
     1 <'

      2 extend sys {

      3   // This is how delcare a method

      4   say_hello() is {

      5     out ("Hello World");

      6   };

      7

      8   run() is also {

      9     say_hello();

     10   };

     11 };

     12 '>
    Here the method is say_hello, and it is regular method, which does not contain wait statements.
    is undefined/empty
    Declares an abstract regular method or an abstract TCM with no defined functionality. Abstract methods are place holders that you can extend at a later point.
    Syntax
    method-name ([parameter-list]) [: return-type] [@event-type] is [undefined|empty]



    Parameters

    Parameter

    Description

    method-name

    A legal e name

    parameter-list

    A list composed of zero or more parameter declarations of the form param-name,The parentheses around the parameter list are required even if the parameter list is empty

    return-type

    For methods that return values, specifies the data type of the return value

    @event-type

    Specifies a default sampling event that determines the sampling points of the TCM.

    undefined

    No action block is defined for the method yet; an action block must be defined in a subsequent module before this method is called. A runtime error is issued if it is called before it is defined.

    empty

    The action block is empty, but no error is issued if it is called. Empty value-returning methods return the default value for the type.

    Parameter

    Description

    method-name

    A legal e name

    parameter-list

    A list composed of zero or more parameter declarations of the form param-name,The parentheses around the parameter list are required even if the parameter list is empty

    return-type

    For methods that return values, specifies the data type of the return value

    @event-type

    Specifies a default sampling event that determines the sampling points of the TCM.

    undefined

    No action block is defined for the method yet; an action block must be defined in a subsequent module before this method is called. A runtime error is issued if it is called before it is defined.

    empty

    The action block is empty, but no error is issued if it is called. Empty value-returning methods return the default value for the type.

    is inline

    Defining a method as inline requires Specman Elite to generate code that enables the C compiler to inline the method. The C compiler to place all the code for the method at each point in the code where the method is called. This inline expansion allows the compiler to optimize the inline method code for the best performance. Methods that are frequently called and involve computation are good candidates for inline definition

    Syntax

    method-name ([parameter-list]) [: return-type] is inline {action;...}

    Note:

    • The Gnu C compiler can inline most methods declared as inline without any additional flags.
    • A method originally defined as inline cannot be redefined using is only, is first, or is also.
    • Methods defined in when conditional struct members cannot be inline.
    • Time-consuming methods (TCMs) cannot be inline.
      Example

      1 <'

      2 extend sys {

      3   // This is how delcare a inline method

      4   say_hello() is inline {

      5     out ("Hello World");

      6   };

      7

      8   run() is also {

      9     say_hello();

     10   };

     11 };

     12 '>

    Bạn Có Đam Mê Với Vi Mạch hay Nhúng      -     Bạn Muốn Trau Dồi Thêm Kĩ Năng

    Mong Muốn Có Thêm Cơ Hội Trong Công Việc

    Và Trở Thành Một Người Có Giá Trị Hơn

    Bạn Chưa Biết Phương Thức Nào Nhanh Chóng Để Đạt Được Chúng

    Hãy Để Chúng Tôi Hỗ Trợ Cho Bạn. SEMICON  

     

    Last Updated ( Tuesday, 03 May 2022 19:51 )  
    Chat Zalo