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

Implicit Net Type Fallacy

HardVerilog / SystemVerilogBuild

A full adder computes the single-bit sum and carry of two 1-bit inputs plus a carry-in. Full adders are the atomic unit of every ripple-carry and carry-lookahead adder chain. In a hierarchical multi-bit adder, a typo in any one internal wire name creates a silent disconnection that corrupts all higher-order bit positions without producing a compile error under default Verilog net type rules.

The solution module accepts A, B, and Cin and drives Sum and Cout. All logic is purely combinational and gate-level.

Simulation shows Cout = 0 for inputs A = 1, B = 1, Cin = 0 and A = 0, B = 1, Cin = 1. The carry output fails to assert when expected. The module compiles without errors, but silent logic disconnections exist. Inspect the code and correct the fault.

| Signal | Direction | Width | Description | |---------|-----------|-------|-------------| | A | input | 1 | First operand | | B | input | 1 | Second operand | | Cin | input | 1 | Carry input | | Sum | output | 1 | XOR sum of A, B and Cin | | Cout | output | 1 | Carry output; asserted when two or more inputs are 1 |

Constraints

  • All logic is purely combinational; no clock or flip-flops.
  • Do not alter the module interface or port definitions.
  • You must add ` default_nettype none `` before the module declaration so the compiler flags any undeclared identifiers.
  • All internal wires must be explicitly declared.

Topics

DebugSyntaxVerilogNet Types

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