|
发表于 2007-10-14 15:00:39
|
显示全部楼层
I just present my ideas, any other opinion, Pls discuss.
First, you must know the format of your operator, just to say, the amount of the integer and the fraction. The 4bit 1111, we can reckon it whole as integer.
Second, you have to pay attention to saturation and return-to-zero. Left shifter need saturation and right shifter need return-2-zero.
Third, Symbol-bit do not join shifting.
Your 1111 should be zero after shifting, so just define it as 0000. Before shifting, you should judge if the operator would beyond zero or under under zero after shifting. If the expected result will be under threshold, just force it to a constant.
For example, 1100 is -4, to shift right for two bits, it should be 1111, -1. |
|