B3 A; В, А B A1 Bo Ao M C FA FA FA FA So V HDL Example 4.2 (Hierarchical Modeling-Eight-Bit Adder) Verilog At the bottom of the design hierarchy shown in Eig. 4.33 a half adder is composed of primitive gates. At the next level of the hierarchy, a full adder is formed by instantiating and connecting a pair of half adders. The third module describes the eight-bit adder by instantiating and linking together two four-bit adders. This example illustrates optional Verilog 2001, 2005 syntax, which eliminates extra typing of identifiers declaring the mode (e.g., output), type (reg), and declaration of a vector range (e.g, [3: 0]) of a port. The first version of the standard (1995) uses separate statements for these declarations; the revised standard includes the declarations within the port. module Add_half (input a, b, output c_out, sum), xor G1(sum, a, b); and 62(c_out, a, b); endnodule // Gate instance names are option module Add_full (input a, b, c_in, out put c_out, sum); Eig. 4.8 // see // wi is c_out; w2 is sum wire wi, W2, wa; Add_half M1 (a, b, wi, w2); Add_half MO (w2, e_in, w3, sum); or (c_out, w1, w3); endnodule module Add_rca_4, (input [3:0] a, b, input c_in output c_out, ou wire c_ini, c_in3, c_in4; Add_full MO (a[0), b[0), c_in, cini, sun[e]); Add_full M1 (a[ij, b(aj, c_ini, c_in2, sum[1]); Add_full M2 (a[2j, b(2), c_in2, c_in3, sum[2]); Add_full M3 (ataj, b(aj, c_ina, c_out, sum[3]); endnodule // İntermediate carries module Add_rca_8 (input [7:e] a, b, input c_in, output c_out, a wire c_in4; Add_rca_4 MO (a[3:0], b[3:0], c_in, c_in4, sum[3:0]); Add_rca_4 M1 (a[7:4], b[7:4], cin4, c_out, sum[7:4]); endnodule Verilog modules can be instantiated within other modules, but module declarations cannot be nested; that is, a module declaration cannot be inserted into the text between the module and endmodule keywords of another module. Also, instance names (e.g., MO) must be specified when a module is instantiated within another module.

Introductory Circuit Analysis (13th Edition)
13th Edition
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:Robert L. Boylestad
Chapter1: Introduction
Section: Chapter Questions
Problem 1P: Visit your local library (at school or home) and describe the extent to which it provides literature...
icon
Related questions
Question

Write the HDL gate-level hierarchical description of a four-bit adder–subtractor for unsigned binary numbers. The circuit is similar to Fig. 4.13 but without output V. You can instantiate the four-bit full adder described in HDL Example 4.2 .

