Nick Gasson
4ebe09bb72
Various fixes to support automatic functions
...
Mostly this ensures that a recursive call to a function
is made with the correct types (this may involve generating
code to cast expressions to the correct type).
2008-08-20 22:54:53 +01:00
Nick Gasson
cb1d4fd278
Amend inaccurate comment
2008-08-18 16:15:05 +01:00
Nick Gasson
e1deba51ab
Handle BUFIF logic when vector inputs
2008-08-18 15:48:07 +01:00
Nick Gasson
d53014a07f
Fix leading comma it expression only has "others" part
...
Stop syntax errors caused by things like this:
(, others => '1')
2008-08-18 15:36:11 +01:00
Nick Gasson
7865264de0
Implement IVL_LPM_REPEAT
2008-08-18 15:34:58 +01:00
Nick Gasson
86661c1538
Add a few more `unsupported' messages
2008-08-18 15:29:30 +01:00
Nick Gasson
e2dd7425bd
Add error messages for unsupported statement types
2008-08-18 15:24:38 +01:00
Nick Gasson
026d941734
Avoid printing field widths in $display/$write output
...
This removes some unwanted artifacts from the output.
2008-08-15 19:43:16 +01:00
Nick Gasson
a577ee447b
Generate process for sequential UDPs
2008-08-13 17:03:03 +01:00
Nick Gasson
d7b85c42a0
Split sequential and combinatorial UDPs into separate functions
2008-08-13 11:57:05 +01:00
Nick Gasson
dea54df71b
Catch possibly NULL return value
...
This is caused by using a hierarchical reference (which can't
be translated to VHDL). The result of get_decl is NULL since
the signal has been declared in a different VHDL architecture.
Adding the assert is cleaner than having it segfault, for the
moment, until a nicer error message can be added.
2008-08-12 09:47:03 +01:00
Nick Gasson
a3929330b0
Fix regression caused by UDP delay patch
...
translate_time_expr cannot be passed a NULL ivl_expr_t.
2008-08-11 20:53:13 +01:00
Nick Gasson
c404b761b7
Change `out' ports to `buffer' when the signal is read
...
Previously this was handled by creating an internal
signal that was connected to the output and could also
be read inside the entity. The correct solution is to
make the output `buffer' rather than `out'. However, this
does not work in the case when an output is connected to
an output of a child entity, and that values is read
in the parent. In this case *both* the outputs of the child
and the parent need to be made `buffer'.
2008-08-11 20:48:28 +01:00
Nick Gasson
9b1f2d5971
Remove UDP debug messages from output
2008-08-11 20:37:10 +01:00
Nick Gasson
9d7e4ac15f
Allow delays in combinatorial UDPs
...
Add a `after' clause to the `with .. select' statement.
2008-08-11 20:36:09 +01:00
Nick Gasson
d55a3a073a
Handle '?' in vl_to_vhdl_bit
...
The rough translation is '-', although the semantics are incompatible
in some cases (e.g. '-' = '1' is false)
2008-08-11 13:53:42 +01:00
Nick Gasson
01bf741983
Implement combinatorial UDPs
...
Using a `with .. select' statement
2008-08-11 13:23:50 +01:00
Nick Gasson
bf3734110e
Add VHDL syntax element for `with .. select' statement
...
This will be used to implement combinatorial UDPs
2008-08-11 13:09:52 +01:00
Nick Gasson
6dcf936807
Generate combined input for UDP devices
...
Combinatorial UDPs will be implemented with a `with ... select'
statemetnt. However the input to this must be "locally static".
This patch joins the inputs into a vector which can be used as
the select expression.
2008-08-11 12:58:46 +01:00
Nick Gasson
8e0bf3ebff
Add conversion from std_logic to (un)signed types
...
Implemented using the expression (0 => X, others => '0')
2008-08-10 11:22:23 +01:00
Nick Gasson
7ed8c0915d
Add file/line comments to signal declarations
2008-08-08 20:28:16 +01:00
Nick Gasson
eef1c968dc
Add message that casex cannot be translated
...
...with the correct behavior. It would be possible to
just translate it as a regular VHDL case statement (as
it was before this patch). But the behavior is not
correct as VHDL only does the equivalent of case-equality
in case statements and this can be confusing when debugging
the output. An alternative might be to emit a warning rather
than an error.
2008-08-08 20:09:40 +01:00
Nick Gasson
0985158090
Handle %% in $display
2008-08-08 20:07:22 +01:00
Nick Gasson
090ae5fa56
Catch case where signal with same name in task and module
...
This fixes task3.14C
2008-08-08 19:47:20 +01:00
Nick Gasson
13cb81f4bb
Add task signals to containing architecture
...
This is necessary to support the in-line expansion of tasks
2008-08-08 19:31:45 +01:00
Nick Gasson
bb0efda526
Make make_safe_name case insensitive
2008-08-07 17:58:42 +01:00
Nick Gasson
e4d0a92d7c
Division and modulus operators
2008-08-07 14:18:26 +01:00
Nick Gasson
28d782e13c
Remove redundant verilog_support.vhd file
2008-08-07 13:10:53 +01:00
Nick Gasson
6f5f700cb9
Very minimal implementation of tasks
...
This expands the task in-line inside the process to avoid
problems with global variables (VHDL processes cannot
reference globals)
2008-08-07 10:54:39 +01:00
Nick Gasson
4cbec1c817
Add XNOR binary operand
2008-08-06 11:18:01 +01:00
Nick Gasson
f86f454956
Apply the last patch to if/case statements too
...
This further cleans up the output by removing more
useless `wait for 0ns' statements.
2008-08-05 11:09:51 +01:00
Nick Gasson
e01e038cf9
Avoid generating useless `wait for 0ns' statements
...
If the final statement in a process is a non-blocking
assignment then there is no point adding a `wait for 0ns'
after it since it will be immediately followed by another
wait. This case is suprisingly common, so this patch helps
generate much cleaner output without breaking the cases
where the 0ns wait is actually required (e.g. to implement
non-blocking assignment properly).
2008-08-05 11:02:36 +01:00
Nick Gasson
c849dfeec4
Add XNOR logic device
2008-08-05 10:45:01 +01:00
Nick Gasson
8d7b03576c
Correctly implement unary XNOR
...
Forgot to negate the output.
2008-08-05 10:38:43 +01:00
Nick Gasson
72019959a8
Translate some ternary expressions to if statements
...
This re-implements some earlier functionality where
ternary expressions on an assignment RHS are translated
to an if statement.
2008-08-03 15:47:32 +01:00
Nick Gasson
9565ea1034
Add some whitespace above component instantiations
2008-08-03 14:50:13 +01:00
Nick Gasson
49a2693357
Add file / line number information to functions
2008-08-03 14:46:57 +01:00
Nick Gasson
10a5ca199d
Add file / line number comments to instantiations
2008-08-03 14:38:08 +01:00
Nick Gasson
c2f622327f
Use ivl_scope_def_* for definition file/line numbers
2008-08-03 14:34:41 +01:00
Nick Gasson
0e2628a3fb
Minimal implementation of IVL_LPM_MUX
...
This handles the (common) case of the select being only
1 bit wide. Implemented as a concurrent assignment with
a `when' clause.
2008-08-03 12:46:50 +01:00
Nick Gasson
45dfa28dba
Remember signal pin a nexus was attached to
...
Also modify nexus_to_var_ref to set the correct array
offset when the signal is an array (the offset comes
from the pin).
2008-08-03 11:41:26 +01:00
Nick Gasson
c8cbac58f5
Add forward declarations for functions
...
This patch adds a forward declaration for every user funciton.
This fixes VHDL compile problems if a function calls another
before it has been declared.
2008-08-03 10:50:31 +01:00
Nick Gasson
c1b5424ca6
Implement assignment with multiple lvals
...
Multiple lvals are implemented by first assigning the complete
RHS to a temporary, and then assigning each lval in turn as
bit-selects of the temporary
2008-08-02 18:40:24 +01:00
Nick Gasson
c706c94e38
Generate a vhdl_var_ref for every assignment lval
...
This completes the refactoring of make_assignment
necessary to implement multiple lvals.
2008-08-02 18:20:18 +01:00
Nick Gasson
fad8abee34
Start refactoring make_assignment for multiple lvals
...
This patch lifts the RHS generating code out of the
lval-specific code and sticks a loop around the lvals.
2008-08-02 16:38:44 +01:00
Nick Gasson
9448c5939c
Always user Ternary_* support functions for ternary assignments
...
Previously the code generator expanded ternary assignments to
and `if' statement. This patch replaces that with a single assignment
and a call to a Ternary_* support function. This will make it
much easier to support multiple lvals later.
2008-08-02 15:46:36 +01:00
Nick Gasson
752a90dc2f
Insert blank line before VHDL process in output
2008-08-02 10:45:38 +01:00
Nick Gasson
a60216ec15
Use ivl_process_* functions for file/line number information
2008-08-02 10:44:03 +01:00
Nick Gasson
5d0df8d880
Change format of line file/line numbers
2008-08-02 10:42:00 +01:00
Nick Gasson
bb80b432e6
Add comments file/line number comments
...
Added to entities, architectures, and processes
2008-08-01 21:21:42 +01:00
Nick Gasson
e0834f7f38
Add NAND and NOR logic devices
2008-08-01 17:46:04 +01:00
Nick Gasson
a26d91557b
Add binary NAND and NOR operators
2008-08-01 17:42:26 +01:00
Nick Gasson
3f73c9bb54
Make sure argument to unary - is signed
2008-08-01 16:35:47 +01:00
Nick Gasson
09f3eb4a36
Don't bother calling reduction function if argument is std_logic
2008-08-01 16:27:55 +01:00
Nick Gasson
d21277f1b9
Tidy up whitespace in output
2008-07-31 21:17:49 +01:00
Nick Gasson
7b0f675785
Add check for sequential UDPs
2008-07-31 21:08:59 +01:00
Nick Gasson
db339b8fc3
Stub for UDP logic devices
2008-07-31 20:59:20 +01:00
Nick Gasson
baa2363e85
Split logic device code into separate file
2008-07-30 10:13:08 +01:00
Nick Gasson
e5b8abfb23
Remove debugging output
2008-07-29 21:15:51 +01:00
Nick Gasson
9f6f711f8d
Remove unused variable
2008-07-29 21:08:50 +01:00
Nick Gasson
9a5b7bb0b0
Connect signals together if joined in a nexus
2008-07-29 21:03:00 +01:00
Nick Gasson
eaf1cc9120
Fix assertion failure with arrayed signals
2008-07-29 19:47:17 +01:00
Nick Gasson
3bcd42dc8f
Fix case where logic device has no valid output
2008-07-29 19:39:20 +01:00
Nick Gasson
744fbed783
Finish re-writing nexus code
2008-07-29 19:33:40 +01:00
Nick Gasson
c9454b346e
Fix module3.12B
2008-07-29 19:04:41 +01:00
Nick Gasson
5ec2c37e7e
Get functions working again
2008-07-29 15:29:49 +01:00
Nick Gasson
25602e487d
Comment
2008-07-29 15:12:51 +01:00
Nick Gasson
e037ffd952
Create temporaries for LPM outputs
2008-07-29 15:09:58 +01:00
Nick Gasson
48c1a7982c
Make seen_nexus private
2008-07-29 14:24:04 +01:00
Nick Gasson
a842b327c7
Generate constant drivers as concurrent assignments
2008-07-29 14:02:05 +01:00
Nick Gasson
f8034d69ef
Fix constants in nexuses
2008-07-29 13:30:54 +01:00
Nick Gasson
d94dac28a8
Remove redundant lpm_output
2008-07-29 13:08:13 +01:00
Nick Gasson
680c6f0503
Make sure LPMs have valid inputs/outputs
2008-07-29 13:06:21 +01:00
Nick Gasson
39717989a8
Call set_active_entity in the right places
2008-07-29 13:04:29 +01:00
Nick Gasson
c26b7ce675
Port maps
2008-07-29 13:02:55 +01:00
Nick Gasson
c6f6ea7358
Instantiation working again
2008-07-29 12:21:19 +01:00
Nick Gasson
c0c838f1bc
Logic devices now working again
2008-07-29 12:11:44 +01:00
Nick Gasson
1a45e9164f
Find signal a logic device is connected to
2008-07-29 12:04:40 +01:00
Nick Gasson
8a5f129e56
Draw nexus in multiple passes
2008-07-29 12:00:26 +01:00
Nick Gasson
65c2ceb89d
Build entity hierarchy in separate stages
2008-07-29 11:01:02 +01:00
Nick Gasson
7a2e9c02cd
Simplify support function emitting code
2008-07-28 22:48:21 +01:00
Nick Gasson
f88415b1d7
Conversion of std_logic to integer
2008-07-28 22:46:39 +01:00
Nick Gasson
506a0ba7d6
Support repeat in concatenation
2008-07-28 21:46:19 +01:00
Nick Gasson
1d4914c590
Undo last commit
2008-07-28 13:04:30 +01:00
Nick Gasson
78028a3310
Fully support ternary expressions
2008-07-28 12:59:10 +01:00
Nick Gasson
b9cecbef64
Make sure LPM comparison result is std_logic not Boolean
2008-07-27 19:05:49 +01:00
Nick Gasson
8b32096e2a
Convert std_logic to Boolean in loop tests
2008-07-27 18:39:16 +01:00
Nick Gasson
ba462eb8b7
Merge branch 'vhdl' of git@github.com:nickg/iverilog into vhdl
2008-07-25 20:00:26 +01:00
Nick Gasson
5a09819729
Catch case of select expression on non-variable
2008-07-24 16:00:12 +01:00
Nick Gasson
d3296d4895
Refactor while/for loop code to use common base
2008-07-24 15:22:25 +01:00
Nick Gasson
39c9c54760
Add repeat statement
2008-07-24 14:52:06 +01:00
Nick Gasson
8bee5b1108
Add `forever' statement type
2008-07-24 14:30:10 +01:00
Nick Gasson
e4c2400eb2
Refactor the expression->time code into a single function
2008-07-23 16:18:49 +01:00
Nick Gasson
1409207def
Correctly indent case statements
2008-07-23 14:31:41 +01:00
Nick Gasson
30fdadc525
Support delays in logic devices
2008-07-23 13:40:42 +01:00
Nick Gasson
a5db0297b0
Unary minus
2008-07-22 15:44:29 +01:00
Nick Gasson
e25f946ac0
Merge branch 'vhdl' of file:///media/disk/data/iverilog/ into vhdl
2008-07-21 15:20:42 +01:00
Nick Gasson
2f4f075005
Typo
2008-07-21 15:20:40 +01:00
Nick Gasson
3ca85491ee
Unary AND and XOR
2008-07-20 16:41:57 +01:00
Nick Gasson
d8351ec1b2
Fix reduction OR in procedural code
2008-07-20 15:13:20 +01:00
Nick Gasson
77508b9afa
Reduction OR operator
2008-07-20 15:10:00 +01:00
Nick Gasson
38de6ebf3a
Compress support function definitions a bit
2008-07-19 21:04:52 +01:00
Nick Gasson
af3ee49f57
Refactor support function code a bit
2008-07-19 20:49:55 +01:00
Nick Gasson
0cb6ea34d7
Move type conversion code into a separate file
2008-07-19 15:23:47 +01:00
Nick Gasson
b6df73d3b9
Support functions for converting (un)signed -> boolean
2008-07-19 15:15:16 +01:00
Nick Gasson
2d79e1a2e0
Store the currently active entity
2008-07-19 14:45:00 +01:00
Nick Gasson
7b311b6adb
Translate internal delays in assignments
2008-07-18 14:47:35 +01:00
Nick Gasson
df4a380e42
Fix implementation of IVL_LPM_UFUNC
...
Function name was not correct.
2008-07-18 14:31:12 +01:00
Nick Gasson
6ff80e80a4
Catch case where (un)signed is converted to boolean
2008-07-18 12:30:24 +01:00
Nick Gasson
8b6b111541
Add IVL_LPM_CMP_EQ
2008-07-18 11:58:26 +01:00
Nick Gasson
fd8f01e317
Add IVL_LPM_CMP_GE
2008-07-18 11:56:00 +01:00
Nick Gasson
00317dd47f
Dummy implementation of $time
2008-07-18 11:50:05 +01:00
Nick Gasson
e9637f6d11
Generate synthesisable code for sequential processes
...
Whilst adding `wait until ...' at the end of every
process is a valid translation of the input, it is not
actually synthesisable in at least one commercial
synthesiser (XST). According to the XST manual the
correct template is to use `wait until ...' at the
start of sequential processes and `wait on ...'
(equivalent to `wait until ...' with 'Event on all
the signals) at the end of combinatorial processes.
This patch implements that.
2008-07-17 17:36:42 +01:00
Nick Gasson
1f9ed2c5ec
VHDL AST element for `wait on' statement
2008-07-17 17:23:21 +01:00
Nick Gasson
7677b59650
Make sure offset of IVL_LPM_ARRAY is integer
2008-07-17 16:41:34 +01:00
Nick Gasson
9cf4792d53
Translate array references in expressions
2008-07-17 14:47:10 +01:00
Nick Gasson
4d9f029000
Generate correct array bounds
2008-07-17 14:38:07 +01:00
Nick Gasson
9916686c24
Convert constant bits to integers
2008-07-17 14:29:56 +01:00
Nick Gasson
c86377790f
Automatically convert constant bit strings to integers
2008-07-17 14:26:35 +01:00
Nick Gasson
2a791bfb38
Assignment to arrays
2008-07-17 13:41:44 +01:00
Nick Gasson
1d3ac6bc1f
Generate VHDL array type declarations of Verilog arrays
2008-07-17 13:08:55 +01:00
Nick Gasson
3fa5a04947
Merge branch 'vhdl' into array
2008-07-17 12:01:09 +01:00
Nick Gasson
7c5b0f737c
Class for VHDL type declarations
2008-07-17 11:59:02 +01:00
Nick Gasson
c116808fdb
Remove duplicated code
2008-07-17 11:46:36 +01:00
Nick Gasson
553f3d77a9
Code for VHDL array type
2008-07-17 11:43:59 +01:00
Nick Gasson
642fbe9fc5
Correct check for arrays
2008-07-17 11:31:06 +01:00
Nick Gasson
395a2248d8
Make sure 1-bit constants are std_logic not (un)signed
2008-07-16 16:52:15 +01:00
Nick Gasson
be67cae29f
Add translation for IVL_ST_CASEX
2008-07-16 16:42:44 +01:00
Nick Gasson
f62a00bedb
Fix LPM binop with different signedness
...
Need to explicitly cast between signed/unsigned to
make sure both arguments have the same type or the
VHDL won't compile.
2008-07-16 16:20:08 +01:00
Nick Gasson
646a6056a2
Add IVL_LPM_CMP_EEQ support
2008-07-16 12:50:55 +01:00
Nick Gasson
4504c2bceb
Fix initialisation order bug with `if' statements
...
If an assignment appears inside an if statement branch
it could be incorrectly used as the signal's initial
value.
2008-07-16 12:11:00 +01:00
Nick Gasson
d343db34fd
Fix initialisation order
...
Initial processes set a magic flag in the code generator
which allows it to push constant assignments into the
VHDL signal initialisation and omit the assignment.
However, it should only do this if the signal has not
already been read (otherwise the previous read would
not get the undefined value as expected)
2008-07-16 12:00:11 +01:00
Nick Gasson
b5e12077b2
Fix assignment to lval slice
...
It was broken in yeserday's refactoring
2008-07-15 18:40:30 +01:00
Nick Gasson
f3753ea9ad
Add warning that arrays are not yet implemented
2008-07-15 18:09:18 +01:00
Nick Gasson
45e289d32d
Implement IVL_LPM_SHIFTL/R
2008-07-15 18:01:37 +01:00
Nick Gasson
40cabff44f
Leave blank line at end of function
2008-07-15 16:30:50 +01:00
Nick Gasson
a9c98ad5f2
Handle `if' with empty cond_true part
...
Fixes assertion failure with following statement:
if (foo)
begin
end
else
...
2008-07-15 14:26:19 +01:00
Nick Gasson
b8e758edf0
Refactor LPM code
2008-07-15 14:09:24 +01:00
Nick Gasson
0b48f69b4e
Tidy up blocking assignment code
2008-07-15 10:44:48 +01:00
Nick Gasson
d1e7e325b7
Remove redundant edge_detector function
2008-07-14 21:34:48 +01:00
Nick Gasson
75b1db0add
Fix assignment with ternary RHS
...
This was also broken in the last commit
2008-07-14 21:27:21 +01:00
Nick Gasson
6e965523a1
Fix PV assignment (was broken in last commit)
2008-07-14 21:09:19 +01:00
Nick Gasson
8589c0691b
Refactor assignment code
2008-07-14 21:04:09 +01:00
Nick Gasson
99ef8ec4f1
Simplify edge detector code
...
Now generates a `wait until' statement rather than a
sensitivity list.
2008-07-14 20:29:49 +01:00
Nick Gasson
d22c9a8b05
Simplify blocking assignment
...
Now generates 'wait for 0 ns' after non-blocking assignment
2008-07-14 19:54:45 +01:00
Nick Gasson
f84f50842c
Support bufif for tri1 nets
2008-07-14 19:13:11 +01:00
Nick Gasson
65720f49fe
Simple bufif cases
2008-07-14 19:00:58 +01:00
Nick Gasson
6243736481
Pull-up/pull-down logic devices
2008-07-14 12:04:20 +01:00
Nick Gasson
e331e4831b
Fix nexus_to_expr where nexus has IVL_LPM_SELECT_PV
2008-07-14 11:53:38 +01:00
Nick Gasson
78ee61558d
Remove redundant test
...
Signal is guaranteed to appear in arch_scope or its parent
by the surrounding `if' statement.
2008-07-13 15:27:07 +01:00