Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

Converting between base 10 and 2


BASE 10
263
100 X 2
+
10   X 6
+
1     X 3

BASE 2

101
1 X 1
+
2 X 0
+
4 X 1   = 5

another example

11011

1  X  1
+
2  X  0
+
4  X  1
+​
8  X   1​​​​​​ = 27


 

8Bit size = Byte
 

 

      1           2          3              4            5       6        7      8
 _________________________________________________________
|   128's |  64's |  32's  |  16's  |  8's  |  4's  |  2's  |  1's  |
|________|______|______|______|_____|_____|_____|_____|
|      1            1          1          1          1         1         1       1   = 255       in UTF8 is ÿ

|______________________________________________________
_________________________________________________________
|   128's |  64's |  32's  |  16's  |  8's  |  4's  |  2's  |  1's  |
|________|______|______|______|_____|_____|_____|_____|
|      0          1          1          1          1         1         1       1   =  127       in ASCII is DEL
|______________________________________________________
_________________________________________________________
|   128's |  64's |  32's  |  16's  |  8's  |  4's  |  2's  |  1's  |
|________|______|______|______|_____|_____|_____|_____|
|      0          1          1          1          0        1         1       1   =  119      in ASCII is w
|______________________________________________________

_________________________________________________________
|   128's |  64's |  32's  |  16's  |  8's  |  4's  |  2's  |  1's  |
|________|______|______|______|_____|_____|_____|_____|
|      0          1          1          0          0        0        1       1   =  99     in ASCII is c
|______________________________________________________

16bit encoding came out later.
32bit & 64bit are the standard today.

TAKE NOTE

This is just like in decimal count 
 

The number 1,654 is:
 __________________________________
|  1000's  |  100's  |  10's  |  1's  |
|_________|________|______|_____|
|      1            6              5          4          
|_________________________________

A number at each place is just a multiplacation of 10.

Representing floating numbers:

A floating number, lets say 625.9 can be represented in the following way
0.6259 * 10^3 
   |___|           ^

       |              | exponent
Segnificant

Floating numbers are represented in a 32bit number storage.

______________________________________________________________________________________________________________________________________________________________
|  1 | 2  | 3 | 4 | 5  | 6 |  7  | 8  | 9 | 10  | 11 | 12 | 13  | 14 |  15  | 16  |  17 | 18 | 19 | 20 | 21  | 22 |  23  | 24 |25 | 26  | 27 | 28 | 29 | 30 |  31  | 32  |

|__||_______________________________||______________________________________________________________________________________________________________________|
   ^                                ^                                                                                                            ^
   |                                |                                                                                                            |
  sign                exponent                                                                                              Segnificant
   (-/+)                   8bits                                                                                                         23bits  

  1bit  

    
  


 

The ALU - An arithmetic logic unit (ALU) is a combinational digital electronic circuit that performs arithmetic and bitwise operations on integer binary numbers.
This is in contrast to a floating-point unit (FPU), which operates on floating point numbers.
An ALU is a fundamental building block of many types of computing circuits, including the central processing unit (CPU) of computers, FPUs, and graphics processing units (GPUs).
 single CPU, FPU or GPU may contain multiple ALUs.

The inputs to an ALU are the data to be operated on, called operands, and a code indicating the operation to be performed; the ALU's output is the result of the performed operation. In many designs, the ALU also has status inputs or outputs, or both, which convey information about a previous operation or the current operation, respectively, between the ALU and external status registers.

Arithmetic unit

  • Add: A and B are summed and the sum appears at Y and carry-out.
  • Add with carry: A, B and carry-in are summed and the sum appears at Y and carry-out.
  • Subtract: B is subtracted from A (or vice versa) and the difference appears at Y and carry-out. For this function, carry-out is effectively a "borrow" indicator. This operation may also be used to compare the magnitudes of A and B; in such cases the Y output may be ignored by the processor, which is only interested in the status bits (particularly zero and negative) that result from the operation.
  • Subtract with borrow: B is subtracted from A (or vice versa) with borrow (carry-in) and the difference appears at Y and carry-out (borrow out).
  • Two's complement (negate): A (or B) is subtracted from zero and the difference appears at Y.
  • Increment: A (or B) is increased by one and the resulting value appears at Y.
  • Decrement: A (or B) is decreased by one and the resulting value appears at Y.
  • Pass through: all bits of A (or B) appear unmodified at Y. This operation is typically used to determine the parity of the operand or whether it is zero or negative, or to load the operand into a processor register.

Bitwise logical operations unit

  • AND: the bitwise AND of A and B appears at Y.
  • OR: the bitwise OR of A and B appears at Y.
  • Exclusive-OR: the bitwise XOR of A and B appears at Y.
  • Ones' complement: all bits of A (or B) are inverted and appear at Y.