문제

Why are bits are numbered from right to left, in computer organization, computer architecture.

도움이 되었습니까?

해결책

Bits are not numbered from right to left. They are numbered from lowest weight (the lowest weight bit getting the number 0 or 1 depending on the convention chosen) to highest weight (which can be 15 or 16, 31 or 32, 63 or 64, ...).

One reason to number them this way is so that the number of the bit number n that counts for 2n (in start-at-0 convention) will always be the same. If they were numbered in the other direction, the weight of bit n could not be inferred from n alone, it would also depend on the width of the word being discussed.

Another reason is that it is pretty intuitive to have bits with a lower number have less weight.

They end up being numbered from right to left when written because they are written from the highest weight on the left to the lowest weight on the right. Numbers have been written so for centuries. If this is what you are wondering about, the reasons have probably been lost but the Wikipedia page on the Hindu–Arabic numeral system may hold clues.

다른 팁

Well, why are decimal number numbered right to left? It's just how our system developed. It could have gone the other way just as easy...

It is just like any other number: lower values to the right. It just changes the base.

Some processors number the bits from msb bit first down to lsbit, some number from lsbit to msbit, nothing to do with endianness, just how those companies decided to do it. It is an arbitrary decision it doesnt matter in the grand scheme of things so long as everyone using that product sticks to one convention. In some cases the bit setting and shifting instructions operate based on the chip designers convention, if not everyone uses that convention you have issues. It also gets pretty ugly for example when using an fpga with a powerpc core which numbers from msbit of 0, but if you use verilog the natural convention is lsbit first so you have to not mess up the busses and/or create a boundary around the processor core where you swizzle everything so that it wires up directly to common peripherals, etc that are numbered the other way.

The short answer is "because that is what the designer chose", it is arbitrary.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top