Some more global state into Xctx

This commit is contained in:
Stefan Frederik 2020-12-28 14:01:03 +01:00
parent bcf8986314
commit 1773a2e8d2
2 changed files with 14 additions and 8 deletions

View File

@ -225,6 +225,7 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int what)
my_strdup(138, &(entry->token),token); my_strdup(138, &(entry->token),token);
entry->path = NULL; entry->path = NULL;
my_strdup(139, &(entry->path),xctx->sch_path[xctx->currsch]); my_strdup(139, &(entry->path),xctx->sch_path[xctx->currsch]);
entry->oldvalue = value; /* no old value */
entry->value = value; entry->value = value;
entry->time = xctx->hilight_time; entry->time = xctx->hilight_time;
entry->hash = hashcode; entry->hash = hashcode;
@ -242,6 +243,7 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int what)
my_free(764, &entry); my_free(764, &entry);
*preventry=saveptr; *preventry=saveptr;
} else if(what == XINSERT ) { } else if(what == XINSERT ) {
entry->oldvalue = entry->value;
entry->value = value; entry->value = value;
entry->time=xctx->hilight_time; entry->time=xctx->hilight_time;
} }
@ -983,17 +985,20 @@ void propagate_logic()
if(propagate_str) { if(propagate_str) {
int n = 1; int n = 1;
const char *propag; const char *propag;
int clock_pin, clock_val; int clock_pin, clock_val, clock_oldval;
const char *clock = get_tok_value(rct[j].prop_ptr, "clock", 0); const char *clock = get_tok_value(rct[j].prop_ptr, "clock", 0);
clock_pin = clock[0] - '0'; clock_pin = clock[0] ? clock[0] - '0' : -1;
if(clock_pin != -1) { if(clock_pin != -1) {
entry = bus_hilight_lookup(xctx->inst[i].node[j], 0, XLOOKUP); /* clock pin */ entry = bus_hilight_lookup(xctx->inst[i].node[j], 0, XLOOKUP); /* clock pin */
clock_val = (!entry) ? LOGIC_X : entry->value; clock_val = (!entry) ? LOGIC_X : entry->value;
clock_oldval = (!entry) ? LOGIC_X : entry->oldvalue;
if(entry) { if(entry) {
if(clock_pin == 0) { /* clock falling edge */ if(clock_pin == 0) { /* clock falling edge */
if( clock_val == clock_oldval) continue;
if( clock_val != LOGIC_0) continue; if( clock_val != LOGIC_0) continue;
if(entry && entry->time != xctx->hilight_time) continue; if(entry && entry->time != xctx->hilight_time) continue;
} else if(clock_pin == 1) { /* clock rising edge */ } else if(clock_pin == 1) { /* clock rising edge */
if( clock_val == clock_oldval) continue;
if( clock_val != LOGIC_1) continue; if( clock_val != LOGIC_1) continue;
if(entry && entry->time != xctx->hilight_time) continue; if(entry && entry->time != xctx->hilight_time) continue;
} else if(clock_pin == 2) { /* set/clear active low */ } else if(clock_pin == 2) { /* set/clear active low */

View File

@ -644,6 +644,7 @@ struct hilight_hashentry {
unsigned int hash; unsigned int hash;
char *token; char *token;
char *path; /* hierarchy path */ char *path; /* hierarchy path */
int oldvalue; /* used for FF simulation */
int value; /* hilight color */ int value; /* hilight color */
int time; /*delta-time for sims */ int time; /*delta-time for sims */
}; };