Add support for passing the delay selection to vvp.

This patch adds support for passing the delay selection to vvp.
It adds a new header :ivl_delay_selection "<value>"; that has
the values TYPICAL, MINIMUM or MAXIMUM depending on the -T
flag to iverilog. This information is needed by $sdf_annotate
to select that appropriate value for a triplet when
"TOOL_CONTROL" is specified (default).
This commit is contained in:
Cary R 2010-03-13 20:22:45 -08:00 committed by Stephen Williams
parent 9cbb9251b4
commit e241586bcf
9 changed files with 69 additions and 10 deletions

View File

@ -7,6 +7,7 @@ ivl_design_const
ivl_design_consts ivl_design_consts
ivl_design_discipline ivl_design_discipline
ivl_design_disciplines ivl_design_disciplines
ivl_design_delay_sel
ivl_design_flag ivl_design_flag
ivl_design_process ivl_design_process
ivl_design_root ivl_design_root

View File

@ -1,7 +1,7 @@
#ifndef __ivl_target_H #ifndef __ivl_target_H
#define __ivl_target_H #define __ivl_target_H
/* /*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -477,6 +477,9 @@ extern int ivl_path_source_negedge(ivl_delaypath_t obj);
* entire program. Use the design methods to iterate over the elements * entire program. Use the design methods to iterate over the elements
* of the design. * of the design.
* *
* ivl_design_delay_sel
* Returns the tool delay selection: "MINIMUM", "TYPICAL" or "MAXIMUM"?
*
* ivl_design_flag * ivl_design_flag
* This function returns the string value of a named flag. Flags * This function returns the string value of a named flag. Flags
* come from the "-fkey=value" options to the iverilog command and * come from the "-fkey=value" options to the iverilog command and
@ -510,6 +513,7 @@ extern int ivl_path_source_negedge(ivl_delaypath_t obj);
* signed power of 10) of a simulation tick. * signed power of 10) of a simulation tick.
*/ */
extern const char* ivl_design_delay_sel(ivl_design_t des);
extern const char* ivl_design_flag(ivl_design_t des, const char*key); extern const char* ivl_design_flag(ivl_design_t des, const char*key);
extern int ivl_design_process(ivl_design_t des, extern int ivl_design_process(ivl_design_t des,
ivl_process_f fun, void*cd); ivl_process_f fun, void*cd);

14
main.cc
View File

