Bringup
Open the editor
Verilog (digital engine)74LS181v_ls181

74LS181 (4-bit ALU)

74LS181 (4-bit ALU): functional Verilog gate model, numbered SOIC pins as in the datasheet.

B[0]A[0]S[3]S[2]S[1]S[0]nCnMF[0]F[1]F[2]GNDF[3]AEQBnPnCn4nGB[3]A[3]B[2]A[2]B[1]A[1]VCC74LS181
Schematic symbol

Key data

Category
Logic (Verilog)
Simulation model
Verilog (digital engine)
Manufacturer part number
74LS181
Reference prefix
U
Pins
24
Land pattern
SOIC-24W_7.5x15.4mm_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
24 / 12
Top module
v_ls181
Output driver resistance
50 Ω
Verilog source

module v_ls181(input [3:0] A,B,S,input nCn,M,output [3:0] F,output AEQB,nP,nG,nCn4);
wire [3:0] P=A|(S[0]?B:4'b0000)|(S[1]?~B:4'b0000);
wire [3:0] G=(S[2]?(A&~B):4'b0000)|(S[3]?(A&B):4'b0000);
wire [4:0] sum={1'b0,P}+{1'b0,G}+{4'b0000,~nCn};
assign F=M?~(P^G):sum[3:0];
assign nCn4=~sum[4];
assign nG=~(G[3]|(P[3]&G[2])|(P[3]&P[2]&G[1])|(P[3]&P[2]&P[1]&G[0]));
assign nP=~(&P);
assign AEQB=(&F)?1'bz:1'b0;
endmodule

Pins 24

PinNameUse
1B[0]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
2A[0]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
3S[3]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
4S[2]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
5S[1]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
6S[0]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
7nCnInput pinActive-low control input: low = active; tie high when unused
8MInput pinLogic input: never leave open (tie unused inputs to VCC or GND)
9F[0]Output pinLogic output: drives the next input; do not tie outputs together
10F[1]Output pinLogic output: drives the next input; do not tie outputs together
11F[2]Output pinLogic output: drives the next input; do not tie outputs together
12GNDGround pinGround
13F[3]Output pinLogic output: drives the next input; do not tie outputs together
14AEQBOutput pinLogic output: drives the next input; do not tie outputs together
15nPOutput pinLogic output: drives the next input; do not tie outputs together
16nCn4Output pinLogic output: drives the next input; do not tie outputs together
17nGOutput pinLogic output: drives the next input; do not tie outputs together
18B[3]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
19A[3]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
20B[2]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
21A[2]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
22B[1]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
23A[1]Input pinLogic input: never leave open (tie unused inputs to VCC or GND)
24VCCSupply pinSupply input: decouple with 100 nF close to the pin

Parameters 1

Gate delaytpd
Default10n

PCB

Verified land patternSOIC-24W_7.5x15.4mm_P1.27mm