Fixed point conversions Have following questions about Fixed point conversion format.


Suppose I want to change Fixed Point format as  

X1(m1,n1) (→) X2(m2,n2),m1+n1=m2+n2[Word length same],  n2>n1[ Higher Fractionlength] 

Suppose  X1=00001100 and suppose I do X1&lt;&lt;(2^3)  

Q1)  If I interpret X1 as pure Signed integer, then X1= 12 and above operation means
 Multiply by 2^(n2-n1)=8 so that X2= 01100000 = 96. (Decimal point is irrelevant here?). Is the interpretation correct?
  or
 Assuming Fixed point  notation, above means
 X1(m1,n1) (→) X2(m1-K,n1+k),m1+n1=m2+n2[Word length same],  n2>n1[ Higher Fractionlength]  and k=n2-n1
  For given example, this means X1(3,5)=000.011 00(0.375)(→) X2(0,8)=  .01100000=0.375
  So, the value remained same.  

Q2) Can we always interpret this as decimal point being fixed and bits moved left?Is this a logical shift or arithmatic shift? 

Q3) Ideally, we would like to preserve resolution and range covered. Under what condition would this be guaranteed for the above shift? for example, consider following conversions:  


Consider  X1(3,5)=101.011 00(5.375)(→) X2(0,8) is 101.01100&lt;&lt;3 = .01100000 =0.375.So, we have error.
   Q4) Is this rounding or truncation and why?  

Consider  X1(m1n1) = 000...0 . abc......z  , [m1 = all zeroes],  X1 &lt;&lt; k = X1(m1-k,m1+k) where k&lt;=m1
            would  not change the value, as bits to the left and right  of decimal point remain same   

Q5) So, if fixed point fractional notation is assumed( Positive fraction, with magnitude &lt;1), Left shifts smaller than integer word length would preserve the fractional value?


Suppose I have fixed point number X1(m1,n1) with Word length m1+n1. Suppose  I want to express
it in X2(m2,n2) format so that Word length is reduced ,Fraction length is increased, Integer Word length reduced    but the value remains the same.For example:
X1(3,5) = 000.01100(0.375) -> X2(1,6)
Steps for above could be:

Left shift by n2-n1 bits so that 000 011 00 &lt;&lt;1 = 000 110 00

Keep Least Significant m2+n2 bits so that X2 = 0.011000(0.375) or Keep Most Significant m2+n2 bits so that X2 = 0.001100(0.1875)   

Q6) If I was writing a routine that would automatically do conversion, )(say this was Sum result that needed to be converted to output (m2.n2) format automatically), how are what decides whether I keep LS or MS bits or doing a left or right shift?  
Suppose I have fixed point number X1(m1,n1) with Word length m1+n1. Suppose  I want to express  it in X2(m2,n2) format so that Word length is increased ,Fraction length is increased but the value remains the same.For example:
 X1(3,5) = 100.01100(-3.625) -> X2(3,13)
and  X1(3.5) = 100.01100(-3.635) -> X2(1,11)   

Q7) How can I go about that?  What would be steps if result required increase in Word length and Integer Word Length?  
Suppose I need to convert Fixed Point number as per
X1(m+1,n) (→) X2(m,n)[ Word length reduced, Fraction length same, integer Word length reduced] 

One of the references I found says do following :
  (x1)&amp;(0xff..e) and keep MS m2+n2 bits
  With X1(1,4) = 0.1011(0.875) this becomes 0.101 = 0.75  

Other says: Do left shift by 1 and Keep Ms m2+n2 bits
With X1(1,4) = 1.011(0.875) this becomes 1.011(0.625)  

Obviously, i don't perverse the value.
Q8) Is there a correct way to do it and the logic behind it?   


I know these are lot of questions but it will help me clear lot of confusing stuff.
Thanks
sedy
As mentioned in the comments, your question is pretty confusing and confused, so I might not be able to answer all your smaller questions, but I'll try to shed some light on the topic. This should help you understand what's going on, and hopefully this understanding will help you answer all further questions by yourself.

In the following I assume two's complement representation. Note that if $M$ is the word length, and $n$ is the number of fractional bits, a number $x$ is represented as

$$x=K\cdot 2^{-n}\tag{1}$$

where $K$ is an integer is the range $[-2^{M-1},2^{M-1}-1]$. Now if you want to change the number of fractional bits to $m$, you have

$$x=L\cdot 2^{-m}\tag{2}$$

Combining (1) and (2) gives

$$L=K\cdot 2^{m-n}\tag{3}$$

If $m&gt;n$, $K$ needs to be left-shifted by $m-n$ bits to obtain $L$. This means that you lose range (i.e. the maximum number that can be represented becomes smaller), so there is a possibility of overflow. If $m&lt;n$, $L$ is obtained from $K$ by right-shifting $n-m$ bits, but for two's complement you need to replicate the sign bit, i.e. if the original sign bit was set, the new right-shifted number must also have the sign bit set. For $m&lt;n$ you can lose precision because the resolution is reduced.

An example makes things easier to see. Let $M=6$, i.e. the integer $K$ is in the range $[-32,31]$. Let the number of fractional bits be $n=3$. E.g.

$$x=\texttt{101.011}=(-2^{5}+2^{3}+2^{1}+2^{0})\cdot 2^{-3}=-21\cdot 2^{-3}=-2.625$$

If we want to change the number of fractional bits to $m=2$, you need to do an arithmetic right-shift, resulting in

$$y=\texttt{1101.01}=-11\cdot 2^{-2}=-2.75\neq x$$

i.e. precision is lost. If instead we want $m=4$ fractional bits we need to do a left-shift resulting in overflow:

$$y=\texttt{01.0110}=22\cdot 2^{-4}=1.375\neq x$$

This is clear because by increasing resolution we have decreased the range of possible numbers to $[-32,31]\cdot 2^{-4}=[-2,1.9375]$, which makes it impossible to represent the original value $x=-2.625$.

There are of course examples where you would neither lose precision nor would you get overflow. E.g. (again with $M=6$ and $n=3$)

$$x=\texttt{001.010}=10\cdot 2^{-3}=1.25$$

For $m=2$ we get

$$y=\texttt{0001.01}=5\cdot 2^{-2}=1.25 = x$$

i.e. no loss in precision, and for $m=4$ we get

$$y=\texttt{01.0100}=20\cdot 2^{-4}=1.25=x$$

i.e. no overflow.

I hope that this addressed at least some of your questions and that things have become a bit clearer. If you haven't done it yet, you should check out the basics here, here, and here.