A priority encoder is a logic circuit that converts 2N input

A priority encoder is a logic circuit that converts 2N input signals to N-bit coded outputs. The output of the priority encoder is the binary representation of the ordinal number starting from zero of the most significant input bit. If two or more inputs are given at the same time, the input having the highest priority will take precedence. The output GS indicates if the input is valid. Priority encoders are often used to control interrupt requests by acting on the highest priority request.

Write a VHDL program using Selected Signal Assignment to implement a 4:2 priority encoder with the following truth table:

Solution

ENTITY priority IS

PORT( X : IN STD_LOGIC_VECTOR(3 DOWNTO 0);

A: OUT STD_LOGiC_VECTOR(1 DOWNTO 0);

GS: OUT STD_LOGIC);

END priority;

ARCHITECTURE Behavior OF priority IS

BEGIN

A <= \"11\" WHEN X(3) = \'1\' ELSE

\"10\" WHEN X(2) = \'1\' ELSE

\"01\" WHEN X(1)= \'1\' ELSE \"00\";

Z <= \'0\' WHEN X = \"0000\" ELSE \'1:;

END Behavior;

A priority encoder is a logic circuit that converts 2N input signals to N-bit coded outputs. The output of the priority encoder is the binary representation of

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site