From 3bd307db85c95fdbc9e25a7ca23d0ce46584ee06 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Tue, 2 Dec 2014 16:54:32 -0800 Subject: [PATCH] Expression cast handles size if need be. --- tgt-vvp/eval_vec4.c | 13 +++++++++++++ tgt-vvp/vvp.c | 27 +++++++++++++++++++++++++++ tgt-vvp/vvp_priv.h | 7 +++---- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/tgt-vvp/eval_vec4.c b/tgt-vvp/eval_vec4.c index bf7eb6d30..ac3c974b0 100644 --- a/tgt-vvp/eval_vec4.c +++ b/tgt-vvp/eval_vec4.c @@ -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); diff --git a/tgt-vvp/vvp.c b/tgt-vvp/vvp.c index 519fa3879..55920f325 100644 --- a/tgt-vvp/vvp.c +++ b/tgt-vvp/vvp.c @@ -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. */ diff --git a/tgt-vvp/vvp_priv.h b/tgt-vvp/vvp_priv.h index 9f49d81a2..7f0fbac77 100644 --- a/tgt-vvp/vvp_priv.h +++ b/tgt-vvp/vvp_priv.h @@ -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); /*