Verilog practice / Problem 13
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
| Name | Direction | Bits |
|---|---|---|
in | input | 8 |
idx | output | 3 |
valid | output | 1 |
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