diff --git a/vpi_user.h b/vpi_user.h index 14255b6a8..504c157c4 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -1,7 +1,7 @@ #ifndef __vpi_user_H #define __vpi_user_H /* - * Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2010 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 @@ -364,7 +364,12 @@ typedef struct t_vpi_delay { #define vpiConstantSelect 53 #define vpiSigned 65 /* IVL private properties, also see vvp/vpi_priv.h for other properties */ -#define _vpiNexusId 0x1000000 +#define _vpiNexusId 0x1000000 +/* used in vvp/vpi_priv.h 0x1000001 */ +#define _vpiDelaySelection 0x1000002 +# define _vpiDelaySelMinimum 1 +# define _vpiDelaySelTypical 2 +# define _vpiDelaySelMaximum 3 /* DELAY MODES */ #define vpiNoDelay 1 diff --git a/vvp/main.cc b/vvp/main.cc index ed3927788..7281a65a8 100644 --- a/vvp/main.cc +++ b/vvp/main.cc @@ -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 * and/or modify it in source code form under the terms of the GNU @@ -176,6 +176,21 @@ void verify_version(char*ivl_ver, char*commit) free(vvp_ver); } +int vpip_delay_selection = _vpiDelaySelTypical; +void set_delay_selection(const char* sel) +{ + if (strcmp("TYPICAL", sel) == 0) { + vpip_delay_selection = _vpiDelaySelTypical; + } else if (strcmp("MINIMUM", sel) == 0) { + vpip_delay_selection = _vpiDelaySelMinimum; + } else if (strcmp("MAXIMUM", sel) == 0) { + vpip_delay_selection = _vpiDelaySelMaximum; + } else { + vpi_mcd_printf(1, "Error: Unknown delay selection \"%s\"!", sel); + exit(1); + } +} + unsigned module_cnt = 0; const char*module_tab[64]; @@ -282,7 +297,7 @@ int main(int argc, char*argv[]) if (version_flag) { fprintf(stderr, "Icarus Verilog runtime version " VERSION " (" VERSION_TAG ")\n\n"); - fprintf(stderr, "Copyright 1998-2009 Stephen Williams\n\n"); + fprintf(stderr, "Copyright 1998-2010 Stephen Williams\n\n"); fprintf(stderr, " This program is free software; you can redistribute it and/or modify\n" " it under the terms of the GNU General Public License as published by\n" diff --git a/vvp/parse.y b/vvp/parse.y index a0ed34f23..233bf18de 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -127,7 +127,7 @@ header_line | K_ivl_version T_STRING T_STRING ';' { verify_version($2, $3); } | K_ivl_delay_selection T_STRING ';' - { /* Do something with the delay selection. */ } + { set_delay_selection($2); } | K_vpi_module T_STRING ';' { compile_load_vpi_module($2); } | K_vpi_time_precision '+' T_NUMBER ';' diff --git a/vvp/parse_misc.h b/vvp/parse_misc.h index 0e130f662..85c01240b 100644 --- a/vvp/parse_misc.h +++ b/vvp/parse_misc.h @@ -1,7 +1,7 @@ #ifndef __parse_misc_H #define __parse_misc_H /* - * 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 * and/or modify it in source code form under the terms of the GNU @@ -33,6 +33,11 @@ extern int compile_design(const char*path); */ extern void verify_version(char *ivl_ver, char* commit); +/* + * Set the default delay type for the $sdf_annotate task (min/typ/max). + */ +extern void set_delay_selection(const char* sel); + /* * various functions shared by the lexor and the parser. */ diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index c9c24b24d..032c5ce2d 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -264,6 +264,9 @@ static const char* vpi_type_values(PLI_INT32 code) PLI_INT32 vpi_get(int property, vpiHandle ref) { + /* We don't care what the ref is there is only one delay selection. */ + if (property == _vpiDelaySelection) return vpip_delay_selection; + if (ref == 0) return vpip_get_global(property); @@ -303,6 +306,20 @@ PLI_INT32 vpi_get(int property, vpiHandle ref) char* vpi_get_str(PLI_INT32 property, vpiHandle ref) { + /* We don't care what the ref is there is only one delay selection. */ + if (property == _vpiDelaySelection) { + switch (vpip_delay_selection) { + case _vpiDelaySelMinimum: + return simple_set_rbuf_str("MINIMUM"); + case _vpiDelaySelTypical: + return simple_set_rbuf_str("TYPICAL"); + case _vpiDelaySelMaximum: + return simple_set_rbuf_str("MAXIMUM"); + default: + assert(0); + } + } + if (ref == 0) { fprintf(stderr, "vpi error: vpi_get_str(%s, 0) called " "with null vpiHandle.\n", vpi_property_str(property)); diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 325e550fe..7f705004b 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -1,7 +1,7 @@ #ifndef __vpi_priv_H #define __vpi_priv_H /* - * 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 * and/or modify it in source code form under the terms of the GNU @@ -628,4 +628,6 @@ extern char *generic_get_str(int code, vpiHandle ref, const char *name, const ch /* A routine to find the enclosing module. */ extern vpiHandle vpip_module(struct __vpiScope*scope); +extern int vpip_delay_selection; + #endif