Bringup
Open the editor
Verilog (digital engine)v_counter4

4-bit counter

Synchronous binary counter with enable, asynchronous reset (active high) and carry

CLKRSTENQ[0]Q[1]Q[2]Q[3]COVCCGND4-bit counter
Schematic symbol

Key data

Category
Logic (Verilog)
Simulation model
Verilog (digital engine)
Reference prefix
U
Pins
10
Land pattern
SOIC-10_3.9mm_P1.27mm

Simulation model

The Verilog source is synthesized to gates with Yosys (WebAssembly) and simulated event by event. Outputs drive the analog circuit like CMOS pins through a driver resistance to the supply; inputs switch at 30 % and 70 % of the supply.

Supply pins
VCC / GND
Output driver resistance
50 Ω
Verilog source
module counter4(input CLK, RST, EN, output reg [3:0] Q, output CO);
  always @(posedge CLK or posedge RST)
    if (RST) Q <= 4'd0;
    else if (EN) Q <= Q + 4'd1;
  assign CO = EN & (Q == 4'hF);
endmodule

Pins 10

PinNameUse
CLKCLKInput pinLogic input: never leave open (tie unused inputs to VCC or GND)
RSTRSTInput pinLogic input: never leave open (tie unused inputs to VCC or GND)
ENENInput pinLogic input: never leave open (tie unused inputs to VCC or GND)
Q[0]Q[0]Output pinLogic output: drives the next input; do not tie outputs together
Q[1]Q[1]Output pinLogic output: drives the next input; do not tie outputs together
Q[2]Q[2]Output pinLogic output: drives the next input; do not tie outputs together
Q[3]Q[3]Output pinLogic output: drives the next input; do not tie outputs together
COCOOutput pinLogic output: drives the next input; do not tie outputs together
VCCVCCSupply pinSupply input: decouple with 100 nF close to the pin
GNDGNDGround pinGround

Parameters 1

Gate delaytpd
Default1n s

Delay per gate / clock→Q

PCB

Generic land patternSOIC-10_3.9mm_P1.27mm

no known land pattern, generic SOIC-10_3.9mm_P1.27mm with pins in symbol order