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

Multiple Gate Instantiation List

MediumVerilog / SystemVerilogBuild

Hardware description languages provide concise ways to instantiate multiple primitive gates without writing separate lines for each. When a design requires several identical gates driving independent signals, developers group them into a single instantiation statement to improve readability and reduce verbosity.

The module computes the bitwise AND of two 4-bit input vectors. It produces a 4-bit output vector where each bit is the logical AND of the corresponding bits from the two input vectors. To complete this exercise, the design must use a single primitive keyword followed by four comma-separated instances.

This circuit is purely combinational. There is no clock and no reset. The output updates immediately when any input changes. All outputs are driven continuously.

| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | a | input | 4 | First operand | | b | input | 4 | Second operand | | y | output | 4 | Bitwise AND result |

Constraints

  • The design must instantiate exactly four and gates.
  • All four gate instantiations must share a single and keyword, separated by commas.
  • Continuous assignments using the assign keyword and the & operator are not permitted.
  • Arrays of instances (e.g., and g[3:0] (...)) are not permitted for this specific exercise.
  • Outputs are purely combinational.
  • Bit widths are exactly 4 bits for all ports.

Topics

Combinational LogicGate LevelLanguage Basics

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