B3
A;
В, А
B A1
Bo
Ao
M
C
FA
FA
FA
FA
So
V
Transcribed Image Text:B3 A; В, А B A1 Bo Ao M C FA FA FA FA So V
HDL Example 4.2 (Hierarchical
Modeling-Eight-Bit Adder)
Verilog
At the bottom of the design hierarchy shown in Eig. 4.33 a half adder is
composed of primitive gates. At the next level of the hierarchy, a full
adder is formed by instantiating and connecting a pair of half adders. The
third module describes the eight-bit adder by instantiating and linking
together two four-bit adders. This example illustrates optional Verilog
2001, 2005 syntax, which eliminates extra typing of identifiers declaring
the mode (e.g., output), type (reg), and declaration of a vector range (e.g,
[3: 0]) of a port. The first version of the standard (1995) uses separate
statements for these declarations; the revised standard includes the
declarations within the port.
module Add_half (input a, b, output c_out, sum),
xor G1(sum, a, b);
and 62(c_out, a, b);
endnodule
// Gate instance names are option
module Add_full (input a, b, c_in, out put c_out, sum);
Eig.
4.8
// see
// wi is c_out; w2 is sum
wire wi, W2, wa;
Add_half M1 (a, b, wi, w2);
Add_half MO (w2, e_in, w3, sum);
or (c_out, w1, w3);
endnodule
module Add_rca_4, (input [3:0] a, b, input c_in output c_out, ou
wire c_ini, c_in3, c_in4;
Add_full MO (a[0), b[0), c_in, cini, sun[e]);
Add_full M1 (a[ij, b(aj, c_ini, c_in2, sum[1]);
Add_full M2 (a[2j, b(2), c_in2, c_in3, sum[2]);
Add_full M3 (ataj, b(aj, c_ina, c_out, sum[3]);
endnodule
// İntermediate carries
module Add_rca_8 (input [7:e] a, b, input c_in, output c_out, a
wire c_in4;
Add_rca_4 MO (a[3:0], b[3:0], c_in, c_in4, sum[3:0]);
Add_rca_4 M1 (a[7:4], b[7:4], cin4, c_out, sum[7:4]);
endnodule
Verilog modules can be instantiated within other modules, but module
declarations cannot be nested; that is, a module declaration cannot be
inserted into the text between the module and endmodule keywords of
another module. Also, instance names (e.g., MO) must be specified when a
module is instantiated within another module.
Transcribed Image Text:HDL Example 4.2 (Hierarchical Modeling-Eight-Bit Adder) Verilog At the bottom of the design hierarchy shown in Eig. 4.33 a half adder is composed of primitive gates. At the next level of the hierarchy, a full adder is formed by instantiating and connecting a pair of half adders. The third module describes the eight-bit adder by instantiating and linking together two four-bit adders. This example illustrates optional Verilog 2001, 2005 syntax, which eliminates extra typing of identifiers declaring the mode (e.g., output), type (reg), and declaration of a vector range (e.g, [3: 0]) of a port. The first version of the standard (1995) uses separate statements for these declarations; the revised standard includes the declarations within the port. module Add_half (input a, b, output c_out, sum), xor G1(sum, a, b); and 62(c_out, a, b); endnodule // Gate instance names are option module Add_full (input a, b, c_in, out put c_out, sum); Eig. 4.8 // see // wi is c_out; w2 is sum wire wi, W2, wa; Add_half M1 (a, b, wi, w2); Add_half MO (w2, e_in, w3, sum); or (c_out, w1, w3); endnodule module Add_rca_4, (input [3:0] a, b, input c_in output c_out, ou wire c_ini, c_in3, c_in4; Add_full MO (a[0), b[0), c_in, cini, sun[e]); Add_full M1 (a[ij, b(aj, c_ini, c_in2, sum[1]); Add_full M2 (a[2j, b(2), c_in2, c_in3, sum[2]); Add_full M3 (ataj, b(aj, c_ina, c_out, sum[3]); endnodule // İntermediate carries module Add_rca_8 (input [7:e] a, b, input c_in, output c_out, a wire c_in4; Add_rca_4 MO (a[3:0], b[3:0], c_in, c_in4, sum[3:0]); Add_rca_4 M1 (a[7:4], b[7:4], cin4, c_out, sum[7:4]); endnodule Verilog modules can be instantiated within other modules, but module declarations cannot be nested; that is, a module declaration cannot be inserted into the text between the module and endmodule keywords of another module. Also, instance names (e.g., MO) must be specified when a module is instantiated within another module.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Logic Gate and Its Application
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, electrical-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Introductory Circuit Analysis (13th Edition)
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:
9780133923605
Author:
Robert L. Boylestad
Publisher:
PEARSON
Delmar's Standard Textbook Of Electricity
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:
9781337900348
Author:
Stephen L. Herman
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Electrical Engineering
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education
Fundamentals of Electric Circuits
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:
9780078028229
Author:
Charles K Alexander, Matthew Sadiku
Publisher:
McGraw-Hill Education
Electric Circuits. (11th Edition)
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:
9780134746968
Author:
James W. Nilsson, Susan Riedel
Publisher:
PEARSON
Engineering Electromagnetics
Engineering Electromagnetics
Electrical Engineering
ISBN:
9780078028151
Author:
Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:
Mcgraw-hill Education,