@ -1032,6 +1032,20 @@ int main(int argc, char*argv[])
des->set_flags(flags); des->set_flags(flags);
switch(min_typ_max_flag) {
case MIN:
des->set_delay_sel(Design::MIN);
break;
case TYP:
des->set_delay_sel(Design::TYP);
break;
case MAX:
des->set_delay_sel(Design::MAX);
break;
default:
assert(0);
}
/* Done with all the pform data. Delete the modules. */ /* Done with all the pform data. Delete the modules. */
for (map<perm_string,Module*>::iterator idx = pform_modules.begin() for (map<perm_string,Module*>::iterator idx = pform_modules.begin()
; idx != pform_modules.end() ; idx ++) { ; idx != pform_modules.end() ; idx ++) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -60,6 +60,30 @@ int Design::get_precision() const
return des_precision_; return des_precision_;
} }
void Design::set_delay_sel(delay_sel_t sel)
{
des_delay_sel_ = sel;
}
const char* Design::get_delay_sel() const
{
switch (des_delay_sel_) {
case Design::MIN:
return "MINIMUM";
break;
case Design::TYP:
return "TYPICAL";
break;
case Design::MAX:
return "MAXIMUM";
break;
default:
assert(0);
return "TYPICAL";
}
}
uint64_t Design::scale_to_precision(uint64_t val, uint64_t Design::scale_to_precision(uint64_t val,
const NetScope*scope) const const NetScope*scope) const
{ {

View File

@ -3876,6 +3876,10 @@ class Design {
Design(); Design();
~Design(); ~Design();
/* We need to pass the tool delay selection for $sdf_annotate. */
enum delay_sel_t { MIN, TYP, MAX };
void set_delay_sel(delay_sel_t sel);
const char* get_delay_sel() const;
/* The flags are a generic way of accepting command line /* The flags are a generic way of accepting command line
parameters/flags and passing them to the processing steps parameters/flags and passing them to the processing steps
@ -3998,6 +4002,7 @@ class Design {
map<string,const char*> flags_; map<string,const char*> flags_;
int des_precision_; int des_precision_;
delay_sel_t des_delay_sel_;
private: // not implemented private: // not implemented
Design(const Design&); Design(const Design&);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -43,6 +43,10 @@ extern "C" ivl_nexus_t ivl_branch_terminal(ivl_branch_t net, int idx)
assert( idx < 2); assert( idx < 2);
return net->pins[idx]; return net->pins[idx];
} }
extern "C" const char*ivl_design_delay_sel(ivl_design_t des)
{
return des->self->get_delay_sel();
}
extern "C" const char*ivl_design_flag(ivl_design_t des, const char*key) extern "C" const char*ivl_design_flag(ivl_design_t des, const char*key)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -111,6 +111,9 @@ int target_design(ivl_design_t des)
draw_execute_header(des); draw_execute_header(des);
fprintf(vvp_out, ":ivl_delay_selection \"%s\";\n",
ivl_design_delay_sel(des));
{ int pre = ivl_design_time_precision(des); { int pre = ivl_design_time_precision(des);
char sign = '+'; char sign = '+';
if (pre < 0) { if (pre < 0) {

View File

@ -4,7 +4,7 @@
%{ %{
/* /*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -47,6 +47,7 @@ static char* strdupnew(char const *str)
/* These are some special header/footer keywords. */ /* These are some special header/footer keywords. */
^":ivl_version" { return K_ivl_version; } ^":ivl_version" { return K_ivl_version; }
^":ivl_delay_selection" { return K_ivl_delay_selection; }
^":vpi_module" { return K_vpi_module; } ^":vpi_module" { return K_vpi_module; }
^":vpi_time_precision" { return K_vpi_time_precision; } ^":vpi_time_precision" { return K_vpi_time_precision; }
^":file_names" { return K_file_names; } ^":file_names" { return K_file_names; }

View File

@ -1,7 +1,7 @@
%{ %{
/* /*
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -86,7 +86,8 @@ static struct __vpiModPath*modpath_dst = 0;
%token K_UFUNC K_UFUNC_E K_UDP K_UDP_C K_UDP_S %token K_UFUNC K_UFUNC_E K_UDP K_UDP_C K_UDP_S
%token K_VAR K_VAR_S K_VAR_I K_VAR_R K_vpi_call K_vpi_func K_vpi_func_r %token K_VAR K_VAR_S K_VAR_I K_VAR_R K_vpi_call K_vpi_func K_vpi_func_r
%token K_disable K_fork %token K_disable K_fork
%token K_ivl_version K_vpi_module K_vpi_time_precision K_file_names %token K_ivl_version K_ivl_delay_selection
%token K_vpi_module K_vpi_time_precision K_file_names
%token <text> T_INSTR %token <text> T_INSTR
%token <text> T_LABEL %token <text> T_LABEL
@ -125,6 +126,8 @@ header_line
{ verify_version($2, NULL); } { verify_version($2, NULL); }
| K_ivl_version T_STRING T_STRING ';' | K_ivl_version T_STRING T_STRING ';'
{ verify_version($2, $3); } { verify_version($2, $3); }
| K_ivl_delay_selection T_STRING ';'
{ /* Do something with the delay selection. */ }
| K_vpi_module T_STRING ';' | K_vpi_module T_STRING ';'
{ compile_load_vpi_module($2); } { compile_load_vpi_module($2); }
| K_vpi_time_precision '+' T_NUMBER ';' | K_vpi_time_precision '+' T_NUMBER ';'