Fixed-point multiplication (C166 A*B/B)
| I want to multiply two fixed point numbers. After the multiplication I have to shift the result so that the binary point is correct. Example: int a; The multiplication a*b produces a long int value in the MD register. After the shift operation the int result (the lower byte) should be stored in c. |
|
|
Read-Only
Author
Andrew Neil Posted
22-Oct-2003 09:34 GMT Toolset
C166 |
I don't know the '166, but I suspect this is a 'C' issue rather than a processor issue. You could look up the promotion rules in K&R, or you could just try experimenting with casting a, b, and/or the product to long. |
|
Read-Only
Author
Mike Kleshov Posted
22-Oct-2003 09:56 GMT Toolset
C166 |
As Andrew said, this is a C issue. Take your favourite book on C and read about types and expressions. There are a few pitfalls there. - mike |
|
Read-Only
Author
Bruno Büsser Posted
22-Oct-2003 10:45 GMT Toolset
C166 |
That's it! The product a*b is stored as 32 bit value in MD register, then the MD register value is arithmetic shifted right by 10 and the lower 16 bits stored in c. |
http://www.keil.com/forum/3549/
Fixed-point multiplication (C166 A*B/B)的更多相关文章
- ADC In An FPGA
http://davidkessner.wordpress.com/2011/05/01/adc-in-an-fpga/ Geek Alert! What follows is very techn ...
- c166 -div
unsigned short a=10; unsigned short b; unsigned short c;unsigned long d; b = (unsigned short)(d/2400 ...
- Position属性四个值:static、fixed、relative、absolute的区别和用法
1.static(静态定位):默认值.没有定位,元素出现在正常的文档流中(如果设置 top, bottom, left, right, z-index这些属性就不起做作了). 2.relative(相 ...
- fixed数据类型
在处理图形运算,特别是3D图形生成运算时,往往要定义一个Fixed数据类型,我称它为定点数,定点数其时就是一个整形数据类型,他的作用就是把所有数 进行转换,从而得到相应类型的整型表达,然后使用定点数进 ...
- CSS:position:fixed使用(转)
position属性规定元素的定位类型,即建立元素布局所用的定位机制.任何元素都可以定位,不过绝对定位或固定定位元素会生成一个块级框,而不论该元素本身是什么类型.相对定位元素会相对于它在正常流中的默认 ...
- setprecision **fixed
#include <iostream> #include <iomanip> using namespace std; int main( void ) { const dou ...
- Position属性四个值:static、fixed、absolute和relative的区别和用法
Position属性四个值:static.fixed.absolute和relative的区别和用法 在用CSS+DIV进行布局的时候,一直对position的四个属性值relative,absolu ...
- iframe中positioin:fixed失效问题
页面中嵌套的iframe 内的 position:fixed元素定位失效fixed正常页面 此时position:fixed是根据浏览器窗口定位的,下拉一直位于左上角:以iframe形式嵌入后 此时p ...
- setprecision、fixed、showpoint的用法总结
首先要加头文件:iomanip 一:setprecision 作用:控制输出流显示浮点数的数字个数,setprecision(n)就是输出的n个数,会有四舍五入. 比如:double s=20.784 ...
随机推荐
- mysql的sql语句的性能诊断分析
1> explain SQL,类似于Oracle中explain语句 例如:explain select * from nad_aditem; 2> select benchmark(co ...
- CentOS 7部署Java+Mysql步骤
1.工具 putty0.7:用于远程控制服务器 winSCP5.13: ftp工具,用于向远程服务器传送文件 2.安装jdk: yum -y install java-1.8.0-openjdk ja ...
- TCP/IP协议的四个层及作用
- getHibernateTemplate().save(t)执行不成功,数据不能插入到数据库
BaseDaoImpl类中的代码如下 public void save(T t) {System.out.println(666);getHibernateTemplate().save(t); ...
- 2017ICPC南宁赛区网络赛 The Heaviest Non-decreasing Subsequence Problem (最长不下降子序列)
Let SSS be a sequence of integers s1s_{1}s1, s2s_{2}s2, ........., sns_{n}sn Each integer i ...
- 易混点总结--JS
1.defer与 async 的区别是: defer要等到整个页面在内存中正常渲染结束(DOM 结构完全生成,以及其他脚本执行完成),才会执行:async一旦下载完,渲染引擎就会中断渲染,执行这个脚本 ...
- 20165228 2017-2018-2 《Java程序设计》第2周学习总结
20165228 2017-2018-2 <Java程序设计>第2周学习总结 教材学习内容总结 标识符:名字 组成:字母/下划线/美元符号或数字 注意:标识符的第一个字符不能是数字字符,且 ...
- com.sun.org.apache.xerces.internal.impl.dv.util.Base64出现的问题
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; 出现的问题是这个在eclipse中无法使用,解决方法如下: (1)进入ec ...
- skearn/pandas
转: http://www.cnblogs.com/jasonfreak/p/5448385.html 1 特征工程是什么?2 数据预处理 2.1 无量纲化 2.1.1 标准化 2.1.2 区间缩放法 ...
- 为何linux(包括mac系统)执行指令要加上 ./ ??
比如,现在要在$HIVE_HOME/bin下执行hive指令来启动hive,则该指令的执行顺序如下所示: 1 先找PATH路径 1.1 如果PATH路径下配置了$HIVE_HOME/bin,无论PAT ...