Contains all functions for vsignal/expression binding. More...
#include "defines.h"
Go to the source code of this file.
Functions | |
void | bind_add (int type, const char *name, expression *exp, func_unit *funit) |
Adds vsignal and expression to binding list. | |
void | bind_append_fsm_expr (expression *fsm_exp, const expression *exp, const func_unit *curr_funit) |
Appends an FSM expression to a matching expression binding structure. | |
void | bind_remove (int id, bool clear_assigned) |
Removes the expression with ID of id from binding list. | |
char * | bind_find_sig_name (const expression *exp) |
Searches current binding list for the signal name associated with the given expression. | |
void | bind_rm_stmt (int id) |
Removes the statement block associated with the expression with ID of id after binding has occurred. | |
bool | bind_signal (char *name, expression *exp, func_unit *funit_exp, bool fsm_bind, bool cdd_reading, bool clear_assigned, int exp_line, bool bind_locally) |
Binds a signal to an expression. | |
void | bind_perform (bool cdd_reading, int pass) |
Performs vsignal/expression bind (performed after parse completed). | |
void | bind_dealloc () |
Deallocates memory used for binding. |
Contains all functions for vsignal/expression binding.
void bind_add | ( | int | type, | |
const char * | name, | |||
expression * | exp, | |||
func_unit * | funit | |||
) |
Adds vsignal and expression to binding list.
Adds the specified signal/function/task and expression to the bindings linked list. This bindings list will be handled after all input Verilog has been parsed.
type | Type of thing being bound with the specified expression (0=signal, 1=functional unit) | |
name | Signal/Function/Task scope to bind | |
exp | Expression ID to bind | |
funit | Pointer to module containing specified expression |
References exp_bind_s::clear_assigned, exp_bind_s::exp, exp_bind_s::fsm, exp_bind_s::funit, expression_s::line, exp_bind_s::line, malloc_safe, exp_bind_s::name, exp_bind_s::next, PROFILE, PROFILE_END, strdup_safe, and exp_bind_s::type.
Referenced by bind_task_function_ports(), db_bind_expr_tree(), db_create_expression(), expression_db_read(), gen_item_resolve(), and static_expr_gen().
00124 { PROFILE(BIND_ADD); 00125 00126 exp_bind* eb; /* Temporary pointer to signal/expressing binding */ 00127 00128 assert( exp != NULL ); 00129 00130 /* Create new signal/expression binding */ 00131 eb = (exp_bind *)malloc_safe( sizeof( exp_bind ) ); 00132 eb->type = type; 00133 eb->name = strdup_safe( name ); 00134 eb->clear_assigned = 0; 00135 eb->line = exp->line; 00136 eb->funit = funit; 00137 eb->exp = exp; 00138 eb->fsm = NULL; 00139 eb->next = NULL; 00140 00141 /* Add new signal/expression binding to linked list */ 00142 if( eb_head == NULL ) { 00143 eb_head = eb_tail = eb; 00144 } else { 00145 eb_tail->next = eb; 00146 eb_tail = eb; 00147 } 00148 00149 PROFILE_END; 00150 00151 }
void bind_append_fsm_expr | ( | expression * | fsm_exp, | |
const expression * | exp, | |||
const func_unit * | curr_funit | |||
) |
Appends an FSM expression to a matching expression binding structure.
Searches the expression binding list for the entry that matches the given exp and curr_funit parameters. When the entry is found, the FSM expression is added to the exp_bind structure to be sized when the expression is bound.
fsm_exp | Expression pertaining to an FSM input state that needs to be sized when its associated expression is bound to its signal | |
exp | Expression to match | |
curr_funit | Functional unit that the FSM expression resides in (this will be the same functional unit as the expression functional unit) |
References exp_bind_s::exp, exp_bind_s::fsm, exp_bind_s::funit, exp_bind_s::next, PROFILE, and PROFILE_END.
Referenced by fsm_db_read().
00164 { PROFILE(BIND_APPEND_FSM_EXPR); 00165 00166 exp_bind* curr; 00167 00168 curr = eb_head; 00169 while( (curr != NULL) && ((exp != curr->exp) || (curr_funit != curr->funit)) ) { 00170 curr = curr->next; 00171 } 00172 00173 assert( curr != NULL ); 00174 00175 curr->fsm = fsm_exp; 00176 00177 PROFILE_END; 00178 00179 }
void bind_dealloc | ( | ) |
Deallocates memory used for binding.
Deallocates all memory used for the storage of the binding list.
References free_safe, exp_bind_s::name, exp_bind_s::next, PROFILE, and PROFILE_END.
Referenced by db_close().
00918 { PROFILE(BIND_DEALLOC); 00919 00920 exp_bind* tmp; /* Temporary binding pointer */ 00921 00922 while( eb_head != NULL ) { 00923 00924 tmp = eb_head; 00925 eb_head = tmp->next; 00926 00927 /* Deallocate the name, if specified */ 00928 if( tmp->name != NULL ) { 00929 free_safe( tmp->name, (strlen( tmp->name ) + 1) ); 00930 } 00931 00932 /* Deallocate this structure */ 00933 free_safe( tmp, sizeof( exp_bind ) ); 00934 00935 } 00936 00937 /* Reset the head and tail pointers */ 00938 eb_head = eb_tail = NULL; 00939 00940 PROFILE_END; 00941 00942 }
char* bind_find_sig_name | ( | const expression * | exp | ) |
Searches current binding list for the signal name associated with the given expression.
exp | Pointer to expression to search for |
References exp_bind_s::exp, free_safe, exp_bind_s::funit, funit_get_curr_module_safe(), malloc_safe, func_unit_s::name, exp_bind_s::name, exp_bind_s::next, PROFILE, PROFILE_END, scope_extract_front(), scope_find_signal(), and strdup_safe.
Referenced by expression_find_rhs_sigs().
00296 { PROFILE(BIND_FIND_SIG_NAME); 00297 00298 exp_bind* curr; /* Pointer to current exp_bind link */ 00299 vsignal* found_sig; /* Placeholder */ 00300 func_unit* found_funit; /* Specifies the functional unit containing this signal */ 00301 char* name = NULL; /* Specifies the signal name relative to its parent module */ 00302 char* front; /* Front part of functional unit hierarchy */ 00303 char* rest; /* Rest of functional unit hierarchy (minus front) */ 00304 00305 /* Find matching binding element that matches the given expression */ 00306 curr = eb_head; 00307 while( (curr != NULL) && (curr->exp != exp) ) { 00308 curr = curr->next; 00309 } 00310 00311 /* 00312 If we found the matching expression, find the signal and construct its hierarchical pathname 00313 relative to its parent module. 00314 */ 00315 if( curr != NULL ) { 00316 if( scope_find_signal( curr->name, curr->funit, &found_sig, &found_funit, -1 ) ) { 00317 if( funit_get_curr_module_safe( curr->funit ) == funit_get_curr_module_safe( found_funit ) ) { 00318 front = strdup_safe( found_funit->name ); 00319 rest = strdup_safe( found_funit->name ); 00320 scope_extract_front( found_funit->name, front, rest ); 00321 if( rest[0] != '\0' ) { 00322 unsigned int sig_size = strlen( curr->name ) + strlen( rest ) + 2; 00323 unsigned int rv; 00324 name = (char*)malloc_safe( sig_size ); 00325 rv = snprintf( name, sig_size, "%s.%s", rest, curr->name ); 00326 assert( rv < sig_size ); 00327 } 00328 free_safe( front, (strlen( found_funit->name ) + 1) ); 00329 free_safe( rest, (strlen( found_funit->name ) + 1) ); 00330 } 00331 } 00332 if( name == NULL ) { 00333 name = strdup_safe( curr->name ); 00334 } 00335 } 00336 00337 PROFILE_END; 00338 00339 return( name ); 00340 00341 }
void bind_perform | ( | bool | cdd_reading, | |
int | pass | |||
) |
Performs vsignal/expression bind (performed after parse completed).
anonymous | Throw param_resolve bind_signal generate_resolve bind_task_function_namedblock bind_task_function_namedblock |
In the process of binding, we go through each element of the binding list, finding the signal to be bound in the specified tree, adding the expression to the signal's expression pointer list, and setting the expression vector pointer to point to the signal vector.
cdd_reading | Set to TRUE if we are binding after reading the CDD file; otherwise, set to FALSE | |
pass | Specifies the starting pass to perform (setting this to 1 will bypass resolutions) |
References bind_param(), bind_remove(), bind_signal(), bind_task_function_namedblock(), Catch_anonymous, exp_bind_s::clear_assigned, curr_db, DEBUG, debug_mode, exp_bind_s::exp, expression_get_root_statement(), FALSE, func_unit_s::filename, free_safe, exp_bind_s::fsm, exp_bind_s::funit, FUNIT_NAMED_BLOCK, FUNIT_TASK, expression_s::id, inst_link_s::inst, db_s::inst_head, instance_resolve(), expression_s::line, exp_bind_s::line, exp_bind_s::name, expression_s::name, inst_link_s::next, exp_bind_s::next, obf_file, print_output(), PROFILE, PROFILE_END, stmt_blk_add_to_remove_list(), strdup_safe, Throw, TRUE, Try, exp_bind_s::type, user_msg, USER_MSG_LENGTH, expression_s::value, VDATA_UL, vector_create(), VTYPE_EXP, and vector_s::width.
Referenced by command_exclude(), command_merge(), command_report(), covered_sim_calltf(), parse_and_score_dumpfile(), parse_design(), rank_read_cdd(), and report_read_cdd_and_ready().
00785 { PROFILE(BIND_PERFORM); 00786 00787 exp_bind* curr_eb; /* Pointer to current expression bind structure */ 00788 int id; /* Current expression id -- used for removal */ 00789 bool bound; /* Specifies if the current expression was successfully bound or not */ 00790 statement* tmp_stmt; /* Pointer to temporary statement */ 00791 00792 Try { 00793 00794 /* Make three passes through binding list, 0=local signal/param bindings, 1=remote signal/param bindings */ 00795 for( ; pass<2; pass++ ) { 00796 00797 curr_eb = eb_head; 00798 while( curr_eb != NULL ) { 00799 00800 /* Figure out ID to clear from the binding list after the bind occurs */ 00801 if( curr_eb->clear_assigned == 0 ) { 00802 id = curr_eb->exp->id; 00803 } else { 00804 id = curr_eb->clear_assigned; 00805 } 00806 00807 /* If the expression has already been bound, do not attempt to do it again */ 00808 if( (curr_eb->exp != NULL) && (curr_eb->exp->name != NULL) ) { 00809 00810 bound = TRUE; 00811 00812 } else { 00813 00814 /* Handle signal/parameter binding */ 00815 if( curr_eb->type == 0 ) { 00816 00817 /* Attempt to bind the expression to a parameter; otherwise, bind to a signal */ 00818 if( !(bound = bind_param( curr_eb->name, curr_eb->exp, curr_eb->funit, curr_eb->line, (pass == 0) )) ) { 00819 bound = bind_signal( curr_eb->name, curr_eb->exp, curr_eb->funit, FALSE, cdd_reading, 00820 (curr_eb->clear_assigned > 0), curr_eb->line, (pass == 0) ); 00821 } 00822 00823 /* If an FSM expression is attached, size it now */ 00824 if( curr_eb->fsm != NULL ) { 00825 assert( curr_eb->exp != NULL ); 00826 curr_eb->fsm->value = vector_create( curr_eb->exp->value->width, VTYPE_EXP, VDATA_UL, TRUE ); 00827 } 00828 00829 /* Otherwise, handle disable binding */ 00830 } else if( curr_eb->type == 1 ) { 00831 00832 /* Attempt to bind a named block -- if unsuccessful, attempt to bind with a task */ 00833 if( !(bound = bind_task_function_namedblock( FUNIT_NAMED_BLOCK, curr_eb->name, curr_eb->exp, curr_eb->funit, 00834 cdd_reading, curr_eb->line, (pass == 0) )) ) { 00835 bound = bind_task_function_namedblock( FUNIT_TASK, curr_eb->name, curr_eb->exp, curr_eb->funit, 00836 cdd_reading, curr_eb->line, (pass == 0) ); 00837 } 00838 00839 /* Otherwise, handle function/task binding */ 00840 } else { 00841 00842 /* 00843 Bind the expression to the task/function. If it is unsuccessful, we need to remove the statement 00844 that this expression is a part of. 00845 */ 00846 bound = bind_task_function_namedblock( curr_eb->type, curr_eb->name, curr_eb->exp, curr_eb->funit, 00847 cdd_reading, curr_eb->line, (pass == 0) ); 00848 00849 } 00850 00851 /* If we have bound successfully, copy the name of this exp_bind to the expression */ 00852 if( bound && (curr_eb->exp != NULL) ) { 00853 curr_eb->exp->name = strdup_safe( curr_eb->name ); 00854 } 00855 00856 } 00857 00858 /* 00859 If the expression was unable to be bound, put its statement block in a list to be removed after 00860 binding has been completed. 00861 */ 00862 if( !bound && (curr_eb->clear_assigned == 0) && (pass == 1) ) { 00863 if( (tmp_stmt = expression_get_root_statement( curr_eb->exp )) != NULL ) { 00864 #ifdef DEBUG_MODE 00865 if( debug_mode ) { 00866 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Removing statement block containing line %d in file \"%s\", because it was unbindable", 00867 curr_eb->exp->line, obf_file( curr_eb->funit->filename ) ); 00868 assert( rv < USER_MSG_LENGTH ); 00869 print_output( user_msg, DEBUG, __FILE__, __LINE__ ); 00870 } 00871 #endif 00872 stmt_blk_add_to_remove_list( tmp_stmt ); 00873 } 00874 } 00875 00876 curr_eb = curr_eb->next; 00877 00878 /* Remove this from the binding list */ 00879 if( bound ) { 00880 bind_remove( id, FALSE ); 00881 } 00882 00883 } 00884 00885 #ifndef VPI_ONLY 00886 /* If we are in parse mode, resolve all parameters, generate blocks and arrays of instances now */ 00887 if( !cdd_reading && (pass == 0) ) { 00888 inst_link* instl = db_list[curr_db]->inst_head; 00889 while( instl != NULL ) { 00890 instance_resolve( instl->inst ); 00891 instl = instl->next; 00892 } 00893 } 00894 #endif 00895 00896 } 00897 00898 } Catch_anonymous { 00899 exp_bind* tmp_eb; 00900 curr_eb = eb_head; 00901 while( curr_eb != NULL ) { 00902 tmp_eb = curr_eb; 00903 curr_eb = curr_eb->next; 00904 free_safe( tmp_eb->name, (strlen( tmp_eb->name ) + 1) ); 00905 free_safe( tmp_eb, sizeof( exp_bind ) ); 00906 } 00907 eb_head = eb_tail = NULL; 00908 Throw 0; 00909 } 00910 00911 PROFILE_END; 00912 00913 }
void bind_remove | ( | int | id, | |
bool | clear_assigned | |||
) |
Removes the expression with ID of id from binding list.
Removes the binding containing the expression ID of id. This needs to be called before an expression is removed.
id | Expression ID of binding to remove | |
clear_assigned | If set to TRUE, clears the assigned bit in the specified expression |
References exp_bind_s::clear_assigned, exp_bind_s::exp, free_safe, expression_s::id, exp_bind_s::name, exp_bind_s::next, PROFILE, and PROFILE_END.
Referenced by bind_perform(), and expression_dealloc().
00238 { PROFILE(BIND_REMOVE); 00239 00240 exp_bind* curr; /* Pointer to current exp_bind link */ 00241 exp_bind* last; /* Pointer to last exp_bind link examined */ 00242 00243 curr = eb_head; 00244 last = eb_head; 00245 00246 while( curr != NULL ) { 00247 00248 if( ((curr->exp != NULL) && (curr->exp->id == id)) || (curr->clear_assigned == id) ) { 00249 00250 if( clear_assigned ) { 00251 00252 curr->clear_assigned = id; 00253 curr->exp = NULL; 00254 00255 } else { 00256 00257 /* Remove this binding element */ 00258 if( (curr == eb_head) && (curr == eb_tail) ) { 00259 eb_head = eb_tail = NULL; 00260 } else if( curr == eb_head ) { 00261 eb_head = eb_head->next; 00262 } else if( curr == eb_tail ) { 00263 eb_tail = last; 00264 eb_tail->next = NULL; 00265 } else { 00266 last->next = curr->next; 00267 } 00268 00269 /* Now free the binding element memory */ 00270 free_safe( curr->name, (strlen( curr->name ) + 1) ); 00271 free_safe( curr, sizeof( exp_bind ) ); 00272 00273 } 00274 00275 curr = NULL; 00276 00277 } else { 00278 00279 last = curr; 00280 curr = curr->next; 00281 00282 } 00283 00284 } 00285 00286 PROFILE_END; 00287 00288 }
void bind_rm_stmt | ( | int | id | ) |
Removes the statement block associated with the expression with ID of id after binding has occurred.
bool bind_signal | ( | char * | name, | |
expression * | exp, | |||
func_unit * | funit_exp, | |||
bool | fsm_bind, | |||
bool | cdd_reading, | |||
bool | clear_assigned, | |||
int | exp_line, | |||
bool | bind_locally | |||
) |
Binds a signal to an expression.
anonymous | expression_set_value |
Performs a binding of an expression and signal based on the name of the signal. Looks up signal name in the specified functional unit and sets the expression and signal to point to each other. If the signal is unused, the bind does not occur and the function returns a value of FALSE. If the signal does not exist, it is considered to be an implicit signal and a 1-bit signal is created.
name | String name of signal to bind to specified expression | |
exp | Pointer to expression to bind | |
funit_exp | Pointer to functional unit containing expression | |
fsm_bind | If set to TRUE, handling binding for FSM binding | |
cdd_reading | If set to TRUE, specifies that we are binding after reading a design from a CDD file (instead of the design files) | |
clear_assigned | If set to TRUE, clears signal assigned bit | |
exp_line | Line of specified expression (when expression is NULL) | |
bind_locally | If TRUE, only search for specified signal within the same functional unit as this expression |
References ssuppl_u::assigned, expression_s::col, DEBUG, debug_mode, vsignal_s::dim, ESUPPL_IS_LHS, statement_s::exp, exp_link_s::exp, vsignal_s::exp_head, exp_link_add(), EXP_OP_MBIT_NEG, EXP_OP_MBIT_POS, EXP_OP_MBIT_SEL, EXP_OP_PARAM, EXP_OP_PARAM_MBIT, EXP_OP_PARAM_MBIT_NEG, EXP_OP_PARAM_MBIT_POS, EXP_OP_PARAM_SBIT, EXP_OP_PASSIGN, EXP_OP_SBIT_SEL, EXP_OP_SIG, EXP_OP_TRIGGER, vsignal_s::exp_tail, expression_create_nba(), expression_get_root_statement(), expression_is_nba_lhs(), expression_set_assigned(), expression_set_signed(), expression_set_value(), FALSE, FATAL, func_unit_s::filename, esuppl_u::gen_expr, expression_s::id, expression_s::line, dim_range_s::lsb, malloc_safe, ssuppl_u::mba, dim_range_s::msb, func_unit_s::name, exp_link_s::next, ssuppl_u::not_handled, obf_file, obf_funit, obf_sig, expression_s::op, ovl_is_assertion_module(), esuppl_u::owns_vec, ssuppl_u::part, expression_s::part, esuppl_u::part, vsignal_s::pdim_num, print_output(), PROFILE, PROFILE_END, expression_s::right, scope_find_signal(), scope_local(), expression_s::sig, func_unit_s::sig_head, sig_link_add(), func_unit_s::sig_tail, SSUPPL_TYPE_GENVAR, SSUPPL_TYPE_IMPLICIT, SSUPPL_TYPE_MEM, stmt_blk_add_to_remove_list(), vsignal_s::suppl, expression_s::suppl, Throw, TRUE, ssuppl_u::type, user_msg, USER_MSG_LENGTH, vsignal_s::value, expression_s::value, vector_dealloc(), vsignal_create(), WARNING, and WARNING_WRAP.
Referenced by bind_perform(), and fsm_var_bind_expr().
00420 { PROFILE(BIND_SIGNAL); 00421 00422 bool retval = TRUE; /* Return value for this function */ 00423 vsignal* found_sig; /* Pointer to found signal in design for the given name */ 00424 func_unit* found_funit; /* Pointer to found functional unit containing given signal */ 00425 statement* stmt; /* Pointer to root statement for the given expression */ 00426 exp_link* expl; /* Pointer to current expression link */ 00427 unsigned int rv; /* Return value from snprintf calls */ 00428 00429 /* Skip signal binding if the name is not local and we are binding locally */ 00430 if( scope_local( name ) || !bind_locally || (!clear_assigned && (exp->op == EXP_OP_PASSIGN)) ) { 00431 00432 /* Search for specified signal in current functional unit */ 00433 if( !scope_find_signal( name, funit_exp, &found_sig, &found_funit, exp_line ) ) { 00434 00435 /* If we are binding an FSM, output an error message */ 00436 if( fsm_bind ) { 00437 rv = snprintf( user_msg, USER_MSG_LENGTH, "Unable to find specified FSM signal \"%s\" in module \"%s\" in file %s", 00438 obf_sig( name ), obf_funit( funit_exp->name ), obf_file( funit_exp->filename ) ); 00439 assert( rv < USER_MSG_LENGTH ); 00440 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00441 retval = FALSE; 00442 00443 /* If the expression is within a generate expression, emit an error message */ 00444 } else if( (exp != NULL) && (exp->suppl.part.gen_expr == 1) ) { 00445 rv = snprintf( user_msg, USER_MSG_LENGTH, "Generate expression could not find variable (%s), file %s, line %d", 00446 obf_sig( name ), obf_file( funit_exp->filename ), exp_line ); 00447 assert( rv < USER_MSG_LENGTH ); 00448 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00449 Throw 0; 00450 00451 /* Otherwise, implicitly create the signal and bind to it if the signal exists on the LHS of the equation */ 00452 } else if( (exp != NULL) && (ESUPPL_IS_LHS( exp->suppl ) == 1) ) { 00453 rv = snprintf( user_msg, USER_MSG_LENGTH, "Implicit declaration of signal \"%s\", creating 1-bit version of signal", obf_sig( name ) ); 00454 assert( rv < USER_MSG_LENGTH ); 00455 print_output( user_msg, WARNING, __FILE__, __LINE__ ); 00456 rv = snprintf( user_msg, USER_MSG_LENGTH, "module \"%s\", file \"%s\", line %d", 00457 obf_funit( funit_exp->name ), obf_file( funit_exp->filename ), exp_line ); 00458 assert( rv < USER_MSG_LENGTH ); 00459 print_output( user_msg, WARNING_WRAP, __FILE__, __LINE__ ); 00460 found_sig = vsignal_create( name, SSUPPL_TYPE_IMPLICIT, 1, exp->line, exp->col.part.first ); 00461 found_sig->pdim_num = 1; 00462 found_sig->dim = (dim_range*)malloc_safe( sizeof( dim_range ) * 1 ); 00463 found_sig->dim[0].msb = 0; 00464 found_sig->dim[0].lsb = 0; 00465 sig_link_add( found_sig, &(funit_exp->sig_head), &(funit_exp->sig_tail) ); 00466 00467 /* Otherwise, don't attempt to bind the signal */ 00468 } else { 00469 retval = FALSE; 00470 } 00471 00472 } else { 00473 00474 /* If the found signal is not handled, do not attempt to bind to it */ 00475 if( found_sig->suppl.part.not_handled == 1 ) { 00476 retval = FALSE; 00477 } 00478 00479 /* 00480 If the expression is a generate expression on the LHS and the found signal is not a generate variable, emit an error message 00481 and exit immediately. 00482 */ 00483 if( (exp != NULL) && (exp->suppl.part.gen_expr == 1) && (ESUPPL_IS_LHS( exp->suppl ) == 1) && (found_sig->suppl.part.type != SSUPPL_TYPE_GENVAR) ) { 00484 rv = snprintf( user_msg, USER_MSG_LENGTH, "Attempting to bind an generate expression to a signal that is not a genvar, file %s, line %d", 00485 obf_file( funit_exp->filename ), exp_line ); 00486 assert( rv < USER_MSG_LENGTH ); 00487 print_output( user_msg, FATAL, __FILE__, __LINE__ ); 00488 Throw 0; 00489 } 00490 00491 } 00492 00493 if( retval ) { 00494 00495 /* Bind signal and expression if we are not clearing or this is an MBA */ 00496 if( !clear_assigned ) { 00497 00498 assert( exp != NULL ); 00499 00500 /* Add expression to signal expression list */ 00501 exp_link_add( exp, &(found_sig->exp_head), &(found_sig->exp_tail) ); 00502 00503 /* Set expression to point at signal */ 00504 exp->sig = found_sig; 00505 00506 /* If this is a port assignment, we need to link the expression and signal together immediately */ 00507 if( exp->op == EXP_OP_PASSIGN ) { 00508 vector_dealloc( exp->value ); 00509 exp->suppl.part.owns_vec = 0; 00510 exp->value = found_sig->value; 00511 } 00512 00513 if( ((exp->op == EXP_OP_SIG) || 00514 (exp->op == EXP_OP_SBIT_SEL) || 00515 (exp->op == EXP_OP_MBIT_SEL) || 00516 (exp->op == EXP_OP_MBIT_POS) || 00517 (exp->op == EXP_OP_MBIT_NEG) || 00518 (exp->op == EXP_OP_PARAM) || 00519 (exp->op == EXP_OP_PARAM_SBIT) || 00520 (exp->op == EXP_OP_PARAM_MBIT) || 00521 (exp->op == EXP_OP_PARAM_MBIT_POS) || 00522 (exp->op == EXP_OP_PARAM_MBIT_NEG) || 00523 (exp->op == EXP_OP_TRIGGER)) && 00524 (cdd_reading || (found_sig->suppl.part.type == SSUPPL_TYPE_GENVAR)) ) { 00525 expression_set_value( exp, found_sig, funit_exp ); 00526 } 00527 00528 /* 00529 Create a non-blocking assignment handler for the given expression if the attached signal is a memory 00530 and the expression is assignable on the LHS of a non-blocking assignment operator. Only perform this 00531 if we are reading from the CDD file and binding. 00532 */ 00533 if( cdd_reading && (found_sig->suppl.part.type == SSUPPL_TYPE_MEM) ) { 00534 expression* nba_exp; 00535 if( (nba_exp = expression_is_nba_lhs( exp )) != NULL ) { 00536 expression_create_nba( exp, found_sig, nba_exp->right->value ); 00537 } 00538 } 00539 00540 } 00541 00542 if( !cdd_reading ) { 00543 00544 /* Check to see if this signal should be assigned by Covered or the dumpfile */ 00545 if( clear_assigned ) { 00546 found_sig->suppl.part.assigned = 0; 00547 } 00548 00549 if( !clear_assigned && 00550 ((exp->op == EXP_OP_SIG) || 00551 (exp->op == EXP_OP_SBIT_SEL) || 00552 (exp->op == EXP_OP_MBIT_SEL) || 00553 (exp->op == EXP_OP_MBIT_POS) || 00554 (exp->op == EXP_OP_MBIT_NEG)) && 00555 !ovl_is_assertion_module( funit_exp ) ) { 00556 expression_set_assigned( exp ); 00557 } 00558 00559 /* Set signed bits */ 00560 if( !clear_assigned ) { 00561 expression_set_signed( exp ); 00562 } 00563 00564 /* 00565 If the signal is found for the given expression but the signal is marked as "must be assigned" but is also marked as 00566 "won't be assigned", we need to remove all statement blocks that contain this signal from coverage consideration. 00567 */ 00568 if( (found_sig->suppl.part.assigned == 0) && (found_sig->suppl.part.mba == 1) ) { 00569 expl = found_sig->exp_head; 00570 while( expl != NULL ) { 00571 if( (stmt = expression_get_root_statement( expl->exp )) != NULL ) { 00572 #ifdef DEBUG_MODE 00573 if( debug_mode ) { 00574 unsigned int rv = snprintf( user_msg, USER_MSG_LENGTH, "Removing statement block %d, line %d because it needed to be assigned but would not be", 00575 stmt->exp->id, stmt->exp->line ); 00576 assert( rv < USER_MSG_LENGTH ); 00577 print_output( user_msg, DEBUG, __FILE__, __LINE__ ); 00578 } 00579 #endif 00580 stmt_blk_add_to_remove_list( stmt ); 00581 } 00582 expl = expl->next; 00583 } 00584 } 00585 00586 } 00587 00588 } 00589 00590 } else { 00591 00592 retval = FALSE; 00593 00594 } 00595 00596 PROFILE_END; 00597 00598 return( retval ); 00599 00600 }