13.07.2015 Views

ModuleWare Reference Guide - Hornad

ModuleWare Reference Guide - Hornad

ModuleWare Reference Guide - Hornad

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Encoder (encoder1)Combinatorial PartsEncoder (encoder1)This part provides encoder functionality that is the opposite of thatprovided by a decoder.The value of the output bus port dout is the location of the first bit oninput port din that is equal to the scalar input port mode. This allows theuser to encode either the first zero or the first one in din.The most significant bit (MSB) of dout is used as an error flag.The error flag is set if no bit in din is equal to the mode (that is, whenmode = 1 and all the bits of din = 0, or when mode = 0 and all the bits of din = 1). The errorflag is also set when the width of din is more than dout can encode. Because the MSB isreserved for the error flag, the maximum width of din should not exceed 2 ** (n - 1) where n isthe width of dout.The width of dout must be at least 2. Encoding starts from the least significant bit (LSB) toMSB.This part is equivalent to the gate count of an n bit encoder. Where n is the width of the port din.Functiondout= i= 100…where i is first location (from LSB) of the bit of din = modeif none of the bits in the encodable range of din = modeTruth TableExample (4 to 8 bit):Table 4-7. Encoder Truth Tabledin mode dout00110111 0 001100111100 0 000010101111 0 010001100000 1 010101111111 1 000000000000 1 1000<strong>ModuleWare</strong> <strong>Reference</strong> Manual, Library Version 1.9 69September 18, 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!