Commit Graph

33 Commits

Author SHA1 Message Date
Stephen Williams cc508d1626 Support write_to_stream for arithmetic expressions. 2011-11-05 15:55:41 -07:00
Stephen Williams eeeadea3ac Fix recently broken write of vhdl packages to work space. 2011-10-16 12:18:34 -07:00
Stephen Williams d9acfe57b1 Put off array bound evaluation / describe entity generics as parameters
Entity generics are easily implemented as module parameters, so make
it so. Give the parameters their default values from the generic declaration.

Array bounds may use values that cannot be evaluated right away, so
put off their evaluation.
2011-10-15 17:41:48 -07:00
Stephen Williams 88cce86c63 Emit code for the to_unsigned() bulit-in function. 2011-09-18 19:31:28 -07:00
Stephen Williams f0e61a1db7 Basic vhdl elaboration for unary not operator. 2011-09-18 15:13:30 -07:00
Stephen Williams 1d02f89a09 Handle vhdh array aggregate expressions.
Support the more general case of explicit element expressions
defined at various index positions, mixed with "others" records.
2011-09-11 17:08:22 -07:00
Stephen Williams 3497e2e663 Distinguish bit selects of entity ports from function calls.
Besides variables and signals, a name with a bit select may
be an entity port. Distinguish these from function calls.
2011-09-11 15:28:58 -07:00
Stephen Williams 6d28c989ce Handle the basics of aggregate expressions
This takes care of the parser support, and a shell of the
elaboration. Handle some special cases all the way through.
2011-09-03 17:11:55 -07:00
Stephen Williams 4464c5849b Handle a few built-in functions internally.
The "unsigned" and "std_logic_vector" functions are internal
functions and VHDL and can be handled internally in the code
generator.
2011-08-28 15:30:45 -07:00
Stephen Williams 7556a37859 Parse function calls, and detect type case expressions.
Type cast expressions and some function calls are syntactically
identical to array element select, so we can only tell the difference
by looking up the name of the identifier being selected. If it is a
type name, then create an ExpCast instead of an ExpName object.

Also, parse and emit vector part selects.
2011-08-21 16:52:18 -07:00
Stephen Williams 78788d17fe Translate VHDL string literals to bit vectors 2011-08-20 11:11:47 -07:00
Pawel Szostek 981425fcce Add semantics check in component instantiation
There have been applied rules for port and signal
association in component instatiation statements
described in the VHDL standard.
2011-07-24 10:14:41 -07:00
Stephen Williams e2932cb6b5 Add ExpName::elaborate_rval member function
This function is for the time being used in the
component instatiation. It is checked, whether
an expression is a correct r-value.
To be a correct r-value, it must be either
port name or signal name.
2011-07-19 21:29:05 -07:00
Pawel Szostek 721f9d5d9b Add String Expression to the VHDL parser 2011-07-08 18:05:06 -07:00
Stephen Williams d14f60f28a Elaborate and emit vhdl elsif sections.
The IfStatement contains a list of elsif sections that need
to be elaborated/emitted in the middle of the true and false
clauses.
2011-06-22 18:13:40 -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 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
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
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 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 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
Pawel Szostek 240880d81b Change indentation mechanism in debug dump for VHDL
There has been added additional default attribute to
all 'dump' function calls which is in all cases equal
to 0. Now one can specify how much this debug dumping should
be intended. This should allow people to dump smoothly whole
designs (as it was now) as far as separate units.

This is now the parent who specifies the base indentation
for all components (children). For example, architecture
"decides" how much their signals should be indented.
2011-04-06 18:46:48 -07:00
Pawel Szostek 37d6de344d Add use clause parsing
Up till now only "global" use clauses were parsed
and as a result libraries were loaded.

Since use clauses can appear not only in global context,
parsing of non-global clauses has been introduced and
selected names are now handled (like name1.name2.name3).
2011-03-31 18:57:25 -07:00
Larry Doolittle 8a568055f6 Spelling fixes
All are in comments and .txt files except for one in the Architecture::Statement dump message.
2011-03-29 08:56:10 -07:00
Stephen Williams 162b26c101 Add more complete support for vhdl local signals.
These signals are declared in the architecture and are local to
the module. The Architecture already parsed and stored these signal
declarations, but this patch adds the ability to actually emit these
signals in the generated code.

In the process of doing this, I had to regularize the elaboration
and emit of VTypes, so that it can be used in multiple places, not
just in entity headers (for ports).

I also added support for bit selects of signals. This effected a couple
places in the parser, and expressions in general.
2011-03-28 14:34:02 -07:00
Stephen Williams e172b4d9bc Add support for unary abs and not operators.
While I'm at it, do a little refactoring of the handling of binary
expressions to reduce code duplication.
2011-02-20 17:03:46 -08:00
Stephen Williams cbb213d79e Support for some arithmetic operators. 2011-02-19 17:47:30 -08:00
Stephen Williams 7d552980a6 Elaborate array subtypes of ports.
There are internal types that are unbounded arrays. Allow subtype
syntax that creates bounded versions of these arrays, and elaborate
them as vectors at port boundaries. This makes some interesting types
work out.

Also start replacing vhdlint and vhdlreal with int64_t and double,
which are reasonable values for universal_integer and universal_real
from the VHDL standard. I need these cleaned up because the ints in
particular are used for the literal expressions in array index constraints.
2011-02-13 19:01:21 -08:00
Stephen Williams 798ead9345 Code generator for architectures.
Separate elaboration from code generation in the Entity, and add
to Architectures a code generator to handle some simple cases. At
this point we have the basic structure for the VHDL compiler.
2011-02-13 16:48:52 -08:00
Stephen Williams 769159d053 Add parse decorations for expressions.
Elaboration will need a parse tree for expressions. Create one for
the expression types that are currently supported. Also add rules
and the keywords for all the remaining binary logical operators.
2011-02-13 16:47:05 -08:00