260 likes | 612 Views
Encoder. Section 4.10. Outline. Review: Sum of Products Encoder Priority Decoder Application of Priority Decoder. Definition of an Encoder. 2 n input lines n output lines Performs the inverse operation of a decoder. Review: 3-to-8 Line Decoder.
E N D
Encoder Section 4.10
Outline • Review: Sum of Products • Encoder • Priority Decoder • Application of Priority Decoder
Definition of an Encoder • 2n input lines • n output lines • Performs the inverse operation of a decoder
Review: 3-to-8 Line Decoder Convert binary information from n input lines to 2n unique output lines. This particular circuit take a binary number and convert it to an octal number.
Application of 8 x 3 Encoder The angular or rotary position of a compass is converted into a digital code by an encoder and inputted to the systems computer to provide navigational data
Implementation of an Encoder • Focus on one output at a time x=D4+D5+D6+D7
Implementation of an Encoder • Focus on one output at a time y=D2+D3+D6+D7
Implementation of an Encoder • Focus on one output at a time z=D1+D3+D5+D7
Uncertainty of an Encoder • What if all the input lines are 0? • Use a valid bit
Model an Encoder in Verilog input : D, an array of 8 elements output: Y, an array of 3 elements V, a valid bit to check for 00000000 input.
Module Template module module_name ( , , ) endmodule Input, output wires reg Program Body
Choosing a Module Name module module_name ( , , ) endmodule Input, output wires reg Program Body
Choosing a Module Name module module_name ( , , ) endmodule Input, output wires reg Program Body x=D4+D5+D6+D7 y=D2+D3+D6+D7 z=D1+D3+D5+D7 Or all elements of D
Output File D={D0,D1,D2,D3,D4,D5, D6,D7} Y={Y0,Y1,Y2} (least significant to most significant}
Output File The output with a higher subscript has a higher priority than an output with a lower subscript.
Priority Encoding • What if more than one input line are high? • Use priority—certain bits are more important than other bits
Priority Encoder Not a Valid State