18,363
社区成员




一般我们会分为两步来操作
封装为饱和截位
高饱操作:
d = ((c【27:24】== 4'b0000) || (c[27:24] == 4'b1111) ) ? c[24:0] : c[27] ? 25'h1000000 : 25'h0ffffff;
这个可能是在verilog上能做到的最好的方式了,但是不够完美
使用方式:
fixpoint (15,11,4,1,1) u_add1_fix (.din(fixin),.dout(fixout));
fixpoint (15,10,4,1,1) u_add2_fix (.din(fixin),.dout(fixout));
源码