Draft preview. Lessons are being written and reviewed.

Verilog practice / Problem 13

MediumCombinational

8-to-3 priority encoder

idx is the position of the highest 1 in in. valid is 1 when in has at least one 1. When in is all zeros, valid is 0 and idx is 0. For example, in = 8'b0010_0110 gives idx = 5.

Ports

NameDirectionBits
ininput8
idxoutput3
validoutput1

How it's checked

The test tries the input combinations and checks every output for each one.

Stuck? Read the lesson Decoders and priority encoders.

prio_enc8.vCtrl + Enter runs