Electrical – Understanding what sign extension does

computer-architecturecomputers

Sign-extension works this way: You pad with zeros for a positive number and pad with ones for a negative number, because of two's complement, and left or right depends on endianness.

Did I understand it correctly? Do I need to know more if I'm looking to understand it as it is described e.g. in Pattersson (Comp. Organization)?

Best Answer

Sign extension is a block that takes in your input data and append bits to it based on the MSB(most significant bit) value to maintain sign integrity. It has nothing to do with endianness. Endianness is related to how data is stored in memory and varies from one architecture to another. Also sign extension usually appends bits to the left of the input data.

Link explaining endianness