开发者

Implementing ceil function in Xilinx

开发者 https://www.devze.com 2023-03-06 13:02 出处:网络
I would like to take the ceil of the signal in Simulink(Xilinx Library). So, if for instance, the signal value is 1.5, the output would be 2.

I would like to take the ceil of the signal in Simulink(Xilinx Library). So, if for instance, the signal value is 1.5, the output would be 2.

Any suggestion on how can I implement it in Simulink ?

Also, I am keen to understand the approach 开发者_Python百科how for instance floor,round function could be implemented as well.

Any blocks in xilinx library which does it ?

Thanks

Kiran


Not sure there's a block for it, but you could use an mcode block I think and put the Matlab ceil function in it.

Or you could build a block which uses Slice blocks to separate the integer and fractional parts and increment the integer part if the fractional part is not zero.

For rounding and flooring, the Cast block will round or truncate for you, you have to manage the output type yourself though.

0

精彩评论

暂无评论...
验证码 换一张
取 消