Skip to content

Commit

Permalink
Update docs, fix multiple initial block case
Browse files Browse the repository at this point in the history
Signed-off-by: Bartłomiej Chmiel <bchmiel@antmicro.com>
  • Loading branch information
b-chmiel committed Mar 4, 2025
1 parent 8ac3b15 commit c35b606
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
17 changes: 7 additions & 10 deletions docs/guide/languages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -451,17 +451,14 @@ disable
force, release
Verilator supports the procedural `force` (and corresponding `release`)
statement. However, the behavior of the `force` statement does not
entirely comply with IEEE 1800:
entirely comply with IEEE 1800-2023:
1. Using forced variable as a value to another force statement is currently
not supported. Force statement that depends on the other one is ignored.
2. Function calls on the RHS of force statements are not reevaluated when
their dependencies change. Value from first call is forced.
3. Forcing at time 0 from different active block immediately updates
forced variable.
4. Force/release with procedural continuous assignment is not supported.
Assignment is treated as procedural one.
5. Expressions using multiple VarRefs on forced RHS are not sensitive to
dependency changes.
not supported. The dependant force statement is forced by an initial
constant value.
2. Force/release with procedural continuous assignment is not supported.
Assignment is treated as a procedural one.
3. Expressions using multiple variable references or function calls on
forced right-hand side are not sensitive to dependency changes.

inside
Inside expressions may not include unpacked array traversal or $ as an
Expand Down
2 changes: 1 addition & 1 deletion src/V3Force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ForceState final {
AstAssign* const assignp = new AstAssign{flp, lhsp, rhsp};
AstActive* const activep = new AstActive{
flp, "force-init",
new AstSenTree{flp, new AstSenItem{flp, AstSenItem::Initial{}}}};
new AstSenTree{flp, new AstSenItem{flp, AstSenItem::Static{}}}};
activep->sensesStorep(activep->sensesp());

activep->addStmtsp(new AstInitial{flp, assignp});
Expand Down
2 changes: 0 additions & 2 deletions test_regress/t/t_force_initial.out

This file was deleted.

2 changes: 1 addition & 1 deletion test_regress/t/t_force_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

test.compile(verilator_flags2=["--exe", "--main", "--timing"])

test.execute(expect_filename=test.golden_filename)
test.execute()

test.passes()
11 changes: 5 additions & 6 deletions test_regress/t/t_force_initial.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ module t;
a = 1;
#1;
`checkh(a, 1);
// TODO trigger forced variable update from different initial block.
`checkh(b, 1);

a = 2;
a = 3;
#1;
`checkh(a, 2);
`checkh(b, 2);
`checkh(a, 3);
`checkh(b, 3);

release b;
`checkh(a, 2);
`checkh(b, 2);
`checkh(a, 3);
`checkh(b, 3);

b = 0;
#1;
Expand Down

0 comments on commit c35b606

Please sign in to comment.