SDF files can have null delays.
A SDF file can have null delays and for that case you are to use the existing delay value (do not change it). This patch adds that functionality.
This commit is contained in:
parent
a931eaa586
commit
bb799e7e8f
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2009 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
|
||||
|
|
@ -38,6 +38,7 @@ char sdf_use_hchar = '.';
|
|||
double real_val;
|
||||
char* string_val;
|
||||
|
||||
struct sdf_delay_s delay;
|
||||
struct port_with_edge_s port_with_edge;
|
||||
struct sdf_delval_list_s delval_list;
|
||||
};
|
||||
|
|
@ -58,8 +59,8 @@ char sdf_use_hchar = '.';
|
|||
%type <string_val> hierarchical_identifier
|
||||
%type <string_val> port port_instance
|
||||
|
||||
%type <real_val> rvalue rtriple signed_real_number
|
||||
%type <real_val> delval
|
||||
%type <real_val> rtriple signed_real_number
|
||||
%type <delay> delval rvalue
|
||||
|
||||
%type <int_val> edge_identifier
|
||||
%type <port_with_edge> port_edge port_spec
|
||||
|
|
@ -315,6 +316,7 @@ delval_list
|
|||
$$.count = $1.count;
|
||||
for (idx = 0 ; idx < $$.count ; idx += 1)
|
||||
$$.val[idx] = $1.val[idx];
|
||||
// Is this correct?
|
||||
if ($$.count < 12) {
|
||||
$$.val[$$.count] = $2;
|
||||
$$.count += 1;
|
||||
|
|
@ -343,9 +345,14 @@ delval
|
|||
|
||||
rvalue
|
||||
: '(' signed_real_number ')'
|
||||
{ $$ = $2; }
|
||||
{ $$.defined = 1;
|
||||
$$.value = $2; }
|
||||
| '(' rtriple ')'
|
||||
{ $$ = $2; }
|
||||
{ $$.defined = 1;
|
||||
$$.value = $2; }
|
||||
| '(' ')'
|
||||
{ $$.defined = 0;
|
||||
$$.value = 0.0; }
|
||||
;
|
||||
|
||||
hierarchical_identifier
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _sdf_priv_h
|
||||
#define _sdf_priv_h
|
||||
/*
|
||||
* Copyright (c) 2007 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2007-2009 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
|
||||
|
|
@ -36,9 +36,14 @@ extern int sdf_flag_inform;
|
|||
* it is parsed.
|
||||
*/
|
||||
|
||||
struct sdf_delay_s {
|
||||
int defined;
|
||||
double value;
|
||||
};
|
||||
|
||||
struct sdf_delval_list_s {
|
||||
int count;
|
||||
double val[12];
|
||||
struct sdf_delay_s val[12];
|
||||
};
|
||||
|
||||
extern void sdf_select_instance(const char*celltype, const char*inst);
|
||||
|
|
|
|||
|
|
@ -139,33 +139,22 @@ static const char*edge_str(int vpi_edge)
|
|||
void sdf_iopath_delays(int vpi_edge, const char*src, const char*dst,
|
||||
const struct sdf_delval_list_s*delval_list)
|
||||
{
|
||||
s_vpi_delay delays;
|
||||
vpiHandle iter, path;
|
||||
int match_count = 0;
|
||||
|
||||
if (sdf_cur_cell == 0)
|
||||
return;
|
||||
|
||||
vpiHandle iter = vpi_iterate(vpiModPath, sdf_cur_cell);
|
||||
|
||||
struct t_vpi_time delay_vals[12];
|
||||
int idx;
|
||||
for (idx = 0 ; idx < delval_list->count ; idx += 1) {
|
||||
delay_vals[idx].type = vpiScaledRealTime;
|
||||
delay_vals[idx].real = delval_list->val[idx];
|
||||
}
|
||||
|
||||
delays.da = delay_vals;
|
||||
delays.no_of_delays = delval_list->count;
|
||||
delays.time_type = vpiScaledRealTime;
|
||||
delays.mtm_flag = 0;
|
||||
delays.append_flag = 0;
|
||||
delays.plusere_flag = 0;
|
||||
|
||||
iter = vpi_iterate(vpiModPath, sdf_cur_cell);
|
||||
|
||||
/* Search for the modpath that matches the IOPATH by looking
|
||||
for the modpath that uses the same ports as the ports that
|
||||
the parser has found. */
|
||||
vpiHandle path;
|
||||
int match_count = 0;
|
||||
if (iter) while ( (path = vpi_scan(iter)) ) {
|
||||
s_vpi_delay delays;
|
||||
struct t_vpi_time delay_vals[12];
|
||||
int idx;
|
||||
|
||||
vpiHandle path_t_in = vpi_handle(vpiModPathIn,path);
|
||||
vpiHandle path_t_out = vpi_handle(vpiModPathOut,path);
|
||||
|
||||
|
|
@ -192,6 +181,22 @@ void sdf_iopath_delays(int vpi_edge, const char*src, const char*dst,
|
|||
continue;
|
||||
|
||||
/* Ah, this must be a match! */
|
||||
delays.da = delay_vals;
|
||||
delays.no_of_delays = delval_list->count;
|
||||
delays.time_type = vpiScaledRealTime;
|
||||
delays.mtm_flag = 0;
|
||||
delays.append_flag = 0;
|
||||
delays.plusere_flag = 0;
|
||||
vpi_get_delays(path, &delays);
|
||||
|
||||
for (idx = 0 ; idx < delval_list->count ; idx += 1) {
|
||||
delay_vals[idx].type = vpiScaledRealTime;
|
||||
if (delval_list->val[idx].defined) {
|
||||
delay_vals[idx].real = delval_list->val[idx].value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
vpi_put_delays(path, &delays);
|
||||
match_count += 1;
|
||||
}
|
||||
|
|
|
|||
24
vvp/delay.cc
24
vvp/delay.cc
|
|
@ -768,23 +768,27 @@ static void modpath_src_get_delays ( vpiHandle ref, p_vpi_delay delays )
|
|||
fun->get_delay12(tmp);
|
||||
|
||||
switch (delays->no_of_delays) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
case 12:
|
||||
if (delays->time_type == vpiSimTime) {
|
||||
for (idx = 0; idx < 12; idx += 1) {
|
||||
vpip_time_to_timestruct(delays->da+idx, tmp[idx]);
|
||||
}
|
||||
} else {
|
||||
/* int units = src->dest->scope->time_units; */
|
||||
for (idx = 0; idx < 12; idx += 1) {
|
||||
delays->da[idx].real = vpip_time_to_scaled_real(tmp[idx], src->dest->scope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (delays->time_type == vpiSimTime) {
|
||||
for (idx = 0; idx < delays->no_of_delays; idx += 1) {
|
||||
vpip_time_to_timestruct(delays->da+idx, tmp[idx]);
|
||||
}
|
||||
} else {
|
||||
for (idx = 0; idx < delays->no_of_delays; idx += 1) {
|
||||
delays->da[idx].real = vpip_time_to_scaled_real(tmp[idx], src->dest->scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int pathterm_get(int code, vpiHandle ref)
|
||||
|
|
|
|||
Loading…
Reference in New Issue