seq block

NSL has 'seq' block syntax for stepping execution with clock behavior. It only used in efuncf or eprocf action. The basic syntax of 'seq' block is:

 

  seq {

    behavior description 1

   behavior description 2

    .... as may description as you like ....

     }

 

The ebehavior description 1f will be executed at the invocation clock cycle for this seq block, the ebehavior description 2f will be executed in the next clock cycle, and so on.

 The eseqf has more features but we will try them step by step.

Example nsb3

This example is  a simple one to show the basic operation of  eseqf block.

It will have a ereqf signal to invoke a incoming function ereqf then it invokes a sequence of operations.

declare nsb3 {

   func_in req();

   func_out s1,s2,s3,s4;

}

module nsb3 {

   func req seq {

      s1();

      s2();

      s3();

      s4();

   }

  }

 

req:0, s1:0, s2:0, s3:0, s4:0

req:1, s1:1, s2:0, s3:0, s4:0

req:0, s1:0, s2:1, s3:0, s4:0

req:0, s1:0, s2:0, s3:1, s4:0

req:0, s1:0, s2:0, s3:0, s4:1

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

req:0, s1:0, s2:0, s3:0, s4:0

 

 

 

 

Example-nsb2

 

declare nsb2 {

   input a[8];

   output f[8];

   func_in req(a);

   func_out ack(f);

}

module nsb2 {

   reg  adr[8],d0[8],d1[8],d2[8],d3[8];

   func req seq {

      adr := a;

      d0 := a;

      d1 := a;

      d2 := a;

      d3 := a;

      ack(adr);

      f=d0;

      f=d1;

      f=d2;

      f=d3;

   }

  }

When the func_in req is activated from outside, the seq block will be invoked. The each operation is executed clock by clock.

In this example, it will invoke func_out ack at the last step which send 0x55 to the output signal f.

It is an easy operation and you may image the result. We will make a simulation on this circuitry as following command:

# ./exe -wave nsb2

 

The result will be available on your console.

a:24, req:0, ack:0, f:xx

a:81, req:1, ack:0, f:xx

a:09, req:0, ack:0, f:xx

a:63, req:0, ack:0, f:xx

a:0d, req:0, ack:0, f:xx

a:8d, req:0, ack:0, f:xx

a:65, req:0, ack:1, f:81

a:12, req:0, ack:0, f:09

a:01, req:0, ack:0, f:63

a:0d, req:0, ack:0, f:0d

a:76, req:0, ack:0, f:8d

a:3d, req:0, ack:0, f:xx

a:ed, req:0, ack:0, f:xx

 

 

In seq block, we can use label and goto. The label name must be declared with elabe_name.f

declare nsb4 {

   func_in req();

   func_out s1,s2,s3,s4;

}

module nsb4 {

   func req seq {

   label_name jumpto;

      s1();

      goto jumpto;

      s2();

      s3();

jumpto:

      s4();

   }

  }

 

 

 

 

We can also use some control syntax like eforf or ewhile.f

declare nsb5 {

   func_in req();

   func_out s1,s2,s3,s4;

}

module nsb5 {

   reg i[8];

   func req seq {

      s1();

      for(i:=0;i<5;i++) { s2(); }

      s3();

      s4();

   }

  }

 

 

 

 

 

 

PREV UP NEXT