diff --git a/ivl_target.h b/ivl_target.h index bfee04b75..fc5a67679 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -1444,12 +1444,7 @@ extern const char*ivl_lpm_string(ivl_lpm_t net); * for the local part selecting I might to in the lval object, as * well as the target object width. * - * ivl_lval_mux - * If the l-value includes a bit select expression, this method - * returns an ivl_expr_t that represents that - * expression. Otherwise, it returns 0. - * - * (Should this be combined with ivl_lval_idx? -Ed) + * ivl_lval_mux (* obsolete *) * * ivl_lval_sig * If the l-value is a variable, this method returns the signal @@ -1492,7 +1487,7 @@ extern const char*ivl_lpm_string(ivl_lpm_t net); */ extern unsigned ivl_lval_width(ivl_lval_t net); -extern ivl_expr_t ivl_lval_mux(ivl_lval_t net); /* XXXX Obsolete? */ +extern ivl_expr_t ivl_lval_mux(ivl_lval_t net) __attribute__((deprecated)); /* XXXX Obsolete? */ extern ivl_expr_t ivl_lval_idx(ivl_lval_t net); extern ivl_expr_t ivl_lval_part_off(ivl_lval_t net); extern ivl_select_type_t ivl_lval_sel_type(ivl_lval_t net); diff --git a/t-dll-api.cc b/t-dll-api.cc index 27f431576..7597878aa 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1572,12 +1572,12 @@ extern "C" ivl_event_t ivl_lpm_trigger(ivl_lpm_t net) } } +/* + * Deprecated + */ extern "C" ivl_expr_t ivl_lval_mux(ivl_lval_t net) { - assert(net); - if (net->type_ == IVL_LVAL_MUX) - return net->idx; - return 0x0; + return 0; } extern "C" ivl_expr_t ivl_lval_idx(ivl_lval_t net) @@ -1618,8 +1618,6 @@ extern "C" ivl_signal_t ivl_lval_sig(ivl_lval_t net) assert(net); switch (net->type_) { case IVL_LVAL_REG: - case IVL_LVAL_NET: - case IVL_LVAL_MUX: case IVL_LVAL_ARR: return net->n.sig; default: @@ -2728,9 +2726,6 @@ extern "C" unsigned ivl_stmt_lwidth(ivl_statement_t net) for (unsigned idx = 0 ; idx < nlvals ; idx += 1) { ivl_lval_t cur = lvals + idx; switch(cur->type_) { - case IVL_LVAL_MUX: - sum += 1; - break; case IVL_LVAL_REG: case IVL_LVAL_ARR: sum += ivl_lval_width(cur); diff --git a/t-dll-proc.cc b/t-dll-proc.cc index fb2cffcca..1225a25f2 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -150,50 +150,59 @@ bool dll_target::make_assign_lvals_(const NetAssignBase*net) for (unsigned idx = 0 ; idx < cnt ; idx += 1) { struct ivl_lval_s*cur = stmt_cur_->u_.assign_.lval_ + idx; const NetAssign_*asn = net->l_val(idx); - const NetExpr*loff = asn->get_base(); + flag &= make_single_lval_(net, cur, asn); + } - if (loff == 0) { - cur->loff = 0; - cur->sel_type = IVL_SEL_OTHER; - } else { - loff->expr_scan(this); - cur->loff = expr_; - cur->sel_type = asn->select_type(); + return flag; +} + +bool dll_target::make_single_lval_(const LineInfo*li, struct ivl_lval_s*cur, const NetAssign_*asn) +{ + bool flag = true; + + const NetExpr*loff = asn->get_base(); + + if (loff == 0) { + cur->loff = 0; + cur->sel_type = IVL_SEL_OTHER; + } else { + loff->expr_scan(this); + cur->loff = expr_; + cur->sel_type = asn->select_type(); + expr_ = 0; + } + + cur->width_ = asn->lwidth(); + + if (asn->sig()) { + cur->type_ = IVL_LVAL_REG; + cur->n.sig = find_signal(des_, asn->sig()); + + cur->idx = 0; + // If there is a word select expression, it is + // really an array index. Note that the word index + // expression is already converted to canonical + // form by elaboration. + if (asn->word()) { + assert(expr_ == 0); + asn->word()->expr_scan(this); + cur->type_ = IVL_LVAL_ARR; + cur->idx = expr_; expr_ = 0; } - cur->width_ = asn->lwidth(); - - if (asn->sig()) { - cur->type_ = IVL_LVAL_REG; - cur->n.sig = find_signal(des_, asn->sig()); - - cur->idx = 0; - // If there is a word select expression, it is - // really an array index. Note that the word index - // expression is already converted to canonical - // form by elaboration. - if (asn->word()) { - assert(expr_ == 0); - asn->word()->expr_scan(this); - cur->type_ = IVL_LVAL_ARR; - cur->idx = expr_; - expr_ = 0; - } - - cur->property_idx = -1; - perm_string pname = asn->get_property(); - if (!pname.nil()) { - const netclass_t*use_type = dynamic_cast (cur->n.sig->net_type); - cur->property_idx = use_type->property_idx_from_name(pname); - } - - } else { - cerr << net->get_fileline() << ": internal error: " - << "I don't know how to handle nested l-values " - << "in ivl_target.h API." << endl; - flag = false; + cur->property_idx = -1; + perm_string pname = asn->get_property(); + if (!pname.nil()) { + const netclass_t*use_type = dynamic_cast (cur->n.sig->net_type); + cur->property_idx = use_type->property_idx_from_name(pname); } + + } else { + cerr << li->get_fileline() << ": internal error: " + << "I don't know how to handle nested l-values " + << "in ivl_target.h API." << endl; + flag = false; } return flag; diff --git a/t-dll.h b/t-dll.h index d2c958000..6bc2a9450 100644 --- a/t-dll.h +++ b/t-dll.h @@ -173,6 +173,7 @@ struct dll_target : public target_t, public expr_scan_t { void add_root(const NetScope *s); bool make_assign_lvals_(const NetAssignBase*net); + bool make_single_lval_(const LineInfo*li, struct ivl_lval_s*cur, const NetAssign_*asn); void sub_off_from_expr_(long); void mul_expr_by_const_(long); @@ -453,9 +454,6 @@ struct ivl_lpm_s { enum ivl_lval_type_t { IVL_LVAL_REG = 0, - IVL_LVAL_MUX = 1, - /* IVL_LVAL_MEM = 2, / Deprecated in favor of LVAL_ARR? */ - IVL_LVAL_NET = 3, /* Only force can have NET l-values */ IVL_LVAL_ARR = 4 }; @@ -468,7 +466,6 @@ struct ivl_lval_s { int property_idx; union { ivl_signal_t sig; - ivl_memory_t mem; } n; }; diff --git a/tgt-stub/statement.c b/tgt-stub/statement.c index 7e5204aa9..347cd120a 100644 --- a/tgt-stub/statement.c +++ b/tgt-stub/statement.c @@ -22,7 +22,7 @@ # include /* - * If the l-value signal is a darray object, then the ivl_lval_mux() + * If the l-value signal is a darray object, then the ivl_lval_idx() * gets you the array index expression. */ static unsigned show_assign_lval_darray(ivl_lval_t lval, unsigned ind) @@ -43,11 +43,6 @@ static unsigned show_assign_lval_darray(ivl_lval_t lval, unsigned ind) show_expression(ivl_lval_idx(lval), ind+6); } - if (ivl_lval_mux(lval)) { - fprintf(out, "%*sERROR: unexpected ivl_lval_mux() expression:\n", ind+4, ""); - stub_errors += 1; - show_expression(ivl_lval_mux(lval), ind+6); - } if (ivl_lval_part_off(lval)) { fprintf(out, "%*sERROR: unexpected Part select expression:\n", ind+4, ""); stub_errors += 1; @@ -116,10 +111,6 @@ static unsigned show_assign_lval(ivl_lval_t lval, unsigned ind) stub_errors += 1; } - if (ivl_lval_mux(lval)) { - fprintf(out, "%*sBit select expression:\n", ind+4, ""); - show_expression(ivl_lval_mux(lval), ind+8); - } if (ivl_lval_part_off(lval)) { fprintf(out, "%*sPart select base:\n", ind+4, ""); show_expression(ivl_lval_part_off(lval), ind+8); diff --git a/tgt-vvp/stmt_assign.c b/tgt-vvp/stmt_assign.c index e1a256c24..c890648f0 100644 --- a/tgt-vvp/stmt_assign.c +++ b/tgt-vvp/stmt_assign.c @@ -111,9 +111,6 @@ static void get_vec_from_lval_slice(ivl_lval_t lval, struct vec_slice_info*slice word_ix = 0; } - if (ivl_lval_mux(lval)) - part_off_ex = ivl_lval_mux(lval); - if (ivl_signal_dimensions(sig)==0 && part_off_ex==0 && word_ix==0 && part_off==0 && wid==ivl_signal_width(sig)) { @@ -353,9 +350,6 @@ static void set_vec_to_lval_slice(ivl_lval_t lval, unsigned bit, unsigned wid) word_ix = 0; } - if (ivl_lval_mux(lval)) - part_off_ex = ivl_lval_mux(lval); - if (part_off_ex && ivl_signal_dimensions(sig) == 0) { unsigned skip_set = transient_id++; @@ -757,7 +751,6 @@ static int show_stmt_assign_sig_string(ivl_statement_t net) assert(ivl_stmt_lvals(net) == 1); assert(ivl_stmt_opcode(net) == 0); - assert(ivl_lval_mux(lval) == 0); /* Simplest case: no mux. Evaluate the r-value as a string and store the result into the variable. Note that the @@ -885,7 +878,6 @@ static int show_stmt_assign_sig_darray(ivl_statement_t net) assert(ivl_stmt_lvals(net) == 1); assert(ivl_stmt_opcode(net) == 0); - assert(ivl_lval_mux(lval) == 0); assert(part == 0); if (mux && (ivl_type_base(element_type)==IVL_VT_REAL)) { diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index e4138f8cc..f9aca0528 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -235,9 +235,6 @@ static void assign_to_lvector(ivl_lval_t lval, unsigned bit, part_off_ex = 0; } - if (ivl_lval_mux(lval)) - part_off_ex = ivl_lval_mux(lval); - unsigned long low_d = delay % UINT64_C(0x100000000); unsigned long hig_d = delay / UINT64_C(0x100000000); @@ -985,7 +982,6 @@ static void force_vector_to_lval(ivl_statement_t net, struct vector_info rvec) } else { /* Do not support bit or part selects of l-values yet. */ - assert(ivl_lval_mux(lval) == 0); assert(ivl_lval_width(lval) == ivl_signal_width(lsig)); assert((roff + use_wid) <= rvec.wid); @@ -1208,7 +1204,6 @@ static int show_stmt_deassign(ivl_statement_t net) unsigned part_off; assert(lsig != 0); - assert(ivl_lval_mux(lval) == 0); use_wid = ivl_lval_width(lval); part_off_ex = ivl_lval_part_off(lval); @@ -1619,7 +1614,6 @@ static int show_stmt_release(ivl_statement_t net) unsigned part_off; assert(lsig != 0); - assert(ivl_lval_mux(lval) == 0); use_wid = ivl_lval_width(lval); part_off_ex = ivl_lval_part_off(lval);