Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scratch:namespace [2020/05/11 09:32] prafullscratch:namespace [2020/12/02 06:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Creating a library of building blocks ====== ====== Creating a library of building blocks ======
  
-A library can be created using pre-designed building blocks and use them in hierarchical designs. This can be achieved using keyword "import". In this case, ACT file begins with a sequence of "import" statements. The "import" looks for file in the current directory first, then in the colon-separated path specified by "$ACT_PATH", and finally in "$ACT_HOME/act"+A library can be created using pre-designed building blocks and use them in hierarchical designs. This can be achieved using keyword ''import''. In this case, ACT file begins with a sequence of "import" statements. The "import" looks for file in the current directory first, then in the colon-separated path specified by ''$ACT_PATH'', and finally in ''$ACT_HOME/act''
  
 ACT files can be imported in two ways: ACT files can be imported in two ways:
  
-(a) For simple projects, design files containing building blocks can be imported using keyword "import". For example, the "gates.actfile contains basic logic gates.+(a) For simple projects, design files containing building blocks can be imported using keyword ''import''. For example, the ''gates.act'' file contains basic logic gates.
  
 <code> <code>
Line 34: Line 34:
 </code> </code>
  
-This file can be imported in a new ACT file "xor2.actfor creating XOR gate using basic logic gates.+This file can be imported in a new ACT file ''xor2.act'' for creating XOR gate using basic logic gates.
  
 <code> <code>
Line 52: Line 52:
 (b) For complex projects involving a large number of ACT files, importing libraries can become complicated. For example, a project can have multiple ACT files containing different implementation of a design with same process name or different channels with same name. To keep names of process, channel, and types separate in such cases, ACT provides the option of namespace ([[language:introduction#namespaces|ACT namespaces]]). (b) For complex projects involving a large number of ACT files, importing libraries can become complicated. For example, a project can have multiple ACT files containing different implementation of a design with same process name or different channels with same name. To keep names of process, channel, and types separate in such cases, ACT provides the option of namespace ([[language:introduction#namespaces|ACT namespaces]]).
  
-The following example creates a namespace gates in file gates.act and defines process for basic logic gates within the namespace.+The following example creates a namespace gates in file ''gates.act'' and defines process for basic logic gates within the namespace.
  
 <code> <code>
Line 87: Line 87:
 </code> </code>
  
-As shown below, this library is imported in a new ACT file "adder.actto design full adder using logic gates defined in the library.+As shown below, this library is imported in a new ACT file ''adder.act'' to design full adder using logic gates defined in the library.
  
 <code> <code>
Line 112: Line 112:
 </code> </code>
  
-where adder.scr file contains the following commands:+You could also run ''prsim'' and then source script as: 
 + 
 +<code> 
 +prsim adder.act 
 +(Prsim) source adder.scr 
 +</code> 
 + 
 +where ''adder.scr'' file contains the following commands:
  
 <code> <code>
Line 137: Line 144:
 get fa.co get fa.co
 </code> </code>
 +
 +