Commit Graph

7964 Commits

Author SHA1 Message Date
Stephen Williams 41601696cc properly handle vhdl open ports in component instantiations. 2011-06-12 16:59:07 -07:00
Stephen Williams cab974c0c2 vhdl sequential l-values cause variables to be reg vs. net.
When a signal (or port) is assigned by a sequential assignment,
the signal or port becomes a reg, instead of a wire(net). Detect
this distinction during elaboration and generate the correct
signal/port declaration.
2011-06-12 15:38:03 -07:00
Stephen Williams 43b3df00c8 Better handle type probe of relation arguments. 2011-06-12 11:35:04 -07:00
Stephen Williams bf40c8ecc5 Conditional statements and expressions
Elaborate and emit a variety of conditional constructs.
Fix up type handling for some expression types
Elaborate continuous signal assignments.
2011-06-12 10:51:31 -07:00
Stephen Williams 2e28782af3 Add parser support for concatenations/conditional assignment/elsif
Some of these should be easy to translate, but get the parsing out
of the way first.
2011-06-05 13:58:54 -07:00
Cary R 3362fbc0db Always process specparams since they can be used outside a specify block.
The -gno-specify flag should only control the delay and timing checks.
It should not also remove the specparams since they can be used outside
of a specify block.
2011-06-04 10:45:44 -07:00
Martin Whitaker a45fa00479 Modified rules for primitive gate port expression widths.
The IEEE standard states that the port expressions used for arrays
of primitive gates must be the exact width required, but is silent
about the requirements for single instances. The consensus among
other simulators is that for input ports of single instances, the
expression is silently truncated to a single bit.

This patch also fixes a compiler crash if an error is found when
elaborating a primitive gate port expression.
2011-06-04 10:34:47 -07:00
Stephen Williams 788be63917 Merge branch 'master' into work6 2011-06-02 19:11:43 -07:00
Stephen Williams a4145534e4 Declare vhdl module ports inline, a la ansi-c
Keep the entity/component/module port declarations in the module port
list of the generated code. This clarifies the generated code and
fixes a couple bugs for more complicated types.
2011-06-02 19:11:20 -07:00
Stephen Williams 22ab8e4a76 Elaboration of r-value expressions
R-value expressions are more general then L-value expressions, in that
the expression type may be a bit more complex. If the R-value expression
is part of an assignment, then elaborate with the constrained type from
the L-value. In other cases, where the expression type is not as obvious,
use expression type probes to figure out the type of the expression and
elaborate using that calculated type.
2011-05-30 19:17:40 -07:00
Cary R feba73119a Update fstapi.c to match the latest from GTKWave 2011-05-29 09:05:04 -07:00
Martin Whitaker 6d0e5c2e89 Fix width calculation for expressions containing a specparam.
This patch adds code to properly calculate the type and width of a
specparam when it is used in an expression.

This patch also fixes a compiler crash when an unknown identifier is
used in a delay expression.
2011-05-29 08:55:46 -07:00
Cary R f3497e0c66 Report the correct gate port number.
The error message was reporting the error message as zero based
instead of one based.
2011-05-29 08:53:53 -07:00
Cary R 35488ac254 Fix bug in queue average with a very large number of entries.
Icarus is not actually fast enough to run into this issue in a
reasonable amount of time. I discovered this by thinking about
the algorithm and verified the fix with custom code.
2011-05-29 08:50:30 -07:00
Cary R c69f4ef7e0 Fix spelling problem reported in pr3301924 2011-05-29 08:48:19 -07:00
Martin Whitaker 767bb87ee2 Fix for pr3301924.
If a relative path name is passed to the Windows LoadModule function,
it is applied in turn to each path in the DLL search path. For the
ivl_dlopen function, we actually want to mimic the Unix behaviour,
where a relative path is relative to the current working directory.
On systems where the KB2264107 security fix has been applied, the
CWD is excluded from the DLL search path, so we no longer get the
required behaviour. This patch reworks the ivl_dlopen function to
give the correct behaviour under Windows.

