Here we would give an example of how to create a hierarchical design using just the schematic. Before going through this example you should familiarize yourself with the section on how to create the block symbols in the schematic editor.
Our goal here is to create a four-bit adder using full adder block as a new symbol. The full adder block is basically a schematic for a full adder with inputs A, B, Cin and outputs S and Cout.
To implement the four-bit adder we will follow these steps :
Following the steps indicated in Tutorial 1 : Creating a Schematic we create the following schematic for the full adder with inputs A, B, Cin and outputs S and Cout :
Following the steps indicated in Tutorial 1 : Creating a block symbol we create the following full adder block symbol:
Following the steps indicated in Tutorial 2 : Creating an ABEL source we create the following ABEL top-level source that implements the 4-bit adder by refrencing the fulladder schematic block we have created above:
MODULE bitadd interface(A0,B0,A1,B1,A2,B2,A3,B3,Cin -> S0,S1,S2,S3,Cout); TITLE 'four bit adder' "inputs A0,B0,A1,B1,A2,B2,A3,B3,Cin pin; "outputs S0,S1,S2,S3,Cout pin istype 'com'; fuladder interface (A,B,Cin -> Cout, Sum); ful0..ful3 functional_block fuladder; EQUATIONS ful0.A = A0; ful0.B = B0; ful0.Cin = Cin; S0 = ful0.Sum; ful1.A = A1; ful1.B = B1; ful1.Cin = ful0.Cout; S1 = ful1.Sum; ful2.A = A2; ful2.B = B2; ful2.Cin = ful1.Cout; S2 = ful2.Sum; ful3.A = A3; ful3.B = B3; ful3.Cin = ful2.Cout; Cout = ful3.Cout; END
In the above code, the functional_block statement creates four instances of the fuladder module namely ful0..ful3. The inputs for these instances are assigned values in the top-level module by statements like ful0.A = A0, ful0.B = B0..etc. Finally the ouputs of the top-level ABEL module are obtained from the lower-level schematic by using statements like S0 = ful0.sum, S1 = ful1.sum..etc.