CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Combinational Logic

Addition with Carry Out

MediumVerilog / SystemVerilogBuild

Arithmetic overflow in digital signal processing and datapath logic causes catastrophic calculation errors if the carry bit is ignored or dropped. Datapaths must frequently accommodate the maximum possible value of an arithmetic operation to preserve data integrity.

This module takes two 8-bit unsigned integers and computes their sum. To prevent overflow, the result is stored in a 9-bit vector. The most significant bit of this vector acts as the carry out flag, while the lower 8 bits represent the standard addition sum.

This circuit is strictly combinational. There are no clocks, resets, or sequential elements.

| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | a | input | 8 | First unsigned operand | | b | input | 8 | Second unsigned operand | | sum | output | 9 | The 9-bit sum of a and b; sum[8] captures the carry out |

Constraints

  • Output sum must be exactly 9 bits wide
  • The circuit must be purely combinational
  • Unsigned arithmetic must be used for all calculations

Topics

CombinationalArithmeticOperators

Solve this problem

Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against a real testbench — you get the waveform back, not a stored answer.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Related problems

  • Single Continuous AssignmentEasy
  • Basic Vector ConcatenationEasy
  • Ternary Operator MuxEasy
  • Underscores for ReadabilityEasy
  • Left Hand Side ConcatenationEasy
  • Inout Port MechanicsEasy
  • Explicit Binary LiteralsEasy
  • Vector Port EndiannessEasy

Browse all problems · Learning tracks