This patch also adds a flush of the stderr stream after reporting
VPI call errors. This fixes a race between the stdout and stderr
streams when running the regression tests in a MinGW shell.
2011-05-29 08:47:47 -07:00
Cary R 6cad14c491 Add more comments to $table_model code, etc.
This patch mostly just adds comments, it also changes calles to
index() to strchr().
2011-05-29 08:42:49 -07:00
Stephen Williams da0fb1666f Detect always @edge patterns
VHDL doesn't have a direct way to express "always @(posedge...)"
statements, but we do want to detect common paradigms that naturally
translate. This makes for a better translation.
2011-05-28 10:49:33 -07:00
Stephen Williams a53082176d Arrange for ports used as l-values to be declared as "reg".
Entity output ports may be used as l-values in a process within
the bound architecture. Detect that case during elaboration and
adjust the signal declaration so that it works in the Verilog pass.
2011-05-15 16:17:51 -07:00
Stephen Williams fc25ccde06 Basic emit of sequential code
Infrastructure for debug and emit of sequential statements in processes.
This does not properly handle the actual semantics of the behavioral
code, but it provides an infrastructure where we can handle all the
tricky elaboration to come.
2011-05-15 11:07:42 -07:00
Stephen Williams 27b58a7f93 Reorganize architecture debug methods. 2011-05-15 08:57:19 -07:00
Stephen Williams 3e419dc854 Parse/decorate sequential statements.
Get to the point where our sample program parses completely, and
the sequential statements generate SequentialStmt objects and a
process object in the architecture.

Also add a few missing expression types.
2011-05-08 16:40:35 -07:00
Stephen Williams 7afd4210db Parse some sequential statements and processes. 2011-05-08 13:51:21 -07:00
Cary R b13c899b89 Some more $table_model() changes.
The code should be able to correctly parse any command string and
assign the appropriate values from the file to a structure that will
be used to add the information to the table structure.
2011-05-07 11:46:12 -07:00
Cary R 0597b56ba2 More $table_model code.
This patch adds the ability to process the control string and emit some
debug information.
2011-05-07 11:46:06 -07:00
Cary R e85c43c232 Properly terminate a snprintf() call.
snprintf() copies at most N characters, but the string may not be
terminated correctly. This patch uses sizeof() so that the snprintf()
call matches the size of the buffer and adds code to insert a NULL as
the last character of the string.
2011-05-07 11:44:47 -07:00
Cary R c2225f679b Remove some cppcheck warnings.
This patch removes some cppcheck warnings.
2011-05-07 11:40:16 -07:00
Greg Steuck f186c81403 Moved lex prefixes from Makefile.in into the corresponding .lex files.
Added an explicit option prefix="yy" to files that were generated
without an explicit -P.

