Procedure

In NSL, sequential logic will be described with procedure and/or seq block. Procedure is a basic stracture of a sequential logic and it is also a control signal to invoke the procedure. A procedure will be invoked from combinational logic or transfered the control from other procedure. It will be terminated with 'finish' or transfer control to other procedure. The transfer will terminate the current procedure and invoke a new one. Also 'finish()' will terminate the current procedure. To terminate a procedure from outside of it, you must use explicit procedure name like proc1.finish();. If you don't want to transfer control to the target procedure but simply want to invoke it, you can use invoke extension for it, like: proc2.invoke();. They will have arguments which consist of registers.

Example-NS16

declare NS16 { input a[4]; output f[4]; func_in do(a); } module NS16 { reg r1[4],r2[4],r3[4]; proc_name p1(r1); proc_name p2(r2); proc_name p3(r3); func do { p1(a); } proc p1 { p2(r1); } proc p2 { p3(r2); } proc p3 { f = r3; finish; } }



We will make a simulation on this circuitry as following command:





# ./exe -wave NS16



The result will be available on your console.






PREV UP NEXT