Add support for the other edges in a SDF file.

This patch adds support for the other edges 01, 10, etc. These still
need to be verified in the context of IOPATHs, but they are ignored
in the timing checks and that's what was needed.
This commit is contained in:
Cary R 2009-02-09 20:13:05 -08:00 committed by Stephen Williams
parent bb799e7e8f
commit 9f0e0c6c55
4 changed files with 35 additions and 5 deletions

View File

@ -45,6 +45,7 @@ static int yywrap(void)
%}
%x CCOMMENT
%x EDGE_ID
%%
@ -62,6 +63,16 @@ static int yywrap(void)
/* Count lines so that the parser can assign line numbers. */
\n { sdflloc.first_line += 1; }
/* The other edge identifiers. */
<EDGE_ID>"01" {return K_01; }
<EDGE_ID>"10" {return K_10; }
<EDGE_ID>"0"[zZ] {return K_0Z; }
<EDGE_ID>[zZ]"1" {return K_Z1; }
<EDGE_ID>"1"[zZ] {return K_1Z; }
<EDGE_ID>[zZ]"0" {return K_Z0; }
<EDGE_ID>[pP][oO][sS][eE][dD][gG][eE] {return K_POSEDGE; }
<EDGE_ID>[nN][eE][gG][eE][dD][gG][eE] {return K_NEGEDGE; }
/* Real values */
[0-9]+(\.[0-9]+)?([Ee][+-]?[0-9]+)? {
yylval.real_val = strtod(yytext, 0);
@ -107,8 +118,6 @@ static struct {
{ "INTERCONNECT",K_INTERCONNECT },
{ "INSTANCE", K_INSTANCE },
{ "IOPATH", K_IOPATH },
{ "NEGEDGE", K_NEGEDGE },
{ "POSEDGE", K_POSEDGE },
{ "PROCESS", K_PROCESS },
{ "PROGRAM", K_PROGRAM },
{ "RECOVERY", K_RECOVERY },
@ -126,6 +135,16 @@ static struct {
{ 0, IDENTIFIER }
};
void start_edge_id(void)
{
BEGIN(EDGE_ID);
}
void stop_edge_id(void)
{
BEGIN(0);
}
static int lookup_keyword(const char*text)
{
int idx;

View File

@ -48,6 +48,7 @@ char sdf_use_hchar = '.';
%token K_NEGEDGE K_POSEDGE K_PROCESS K_PROGRAM K_RECOVERY K_REMOVAL
%token K_SDFVERSION K_SETUP K_SETUPHOLD K_TEMPERATURE K_TIMESCALE
%token K_TIMINGCHECK K_VENDOR K_VERSION K_VOLTAGE K_WIDTH
%token K_01 K_10 K_0Z K_Z1 K_1Z K_Z0
%token HCHAR
%token <string_val> QSTRING IDENTIFIER
@ -301,13 +302,19 @@ port
;
port_edge
: '(' edge_identifier port_instance ')'
{ $$.vpi_edge = $2; $$.string_val = $3; }
: '(' {start_edge_id();} edge_identifier {stop_edge_id();} port_instance ')'
{ $$.vpi_edge = $3; $$.string_val = $5; }
;
edge_identifier
: K_POSEDGE { $$ = vpiPosedge; }
| K_NEGEDGE { $$ = vpiNegedge; }
| K_01 { $$ = vpiEdge01; }
| K_10 { $$ = vpiEdge10; }
| K_0Z { $$ = vpiEdge0x; }
| K_Z1 { $$ = vpiEdgex1; }
| K_1Z { $$ = vpiEdge1x; }
| K_Z0 { $$ = vpiEdgex0; }
;
delval_list

View File

@ -1,7 +1,7 @@
#ifndef _sdf_parse_priv_h
#define _sdf_parse_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
@ -35,4 +35,7 @@ extern const char*sdf_parse_path;
/* Hierarchy separator character to use. */
extern char sdf_use_hchar;
extern void start_edge_id(void);
extern void stop_edge_id(void);
#endif

View File

@ -173,6 +173,7 @@ void sdf_iopath_delays(int vpi_edge, const char*src, const char*dst,
/* The edge type must match too. But note that if this
IOPATH has no edge, then it matches with all edges of
the modpath object. */
/* --> Is this correct in the context of the 10, 01, etc. edges? */
if (vpi_edge != vpiNoEdge && vpi_get(vpiEdge,path_t_in) != vpi_edge)
continue;