MATLAB Answers

HDL Coder Error: BITAND/BITOR/BITXOR must have matching operand types

3 views (last 30 days)
I built a block diagram that I am trying to export to VHDL using the Simulink HDL Coder.
(right click -> HDL Code -> Generate HDL for Subsystem)
However, I get the following Error message in the report.html
Compilation errors when generating code for: simulink_dds_interpol/interpolation_1//2_compressed1/sin cos LUT 1//2 compressed1\LUT COS_half Error during MATLAB code compilation: Error Path: /shared/eda/lnx_exe/mathworks/mathworks_matlab_r2020b/toolbox/eml/lib/fixedpoint/@embedded/@fi/bitand.m Error Location: (@Row: --> 55 @Column: --> 27) BITAND/BITOR/BITXOR must have matching operand types. Internal Error: This error occurred inside a MathWorks function.
The error appears for the following XOR Block.
In my understanding, both the inputs and the output are boolean. Same Datatype. So what is the operand type then?


Sign in to comment.

Accepted Answer

Kiran Kintali
Kiran Kintali on 30 Nov 2020
HDL Coder team believes this issue has been resolved in the latest releases. Can you share a sample model? We can double check and confirm this and provide a workaround if possible. Feel free to reach out to
Output type of Ufix1_E5 or Ufix1_E4 looks suspicious and one would expect ufix1 in the case. Not knowing the full context here but accessing MSB or a bit in the word should result in Ufix1 type. Please check the extract bit block output type settings if this something that may need to be addressed independently. You may also consider BitSlice block to access a bit or set of bits.

  1 Comment

Simon Burkhardt
Simon Burkhardt on 4 Dec 2020
I contacted MATHWORKS support, which was able to resolve the issue:
"The second issue concerns an internal error for bitand operations that results from the code generation of a Lookup Table n-D Block. The issue is that the input type to the Block is ufix5, but the break point type is specified to be uint32. A bitand operation is being done on these types in the background and they are not matching. This is an actual issue from our side and we are currently working on resolving it. An easy fix is to change the breakpoint data type setting from "Inherit: Inherit from 'Breakpoint data" to "Inherit""

Sign in to comment.

More Answers (0)



Community Treasure Hunt

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

Start Hunting!