Fix GitHub issue #315 - support modpath delays on multiply-driven nets.

This commit is contained in:
Martin Whitaker 2020-04-02 10:17:28 +01:00
parent f76e1c1ecb
commit a44ffe5746
3 changed files with 24 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2017 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -722,9 +722,9 @@ static void draw_net_input_x(ivl_nexus_t nex,
char*nex_str = draw_net_input_drive(nex, drivers[0]);
char modpath_label[64];
snprintf(modpath_label, sizeof modpath_label,
"V_%p/m", path_sig);
"V_%p_0/m", path_sig);
nex_private = strdup(modpath_label);
draw_modpath(path_sig, nex_str);
draw_modpath(path_sig, nex_str, 0);
} else {
nex_private = draw_net_input_drive(nex, drivers[0]);
@ -745,8 +745,20 @@ static void draw_net_input_x(ivl_nexus_t nex,
}
driver_labels = malloc(ndrivers * sizeof(char*));
for (idx = 0; idx < ndrivers; idx += 1) {
driver_labels[idx] = draw_net_input_drive(nex, drivers[idx]);
ivl_signal_t path_sig = find_modpath(nex);
if (path_sig) {
for (idx = 0; idx < ndrivers; idx += 1) {
char*nex_str = draw_net_input_drive(nex, drivers[idx]);
char modpath_label[64];
snprintf(modpath_label, sizeof modpath_label,
"V_%p_%u/m", path_sig, idx);
driver_labels[idx] = strdup(modpath_label);
draw_modpath(path_sig, nex_str, idx);
}
} else {
for (idx = 0; idx < ndrivers; idx += 1) {
driver_labels[idx] = draw_net_input_drive(nex, drivers[idx]);
}
}
fprintf(vvp_out, "RS_%p .resolv %s", nex, resolv_type);
for (idx = 0; idx < ndrivers; idx += 1) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2007-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -127,16 +127,18 @@ static void draw_modpath_record(const char*label, const char*driver,
struct modpath_item {
ivl_signal_t path_sig;
char*drive_label;
unsigned drive_index;
struct modpath_item*next;
};
static struct modpath_item*modpath_list = 0;
void draw_modpath(ivl_signal_t path_sig, char*drive_label)
void draw_modpath(ivl_signal_t path_sig, char*drive_label, unsigned drive_index)
{
struct modpath_item*cur = calloc(1, sizeof(struct modpath_item));
cur->path_sig = path_sig;
cur->drive_label = drive_label;
cur->drive_index = drive_index;
cur->next = modpath_list;
modpath_list = cur;
}
@ -149,7 +151,7 @@ void cleanup_modpath(void)
modpath_list = cur->next;
snprintf(modpath_label, sizeof modpath_label, "V_%p/m", cur->path_sig);
snprintf(modpath_label, sizeof modpath_label, "V_%p_%u/m", cur->path_sig, cur->drive_index);
draw_modpath_record(modpath_label, cur->drive_label, cur->path_sig);
free(cur->drive_label);
free(cur);

View File

@ -1,7 +1,7 @@
#ifndef IVL_vvp_priv_H
#define IVL_vvp_priv_H
/*
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -120,7 +120,7 @@ extern char* process_octal_codes(const char*txt, unsigned wid);
* Note: draw_modpath drive_label must be malloc'ed by the
* caller. This function will free the string sometime in the future.
*/
extern void draw_modpath(ivl_signal_t path_sig, char*drive_label);
extern void draw_modpath(ivl_signal_t path_sig, char*drive_label, unsigned drive_index);
extern void cleanup_modpath(void);
/*