Differences

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

Link to this comparison view

Next revision
Previous revision
intro_example:templates [2020/06/16 23:25]
prafull created
intro_example:templates [2022/05/13 09:21]
rajit
Line 4: Line 4:
 Let’s revisit the ripple carry adder designed in previous example. Instead of designing adder with fixed bit-width, a generic N-bit adder can be created using ''template'' keyword as shown below:  Let’s revisit the ripple carry adder designed in previous example. Instead of designing adder with fixed bit-width, a generic N-bit adder can be created using ''template'' keyword as shown below: 
  
-<code>+<code act>
 import "adder.act"; import "adder.act";
  
Line 23: Line 23:
 As shown below, an arbitrary bit-width adder can be created by instantiating the process ''adderNb'' with different values of parameter ''N''. As shown below, an arbitrary bit-width adder can be created by instantiating the process ''adderNb'' with different values of parameter ''N''.
  
-<code>+<code act>
 adderNb<8> fa8; adderNb<8> fa8;
 </code> </code>
  
 This creates an 8-bit adder with instance name ''fa8''. Similarly, a 32-bit adder could be created by instantiating adder with parameter N = 32. This creates an 8-bit adder with instance name ''fa8''. Similarly, a 32-bit adder could be created by instantiating adder with parameter N = 32.