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
intro_example:loops [2025/05/01 15:20] – [Selection] rajitintro_example:loops [2025/08/24 16:48] (current) – [Array, loops and selection] rajit
Line 1: Line 1:
 ====== Array, loops and selection ====== ====== Array, loops and selection ======
 +
 +
  
 Complex datapath designs are often designed with array of simpler cells. The following example show how to create array of simple cells and connect them using loop constructs in ACT. Complex datapath designs are often designed with array of simpler cells. The following example show how to create array of simple cells and connect them using loop constructs in ACT.
Line 15: Line 17:
   ( i : 8 : fa[i](a[i], b[i], c[i], s[i], c[i+1]);)     ( i : 8 : fa[i](a[i], b[i], c[i], s[i], c[i+1]);)  
 } }
 +</code>
 +
 +In this example we assume that ''adder.act'' has a full adder definition with a prototype that looks like this:
 +<code act>
 +defproc fulladder (bool? a, b, ci; bool! s, co)
 +{ ... }
 </code> </code>
  
Line 98: Line 106:
     i = 0;     i = 0;
     *[ i < 8 -> x0[i] = y[i]; x1[i] = z[i];     *[ i < 8 -> x0[i] = y[i]; x1[i] = z[i];
-                      x0[i+1] = z[i+1]; x1[i+1] = y[i+1]; +                x0[i+1] = z[i+1]; x1[i+1] = y[i+1]; 
-                      i = i + 2;+                i = i + 2;
     ]     ]
 }                   }