تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Design and simulate an 8-bit adder/subtractor using a hierarchical Verilog behavioral dataflow description.
Your design should accept two twos-complement 8-bit inputs (x and y) and generate an output (result)
which is either their sum or difference, based on another input (sub). If sub is 1, perform a subtract; if sub
is O perform an addition.
Create the design in a hierarchical fashion as follows. Build a 1-bit full adder using a behavioral dataflow
description. Create a testbench to thoroughly test the full adder. Then, create an expandable 4-bit ripple
carry adder by instantiating and connecting multiple instances of your debugged full adder. Write a
testbench to verify your 4-bit ripple carry adder.
Next, create an 8-bit adder/subtractor by instantiating your 4-bit adder twice along with additional logic
needed to handle subtraction. Your 8-bit design will not be expandable.
You must declare your 8-bit adder/subtractor as follows:
module AddSub8Bit (result, x, y, ccn, ccz, ccv, ccc, sub);
input [7:0] x, y;
output [7:0] result;
output ccn, ccz, ccv, ccc;
input sub;
For extra credit: Set four condition code bits (ccn, ccz, ccv, ccc) to indicate whether the result is negative,
zero, resulted in an overflow, resulted in a carry out, respectively.
If you are not doing the extra credit you must still declare the condition code outputs above but you can
leave them undefined in your module.
Your Verilog modules must be compiled and simulated. Save the simulator timing diagrams (except for
the 8-bit versions) so that you can include them in your final report.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.