Remainder of a division operation in System Generator

조회 수: 4 (최근 30일)
SUHANYA M S
SUHANYA M S 2023년 1월 20일
댓글: SUHANYA M S 2023년 1월 30일
I have an integrator which gives the running value of angle theta. To find the sine/cosine of this angle using the SysGen ROM block, the value of theta is always required to be within the range 0-360, which can be obtained by finding the remainder of division of theta by 360.
As there is no direct block that gives the remainder after division operation in SysGen blockset, please suggest a way to do this.
Thanks!

채택된 답변

Andy Bartlett
Andy Bartlett 2023년 1월 23일
Consider restructuring your design to work in units of revolutions instead of in degrees. In that case you only need to perform modulo 1 which is nothing more that dropping the bits to the left of the binary-point.
FYI: when modeling with Simulink blocks instead of System Generator Blocks, Fixed-Point Designer's Modulo by Constant block can be used. It is design to give optimal handling of modulo by constants like 360, 2*pi, etc. But modulo of 1 revolution will still lead to the most efficient implementation.
  댓글 수: 4
Andy Bartlett
Andy Bartlett 2023년 1월 25일
Hi Suhanya,
As I noted in the your other posting.
Please reach out to the tech support team from AMD (Xilinix) for their System Generator product.
I'd like to be more helpful, but the details are specific to these AMD blocks and will require the AMD tech support or development team to explain.
Regards
Andy
SUHANYA M S
SUHANYA M S 2023년 1월 30일
WIll do that. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bharath Venkataraman
Bharath Venkataraman 2023년 1월 20일
When you say "running value", what is the range of the update value? If the initial value can be set to the proper range of 0 to 360 and the update value is limited such that the accumulated value will be less than 720 degreees, you may be able to use an adder to add the value followed by a subtractor of added value-360. Then you can choose between those values to stay between 0 and 360 all the time.
So if you current value is 300 and you add in 75 degrees, you will end up with 375 out of the adder and 15 out of the subtractor. Seeing that 15 is a positive value (or knowing that 375 is greater than 360), you pick the subtractor output. Otherwise, you would pick the adder output. Whichever value you pick needs to be the next value used for the accumulation.
  댓글 수: 4
Bharath Venkataraman
Bharath Venkataraman 2023년 1월 25일
편집: Bharath Venkataraman 2023년 1월 26일
For your case where the value range is not restricted, the above option I proposed will not help. You can try Andy's approach using the Modulo block in Fixed-Point Designer.
For Sysgen specific approaches, I suggest reaching out to Xilinx support.
SUHANYA M S
SUHANYA M S 2023년 1월 30일
WIll do that. Thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fixed-Point Designer에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by