This makes the lex-generated symbol names self contained without any
help from from build system.
2011-05-07 11:38:32 -07:00
Cary R f61695a03f Fix compile warning. 2011-05-07 11:35:02 -07:00
Cary R 65f187964c Synchronize lxt_write.c with GTKWave (add back const fixes).
The const fixes for lxt_write.c were never pushed to GTKWave so
they were lost in a later sync with GTKWave. These changes have
now been pushed to GTKWave.
2011-04-27 11:05:39 -07:00
Stephen Williams c02d6953ef cfparse.y needs stdio.h
Based on patch subbmitted to sourceforge tracker by
Greg Steuck (gnezdo)
2011-04-27 11:03:08 -07:00
Cary R 029309103f Fix some space issues. 2011-04-27 10:53:36 -07:00
Cary R 45ed389fc5 pform_module_define_port() already deletes the port attribute(s).
If there are attributes attached to a module port declaration them
pform_bind_attribute() which is called from pform_module_define_port()
will delete the attribute list. They do not need to be deleted locally.
2011-04-27 10:48:48 -07:00
Larry Doolittle 347cc67e71 Spelling and related fixes
No effect on executable code.
2011-04-27 10:36:00 -07:00
Cary R 7eb60c9802 We must include the file that has _FILE_OFFSET_SIZE before other headers
To get the correct definition for _FILE_OFFSET_SIZE we must include
the header that loads this before calling the other system headers.
This patch also fixes a minor spacing issues.
2011-04-27 10:33:54 -07:00
Cary R d9253e77c9 Remove some OpenBSD time variable warnings.
Since time is a function OpenBSD does not like us using a variable
named time. This patch fixes that in the sys_queue.c file.
2011-04-27 10:24:51 -07:00
Cary R 619273b8e9 Update ivl.def to include ivl_const_nex 2011-04-20 19:27:31 -07:00
Cary R 10b2310c52 $q_full should return x for an invalid id.
After some more thought I believe it is better for $q_full to return
'bx instead of 2 when $q_full is given an invalid id. This will make
the typical full/not full checks both return false. We still return
an error code in the status variable.
2011-04-20 18:19:53 -07:00
Cary R 54ed0832db Convert a single % at the end of a format string to %%.
If there is a single % at the end of a format string then automatically
convert this to %% so that we get a single % in the output.
2011-04-20 18:13:19 -07:00
Cary R 4006bb2336 Some more cppcheck cleanup.
This patch cleans up most of the warnings in the main (ivl) directory.
2011-04-20 18:09:11 -07:00
Cary R c75d30455d Preliminary support for $table_model.
This patch adds preliminary support for implementing the $table_model()
function for Verilog-A. It is not currently functional, but the VPI
interface routines and data file parsing are mostly complete. The big
things left are building the data structures and adding the interpolation
and extrapolation routines.

We also need to fix vvp to identify constant strings/parameters in a
structural context.
2011-04-20 18:07:01 -07:00
Cary R ccf771ec4b Use the ivl malloc, etc. routines in the sys_queue code.
We want to use the ivl definitions for malloc, etc. to check for
errors. This patch adds the include for this to sys_queue.c.
2011-04-20 18:05:28 -07:00
Cary R 8b8e181fe2 vlog95: Print structural string constants and a few other fixes
This patch adds the ability to print a constant string in a
structural context. It also fixes the argument order for
structural function calls and makes a few improvements in
nexus identification.
2011-04-20 17:50:41 -07:00
Cary R 2158ebdf0b Fix a few minor cppcheck warnings.
This patch fixes a minor memory leak and slight inefficiency
reported by cppcheck. It also updates the expected warning for
vpi/fstapi.c.
2011-04-20 17:48:09 -07:00
Cary R 56b04891e0 Pass structural constant string information to the ivl interface.
This patch adds code to the compiler so that a constant string
in a structural context can maintain the string property. This
is needed but not currently implemented in vvp (it's still
converted to a number). A pending patch for the vlog95 target
does use this new information.
2011-04-20 17:29:35 -07:00
Cary R 12df29af55 Fix space issues.
Thsi patch removes space before end of line, etc.
2011-04-20 17:26:52 -07:00
Cary R c67f1b5bc2 Add support for calculating the average queue wait time.
This patch adds support for calculating the average queue wait
time. This is accomplished by keeping two 64 bit values that
represent the high and low total wait time for all previous
queue elements. The current wait time for any elements still
in the queue are added to this total. The wait time total is
then divided by the total number of items added to the queue.
2011-04-20 16:57:34 -07:00
Stephen Williams 3ff7a8f7b0 Add support for constants and package types.
Significant rework of scope management to unify the handling of
types in the ieee library and types/constants/components in packages.
This involved adjusting the parser rules to manage a stack of scopes
and rewriting the IEEE library support to not use global maps for
the loaded types.
2011-04-17 17:19:09 -07:00
Stephen Williams 303f057de1 Support collecting ALL component declarations from a used scope. 2011-04-13 19:55:18 -07:00
Stephen Williams e017ccb5d2 Merge branch 'master' into work5
Conflicts:
	vhdlpp/architec.h
	vhdlpp/debug.cc
2011-04-13 19:09:51 -07:00