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

Full Adder Boolean vs Operator

MediumVerilog / SystemVerilogBuild

Modern FPGAs and ASICs contain dedicated hardware for arithmetic operations, such as high-speed carry chains. When an engineer uses the addition operator in Verilog, the synthesis tool automatically maps the logic to these optimized structures. Conversely, manually writing boolean equations for arithmetic can sometimes bypass these optimizations, forcing the tool to synthesize slower and larger logic using generic LUTs or standard cells.

This module evaluates both implementation styles side-by-side. It accepts two 1-bit operands and a carry-in signal. It computes the sum and carry-out using two different methods. The first method computes the result using bitwise boolean operators. The second method computes the exact same logical result using the Verilog addition operator.

This circuit is purely combinational. All outputs must update continuously based on the current state of the inputs.

| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | a | input | 1 | First operand | | b | input | 1 | Second operand | | cin | input | 1 | Carry-in bit | | sum_bool | output | 1 | Sum bit computed using boolean logic operators | | cout_bool | output | 1 | Carry-out bit computed using boolean logic operators | | sum_op | output | 1 | Sum bit computed using the addition operator | | cout_op | output | 1 | Carry-out bit computed using the addition operator |

Constraints

  • Purely combinational logic; no clock or reset ports exist.
  • The sum_bool and cout_bool outputs must be driven by boolean logic operators.
  • The sum_op and cout_op outputs must be driven by the addition operator.
  • Both implementations must produce identical logical results for all input combinations.

Topics

CombinationalArithmeticSynthesis

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