Differences

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

Link to this comparison view

Next revision
Previous revision
scratch:loops [2020/05/12 03:16] prafullscratch:loops [2020/12/02 06:00] (current) – external edit 127.0.0.1
Line 19: Line 19:
 The statement ''fulladder fa[8];'' creates an array with 8 instances of full adder and the carry chain between adders is connected by bool array ''c''. The statement ''(i:8: ….)'' implements a loop with index ''i'' and its value runs from 0 to 7. The statement ''fulladder fa[8];'' creates an array with 8 instances of full adder and the carry chain between adders is connected by bool array ''c''. The statement ''(i:8: ….)'' implements a loop with index ''i'' and its value runs from 0 to 7.
  
-Here is a different way of writing the same loop using another variant of signal connection.+Here are different ways of writing the same loop using another variant of signal connection.
  
 <code> <code>
-(i : : fa[i].a = a[i]; fa[i].b = b[i]; fa[i].ci = c[i]; fa[i].s = s[i]; fa[i].co = fa[i+1].ci; )+(i : : fa[i].a=a[i]; fa[i].b=b[i]; fa[i].ci=c[i]; fa[i].s=s[i]; fa[i].co=fa[i+1].ci; 
 +</code> 
 +<code> 
 +(i : 8 : fa[i](.a=a[i], .b=b[i], .ci=c[i], .s=s[i], .co=fa[i+1].ci) )
 </code> </code>