AR# 45780

AutoESL - Syntax error issued while the code passes non-AutoESL compilers for code containing #define

Description

Define variables before including libraries such ap_int or ap_private can cause syntax errors.

For example:

// wrong place to define N
#define N 42
#include <ap_int.h>
// good place to define N
//#define N 42
void define_N(ap_int<10> *a, ap_int<11> b) {
*a = b + N;
}

When "N" is declared before ap_int, following errors will be issued.
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h:1687:33: error: expected ','
or '...' before numeric constant
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h:2782:33: error: expected ','
or '...' before numeric constant
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h: In function 'bool
llvm::ap_private_ops::isIntN(uint32_t)':
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h:2783:16: error: 'APIVal' was
not declared in this scope
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h: At global scope:
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h:3154:29: error: expected ','
or '...' before numeric constant
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h: In function 'bool
llvm::isIntN(uint32_t)':
c:/Xilinx/2011.4/AutoESL/include/etc/ap_private.h:3155:12: error: 'APIVal' was
not declared in this scope {0} Field Help

Solution

For the AutoESL tool versions 2011.4.2 and prior, define N after including ap_int.

This issue is resolved in AutoESL 2012.1.

AR# 45780
Date 09/09/2014
Status Active
Type Known Issues
Tools