ACT Library
Loading...
Searching...
No Matches
Macros
expr_width.h File Reference

This file contains a macro that is used to compute the bit-width of the result of two sub-expressions based on different combination modes. The bit-width rules for ACT expressions fall into one of the modes specified in this file. More...

Go to the source code of this file.

Macros

#define WIDTH_MAX   0
 set width to the max of lw, rw
 
#define WIDTH_MAX1   1
 set width to max of lw, rw + 1
 
#define WIDTH_SUM   2
 set width to sum of lw, rw
 
#define WIDTH_BOOL   3
 set width to 1
 
#define WIDTH_LEFT   4
 set width to lw
 
#define WIDTH_RIGHT   5
 set width to rw
 
#define WIDTH_LSHIFT   6
 set width to lw + 2^rw-1
 
#define MAX(a, b)   ((a) < (b) ? (b) : (a))
 
#define WIDTH_UPDATE(mode)
 

Detailed Description

This file contains a macro that is used to compute the bit-width of the result of two sub-expressions based on different combination modes. The bit-width rules for ACT expressions fall into one of the modes specified in this file.

Modes: 0 = max of lw. rw 1 = max of lw, rw + 1 2 = sum of lw, rw 3 = 1 (bool result) 4 = lw itself 5 = rw itself 6 = lw + (2^rw-1)

Macro Definition Documentation

◆ MAX

#define MAX (   a,
 
)    ((a) < (b) ? (b) : (a))

◆ WIDTH_BOOL

#define WIDTH_BOOL   3

set width to 1

◆ WIDTH_LEFT

#define WIDTH_LEFT   4

set width to lw

◆ WIDTH_LSHIFT

#define WIDTH_LSHIFT   6

set width to lw + 2^rw-1

◆ WIDTH_MAX

#define WIDTH_MAX   0

set width to the max of lw, rw

◆ WIDTH_MAX1

#define WIDTH_MAX1   1

set width to max of lw, rw + 1

◆ WIDTH_RIGHT

#define WIDTH_RIGHT   5

set width to rw

◆ WIDTH_SUM

#define WIDTH_SUM   2

set width to sum of lw, rw

◆ WIDTH_UPDATE

#define WIDTH_UPDATE (   mode)
Value:
if (width) { \
if (mode == WIDTH_MAX) { \
*width = MAX(lw,rw); \
} \
else if (mode == WIDTH_MAX1) { \
*width = MAX(lw,rw)+1; \
} \
else if (mode == WIDTH_SUM) { \
*width = lw+rw; \
} \
else if (mode == WIDTH_BOOL) { \
*width = 1; \
} \
else if (mode == WIDTH_LEFT) { \
*width = lw; \
} \
else if (mode == WIDTH_RIGHT) { \
*width = rw; \
} \
else if (mode == WIDTH_LSHIFT) { \
*width = lw + ((1 << rw)-1); \
} \
}
#define WIDTH_RIGHT
set width to rw
Definition: expr_width.h:51
#define WIDTH_SUM
set width to sum of lw, rw
Definition: expr_width.h:48
#define WIDTH_MAX
set width to the max of lw, rw
Definition: expr_width.h:46
#define WIDTH_LSHIFT
set width to lw + 2^rw-1
Definition: expr_width.h:52
#define WIDTH_BOOL
set width to 1
Definition: expr_width.h:49
#define WIDTH_MAX1
set width to max of lw, rw + 1
Definition: expr_width.h:47
#define WIDTH_LEFT
set width to lw
Definition: expr_width.h:50
#define MAX(a, b)
Definition: expr_width.h:55