开发者

How many Bits were used?

Assume a simple machine uses 4 bits to represent it instruction set. How many different instruction can this machine have? How many instruction could it have if eight bit are used? How many if 16 bits are used?

S开发者_JAVA百科orry with the homework theory.. I didnt know how else to put it.. thanks


A bit can have two values: 0 or 1.

How many unique values are there of no bits? Just one. I'd show it here, but I don't know how to show no bits.

How many unique values are there of one bit? Two: 0 1

How many unique values are there of two bits? Four: 00 01 10 11

How many unique values are there of three bits? Eight: 000 001 010 011 100 101 110 111

Notice anything? Each time you add another bit, you double the number of values. You can represent that with this recursive formula:

unique_values(0) -> 1
unique_values(Bits) -> 2 * unique_values(Bits - 1)

This happens to be a recursive definition of "two to the power of," which can also be represented in this non-recursive formula:

unique_values = 2 ^ bits    # ^ is exponentiation

Now you can compute the number of unique values that can be held by any number of bits, without having to count them all out. How many unique values can four bits hold? Two to the fourth power, which is 2 * 2 * 2 * 2 which is 16.


It's 2 to the power "bits". So

  • 4 bits = 16 instructions
  • 8 bits = 256 instructions
  • 16 bits = 65536 instructions


You can have 2 raised to the power of the number of bits (since each bit can be 1 or zero). E.g. for the 4 bit computer: 2^4 = 16.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