Physics — Logic: 4-to-2 priority encoder
Encodes the highest active input to a 2-bit code.
Make it your own.
title "4-to-2 priority encoder"
type gates
input I0 at (0,0)
input I1 at (0,1.5)
input I2 at (0,3)
input I3 at (0,4.5)
gate NOT N2 at (3,3)
gate OR G0 at (5,1)
gate AND G1 at (5,3)
gate OR G2 at (7,3.5)
output Y1 at (9,1)
output Y0 at (9,3.5)
wire I2 G0
wire I3 G0
wire G0 Y1
wire I2 N2
wire I1 G1
wire N2 G1
wire I3 G2
wire G1 G2
wire G2 Y0