Expression cast handles size if need be.

This commit is contained in:
Stephen Williams 2014-12-02 16:54:32 -08:00
parent 35db02d35d
commit 3bd307db85
3 changed files with 43 additions and 4 deletions

View File

@ -1129,6 +1129,12 @@ static void draw_unary_vec4(ivl_expr_t expr)
{
ivl_expr_t sub = ivl_expr_oper1(expr);
if (debug_draw) {
fprintf(vvp_out, " ; %s:%u:draw_unary_vec4: opcode=%c\n",
ivl_expr_file(expr), ivl_expr_lineno(expr),
ivl_expr_opcode(expr));
}
switch (ivl_expr_opcode(expr)) {
case '&':
draw_eval_vec4(sub);
@ -1226,6 +1232,7 @@ static void draw_unary_vec4(ivl_expr_t expr)
break;
case IVL_VT_BOOL:
draw_eval_vec4(sub);
resize_vec4_wid(sub, ivl_expr_width(expr));
break;
case IVL_VT_REAL:
draw_eval_real(sub);
@ -1245,6 +1252,12 @@ static void draw_unary_vec4(ivl_expr_t expr)
void draw_eval_vec4(ivl_expr_t expr)
{
if (debug_draw) {
fprintf(vvp_out, " ; %s:%u:draw_eval_vec4: expr_type=%d\n",
ivl_expr_file(expr), ivl_expr_lineno(expr),
ivl_expr_type(expr));
}
switch (ivl_expr_type(expr)) {
case IVL_EX_BINARY:
draw_binary_vec4(expr);

View File

@ -48,6 +48,8 @@ FILE*vvp_out = 0;
int vvp_errors = 0;
unsigned show_file_line = 0;
int debug_draw = 0;
# define FLAGS_COUNT 256
static uint32_t allocate_flag_mask[FLAGS_COUNT / 32] = { 0x000000ff, 0 };
@ -118,6 +120,28 @@ void clr_flag(int idx)
allocate_flag_mask[word] &= ~mask;
}
static void process_debug_string(const char*debug_string)
{
const char*cp = debug_string;
debug_draw = 0;
while (*cp) {
const char*tail = strchr(cp, ',');
if (tail == 0)
tail = cp + strlen(cp);
size_t len = tail - cp;
if (len == 4 && strncmp(cp,"draw", 4)==0) {
debug_draw = 1;
}
while (*tail == ',')
tail += 1;
cp = tail;
}
}
int target_design(ivl_design_t des)
{
@ -132,6 +156,9 @@ int target_design(ivl_design_t des)
* The default is no file/line information will be included. */
const char*fileline = ivl_design_flag(des, "fileline");
const char*debug_flags = ivl_design_flag(des, "debug_flags");
process_debug_string(debug_flags);
assert(path);
/* Check to see if file/line information should be included. */

View File

@ -28,6 +28,8 @@
#endif
extern int debug_draw;
/*
* The target_design entry opens the output file that receives the
* compiled design, and sets the vvp_out to the descriptor.
@ -109,10 +111,7 @@ extern void draw_ufunc_vec4(ivl_expr_t expr);
extern void draw_ufunc_real(ivl_expr_t expr);
extern void draw_ufunc_string(ivl_expr_t expr);
extern void draw_ufunc_object(ivl_expr_t expr);
#if 0
extern void pad_expr_in_place(ivl_expr_t expr, struct vector_info res,
unsigned swid);
#endif
extern char* process_octal_codes(const char*txt, unsigned wid);
/*