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...
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...
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...
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...
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...
Using the following code perform ALL of the tasks below in C++: ------------------------------------------------------------------------------------------------------------------------------------------- Implementation: Overload input...
Using the following code perform ALL of the tasks below in C++: ------------------------------------------------------------------------------------------------------------------------------------------- Implementation: Overload input operator>> a bigint in the following manner: Read in any number of digits [0-9] until a semi colon ";" is encountered. The number may span over multiple lines. You can assume the input is valid. Overload the operator+ so that it adds two bigint together. Overload the subscript operator[]. It should return the i-th digit, where i is the 10^i position. So the first...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • What is the most important factor to consider when developing the promotional mix for a product?...
    asked 1 minute ago
  • Assume the random variable X has a binomial distribution with the given probability of obtaining a...
    asked 3 minutes ago
  • I have a few questions that I'm not sure how to go about doing? This is...
    asked 3 minutes ago
  • The Bernoulli effect can have important consequences for the design of buildings. For example, wind can...
    asked 3 minutes ago
  • (i) Define the 3 Bolting Categories (ii) Discuss the methods of Achieving snug tight and fully...
    asked 9 minutes ago
  • HYPOTHESIS TEST: Difference in Cardiopulmonary exercise testing time Pre- and Post- PCI procedure (in seconds): PCI:...
    asked 9 minutes ago
  • A consumer advocacy group is doing a large study on car rental practices. Among other things,...
    asked 11 minutes ago
  • A productivity index of 110% means that a company’s labor costs would have been 10% higher...
    asked 20 minutes ago
  • explain the difference between intentional interference with contractual relationship and interference with prospective advantage ?? Give...
    asked 28 minutes ago
  • How does James Madison advocate for protections and safeguards for the rights and liberties of the...
    asked 30 minutes ago
  • The concentration of a drug in body fluids depends on the time (t) elapsed after its...
    asked 41 minutes ago
  • Between: Galton and General Intelligence, Thurstone’s The Theory of Multiple Factors, Guilford’s ‘Structure of Intellect’, Cattell’s...
    asked 44 minutes ago