Presentation is loading. Please wait.

Presentation is loading. Please wait.

Decoders and Encoders Discussion D4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders.

Similar presentations


Presentation on theme: "Decoders and Encoders Discussion D4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders."— Presentation transcript:

1 Decoders and Encoders Discussion D4.2

2 Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders

3 Decoders

4 3-to-8 Decoder Behavior input [2:0] A ; wire [2:0] A ; output [0:7] Y ; reg [0:7] Y ; for(i = 0; i <= 7; i = i+1) if(A == i) Y[i] = 1; else Y[i] = 0;

5 3-to-8 Decoder module decode38 ( A, Y ); input [2:0] A ; wire [2:0] A ; output [0:7] Y ; reg [0:7] Y ; integer i; always @(A) for(i = 0; i <= 7; i = i+1) if(A == i) Y[i] = 1; else Y[i] = 0; endmodule decode38.v

6 3-to-8 Decoder

7 TTL Decoders 1 2 3 4 5 6 7 89 10 11 12 13 14 15 16 GND Vcc1G 1A 1B 1Y0 1Y1 1Y2 1Y3 2G 2A 2B 2Y0 2Y1 2Y2 2Y3 74LS139 Y0 Y1 Y2 Y3BA G 1 X X 1 1 1 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 1 0 Dual 2-4 Decoder

8 TTL Decoders 1 2 3 4 5 6 7 89 10 11 12 13 14 15 16 GND VccA B C G1 Y7 Y0 Y1 Y2 Y3 Y4 Y5 Y6 !G2A !G2B 74LS138 ABC Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 G1 G2 G2 = G2A # G2B X = don't care X 1 X X X 1 1 1 1 1 1 1 1 0 X X X X 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 3-to-8 Decoder

9 Decoder Networks

10 4-input tree decoder

11 8-input Coincident Decoder

12 Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders

13 Binary encoders

14 Encoders A B I0 I1 I2 I3 4-to-2 Encoder 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 1 I0 I1 I2 I3 B A

15 Encoders 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 1 1 1 I0 I1 I2 I3 B A Assume only 1 input can be high at any time. A = I1 + I3 B = I2 + I3 I1 I2 I3 I0 B = I2 + I3 A = I1 + I3

16 8-to-3 Encoder 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 I0 I1 I2 I3 I4 I5 I6 I7 Y2 Y1 Y0 Y2 = I7 + I6 + I5 + I4 Y1 = I7 + I6 + I3 + I2 Y0 = I7 + I5 + I3 + I1

17 Uses of binary encoders

18 Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders

19 Priority Encoder 1 0 0 0 0 0 0 0 0 0 0 X 1 0 0 0 0 0 0 0 0 1 X X 1 0 0 0 0 0 0 1 0 X X X 1 0 0 0 0 0 1 1 X X X X 1 0 0 0 1 0 0 X X X X X 1 0 0 1 0 1 X X X X X X 1 0 1 1 0 X X X X X X X 1 1 1 1 I 0 I 1 I 2 I 3 I 4 I 5 I 6 I 7 Y 2 Y 1 Y 0

20 Priority Encoder 1 0 0 0 0 0 0 0 0 0 0 X 1 0 0 0 0 0 0 0 0 1 X X 1 0 0 0 0 0 0 1 0 X X X 1 0 0 0 0 0 1 1 X X X X 1 0 0 0 1 0 0 X X X X X 1 0 0 1 0 1 X X X X X X 1 0 1 1 0 X X X X X X X 1 1 1 1 Y 2 = L 7 + L 6 + L 5 + L 4 L 7 = I 7 L 6 = I 7 'I 6 L 5 = I 7 'I 6 'I 5 L 4 = I 7 'I 6 'I 5 'I 4 I 0 I 1 I 2 I 3 I 4 I 5 I 6 I 7 Y 2 Y 1 Y 0

21 Priority Encoder 1 0 0 0 0 0 0 0 0 0 0 X 1 0 0 0 0 0 0 0 0 1 X X 1 0 0 0 0 0 0 1 0 X X X 1 0 0 0 0 0 1 1 X X X X 1 0 0 0 1 0 0 X X X X X 1 0 0 1 0 1 X X X X X X 1 0 1 1 0 X X X X X X X 1 1 1 1 Y 1 = L 7 + L 6 + L 3 + L 2 I 0 I 1 I 2 I 3 I 4 I 5 I 6 I 7 Y 2 Y 1 Y 0 L 7 = I 7 L 6 = I 7 'I 6 L 3 = I 7 'I 6 'I 5 'I 4 'I 3 L 2 = I 7 'I 6 'I 5 'I 4 'I 3 'I 2

22 Priority Encoder 1 0 0 0 0 0 0 0 0 0 0 X 1 0 0 0 0 0 0 0 0 1 X X 1 0 0 0 0 0 0 1 0 X X X 1 0 0 0 0 0 1 1 X X X X 1 0 0 0 1 0 0 X X X X X 1 0 0 1 0 1 X X X X X X 1 0 1 1 0 X X X X X X X 1 1 1 1 I 0 I 1 I 2 I 3 I 4 I 5 I 6 I 7 Y 2 Y 1 Y 0 Y 0 = L 7 + L 5 + L 3 + L 1 L 7 = I 7 L 5 = I 7 'I 6 'I 5 L 3 = I 7 'I 6 'I 5 'I 4 'I 3 L 1 = I 7 'I 6 'I 5 'I 4 'I 3 'I 2 'I 1

23 TTL Priority Encoder 1 2 3 4 5 6 7 89 10 11 12 13 14 15 16 GND Vcc 1 2 3 4 5 6 7 A2 A1 E1 E0 GS 0 A0 74LS148 1 X X X X X X X X 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 X X X X X X X 0 0 0 0 0 1 0 X X X X X X 0 1 0 0 1 0 1 0 X X X X X 0 1 1 0 1 0 0 1 0 X X X X 0 1 1 1 0 1 1 0 1 0 X X X 0 1 1 1 1 1 0 0 0 1 0 X X 0 1 1 1 1 1 1 0 1 0 1 0 X 0 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 EI 0 1 2 3 4 5 6 7 A2 A1 A0 GS EO Priority Encoder

24 68000 Interrupt Logic Peripheral 74148 Encoder 74138 Decoder IP0 IP1 IP2 A0 A1 A2 IRQA 68000 Data Bus IRQ

25 entity pencoder is port ( x: in STD_LOGIC_VECTOR (7 downto 0); E: in STD_LOGIC; y: out STD_LOGIC_VECTOR (2 downto 0); A: out STD_LOGIC ); end pencoder; 8-to-3 Priority Encoder

26 architecture pencoder_arch of pencoder is begin pe: process(x,E) variable k: integer; begin y <= "000"; A <= '0'; if E = '1' then for j in 0 to 7 loop if x(j) = '1' then y <= conv_std_logic_vector(j,3); A <= '1'; end if; end loop; end if; end process pe; end pencoder_arch;

27

28

29

30


Download ppt "Decoders and Encoders Discussion D4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders."

Similar presentations


Ads by Google