Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Organizing those 1s and 0s

#1
Organizing those 1s and 0s

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/12/organizing-those-1s-and-0s.png" width="640" height="320" title="" alt="" /></div><div><p>“It’s all 1s and 0s.” People say this when they’re making a joke or a sarcastic remark. When it comes to computers thought, it’s really true. And at the hardware level, that’s all there is. The processor, the memory, various forms of storage, USB, HDMI, and network connections, along with everything else in that cell-phone, tablet, laptop, or desktop only uses 1s and 0s. Bytes provide for the grouping of the 1s and 0s. So they are a big help in keeping them organized. Let’s looks at how they do that.</p>
<hr class="wp-block-separator" />
<p>Bytes are the unit of measure for data and programs stored and used in your computer. Though the byte has existed for a long time in computer history and has taken several forms, it’s current 8 bit length is well settled. Taken either singly or as adjacent groups, bytes are the generally accepted most common way the Bits in a computer are kept organized.</p>
<p>So what’s a bit? A bit is a binary digit; that is it can have only two values. In computers the two values a bit can have are zero (0) and one (1). That’s it, no other choices. A byte is just eight binary bits that are taken together to represent binary numbers. Through various coding schemes the numbers can represent a wide variety of other things like the characters we write with.</p>
<p>The table below shows a single Little-Endian byte showing individual bits of this byte and their associated powers of two. The decimal values of each power of two is show with each bit for reference. The line between Bit 3 and Bit 4 is where the&nbsp; byte is sub divided into four bit groups called Nibbles. Little-Endian is a very commonly used byte format. Stay tuned for more on Endians. If you’re curious about the name, do a search on (etymology of endian).</p>
<p>One Little-Endian Byte:</p>
<figure class="wp-block-table">
<table class="">
<tbody>
<tr>
<td></td>
<td>Bit0</td>
<td>Bit1</td>
<td>Bit2</td>
<td>Bit3</td>
<td>Bit4</td>
<td>Bit5</td>
<td>Bit6</td>
<td>Bit7</td>
</tr>
<tr>
<td>Power of 2</td>
<td>2<sup>0</sup></td>
<td> 2<sup>1</sup></td>
<td> 2<sup>2</sup></td>
<td> 2<sup>3</sup></td>
<td> 2<sup>4</sup></td>
<td> 2<sup>5</sup></td>
<td> 2<sup>6</sup></td>
<td> 2<sup>7</sup></td>
</tr>
<tr>
<td>Decimal value</td>
<td>1</td>
<td>2</td>
<td>4</td>
<td>8</td>
<td>16</td>
<td>32</td>
<td>64</td>
<td>128</td>
</tr>
</tbody>
</table>
</figure>
<p>Each nibble of a byte can hold a four bit binary number as shown in the following table. If a bit is set to “1” that power of two adds to the value of the nibble. If a bit is set to “0” that power of two does not add to the value of the nibble. A byte which is two nibbles can hold a two digit hexadecimal number. Bits are really all that a computer can use. Programmers and engineers developing computer hardware use hexadecimal to make dealing with the bits easier. In the table below the least significant bit is on the left 2<sup>0</sup>, 2<sup>1</sup>, 2<sup>2</sup>, 2<sup>3</sup></p>
<p>One Little-Endian Nibble:</p>
<figure class="wp-block-table aligncenter">
<table class="">
<tbody>
<tr>
<td>Binary<br />Number</td>
<td>Hexidecimal<br />Value</td>
</tr>
<tr>
<td>0000</td>
<td>0</td>
</tr>
<tr>
<td>1000</td>
<td>1</td>
</tr>
<tr>
<td>0100</td>
<td>2</td>
</tr>
<tr>
<td>1100</td>
<td>3</td>
</tr>
<tr>
<td>0010</td>
<td>4</td>
</tr>
<tr>
<td>1010</td>
<td>5</td>
</tr>
<tr>
<td>0110</td>
<td>6</td>
</tr>
<tr>
<td>1110</td>
<td>7</td>
</tr>
<tr>
<td>0001</td>
<td>8</td>
</tr>
<tr>
<td>1001</td>
<td>9</td>
</tr>
<tr>
<td>0101</td>
<td>A</td>
</tr>
<tr>
<td>1101</td>
<td>B</td>
</tr>
<tr>
<td>0011</td>
<td>C</td>
</tr>
<tr>
<td>1011</td>
<td>D</td>
</tr>
<tr>
<td>0111</td>
<td>E</td>
</tr>
<tr>
<td>1111</td>
<td>F</td>
</tr>
</tbody>
</table>
</figure>
<p>I’ll explain Littel-Endian starting with a one byte diagram. The longer lines at the end of this frame are the boundaries of the byte so if you were drawing a group of adjacent bytes it would be clear where one byte left off and another began. The small lines divide the frame into individual locations where each of the eight bits can be shown. The medium line in the middle divides the byte into two equal four bit pieces which are the nibbles. Nibbles also have a long and varied history. I’ve never seen that they have been standardized. However the current well settled view is that nibbles are groups of four bits as I have shown them below. All of these lines only exist as people draw bytes. The lines don’t exist in the computer.</p>
</p>
<figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/12/organizing-those-1s-and-0s.png" alt="" class="wp-image-29764" /><figcaption>Byte Illustration</figcaption></figure>
<p>The Lower Nibble and Upper Nibble are labels as they would be used in a Little-Endian byte. In Little-Endian, the least significant digit is on the left end of a number. So the Lower Nibble is the least significant half of the number in the byte. Likewise the least significant bit is on the left LSBit (usually noted as LSB) stands for Least Significant Bit. and the most significant bit is on the right. The Upper Nibble on the right is the most significant half of the number. MSBit (usually noted as MSB) is the most significant bit. This is opposite to how we write decimal numbers with the most significant digit on the left. This is called Little-Endian because the “little end” of the number comes first.</p>
<p>With the byte being able to hold two hexadecimal digits, a byte can hold hexadecimal numbers between 00 and FF (0 to 255 in decimal) So if you are using bytes to represent the characters of a human readable language you just give each character, punctuation mark, etc. a number. (Then of course get everyone to agree with the coding you invented.) This is only one use for bytes. Bytes are also used as program code that your computer runs, numbers for various data you might have, and everything else that inhabits a computer in the CPU, memory, storage, or zooming around on the various buses and interface ports.</p>
<p>As it turns out there are two commonly used byte formats. Little-Endian has been used in the prior examples. Its feature is having the least significant digit on the left and the most significant digit on the right. If we were to write the decimal number 1620 in Little-Endian format it would be 0261.</p>
<p>There is also a byte format called Big-Endian. As you might expect it is opposite of Little-Endian with the most significant digit on the left and the least significant digit on the right. Like we write decimal numbers.</p>
<p>There are reasons for using both and the meaty reasons are beyond the scope of this article. However, Little-Endian tends to be used in microprocessors. The x86-64 processors in most PCs use the Little-Endian byte format. Though the later generations do have special instructions that provide limited use of Big-Endian format. The Big-Endian byte format is widely used in networking and notably in those big Z computers. Now you’re not necessarily limited to one or the other. The newer ARM processors can use either Endian format. Devices like microprocessors that can use both Big-Endian and Little Endian are sometimes referred to as Bi-Endian.</p>
<p>Well, sometimes you really need more than one byte to hold a number. To that end there are longer formats available that are composed of multiple bytes. For instance: The x86-64 processors Have Words which are 16 bits or 2 bytes that happen to be lined up next to each other head to tail, so to speak. They also have Double Words (32 bits or 4 bytes), and Quad Words (64 bits or 8 bytes). Now these are just examples of data forms made available by the processor hardware.</p>
<p>Programmers working with languages have many more ways to organize the bits and bytes. When the program is ready, a compiler or another mechanism converts the way that the program has bits and bytes organized into data forms that the CPU hardware can deal with.</p>
</div>


https://www.sickgaming.net/blog/2019/12/...1s-and-0s/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016