Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
intro_example:namespace [2020/06/16 23:24] prafull created |
intro_example:namespace [2020/12/02 01:00] 127.0.0.1 external edit |
||
---|---|---|---|
Line 104: | Line 104: | ||
adder FA; | adder FA; | ||
</ | </ | ||
+ | |||
+ | |||
+ | Finally, ACT supports another import format that is similar to those provided by object-oriented languages like Python and Java. Since '' | ||
+ | |||
+ | < | ||
+ | import gates; | ||
+ | |||
+ | defproc adder (bool? a,b,ci; bool! s,co) | ||
+ | { | ||
+ | bool y1,y2,y3; | ||
+ | gates::xor2 X1(a, b, y1); | ||
+ | gates::and2 A1(a,b,y2); | ||
+ | gates::xor2 X2 (y1,ci,s); | ||
+ | gates::and2 A2(y1, | ||
+ | gates::or2 O1(y2, | ||
+ | } | ||
+ | |||
+ | adder FA; | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | |||
+ | Finally, if you are going to be using the '' | ||
+ | |||
+ | < | ||
+ | import gates; | ||
+ | open gates; | ||
+ | |||
+ | defproc adder (bool? a,b,ci; bool! s,co) | ||
+ | { | ||
+ | bool y1,y2,y3; | ||
+ | xor2 X1(a, b, y1); | ||
+ | and2 A1(a,b,y2); | ||
+ | xor2 X2 (y1,ci,s); | ||
+ | and2 A2(y1, | ||
+ | or2 O1(y2, | ||
+ | } | ||
+ | |||
+ | adder FA; | ||
+ | </ | ||
+ | |||
===== Simulating with prsim script ===== | ===== Simulating with prsim script ===== |