Attachment 'OnseComplement.tex'

Download

   1 \documentclass[]{article}
   2 
   3 \title{One's Complement}
   4 \author{}
   5 
   6 \begin{document}
   7 
   8 \maketitle
   9 
  10 Given an $n-$bit binary string, $I$, the leftmost bit indicates the sign of an integer in $1$s complement representation. In this left most position a $1$ indicates a negative value while a $0$ indicates a positive value. The representation for positive integers corresponds to unsigned representation where the leftmost bit must contain a $0$.
  11 
  12 Negative integers are formed by reversing all bits to form the bitwise complement of the corresponding positive integer. If we represent $I$ by the $n-$bit binary sequence, $b_{n} \ldots b_1 $ then $-I$ in one's complement is given by $\overline{b_n } \ldots \overline{b_1}$ where $\overline{b_i}=1-b_i$ for all $i$.\bigskip
  13 
  14 \noindent\textbf{Let's see what that looks like in Math speak}\bigskip
  15 
  16 Let $I$ be a negative one's complement integer. The value of $I$ is obtained by forming its one's complement:
  17 \begin{equation}
  18 -I = \sum_{i=0}^{n-1}(1-b_i)\cdot2^i = \sum_{i=0}^{n-1}2^i - \sum_{i=0}^{n-1} b_i \cdot 2^i.
  19 \end{equation}
  20 Thus,
  21 
  22 \begin{equation}
  23 I = \sum_{i=0}^{n-1}b_i \cdot 2^i - (2^n - 1).
  24 \end{equation}
  25 
  26 Negative one's complement integers are formed by subtracting a bias of $2^n - 1$ from the positive integers. Taking into account the sign bit $bn$, the value for a positive or negative (n+1) bit one's complement integer is:
  27 \begin{equation}
  28 I = \sum_{i=0}^{n-1}b_i \cdot 2^i - b_n (2^n - 1).
  29 \end{equation}
  30 
  31 Recalling that the left most bit only represents the sign, the range of values for an $n-$bit one's complement integer is $-(2^{n-1}-1)$ to $2^{n-1}-1$.\bigskip
  32 
  33 \noindent\textbf{Examples:}\bigskip
  34 
  35 Since the complement of $0$ is $2^{n+1}-1$, there are different representations for $+0$ and $-0$ in one's complement. Examples of $8$-bit one's complement numbers:
  36 \[
  37 \begin{array}{cr}
  38 Binary & Decimal \\
  39 00000000 & 0 \\
  40 11111111 & -0 \\
  41 00000011 & 3 \\
  42 11111100 & -3 \\
  43 \end{array}
  44 \]
  45 
  46 The range of $8-$bit one's complement integers is $-127$ to $+127$.
  47 
  48 Addition of signed numbers in one's complement is performed using binary addition with end-around carry. If there is a carry out of the most significant bit of the sum, this bit must be added to the least significant bit of the sum.
  49 
  50 To add decimal 17 to decimal -8 in 8-bit one's complement:\bigskip
  51 \begin{center}
  52 	\begin{tabular}{rrrrrr}
  53 		&  & $0001$ & $0001$ &  & $(17)$ \\
  54 		$+$ &  & $1111$ & $0111$ &  & $(-8)$ \\ \cline{1-4}\cline{6-6}
  55 		& $1$ & $0000$ & $1000$ &  &  \\
  56 		&  & \multicolumn{1}{l}{$\hookrightarrow $} & $+1$ &  &  \\ \cline{3-4}
  57 		&  & $0000$ & $1001$ & $=$ & $(9)$%
  58 	\end{tabular}
  59 \end{center}
  60 
  61 \end{document}

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2020-01-26 22:57:39, 103.3 KB) [[attachment:OnseComplement.pdf]]
  • [get | view] (2020-01-26 22:57:34, 2.7 KB) [[attachment:OnseComplement.tex]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.