Return to previous page Advance to next page
Verilog Reference Guide
Chapter 5: Functional Descriptions

Sequential Constructs

Although many Verilog constructs appear sequential in nature, they describe combinatorial circuitry. A simple description that appears to be sequential is shown in the following example.

x=b; 
if (y)
      x=x + a;

Foundation Express determines the combinatorial equivalent of this description. In fact, Foundation Express treats the statements in the above example in the same way that it treats the statements in the following example.

if (y) 
   x = b + a;
else
   x = b;

To describe combinatorial logic, you write a sequence of statements and operators to generate the output values you want. For example, suppose the addition operator (+) is not supported, and you want to create a combinatorial, ripple-carry adder. The easiest way to describe this circuit is as a cascade of full adders, as in the following example. The example has eight full adders, with each adder following the one before. From this description, Foundation Express generates a fully combinatorial adder.

function [7:0] adder;
input [7:0] a, b;
   reg c;
   integer i;
   begin
      c = 0;
      for (i = 0;i <= 7; i = i + 1) begin
         adder[i] = a[i] ^ b[i ^ c;
         c = a[i] & b[i] | a[i] & c | b[i] & c;
      end
   end
endfunction