Question

Design a module that can perform a binary-coded decimal (BCD) addition. You have two 4-bit BCD...

Design a module that can perform a binary-coded decimal (BCD) addition. You have two 4-bit BCD (decimal digits 0 to 9) inputs “a” and “b” and an 8-bit output “x” which represents a two digit BCD number.

X [7:4] represents the upper BCD digits

X [3:0] represents the lower BCD digits

In the Verilog file, please code a BCD adder. It should follow the following format.

module bcd_adder( a,b,x );

input wire [3:0] a;

input wire [3:0] b;

output reg [7:0] x;

...

Homework Answers

Answer #1

module bcd_adder(a, b, x);

input wire [3:0] a;
input wire [3:0] b;
output reg [7:0] x;

wire [7:0] sum;

wire [7:0] result;

assign sum = a + b;

assign result = (sum[3:0] > 4'b1001 || sum[4] == 1'b1)? (sum + 4'b0110) : sum;

always @ (result)
begin
x <= result;
end

//Simulated

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Design a module using Verilog’s behavioral design method that can perform a BCD to seven segment...
Design a module using Verilog’s behavioral design method that can perform a BCD to seven segment display decoder. This module receives a 4-bit binary input and generates the seven output signals (a - g) plus DP (dot pixel) for the display. module bcd_to_seven( bin_in, sseg_out); input wire [3:0] bin_in; output reg [7:0] sseg_out; endmodule The inputs bin_in should be binary 0 to 15. The outputs of sseg_out should drive a seven segment display to indicate a number from 0 -...
Design and code a Verilog module to convert a 4 digit unsigned BCD whole number into...
Design and code a Verilog module to convert a 4 digit unsigned BCD whole number into a 14 bit binary number.
Verilog HDL Design a logic module to multiply an 8-bit binary number A [0:7] by a...
Verilog HDL Design a logic module to multiply an 8-bit binary number A [0:7] by a 4-bit binary number N [0:3]. The multiply is started when M is asserted. The output F is asserted when the multiply is completed and the product P [0: 15] is available. The outputs need to remain valid until the next multiply command is given. Assume M is valid for several of your clock cycles and then is de-asserted. Implement the multiply using repeated addition...
(a) Design a 2 - digit BCD number -to- binary number converter circuit by using 4...
(a) Design a 2 - digit BCD number -to- binary number converter circuit by using 4 bit parallel adders. (b) Design a parallel binary multiplier that multiplies a 4- bit number B = B3B2B1B0 by a 3- bit number A = A2A1A0 to form the product C = C6C5C4C3C2C1C0.
VERILOG Design an Arithmetic Logic Unit (ALU) that can perform four-bit 1. Four-bit addition; 2. Four-bit...
VERILOG Design an Arithmetic Logic Unit (ALU) that can perform four-bit 1. Four-bit addition; 2. Four-bit subtraction; 3. Four-bit multiplication; 4. Four-bit comparator (that compares two binary numbers to check whether two numbers are equal, or one is less/greater than other). Write test benches and simulate each module/submodule. Hint: First make individual modules of the four-bit adder, four-bit subtractor, four-bit multiplier, four-bit comparator modules (make all these in same/one project) and then use a multiplexer to combine these modules to...
Design a 4-bit adder-subtractor circuit using the 4-bit binary Full adders (74LS83) and any necessary additional...
Design a 4-bit adder-subtractor circuit using the 4-bit binary Full adders (74LS83) and any necessary additional logic gates. The circuit has a mode input bit, M, that controls its operation. Specifically, when M=0, the circuit becomes a 4-bit adder, and when M=1, the circuit becomes a 4-bit subtractor that performs the operation A plus the 2’s complement of B.Where A and B are two 4-bits binary numbers. That is, * When M=0, we perform A+B, and we assume that both...
1.) 2-bit binary numbers represent the values 0..3 with the following encoding: Encoding [1:0] Value 0...
1.) 2-bit binary numbers represent the values 0..3 with the following encoding: Encoding [1:0] Value 0 0 0 0 1 1 1 0 2 1 1 3 Develop the simplest Sum-of-Products equation possible that, when given two 2-bit binary numbers X[1:0] and Y[1:0], will output whether the value of X is greater than the value of Y. 2.) Assume that we have already implemented the solution to problem #1 as a module “isGreater(F, X, Y)” in Verilog, and cannot change...
QUESTION 1 During a single clock tick, how many 64-bit values can be written to an...
QUESTION 1 During a single clock tick, how many 64-bit values can be written to an input of a register file with 8 64-bit registers (i.e. an 8x64 register file)? QUESTION 2 Suppose you are designing a processor that contains a register file with 32 32-bit registers (i.e. a 32x32 register file). What is the minimum number of bits required in order to select which register is being written to? QUESTION 3 If the decimal value, 30, is shifted to...
We wish to design a 4-bit PWM to control the brightness of a 7-segment LED display....
We wish to design a 4-bit PWM to control the brightness of a 7-segment LED display. A PWM circuit will be constructed with a 74163 (4-bit binary counter) and a 7485 (4-bit magnitude comparator). The inputs and output are:  clk: DE1 50 MHz clock signal.  d: 4-bit input control signal specifying the duty cycle of output pulse.  p: 1-bit output pulse with the specified duty cycle. The d signal is treated as a 4-bit unsigned binary number....
Adder Start out by picking 2 positive six bit binary numbers that are less than 3210,...
Adder Start out by picking 2 positive six bit binary numbers that are less than 3210, written in 2's complement notation. The eventual goal is to add these two numbers. 1) Look at the LSB bit of the numbers, and using logic gates (NANDs, NORs, etc.) design a circuit that correctly gives the right output for any possible combination of bits in the LSB place. 2) Now look at the next column to the left (next to LSB). In this...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT