Study Web

Week 6

Encoders , Decoders and Multiplexers

COS10004 Computer Systems · Lecture 5.1 Encoders , Decoders and Multiplexers

ENCODERS AND DECODERS

  • Binary signals along a wire can represent a single state, or form part of a binary code
  • Sometimes we want to convert between these representations:
  • We may want to encode independent input wires as a single output binary code OR
  • We may want to decode a multi-bit binary value to the single output line it represents

ENCODERS

  • Encoders are used to code binary data
  • Converts an active input signal into a coded output signal
  • If an encoder has n lnput lines and m output lines then:
  • n <= 2m

src: https://www.engineersgarage.com

ENCODER EXAMPLE: 4-TO-2 PRIORITY ENCODER

  • Imagine 4 input lines each indicating a priority level
  • We encode the priority as a 2 bit binary number according to the truth table:
  • Imagine 4 input lines each indicating a priority level
  • We encode the priority as a 2 bit binary number according to the circuit:
  • Key feature:
  • If multiple inputs are raised High, it will always encode the high priority!
  • Lets try it

ENCODER EXAMPLE: 8-TO-3 PRIORITY ENCODER

  • What about an 8-to-3 encoder?
  • Try and have a go!
  • Hint: use 3 x 4 input OR gates

COMMON ENCODER APPLICATIONS

  • Interrupts we talked about last week!
  • Keyboards: Imagine microcomputer reads from keyboard only one button at a time. buttons of a QWERTY keyboard into a binary code
  • Eg ASCII code in 7 bits (= output wires)

DECODERS

  • Decoders are the opposite of encoders:
  • used to decode binary information
  • Multiple input lines represent a binary code
  • This code is used to select a single output line to raise High
  • If a decoder has n input lines, it can have a maximum 2n output lines

DECODER EXAMPLE: 2-TO-4 DECODER

Have a go at designing a circuit to map a 2 bit binary number to select 1 of 4 output lines

DECODER APPLICATIONS

  • Memory Address Decoder
  • Memory commonly stored across multiple chips but transferred over a common bus
  • Each memory chip has a Chip Select (CS) input
  • Memory address is decoded to select the desired chip

Img src: https://www.electronics-tutorials.ws/combination/comb_5.html

  • Displays (eg. 7-segment display)
  • 3-8 decoder outputs can feed directly into 7-segment display
  • Similar concept for LCD displays

MULTIPLEXERS

  • Mulitplexers (many-to-one) are similar to encoders
  • Used for routing digital data from many to one line.
  • Selects a single input line from several possible lines and sends the data to the output line.

MULTIPLEXER USE-CASES

  • Telephony
  • Communication systems
  • Memory
  • Parallel to serial conversion

DE-MULTIPLEXERS

  • De-Mulitplexers (one-to-many) are similar to decoders
  • Used to transimit digital data from one to many lines.
  • Selects an output line from several possible lines and sends the input data to that line.

DE-MULTIPLEXER USE-CASES

  • Communication systems
  • Connecting ALU with registers
  • Serial to parallel conversion

SUMMARY

  • data manipulation and transfer
  • Encoders convert an active input signal into a coded output signal
  • Decoders selects a single output line based on a coded output
  • Multiplexers (many-to-one) choose which line to channel data from
  • De-Multiplexers (one-to-many) choose which output line to channel data to