Compare commits

..
282 Commits
Author SHA1 Message Date
Wilson Snyder d3797ade95 Version bump 2020-04-04 08:40:47 -04:00
Wilson Snyder 19b472cf0b Internals: Cleanup unused nodep in visitors. No functional change intended. 2020-04-04 08:31:14 -04:00
Wilson Snyder 38a31ae168 Cleanup misc clang-tidy warnings. No functional change intended 2020-04-03 22:31:54 -04:00
Wilson Snyder 27516b565d Commentary 2020-04-03 20:08:24 -04:00
Wilson Snyder c288a7bfb9 Add GCC10-style line number prefix when showing source text for errors. 2020-04-03 20:07:46 -04:00
Maciej Sobkowski b44cd57866 Add myself to CONTRIBUTORS, #2223 2020-04-03 18:06:48 -04:00
Wilson Snyder b88a7f5152 Commentary - sort names. 2020-04-03 17:59:19 -04:00
Marco Widmer 7f9aa057bf Support split_var in vit files (#2219) 2020-04-03 08:08:23 -04:00
Marco Widmer 305b4f3c75 Fix configuration file documentation (#2221) 2020-04-02 17:32:06 -04:00
Wilson Snyder 6f4a8fe695 Fix Travis-CI failures. 2020-04-02 09:22:10 -04:00
Wilson Snyder 8aec436b5e Commentary 2020-04-02 08:26:06 -04:00
Wilson Snyder aef2b7ea3c Internals: clang-format cleanup. No functional change. 2020-04-02 08:25:44 -04:00
Wilson Snyder dcde026bac With --Wpedantic, report forward typedefs that are unused. 2020-04-02 07:39:14 -04:00
Wilson Snyder 926209706f Report REALCVT on $display format mistakes. 2020-04-01 20:42:47 -04:00
Wilson Snyder bd5d4c61c6 Suppress REALCVT for small whole real numbers. 2020-04-01 19:24:07 -04:00
Wilson Snyder 19abce5535 Suppress REALCVT for whole real numbers. 2020-04-01 18:43:53 -04:00
Wilson Snyder ab058c85bf Fix clang warning. 2020-04-01 12:40:49 -04:00
Wilson Snyder 4361c4b57a Add vlsint8_t types. 2020-03-31 21:30:18 -04:00
Wilson Snyder e6beab4037 Fix implicit conversion of floats to wide integers. 2020-03-31 20:42:07 -04:00
Wilson Snyder ebeb645539 Commentary 2020-03-30 20:09:55 -04:00
Wilson Snyder 5c72f01598 Fix assertions with unique case inside, #2199. 2020-03-30 18:13:51 -04:00
Wilson Snyder 0cf44a9c4f Internals: Refactor InsideRange common code. No functional change intended. 2020-03-30 18:12:50 -04:00
Sean Cross 1fe5d5db79 Fix mingw build (#2215)
* v3Os: include <windows.h> instead of <winnt.h>

The windows.h header file should be included prior to any other headers,
in order to ensure all definitions are available.  By only including
some headers, such as winnt.h, many "undefined symbol" messages are
generated.

Include "windows.h" to fix the build on msys2 under mingw64.

Signed-off-by: Sean Cross <[email protected]>

* configure: check for bcrypt and psapi on windows

These two libraries must be linked in order to have access to
BCryptGenRandom and GetProcessMemoryInfo respectively.

Signed-off-by: Sean Cross <[email protected]>
2020-03-29 12:29:40 -04:00
Sean Cross a1a2650f1e Modernize va args (#2214)
Verilator uses a form of variadic macros that are nonstandard, making it
unable to be compiled under MSVC.  Replace the old synax with the
standard syntax.  This fixes MSVC usage.

Signed-off-by: Sean Cross <[email protected]>
2020-03-29 10:29:12 -04:00
Wilson Snyder 07d00f26aa Fix docker exit status when Verilator fails, #2153. 2020-03-28 19:15:06 -04:00
Wilson Snyder 8d3d185e3b Fix docker exit status when Verilator fails, #2153. 2020-03-28 17:25:20 -04:00
Wilson Snyder 81a63b0c7d Commentary 2020-03-28 17:18:12 -04:00
Matthew Ballance 510be53521 Expose VPI cbNextDeadline via the public API (#2212)
Signed-off-by: Matthew Ballance <[email protected]>
2020-03-28 13:47:21 -04:00
Wilson Snyder 4145a38c47 Fix duplicate typedefs in generate for, #2205. 2020-03-26 18:10:20 -04:00
Wilson Snyder 590b1853d0 Fix packages as enum base types, #2202. 2020-03-24 17:57:12 -04:00
Wilson Snyder 08a51e3e09 Fix VCD open with empty filename, #2198. 2020-03-24 17:32:47 -04:00
Wilson Snyder 75ebe7a4be Update gtkwave from upstream. 2020-03-21 21:45:57 -04:00
Wilson Snyder 1e0e51edd3 Fix parameter type redeclaring a type, #2195. 2020-03-21 12:13:55 -04:00
Wilson Snyder 0ca07e4d58 Tests: Remove t_emit_memb_limit/vltmt as slow 2020-03-21 12:08:38 -04:00
Wilson Snyder 1ce360ed5b Add SPDX license identifiers. No functional change. 2020-03-21 11:24:24 -04:00
Wilson Snyder 172583eb03 Commentary - fix error regexp, #2191. 2020-03-17 15:39:50 -04:00
Wilson Snyder c2b49f0174 Internals: clang-format cleanups. No functional change. 2020-03-15 23:20:33 -04:00
Wilson Snyder 92d62a6568 Internals: clang-format cleanups for V3Inline. No functional change. 2020-03-15 22:30:20 -04:00
Wilson Snyder 5d9d1cc09f Internals: Favor const_iterator (in a few obvious spots, more needed). No functional change. 2020-03-15 18:34:09 -04:00
Wilson Snyder 57068b95ef Internals: Move code, no functional change. 2020-03-15 13:39:36 -04:00
Wilson Snyder 5f63b24c50 Change --quiet-exit to also suppress 'Exiting due to N errors'. 2020-03-15 08:09:51 -04:00
Wilson Snyder 81c659957e Add column numbers to errors and warnings. 2020-03-14 22:02:42 -04:00
Wilson Snyder ee8dd32c04 Check and document error format, #2191. 2020-03-14 21:48:26 -04:00
Wilson Snyder 0a755e6ecf Tests: Favor use of expect_filename. No functional change. 2020-03-14 17:42:15 -04:00
Wilson Snyder e6c91f59ab Tests: Allow --numsets 2/2 2020-03-09 17:57:27 -04:00
Wilson Snyder 9f947bcb5f Internals: Refactor flags in V3Undriven. No functional change intended. 2020-03-08 21:37:07 -04:00
Wilson Snyder 135ccf6595 Tests: Fix ormux on travis. 2020-03-08 09:48:13 -04:00
Wilson Snyder 9a2a3f8db7 Tests: Add t_gate_ormux, #2186, #2187. 2020-03-08 09:18:12 -04:00
Wilson Snyder 8ccc17f30b Add setting VM_PARALLEL_BUILDS=1 when using --output-split, #2185. 2020-03-08 09:03:29 -04:00
Wilson Snyder 9392eac6a7 devel release 2020-03-08 08:40:33 -04:00
Wilson Snyder 95c4b6aaba Version bump 2020-03-08 08:38:53 -04:00
Wilson Snyder 1c1319079b Tests: Add driver --hashset for Travis. 2020-03-07 22:02:03 -05:00
Wilson Snyder 328fef8190 Tests: Add driver --hashset for Travis. 2020-03-07 21:38:44 -05:00
Wilson Snyder e2dec043a0 Tests: Backout part of previous commit. 2020-03-07 21:01:36 -05:00
Wilson Snyder bd42e31b2a Tests: For travis, skip Bit::Vector and show intall dates. 2020-03-07 20:08:41 -05:00
Wilson Snyder 6d73237b27 Travis: Don't cpan test to save time. 2020-03-07 19:24:05 -05:00
Wilson Snyder 6c6d70a5e5 Fix FST when multi-model tracing. 2020-03-07 18:39:58 -05:00
Wilson Snyder 6f49f802b1 Tests: Add fst_identical. 2020-03-07 16:59:46 -05:00
Wilson Snyder 808c958d42 Internals: Add AstNodeCCall and other items towards classes. 2020-03-07 12:52:11 -05:00
Wilson Snyder 961ac49c5c Internals: Merge parse type from classes branch. No functional change intended. 2020-03-07 11:00:57 -05:00
Wilson Snyder 2d52f525c5 Add --structs-packed for forward compatibility, #1541. 2020-03-07 10:51:06 -05:00
Wilson Snyder e70cba77e6 Add support for dynamic arrays, #379. 2020-03-07 10:24:27 -05:00
Wilson Snyder 8054fc47ea Internals: Refectoring. No functional change intended. 2020-03-07 08:24:57 -05:00
Wilson Snyder e673875b3b Fix clang warning, last commit. 2020-03-06 07:31:56 -05:00
Wilson Snyder 29923b78fd Internals: Use VL_TO_STRING instead of to_string. 2020-03-05 23:28:41 -05:00
Wilson Snyder 135cbcd79a Internals: Move 'new' unsupported forward from parse into Ast. 2020-03-05 22:33:31 -05:00
Wilson Snyder 75ecad591a Implement $displayb/o/h, $writeb/o/h, etc, Closes #1637. 2020-03-05 21:49:25 -05:00
Wilson Snyder c108f5def9 Commentary, Closes #2177. 2020-03-05 19:09:58 -05:00
Wilson Snyder dab1cb610a Tests: Allow iv to run SystemVerilog tests 2020-03-05 18:12:10 -05:00
Wilson Snyder fd656f6cc1 Fix clang asserted missing lock on m_dumping. 2020-03-03 19:20:04 -05:00
Wilson Snyder a7e65379fa Ignore $dumpflush, think causes travis thread error. 2020-03-02 17:56:42 -05:00
Wilson Snyder 905067d13f Fix $dumpvar multithreaded assert, broke last commit. 2020-03-02 07:43:10 -05:00
Wilson Snyder 30a33a6104 Add support for and , #2126. 2020-03-01 21:39:23 -05:00
Wilson Snyder 0ca0e07354 Internals: Vcd doesn't need code when registering. No functional change intended. 2020-02-29 20:42:52 -05:00
Wilson Snyder aac02acf92 Tests: Rename 2020-02-29 10:06:52 -05:00
Wilson Snyder 082c9e0b1d Tests: Add two-design trace tests. 2020-02-29 09:44:51 -05:00
Wilson Snyder a7bd934fe3 Tests: Cleanup false used as 0. No functional change. 2020-02-29 08:56:49 -05:00
David Stanford e98a380b44 Tests: Update some tests to skip if prerequisites aren't installed (#2181) 2020-02-29 07:20:23 -05:00
Wilson Snyder 4878fe3a1f Add split_var metacomment to assist UNOPTFLAT fixes, #2066. 2020-02-28 19:15:08 -05:00
Wilson Snyder c6b755a12e Commentary 2020-02-27 19:35:49 -05:00
Wilson Snyder 991d81cd0a Recommend -Os. 2020-02-27 07:46:34 -05:00
Wilson Snyder c06a97a221 Remove OBJCACHE_HOSTS; dead code. 2020-02-27 07:18:15 -05:00
Wilson Snyder 6131bcdbb0 Verilator_gantt: Fix CPU count in report. 2020-02-27 07:12:50 -05:00
Wilson Snyder 68b6a0b667 Fix genblk naming with directly nested generate blocks, #2176. 2020-02-25 22:21:16 -05:00
Wilson Snyder 4c438bbc67 Commentary 2020-02-25 19:01:14 -05:00
Wilson Snyder 5b83484f20 Remove dead genblk code & some cleanups. 2020-02-25 18:57:51 -05:00
Wilson Snyder 93ac79981b Tests: Rename t_var_dotted. No functional change. 2020-02-24 18:51:44 -05:00
Wilson Snyder c9b74847d1 Docs: Tighter margins, save 10 pages. 2020-02-24 18:11:56 -05:00
Wilson Snyder 23eb96579c Fix duplicate __STDC_FORMAT_MACROS definition. 2020-02-24 18:11:41 -05:00
Todd Strader 8319ea6c73 Changes 2020-02-24 06:36:13 -05:00
Todd Strader 60f82961b4 De-tabify 2020-02-24 06:36:13 -05:00
Todd Strader f7d1c6ca72 emacs verilog-batch-indent 2020-02-24 06:36:13 -05:00
Todd Strader 4b4f10f5e6 Follow other clock gating examples 2020-02-24 06:36:13 -05:00
Todd Strader 120f62fe85 Fix is probably to mark as a clock 2020-02-24 06:36:13 -05:00
Todd Strader db6ecbd57e Test for #2169 2020-02-24 06:36:13 -05:00
Wilson Snyder 28e19cef90 Fix undeclared VL_SHIFTR_WWQ, #2114. 2020-02-23 19:33:37 -05:00
Tobias Wölfel 18f8cd0529 Allow assert disable (#2168)
* Add +verilator+noassert flag

This allows to disable the assert check per simulation argument.

* Add AssertOn check for assert

Insert the check AssertOn to allow disabling of asserts.
Asserts can be disabled by not using the `--assert` flag or by calling
`AssertOn(false)`, or passing the "+verilator+noassert" runtime flag.
Add tests for this behavior.
Bad tests check that the assert still causes a stop.
Non bad tests check that asserts are properly disabled and cause no stop
of the simulation.

Fixes #2162.

Signed-off-by: Tobias Wölfel <[email protected]>

* Correct file location

Signed-off-by: Tobias Wölfel <[email protected]>

* Add description for single test execution

Without this description it is not obvious how to run a single test from
the regression test suite.

Signed-off-by: Tobias Wölfel <[email protected]>
2020-02-15 18:17:23 -06:00
Wilson Snyder 02786b3f09 Commentary 2020-02-12 22:46:59 -05:00
Wilson Snyder 70358e8587 Fix compiler warning. 2020-02-08 10:58:07 -05:00
Wilson Snyder 95b66feeb8 devel release 2020-02-08 09:16:35 -05:00
Wilson Snyder 890cecc15b Version bump 2020-02-08 09:03:51 -05:00
Wilson Snyder f7bad37e88 Fix GCC 4.4.7 errors. 2020-02-08 07:09:41 -05:00
Wilson Snyder 134b5efd70 Tests: Ignore obj_iv. 2020-02-07 18:00:07 -05:00
Wilson Snyder 0d6ebf21b3 Suggest svSetScope, #2152. 2020-02-07 17:59:02 -05:00
Wilson Snyder 2d1b804e80 Fix OpenSolaris issues, #2154. 2020-02-07 17:35:04 -05:00
Todd Strader 77f1b3eef4 Support parameter access from arrays of interfaces, #2155. 2020-02-06 19:19:23 -05:00
Wilson Snyder 609a5dc26d Fix cppcheck warnings. No functional change intended. 2020-02-03 23:21:56 -05:00
Wilson Snyder 0aabe6ce00 Internals: Fix cppcheck warning including missing init. 2020-02-03 22:10:29 -05:00
Wilson Snyder 20cc4e57d5 tests: Driver style fix. 2020-02-03 18:43:56 -05:00
Wilson Snyder f3ebdc40c6 Fix some coverage lost when multithreaded, #2151. 2020-02-03 18:43:41 -05:00
Wilson Snyder 2ca9f73b31 Internals: Cleanup Emit towards constructor/destructor output. 2020-02-02 21:15:07 -05:00
Wilson Snyder 73f5e3f808 Internals: Add missing const. No functional change. 2020-02-02 10:34:29 -05:00
Wilson Snyder 8d3dad510f Fix unused variable. 2020-02-02 06:52:28 -05:00
Wilson Snyder 2576c136f6 Fix `pragma pedantic check to work with -E. 2020-02-01 22:03:18 -05:00
Wilson Snyder a8ad97eef2 Add VL_CACHE_LINE_BYTES and use 64 as defult. 2020-02-01 20:28:03 -05:00
Wilson Snyder ee7da1e690 Remove .h comments for empty sections. 2020-02-01 20:11:21 -05:00
Wilson Snyder 969a46faf6 Internals: V3Emit refactoring. No functional change intended. 2020-02-01 19:32:04 -05:00
Wilson Snyder 820df28ad9 Internals: V3CUse state refactoring. No functional change intended. 2020-02-01 19:11:19 -05:00
Yutetsu TAKATSUKASA 50fb7fc8b4 Tests: Resolve self assignment in t_unoptflat_simple_2, Closes #2149. 2020-02-01 19:07:02 -05:00
Wilson Snyder 119162912a Internals: Determine emit forward declaraions in new pass, towards classes. 2020-02-01 16:51:05 -05:00
Wilson Snyder 80d94891e1 Internals: Allow const & non-member CFuncs for class branch. No functional change. 2020-02-01 10:57:55 -05:00
Geza Lore f00ff61559 Link Verilator binary partially statically, Closes #2146.
The build is now by default configured to link performance critical
libraries (libgcc, libstdc++, libtcmalloc) statically. This improves
Verilation speed by between 4.5-7% based on my measurements as it
eliminates approx 20% of the mispredicted branches from the execution.
With partial static linking, the size of the .text section in
verilator_bin is increased by about 14%, and the binary is itself only
about 800KB bigger on disk, so hopefully this is not a big issue in
exchange for the faster compilation speed. A configure option
"--disable-partial-static" is provided to restore the old behaviour of
linking everything dynamically.

Note: This patch also changes to use libtcmalloc_minimal, which is all
we really need and itself has fewer dependencies.
2020-01-31 19:13:55 -05:00
Wilson Snyder 2d195ebae5 Cleanup IEEE references. 2020-01-30 20:23:57 -05:00
Wilson Snyder 9a6bc3ddcf Commentary 2020-01-30 19:52:58 -05:00
Wilson Snyder d218f1746c Add warning on genvar in normal for loop, #2143. 2020-01-29 21:16:44 -05:00
Yutetsu TAKATSUKASA 8d8eb1b9f3 Tests: Resolve racing among initial blocks in t_display_signed.v, #2144. 2020-01-29 17:07:45 -05:00
Wilson Snyder d4614c290e Fix WIDTH warning on </<= of narrower value, #2141. 2020-01-28 20:10:10 -05:00
Tobias Rosenkranz 027cce35c0 Support enum.next(k) with constant k > 1, #2125. 2020-01-27 17:25:25 -05:00
Wilson Snyder 9fd81b2c6b Support string character access via indexing. 2020-01-26 16:38:22 -05:00
Wilson Snyder 5430e4ac9b Cleanup more errors showing data types. 2020-01-26 15:54:57 -05:00
Wilson Snyder 619214b48f Support $sampled. 2020-01-26 13:38:15 -05:00
Wilson Snyder 68fa82fb14 Support $typename, and use to cleanup error messages. 2020-01-26 13:21:25 -05:00
Wilson Snyder cac50282eb Fix pattern replication without key. 2020-01-26 11:38:34 -05:00
Wilson Snyder b50ef9ff39 Tests: Disabled test for 5.9. 2020-01-26 11:23:52 -05:00
Wilson Snyder 8a8f1135b7 Support type(expression) operator, #1650. 2020-01-26 10:28:13 -05:00
Wilson Snyder f0b2336345 Internals: Fix cell recursion with future module-in-module. 2020-01-25 18:15:55 -05:00
Wilson Snyder 52907e7b02 astgen: Preserve #line, #2138. 2020-01-25 15:36:37 -05:00
Geza Lore ef5250f0ca Internals: Further performance improvement of AstNode type tests, #2138. No functional change intended.
Replace the virtual type() method on AstNode with a non-virtual, inlined
accessor to a const member variable m_type.  This means that in order to be
able to use this for type testing, it needs to be initialized based on the
final type of the node. This is achieved by passing the relevant AstType
value back through the constructor call chain. Most of the boilerplate
involved is auto generated by first feeding V3AstNodes.h through astgen to
get V3AstNodes__gen.h, which is then included in V3Ast.h. No client code
needs to be aware and there is no functional change intended.

Eliminating the virtual function call to fetch the node type identifier
results in measured compilation speed improvement of 5-10% as it
eliminates up to 20% of all mispredicted branches from the execution.
2020-01-25 15:29:44 -05:00
Wilson Snyder eafed88a6e Internals: Add assertions. No functional change intended. 2020-01-25 10:19:59 -05:00
Wilson Snyder d64e6b3f9c Internals: Refactoring towards classes. No functional change intended. 2020-01-25 09:33:43 -05:00
Wilson Snyder d68ffba8cd Internals: Rename to prefixNameProtect. No functional change intended. 2020-01-25 09:16:00 -05:00
Wilson Snyder f0f370490f Internals: Style cleanups. 2020-01-25 07:59:25 -05:00
Wilson Snyder 708fd36563 Tests: Show entering/exit so goto-error works on compile errors. 2020-01-24 22:40:19 -05:00
Wilson Snyder a4e8d39932 Spelling fixes 2020-01-24 20:10:44 -05:00
Wilson Snyder 8f0e8e0696 Fix FST tracing of enums inside structs. 2020-01-24 19:46:46 -05:00
Wilson Snyder 11380bc3b2 Merge from upstream gtkwave includes. 2020-01-23 17:48:27 -05:00
Geza Lore 7ab2bdb6bb Support libgoogle-perftools-dev's libtcmalloc if available. #2137.
As Verilator continuously allocates and releases small objects (e.g.:
AstNode, V3GraphVertex, V3GraphEdge), it spends a significant amount of
time in malloc/free and friends. This patch adds the --enable-tcmalloc
configure option to link Verilator against the high performance malloc
implementation library libtcmalloc. The default is to use libtcmalloc if
available on the system. Note that there are no source code change, we
are simply replacing the standard library memory allocation functions.

Measured major compilation speed improvement of 27% when running
Verilator with -O3 on a large design.
2020-01-23 17:32:19 -05:00
Pieter Kapsenberg 5d037c3c8c Docs: Add initial XML dovcument description. #2136. 2020-01-23 07:26:11 -05:00
Geza Lore c5d04631d1 Internals: More performance efficient AstNode casting. Closes #2133.
dynamic_cast can have large run-time cost, so here we implement type
tests for AstNode instances by checking the unique type() property, which
in turn is a constant generated by astgen. For leaf types in the AstNode
type hierarchy, this is a simple equality check. To handle intermediate
types, we generate the type ids of leaf types in a pre-order traversal of
the type hierarchy. This yields contiguous ranges of ids for sub-type
trees, which means we can check membership of a non-leaf type via 2
comparisons against a low and high id. This single patch makes Verilator
itself 6-13% faster (depending on which optimizations are enabled) on a
large design of over 250k lines of Verilog.
2020-01-22 19:07:48 -05:00
Pieter Kapsenberg 957c1d606b Add detailed XML location to cell elements, #2134, #2122.
This was accidentally omitted from the previous PR #2122.
2020-01-22 07:18:50 -05:00
Wilson Snyder 48dd358c03 Fix clang warnings from override. 2020-01-21 20:22:32 -05:00
Geza Lore 220daa5f33 Internals: Restore AstNode naming property. #2133.
The intention was that all subclasses of AstNode which are
intermediate must be abstract as well and called AstNode*. This was
violated recently by 28b9db1903. This
patch restores that property by:
- Renaming AstFile to AstNodeFile
- Introducing AstNodeSimpleText as the common base of AstText and
  AstTextBlock, rather than AstTextBlock deriving from AstText.
2020-01-21 19:54:14 -05:00
Wilson Snyder d76b5b7823 Fix C++11 intrusion. 2020-01-21 19:45:44 -05:00
Wilson Snyder 4266d31443 Internals: Add VL_OVERRIDE to includes. No functional change intended. 2020-01-21 18:02:23 -05:00
Yutetsu TAKATSUKASA fbdf5f2dad Internals: Mark all visit() with VL_OVERRIDE. Closes #2132.
* Add VL_OVERRIDE macro so that compiler can tell my typo when trying to override a function.

* Mark visit() with VL_OVERRIDE. No functional change intended.
2020-01-21 17:35:56 -05:00
Stefan Wallentowitz 8e26bdd098 Fix vpi scope naming (#2130)
Dedot and shorten the name so that public modules and interface cells
are accessible too via VPI.

Fixes #2109
2020-01-21 17:03:21 +01:00
Stefan Wallentowitz 22088c907f Set maximum number width (#2128)
Adjust the maximum number width to 64K. Add --max-num-width option to
adjust this setting.

Closes #2082
2020-01-21 12:17:31 +01:00
Matthew Ballance d87648c258 Correct FST-support issue with some GCC versions. Closes #2129. 2020-01-20 17:33:40 -05:00
Wilson Snyder abf3850d08 Internals: Misc cleanups for classes. 2020-01-20 16:53:27 -05:00
Pieter Kapsenberg 4a122fd0f2 Add detailed location to XML output (#2122)
* Add detailed location to XML output

* Fixing build failures

* less cryptic regulary expressions

* correcting typo in test

* Adding file letter to the location attribute, and cleaning up the regular expression in the tests.

* Add remaining test expected output files for XML changes

* spacing fix, adding documentation on changes
2020-01-20 14:08:13 -05:00
Wilson Snyder 0352ceea44 Internals: Refactor some emit code towards classes. No functional change intended. 2020-01-20 14:07:03 -05:00
Wilson Snyder e8ff191a17 Internals: Prepare for hierarchical NodeModule's. No functional change intended. 2020-01-20 13:27:27 -05:00
Wilson Snyder 5ae09daf5b Internals: Style cleanup. No functional change. 2020-01-20 11:56:08 -05:00
Wilson Snyder 1acff950d0 Commentary: Add deprecations section to docs. Closes #2081. 2020-01-20 10:06:45 -05:00
Stefan Wallentowitz f28d837930 Docker: Tag stable as latest (#2098) 2020-01-20 15:53:26 +01:00
Pieter Kapsenberg 1dd9a74b6c Internals: Move V3Global function definitions to their own files. No functional change intended. Closes #2120. 2020-01-19 07:23:26 -05:00
Pieter Kapsenberg 165833a97c Add compile_commands.json to .gitignore (#2119)
When running make with the "bear" command, the generated
compile_commands.json file shouldn't be considered new source. This file
allows clangd-based code completion tools (e.g. YouCompleteMe) to know
the flags that each file was compiled with.
2020-01-18 22:44:03 -05:00
Wilson Snyder 18e837336a Internals: Rename MethodCall. No functional change. 2020-01-18 14:11:05 -05:00
Wilson Snyder 835f668aaa Internals: Refactor statement tracking. No functional change intended. 2020-01-18 13:02:42 -05:00
Wilson Snyder 09199f79a6 Internals: Add VL_DO_CLEAR delete protections. No functional change intended. 2020-01-18 10:29:49 -05:00
Wilson Snyder 2f4954ca68 Commentary 2020-01-18 09:18:57 -05:00
Wilson Snyder 7024ea8cb6 Cleaner tristate error. #2117. 2020-01-18 07:56:50 -05:00
Wilson Snyder 623c4ec103 Internals: Create VL_DO_DANGLING. No functional change intended. 2020-01-16 20:17:11 -05:00
Wilson Snyder 023526ad4b Internals: Minor refactoring from class branch. 2020-01-15 20:18:12 -05:00
Wilson Snyder e2ba1c041f Commentary 2020-01-15 20:09:19 -05:00
Tobias Rosenkranz b41b9417b9 Fix sign compare warning. Closes #2112. 2020-01-15 07:40:22 -05:00
Pieter Kapsenberg 4443ab34fd Support left justified . Closes #2101. 2020-01-15 07:32:45 -05:00
Wilson Snyder e9a309ea8d Clang warning fix. 2020-01-15 07:27:04 -05:00
Wilson Snyder 81e8127168 Add parameter values in XML. #2110. 2020-01-14 18:51:20 -05:00
Wilson Snyder 47803c3591 Tests: Better message for contributors. 2020-01-14 17:49:04 -05:00
Wilson Snyder af38e8d387 Improve error on > 127 char modnames. #2106. 2020-01-14 07:33:12 -05:00
Wilson Snyder 67bb0c78c8 Codacity fix. 2020-01-14 07:13:35 -05:00
Wilson Snyder 918df2e618 Support / with assoc arrarys. Closes #2100. 2020-01-14 07:01:17 -05:00
Wilson Snyder 7bed17b14b Fix clang warning 2020-01-13 19:01:30 -05:00
Stefan Wallentowitz fad465abf1 Add lint_off -match waivers (#2102)
* Add more directives to configuration files

Allow to set the same directives in configuration files that can also
be set by comment attributes (such as /* verilator public */ etc).

* Add support for lint messsage waivers

Add configuration file switch '-match' for lint_off. It takes a string
with wildcards allowed and warnings will be matched against it (if
rule and file also match). If it matches, the warning is waived.

Fixes #1649 and #1514 
Closes #2072
2020-01-12 10:03:17 +01:00
Wilson Snyder 98fb7ec193 Commentary. 2020-01-11 21:08:20 -05:00
Wilson Snyder b71eb76252 For / allow 64-bit addressing. 2020-01-11 14:08:07 -05:00
Wilson Snyder 1d2a7b2f41 Style cleanups. No functional change. 2020-01-11 12:36:30 -05:00
Wilson Snyder cd38e88fb8 For travis, add VERILATOR_AUTHOR_SITE to get -Werror. Closes #2099. 2020-01-11 10:52:13 -05:00
Todd Strader a15aa0b82b Fix clang warning 2020-01-11 09:59:42 -05:00
Wilson Snyder fe94f9891b Add error on misused define. 2020-01-11 09:16:26 -05:00
Wilson Snyder fe9cf9bd42 devel release 2020-01-11 09:08:33 -05:00
Wilson Snyder 0c99bee4b1 Version bump 2020-01-11 06:54:36 -05:00
Wilson Snyder f66dacd185 Remove some make clean files. 2020-01-11 06:53:52 -05:00
Wilson Snyder 5f9ceb99a7 Cleanup spacing. 2020-01-10 21:37:53 -05:00
Wilson Snyder 2638f9db19 Error cleanups. 2020-01-10 19:18:27 -05:00
Wilson Snyder 8859cbf5bc Commentary 2020-01-10 19:12:45 -05:00
Wilson Snyder 16bb97687a Tests: Check for missing newlines at EOF. 2020-01-10 18:49:23 -05:00
Wilson Snyder 1234c83953 Fix some C++11 requirements. 2020-01-10 07:07:21 -05:00
Wilson Snyder 2982336ec2 Commentary 2020-01-09 20:29:36 -05:00
Wilson Snyder ca211c3b11 Commentary - Codacy badge fix. 2020-01-09 20:28:33 -05:00
Wilson Snyder 87d126de49 Commentary 2020-01-09 20:09:50 -05:00
Philipp Wagner 4a307742c4 Fix typo in help output (#2096)
The variable is named VM_PARALLEL_BUILDS, not VM_PARALLEL_BUILD.

Signed-off-by: Philipp Wagner <[email protected]>
2020-01-09 20:07:08 -05:00
Wilson Snyder a2911ed933 Fix shebang breaking some shells. Closes #2067. 2020-01-09 20:01:12 -05:00
Wilson Snyder 2a50fafef2 Fix %{number}s with strings. #2093. 2020-01-09 19:39:27 -05:00
Wilson Snyder 029ff69d30 Update .clang-format to allow 6.0.0 to work. 2020-01-09 19:39:14 -05:00
Wilson Snyder aac02c1ed1 Fix expand optimization slowing --lint-only. Closes #2091. 2020-01-09 18:04:49 -05:00
Stefan Wallentowitz 525c79bd0a Add Docker infrastructure (#2087)
This adds files to build and run two Docker images:

 - run: Build a Docker container that can be used as an executable
        drop-in for verilator. This can be useful to test behavior of
        older versions or a development version. The functionality is
        pretty simplistic at the moment for a start.

 - buildenv: Everything needed to build and test Verilator. Useful to
        run quick tests in the cloud or try other compilers. It can
        also serve as basis for further CI integration.
2020-01-09 23:22:15 +01:00
Yutetsu TAKATSUKASA b5c151863a Update .clang-format so that recent clang-format such as LLVM-8 works. (#2092)
Use C++03 because this project needs to compile with the standard.
2020-01-09 10:13:08 -05:00
Wilson Snyder 06247686c5 Codacy cleanups 2020-01-08 19:33:47 -05:00
Wilson Snyder 951a7d867a Commentary 2020-01-08 19:33:42 -05:00
Wilson Snyder 9978cbfa5c Fix tracing -1 index arrays. Closes #2090. 2020-01-08 07:32:31 -05:00
Wilson Snyder f23fe8fd84 Update copyright year. 2020-01-06 18:05:53 -05:00
Stefan Wallentowitz 37dc33a195 Deprecation (#2088)
* Add deprecation warning

* Deprecate -msg in configuration files

* Deprecate sc_clock
2020-01-03 17:27:51 +01:00
Stefan Wallentowitz 924fe235a9 No assign alias for unpacked public variables (#2089)
Public variables are all emitted in the C code and unpacked arrays
arrays are sliced up for this. After inlining public unpacked array
assignments should not be alias assignments but actual assignments, so
that they are sliced and hence emitted properly.

Fixes #2073
2020-01-03 13:44:45 +01:00
Todd Strader 1957b1ebbd Fix permissions on build_vcddiff.sh 2020-01-02 07:40:15 -05:00
Todd Strader b70d1c1349 Update gtkwave files 2020-01-02 07:39:24 -05:00
Stefan Wallentowitz b7665a88db Rename msg to rule in configuration files (#2080)
Rename the -msg switch to -rule in configuration files as it is more
clear.

resolves #2068
2019-12-30 19:15:43 +01:00
Kuba Ober 19c8d32263 Fix SystemC link in the documentation. (#2076) 2019-12-30 18:56:51 +03:00
Stefan Wallentowitz 7b384f7eb7 XML: Add variable attributes (#2079) 2019-12-30 12:55:36 +01:00
Kuba Ober 7bbce51f7b Add include guard to V3InstrCount.h. (#2075)
This is needed for cmake unity build to work.
2019-12-30 06:04:03 +03:00
Kuba Ober ac1cdf7cdf Implement APIs missing on Windows. (#12) 2019-12-28 19:44:24 +03:00
Wilson Snyder c753904a3f Internals: Copy into parser Verilog-Perl rules as comments. No functional change. 2019-12-24 16:15:48 -05:00
Wilson Snyder 8bd43d83b1 Internals: bisonpre should ignore commented BISONPRE lines. 2019-12-24 16:15:47 -05:00
Wilson Snyder ea5b01d9f3 Internals: Rename pexpr. No functional change intended. 2019-12-24 16:04:28 -05:00
Wilson Snyder f540dead79 Internals: new() support code, and misc stuff. 2019-12-24 12:47:27 -05:00
Wilson Snyder 40a847d613 Internals: Refactor some code. No functional change intended. 2019-12-24 10:23:43 -05:00
Wilson Snyder 37b9f254a2 Internals: Add origNameProtect. No functional change intended. 2019-12-24 08:47:30 -05:00
Wilson Snyder c8daab3b46 Internals: Refactor some member handling. No functional change intended. 2019-12-23 20:48:23 -05:00
Wilson Snyder a0d391d695 Tests: Less aggressive contributors check. 2019-12-23 19:01:29 -05:00
Wilson Snyder 5089f997cc Internals: Use standard function for include guards. No functional change intended. 2019-12-23 19:00:17 -05:00
Wilson Snyder 5c59fde92e Fix codacy warning 2019-12-23 18:56:08 -05:00
Wilson Snyder 81ee4930fc Github: Update issue templates 2019-12-23 17:40:50 -05:00
Wilson Snyder 350de3719e Github: Update issue templates 2019-12-23 17:39:38 -05:00
Wilson Snyder a37a127ef1 Github: Update issue templates 2019-12-23 17:37:48 -05:00
W Snyder dc8a0dfd5a Update issue templates 2019-12-23 17:36:26 -05:00
Wilson Snyder 0ca197ec1b Github: Add issue templates 2019-12-23 17:34:53 -05:00
Wilson Snyder f23a7bfdd7 Tests: Check for carriage returns 2019-12-23 17:34:43 -05:00
Peter Monsson 9b998cf6b3 Support implication operator "|->" in assertions, #2069.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-23 16:49:18 -05:00
Wilson Snyder 0f0c3d4684 Internals: Copy into parser Verilog-Perl rules as comments. No functional change. 2019-12-23 16:27:07 -05:00
Wilson Snyder bacbb4cafd Parse join_any/join_none still as unsupported. 2019-12-23 15:19:22 -05:00
Wilson Snyder 4afde8b478 Test class parsing (intended as part of last commit). 2019-12-23 15:18:55 -05:00
Wilson Snyder 2cbfe99ad5 Parse all class constructs, as still unsupported. 2019-12-23 15:03:04 -05:00
Julien Margetts c1fb938a61 Fix huge case statement performance. Closes #1644.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-23 07:47:57 -05:00
Wilson Snyder 49db4d2b66 Internals: Trivial spacing change to force CI rebuild. No functional change. 2019-12-22 20:02:37 -05:00
Wilson Snyder b087673254 Fix output endif spacing. No functional change. 2019-12-22 18:21:43 -05:00
Wilson Snyder 5c361efaea Internals: Minor format cleanups. No functional change. 2019-12-22 18:09:46 -05:00
Peter Monsson ea979c8f83 Fix disable iff in assertions. Closes #1404.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-22 15:49:10 -05:00
Wilson Snyder 3a70bbc70c Update Changes to reflect github issue numbers. 2019-12-22 15:33:45 -05:00
Kuba Ober 3f0e2f7d9d Fix argument in AstConst.m_num.width. (#9) 2019-12-21 10:25:05 -05:00
Kuba Ober c9ca390926 Fix missing <algorithm> header. Pull (#8) 2019-12-20 20:14:52 -05:00
Kuba Ober 4a31b69f84 Decrease the number of chained if-else blocks to fix MSVC build. Pull (#7)
MSVC has a limit of 128 blocks in a chain.
2019-12-20 20:07:50 -05:00
Kuba Ober ee184f3f39 Fix strcasecmp for windows, bug1651.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-20 06:58:05 -05:00
Wilson Snyder 9807025618 Fix infinite loop on some V3Ast internal errors. 2019-12-19 20:07:48 -05:00
Stefan Wallentowitz 9a54b2144b Fix queue issues, bug1643.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-18 18:17:18 -05:00
Wilson Snyder 0465b6a3b1 Fix example makefiles, 1648. 2019-12-18 17:58:24 -05:00
Julien Margetts cafb148a62 Commentary 2019-12-17 18:27:47 -05:00
Stefan Wallentowitz d738501c01 Fix queues as statements, bug1641. 2019-12-17 06:08:41 -05:00
Wilson Snyder 53c6b7df63 Internals: Rename NodeClassDType. No functional change. 2019-12-16 22:46:09 -05:00
Wilson Snyder f514049c04 Add cleaner error on version control conflicts in sources. 2019-12-16 21:54:20 -05:00
Wilson Snyder 83a1bd0675 Support immediate cover statements & refactor coverage internals. 2019-12-16 21:44:20 -05:00
Yutetsu TAKATSUKASA 8cdc0c4e00 Support string putc, getc, substr, bug1606.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-15 08:09:52 -05:00
Wilson Snyder 460e0541f3 Add error when `resetall inside module 2019-12-14 22:04:58 -05:00
Wilson Snyder 2408de16a0 Support bounded queues. 2019-12-14 21:39:47 -05:00
Wilson Snyder 2a1c57ada6 With -Wpedentic, warn about bad `pragma 2019-12-14 10:13:38 -05:00
Wilson Snyder 7387db506d GTKWave: Merge from upstream. 2019-12-14 09:25:36 -05:00
Stefan Wallentowitz 3ac6745658 Add vpiTimeUnit and allow to specify time as string, bug1636.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-13 19:11:37 -05:00
Wilson Snyder 39950d16d0 Ignore `uselib to end-of-line, bug1634. 2019-12-12 20:57:48 -05:00
Todd Strader c62c152048 Commentary 2019-12-12 07:53:08 -05:00
Wilson Snyder 6046b06b17 Tests: Fix no-email contributors. 2019-12-11 18:56:10 -05:00
Julien Margetts f7a06cb54a Fix little endian cell ranges, bug1631.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-11 17:15:45 -05:00
Wilson Snyder 521418d832 Update FST trace API for better performance. 2019-12-10 18:55:09 -05:00
Wilson Snyder 1c643916a3 Tests: Add copy_if_golden to harness. 2019-12-10 18:53:35 -05:00
Todd Strader 9cf5acc43e Install vcddiff for Travis, bug1600. 2019-12-10 05:27:34 -05:00
Yutetsu TAKATSUKASA c2037ddbc5 Support string compare, icompare, ato* methods, bug1606.
Signed-off-by: Wilson Snyder <[email protected]>
2019-12-09 19:17:52 -05:00
Wilson Snyder ca1b083d5c Fix clang warning. 2019-12-09 18:53:56 -05:00
Wilson Snyder c896a76fef Fix clang warning. 2019-12-09 18:25:59 -05:00
Wilson Snyder bd0eadb311 Fix handling user-botch of %d to print real. 2019-12-08 22:48:44 -05:00
Wilson Snyder 62b0d15d2e Add lint check for bad enum 4-state values. 2019-12-08 22:26:54 -05:00
Wilson Snyder 700f2072c0 Framework for WDatas being vectors of 64-bit EDatas, but not supporting this at this time. 2019-12-08 21:36:38 -05:00
Wilson Snyder cda5c53cf9 Add BOUNDED warning and promote bounded queues to unbounded. 2019-12-08 15:56:49 -05:00
Wilson Snyder 3be0eea995 devel release 2019-12-08 13:50:14 -05:00
2871 changed files with 34053 additions and 16796 deletions
+1 -5
View File
@@ -90,10 +90,6 @@ PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000 PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60 PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true ReflowComments: true
SortIncludes: false SortIncludes: false
SortUsingDeclarations: true SortUsingDeclarations: true
@@ -108,7 +104,7 @@ SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
Standard: Cpp11 Standard: Cpp03
TabWidth: 8 TabWidth: 8
UseTab: Never UseTab: Never
... ...
+1
View File
@@ -1,4 +1,5 @@
--- ---
exclude_paths: exclude_paths:
- '.github/**'
- 'ci/build_verilator.sh' - 'ci/build_verilator.sh'
- 'include/vltstd/**' - 'include/vltstd/**'
+14
View File
@@ -0,0 +1,14 @@
---
name: Bug report
about: Something isn't working as expected, and it isn't "Unsupported." (Note our contributor agreement at https://github.com/verilator/verilator/.github/blob/master/CONTRIBUTING.adoc)
title: ''
labels: new
assignees: ''
---
Thanks for taking the time to report this.
Can you attach an example that shows the issue? (Must be openly licensed, ideally in test_regress format.)
May we assist you in trying to fix this yourself?
+16
View File
@@ -0,0 +1,16 @@
---
name: Feature Request
about: Request something should be supported, or a new feature added. (Note our contributor agreement at https://github.com/verilator/verilator/.github/blob/master/CONTRIBUTING.adoc)
title: ''
labels: new
assignees: ''
---
Thanks for taking the time to report this.
What would you like added/supported?
Can you attach an example that runs on other simulators? (Must be openly licensed, ideally in test_regress format.)
May we assist you in trying to fix this yourself?
+10
View File
@@ -0,0 +1,10 @@
---
name: Q and A, or Other
about: Ask a question, not related to a specific bug or feature request. (Note our contributor agreement at https://github.com/verilator/verilator/.github/blob/master/CONTRIBUTING.adoc)
title: ''
labels: new
assignees: ''
---
How may we help - what is your question?
+1
View File
@@ -0,0 +1 @@
We appreciate your contributing to Verilator. If this is your first commit, please add your name to docs/CONTRIBUTORS, and read our contributing guidelines in docs/CONTRIBUTING.adoc.
+199
View File
@@ -0,0 +1,199 @@
["area: assertions"]
color = "ffffe8"
name = "area: assertions"
description = "Issue involves assertions"
["area: configure/compiling"]
color = "ffffe8"
name = "area: configure/compiling"
description = "Issue involves configuring or compilating Verilator itself"
["area: coverage"]
color = "ffffe8"
name = "area: coverage"
description = "Issue involves coverage generation"
["area: data-types"]
color = "ffffe8"
name = "area: data-types"
description = "Issue involves data-types"
["area: documentation"]
color = "ffffe8"
name = "area: documentation"
description = "Issue involves documentation"
["area: elaboration"]
color = "ffffe8"
name = "area: elaboration"
description = "Issue involves elaboration phase"
["area: invoking/options"]
color = "ffffe8"
name = "area: invoking/options"
description = "Issue involves options passed to Verilator"
["area: lint"]
color = "ffffe8"
name = "area: lint"
description = "Issue involves SystemVerilog lint checking"
["area: parser"]
color = "ffffe8"
name = "area: parser"
description = "Issue involves SystemVerilog parsing"
["area: performance"]
color = "ffffe8"
name = "area: performance"
description = "Issue involves performance issues"
["area: portability"]
color = "ffffe8"
name = "area: portability"
description = "Issue involves operating system/compiler portability"
["area: runtime result"]
color = "ffffe8"
name = "area: runtime result"
description = "Issue involves an incorrect runtine result from Verilated model"
["area: scheduling"]
color = "ffffe8"
name = "area: scheduling"
description = "Issue involves scheduling/ordering of events"
["area: tests"]
color = "ffffe8"
name = "area: tests"
description = "Issue involves the testing system"
["area: usability"]
color = "ffffe8"
name = "area: usability"
description = "Issue involves general usability"
["effort: days"]
color = "d0c0b0"
name = "effort: days"
description = "Expect this issue to require roughly days of invested effort to resolve"
["effort: hours"]
color = "f5e6d6"
name = "effort: hours"
description = "Expect this issue to require roughly hours of invested effort to resolve"
["effort: minutes"]
color = "f5e6d6"
name = "effort: minutes"
description = "Expect this issue to require less than an hour of invested effort to resolve"
["effort: weeks"]
color = "d0c0b0"
name = "effort: weeks"
description = "Expect this issue to require weeks or more of invested effort to resolve"
["good first issue"]
color = "7057ff"
name = "good first issue"
description = "Good for newcomers"
["help wanted"]
color = "008672"
name = "help wanted"
description = "Extra attention is needed"
["new"]
color = "ff4400"
name = "new"
description = "New issue, not yet seen by maintainers"
["resolution: abandoned"]
color = "cfd3d7"
name = "resolution: abandoned"
description = "Closed; not enough information or otherwise never finished"
["resolution: answered"]
color = "cfd3d7"
name = "resolution: answered"
description = "Closed; only applies to questions which were answered"
["resolution: duplicate"]
color = "cfd3d7"
name = "resolution: duplicate"
description = "Closed; issue or pull request already exists"
["resolution: external"]
color = "cfd3d7"
name = "resolution: external"
description = "Closed; passed to another tool's bug tracker"
["resolution: fixed"]
color = "cfd3d7"
name = "resolution: fixed"
description = "Closed; fixed"
["resolution: invalid"]
color = "cfd3d7"
name = "resolution: invalid"
description = "Closed; issue or pull request is no longer relevant"
["resolution: no fix needed"]
color = "cfd3d7"
name = "resolution: no fix needed"
description = "Closed; no fix required (not a bug)"
["resolution: wontfix"]
color = "cfd3d7"
name = "resolution: wontfix"
description = "Closed; work won't continue on an issue or pull request"
["status: asked reporter"]
color = "ffffff"
name = "status: asked reporter"
description = "Bug is waiting for reporter to answer a question"
["status: assigned"]
color = "a0f0ff"
name = "status: assigned"
description = "Issue is assigned to someone to work on"
["status: blocked"]
color = "00007f"
name = "status: blocked"
description = "Issue is waiting for another bug, when other bug is fixed, then goes to 'status: assigned'"
["status: discussion"]
color = "d876e3"
name = "status: discussion"
description = "Issue is waiting for discussions to resolve"
["status: ready"]
color = "b6c92a"
name = "status: ready"
description = "Issue is ready for someone to fix; then goes to 'status: assigned'"
["type: bug"]
color = "d73a4a"
name = "type: bug"
description = "Defect"
["type: feature-IEEE"]
color = "cfccff"
name = "type: feature-IEEE"
description = "Request to add new feature, described in IEEE 1800"
["type: feature-non-IEEE"]
color = "cfccff"
name = "type: feature-non-IEEE"
description = "Request to add new feature, outside IEEE 1800"
["type: maintenance"]
color = "cfccff"
name = "type: maintenance"
description = "Internal maintenance task"
["type: q and a"]
color = "84ba34"
name = "type: q and a"
description = "Question and answer about some feature or user question"
+1
View File
@@ -17,6 +17,7 @@
README README
TAGS TAGS
autom4te.cache autom4te.cache
compile_commands.json
config.cache config.cache
config.status config.status
configure configure
+17 -6
View File
@@ -1,8 +1,10 @@
# DESCRIPTION: Travis-CI config # DESCRIPTION: Travis-CI config
# #
# Copyright 2003-2019 by Todd Strader. Verilator is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU Lesser # can redistribute it and/or modify it under the terms of either the GNU
# General Public License Version 3 or the Perl Artistic License Version 2.0. # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
version: ~> 1.0 version: ~> 1.0
@@ -16,6 +18,7 @@ env:
- VERILATOR_ROOT=$PWD - VERILATOR_ROOT=$PWD
- VERILATOR_NUM_JOBS=$(echo `nproc` + 1 | bc) - VERILATOR_NUM_JOBS=$(echo `nproc` + 1 | bc)
- VERILATOR_CONFIG_FLAGS="--enable-maintainer-mode --enable-longtests" - VERILATOR_CONFIG_FLAGS="--enable-maintainer-mode --enable-longtests"
- VERILATOR_AUTHOR_SITE=1
- OBJCACHE=ccache - OBJCACHE=ccache
cache: cache:
@@ -24,9 +27,12 @@ cache:
before_install: before_install:
# Perl modules needed for testing # Perl modules needed for testing
- yes yes | sudo cpan -fi Unix::Processors Parallel::Forker Bit::Vector # Not listing Bit::Vector as slow to install, and only skips one test
- yes yes | sudo cpan -fi Unix::Processors Parallel::Forker
- sudo apt-get install gdb gtkwave - sudo apt-get install gdb gtkwave
- sudo apt-get install libgoogle-perftools-dev
before_script: before_script:
- bash -x ci/build_vcddiff.sh
- bash -x ci/build_verilator.sh - bash -x ci/build_verilator.sh
after_script: after_script:
- ccache -s - ccache -s
@@ -55,9 +61,14 @@ jobs:
script: ci/test.sh vlt script: ci/test.sh vlt
- if: type != cron - if: type != cron
stage: test stage: test
name: Vltmt test name: Vltmt set 0 test
compiler: gcc compiler: gcc
script: ci/test.sh vltmt script: ci/test.sh vltmt0
- if: type != cron
stage: test
name: Vltmt set 1 test
compiler: gcc
script: ci/test.sh vltmt1
# Cron builds try different OS/compiler combinations # Cron builds try different OS/compiler combinations
- if: type = cron - if: type = cron
stage: "Build Verilator" stage: "Build Verilator"
+824 -682
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -2,6 +2,7 @@
\.clang-tidy \.clang-tidy
\.git/ \.git/
\.git$ \.git$
\.github/
\.svn/ \.svn/
\.(bak|old)/ \.(bak|old)/
\.(bak|old)$ \.(bak|old)$
@@ -18,15 +19,16 @@
\.codacy\.yml \.codacy\.yml
\.travis\.yml \.travis\.yml
/build/ /build/
/obj_dir/
/obj_dbg/ /obj_dbg/
/obj_dir/
/obj_dist/
/obj_iv/
/obj_nc/ /obj_nc/
/obj_opt/ /obj_opt/
/obj_vcs/ /obj_vcs/
/obj_vlt/ /obj_vlt/
/obj_vltmt/ /obj_vltmt/
/obj_dist/ INCA_libs/
/INCA_libs/
/cov_work/ /cov_work/
/logs/ /logs/
^Makefile$ ^Makefile$
@@ -35,6 +37,7 @@ bin/verilator_bin.*
bin/verilator_coverage_bin.* bin/verilator_coverage_bin.*
docs/.*\.html$ docs/.*\.html$
docs/Makefile$ docs/Makefile$
docs/clang-format.txt$
docs/doxygen-doc/.* docs/doxygen-doc/.*
examples/xml_py/copied/ examples/xml_py/copied/
examples/xml_py/graph.* examples/xml_py/graph.*
+7 -14
View File
@@ -7,15 +7,11 @@
# #
#***************************************************************************** #*****************************************************************************
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# Verilator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# #
#****************************************************************************/ #****************************************************************************/
# #
@@ -103,7 +99,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
SHELL = /bin/sh SHELL = /bin/sh
SUBDIRS = src test_regress \ SUBDIRS = docs src test_regress \
examples/cmake_hello_c \ examples/cmake_hello_c \
examples/cmake_hello_sc \ examples/cmake_hello_sc \
examples/cmake_tracing_c \ examples/cmake_tracing_c \
@@ -114,6 +110,7 @@ SUBDIRS = src test_regress \
examples/make_tracing_c \ examples/make_tracing_c \
examples/make_tracing_sc \ examples/make_tracing_sc \
examples/make_protect_lib \ examples/make_protect_lib \
examples/xml_py \
INFOS = verilator.txt verilator.html verilator.pdf INFOS = verilator.txt verilator.html verilator.pdf
@@ -147,6 +144,7 @@ DISTFILES_INC = $(INFOS) .gitignore \
docs/install.adoc \ docs/install.adoc \
docs/internals.adoc \ docs/internals.adoc \
docs/verilator_logo.png \ docs/verilator_logo.png \
docs/xml.adoc \
install-sh configure *.pod \ install-sh configure *.pod \
include/*.[chv]* \ include/*.[chv]* \
include/*.in \ include/*.in \
@@ -206,12 +204,6 @@ EXAMPLES_FIRST = \
EXAMPLES = $(EXAMPLES_FIRST) $(filter-out $(EXAMPLES_FIRST), $(sort $(wildcard examples/*))) EXAMPLES = $(EXAMPLES_FIRST) $(filter-out $(EXAMPLES_FIRST), $(sort $(wildcard examples/*)))
ifeq ($(OBJCACHE_JOBS),)
ifneq ($(OBJCACHE_HOSTS),)
export OBJCACHE_JOBS := -j $(shell objcache --jobs "$(OBJCACHE_HOSTS)")
endif
endif
# See uninstall also - don't put wildcards in this variable, it might uninstall other stuff # See uninstall also - don't put wildcards in this variable, it might uninstall other stuff
VL_INST_MAN_FILES = verilator.1 verilator_coverage.1 verilator_gantt.1 verilator_profcfunc.1 VL_INST_MAN_FILES = verilator.1 verilator_coverage.1 verilator_gantt.1 verilator_profcfunc.1
@@ -513,6 +505,7 @@ clean mostlyclean distclean maintainer-clean::
rm -f *.tex rm -f *.tex
rm -rf examples/*/obj_dir* examples/*/logs rm -rf examples/*/obj_dir* examples/*/logs
rm -rf test_*/obj_dir rm -rf test_*/obj_dir
rm -rf nodist/fuzzer/dictionary
rm -rf nodist/obj_dir rm -rf nodist/obj_dir
distclean maintainer-clean:: distclean maintainer-clean::
+20 -9
View File
@@ -4,7 +4,7 @@
ifdef::env-github[] ifdef::env-github[]
image:https://img.shields.io/badge/License-LGPL%20v3-blue.svg[license LGPLv3,link=https://www.gnu.org/licenses/lgpl-3.0] image:https://img.shields.io/badge/License-LGPL%20v3-blue.svg[license LGPLv3,link=https://www.gnu.org/licenses/lgpl-3.0]
image:https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg[license Artistic-2.0,link=https://opensource.org/licenses/Artistic-2.0] image:https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg[license Artistic-2.0,link=https://opensource.org/licenses/Artistic-2.0]
image:https://api.codacy.com/project/badge/Grade/ff998fdaa6f64b9a95eb5f342ee6bf4d[Code Quality,link=https://www.codacy.com/manual/wsnyder/verilator] image:https://api.codacy.com/project/badge/Grade/48478c986f13400682ffe4a5e0939b3a[Code Quality,link=https://www.codacy.com/gh/verilator/verilator]
image:https://travis-ci.com/verilator/verilator.svg?branch=master[Build Status (Travis CI),link=https://travis-ci.com/verilator/verilator] image:https://travis-ci.com/verilator/verilator.svg?branch=master[Build Status (Travis CI),link=https://travis-ci.com/verilator/verilator]
endif::[] endif::[]
@@ -16,6 +16,7 @@ ifndef::env-github[]
:link_verilator_contributing: https://github.com/verilator/verilator/blob/master/docs/CONTRIBUTING.adoc :link_verilator_contributing: https://github.com/verilator/verilator/blob/master/docs/CONTRIBUTING.adoc
:link_verilator_install: https://verilator.org/install :link_verilator_install: https://verilator.org/install
endif::[] endif::[]
:link_verilator_commercial_support: https://verilator.org/verilator_commercial_support
== Welcome to Verilator == Welcome to Verilator
@@ -24,7 +25,7 @@ endif::[]
^.^| *Welcome to Verilator, the fastest free Verilog HDL simulator.* ^.^| *Welcome to Verilator, the fastest free Verilog HDL simulator.*
+++ <br/> +++ &bullet; Accepts synthesizable Verilog or SystemVerilog +++ <br/> +++ &bullet; Accepts synthesizable Verilog or SystemVerilog
+++ <br/> +++ &bullet; Performs lint code-quality checks +++ <br/> +++ &bullet; Performs lint code-quality checks
+++ <br/> +++ &bullet; Compiles into multithreaded {cpp}, SystemC, or (soon) {cpp}-under-Python +++ <br/> +++ &bullet; Compiles into multithreaded {cpp}, or SystemC
+++ <br/> +++ &bullet; Creates XML to front-end your own tools +++ <br/> +++ &bullet; Creates XML to front-end your own tools
<.^|image:https://www.veripool.org/img/verilator_256_200_min.png[Logo,256,200] <.^|image:https://www.veripool.org/img/verilator_256_200_min.png[Logo,256,200]
@@ -38,12 +39,18 @@ endif::[]
+++ <br/> +++ &bullet; Out-of-the-box support from Arm, and RISC-V vendor IP +++ <br/> +++ &bullet; Out-of-the-box support from Arm, and RISC-V vendor IP
<.^|image:https://www.veripool.org/img/verilator_usage_400x200-min.png[,400,200] <.^|image:https://www.veripool.org/img/verilator_usage_400x200-min.png[,400,200]
>.^|image:https://www.veripool.org/img/chips_alliance_logo_225x75-min.png[CHIPS Alliance,link=https://chipsalliance.org] >.^|image:https://www.veripool.org/img/verilator_community_400x125-min.png[,400,125]
image:https://www.veripool.org/img/osi_logo_125x125-min.png[,125,125]
^.^| *Community Driven & Openly Licensed* ^.^| *Community Driven & Openly Licensed*
+++ <br/> +++ &bullet; Guided by the https://chipsalliance.org/[CHIPS Alliance] and https://www.linuxfoundation.org/[Linux Foundation] +++ <br/> +++ &bullet; Guided by the https://chipsalliance.org/[CHIPS Alliance] and https://www.linuxfoundation.org/[Linux Foundation]
+++ <br/> +++ &bullet; Open, and free as in both speech and beer +++ <br/> +++ &bullet; Open, and free as in both speech and beer
+++ <br/> +++ &bullet; More simulation for your verification budget +++ <br/> +++ &bullet; More simulation for your verification budget
^.^| *Commercial Support Available*
+++ <br/> +++ &bullet; Commercial support contracts
+++ <br/> +++ &bullet; Design support contracts
+++ <br/> +++ &bullet; Enhancement contracts
<.^|image:https://www.veripool.org/img/verilator_support_400x125-min.png[,400,125]
|=== |===
== What Verilator Does == What Verilator Does
@@ -74,7 +81,7 @@ touch of {cpp} code, Verilator is the tool for you.
Verilator does not simply convert Verilog HDL to {cpp} or SystemC. Rather Verilator does not simply convert Verilog HDL to {cpp} or SystemC. Rather
than only translate, Verilator compiles your code into a much faster than only translate, Verilator compiles your code into a much faster
optimized and optionally thread-partitioned model, which is in turn wrapped optimized and optionally thread-partitioned model, which is in turn wrapped
inside a {cpp}/SystemC/Python module. The results are a compiled Verilog inside a {cpp}/SystemC/{cpp}-under-Python module. The results are a compiled Verilog
model that executes even on a single-thread over 10x faster than standalone model that executes even on a single-thread over 10x faster than standalone
SystemC, and on a single thread is about 100 times faster than interpreted SystemC, and on a single thread is about 100 times faster than interpreted
Verilog simulators such as http://iverilog.icarus.com[Icarus Verilog simulators such as http://iverilog.icarus.com[Icarus
@@ -109,7 +116,7 @@ or https://verilator.org/verilator_doc.pdf[Verilator manual (PDF)]
* https://verilator.org/issues[Verilator Issues] * https://verilator.org/issues[Verilator Issues]
== Community Supported == Support
Verilator is a community project, guided by the Verilator is a community project, guided by the
https://chipsalliance.org/[CHIPS Alliance] under the https://chipsalliance.org/[CHIPS Alliance] under the
@@ -120,6 +127,10 @@ We appreciate and welcome your contributions in whatever form; please see
https://verilator.org/verilator_doc.html#CONTRIBUTORS[Contributors and https://verilator.org/verilator_doc.html#CONTRIBUTORS[Contributors and
Sponsors]. Sponsors].
Verilator also supports and encourages commercial support models and
organizations; please see {link_verilator_commercial_support}[Verilator
Commercial Support].
== Related Projects == Related Projects
* http://gtkwave.sourceforge.net/[GTKwave] - Waveform viewer for Verilator * http://gtkwave.sourceforge.net/[GTKwave] - Waveform viewer for Verilator
@@ -131,10 +142,10 @@ perhaps Icarus may.
== Open License == Open License
Verilator is Copyright 2003-2019 by Wilson Snyder. (Report bugs to Verilator is Copyright 2003-2020 by Wilson Snyder. (Report bugs to
https://verilator.org/issues[Verilator Issues].) https://verilator.org/issues[Verilator Issues].)
Verilator is free software; you can redistribute it and/or modify it under Verilator is free software; you can redistribute it and/or modify it under
the terms of either the GNU Lesser General Public License Version 3 or the the terms of either the GNU Lesser General Public License Version 3 or the
Perl Artistic License Version 2.0. (See the documentation for more Perl Artistic License Version 2.0. See the documentation for more
details.) details.
+459 -84
View File
@@ -1,17 +1,11 @@
: # -*-Mode: perl;-*- use perl, wherever it is #!/usr/bin/env perl
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
###################################################################### ######################################################################
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# #
###################################################################### ######################################################################
@@ -325,6 +319,7 @@ detailed descriptions in L</"VERILATION ARGUMENTS"> for more information.
--language <lang> Default language standard to parse --language <lang> Default language standard to parse
+libext+<ext>+[ext]... Extensions for finding modules +libext+<ext>+[ext]... Extensions for finding modules
--lint-only Lint, but do not make output --lint-only Lint, but do not make output
--max-num-width <value> Maximum number width (default: 64K)
--MMD Create .d dependency files --MMD Create .d dependency files
--MP Create phony dependency targets --MP Create phony dependency targets
--Mdir <directory> Name of output object directory --Mdir <directory> Name of output object directory
@@ -422,6 +417,7 @@ more information.
+verilator+prof+threads+window+I<value> Set profile duration +verilator+prof+threads+window+I<value> Set profile duration
+verilator+rand+reset+I<value> Set random reset technique +verilator+rand+reset+I<value> Set random reset technique
+verilator+seed+I<value> Set random seed +verilator+seed+I<value> Set random seed
+verilator+noassert Disable assert checking
+verilator+V Verbose version and config +verilator+V Verbose version and config
+verilator+version Show version and exit +verilator+version Show version and exit
@@ -970,6 +966,11 @@ stylistic and not enabled by default.
If the design is not to be completely Verilated see also the --bbox-sys and If the design is not to be completely Verilated see also the --bbox-sys and
--bbox-unsup options. --bbox-unsup options.
=item --max-num-width I<value>
Set the maximum number literal width (e.g. in 1024'd22 this it the 1024).
Defaults to 64K.
=item --MMD =item --MMD
=item --no-MMD =item --no-MMD
@@ -1078,8 +1079,8 @@ and the remaining files can be compiled on parallel machines. Using
design --output-split 20000 resulted in splitting into approximately design --output-split 20000 resulted in splitting into approximately
one-minute-compile chunks. one-minute-compile chunks.
Typically when using this, make with VM_PARALLEL_BUILD=1, and use Typically when using this, make with VM_PARALLEL_BUILDS=1 (set for you if
I<ccache>. using the default makefiles), and use I<ccache>.
=item --output-split-cfuncs I<statements> =item --output-split-cfuncs I<statements>
@@ -1268,7 +1269,8 @@ detailed description.
=item --quiet-exit =item --quiet-exit
When exiting due to an error, do not display the "Command Failed" message. When exiting due to an error, do not display the "Exiting due to Errors"
nor "Command Failed" messages.
=item --relative-includes =item --relative-includes
@@ -1339,6 +1341,13 @@ Creates more detailed statistics, including a list of all the variables by
size (plain --stats just gives a count). See --stats, which is implied by size (plain --stats just gives a count). See --stats, which is implied by
this. this.
=item --structs-packed
Converts all unpacked structures to packed structures and issues a UNPACKED
warning. Currently this is the default and --no-structs-packed will not
work. Specifying this option allows for forward compatibility when a
future version of Verilator no longer always packs unpacked structures.
=item -sv =item -sv
Specifies SystemVerilog language features should be enabled; equivalent to Specifies SystemVerilog language features should be enabled; equivalent to
@@ -1769,6 +1778,11 @@ For $random and "-x-initial unique", set the simulation runtime random seed
value. If zero or not specified picks a value from the system random value. If zero or not specified picks a value from the system random
number generator. number generator.
=item +verilator+noassert
Disable assert checking per runtime argument. This is the same as calling
"Verilated::assertOn(false)" in the model.
=item +verilator+V =item +verilator+V
Shows the verbose version, including configuration information. Shows the verbose version, including configuration information.
@@ -1896,13 +1910,13 @@ Now we run Verilator on our little example.
We then can compile it We then can compile it
cd obj_dir make -j -C obj_dir -f Vour.mk Vour__ALL.a
make -j -f Vour.mk Vour__ALL.a make -j -C obj_dir -f Vour.mk ../sc_main.o verilated.o
make -j -f Vour.mk ../sc_main.o verilated.o
And link with SystemC. Note your path to the libraries may vary, And link with SystemC. Note your path to the libraries may vary,
depending on the operating system. depending on the operating system.
cd obj_dir
export SYSTEMC_LIBDIR=/path/to/where/libsystemc.a/exists export SYSTEMC_LIBDIR=/path/to/where/libsystemc.a/exists
export LD_LIBRARY_PATH=$SYSTEMC_LIBDIR:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$SYSTEMC_LIBDIR:$LD_LIBRARY_PATH
# Might be needed if SystemC 2.3.0 # Might be needed if SystemC 2.3.0
@@ -1926,6 +1940,39 @@ when your source changes it will automatically run all of these steps. See
the examples directory in the distribution. the examples directory in the distribution.
=head1 EVALUATION LOOP
When using SystemC, when Verilator is evaluated is managed by the SystemC
kernel, and for the most part can be ignored. When using C++, the user
must call eval(), or eval_step() and eval_end_step().
1. When there is a single design instantiated at the C++ level that need to
evaluate, just call designp->eval().
2. When there are multiple designs instantiated each at the C++ level that
need to evaluate, call first_designp->eval_step() then ->eval_step() on all
other designs. Then call ->eval_end_step() on the first design then all
other designs. If there is only a single design, you would call
eval_step() then eval_end_step(); in fact eval() described above is just a
wrapper which calls these two functions.
When eval() is called Verilator looks for changes in clock signals and
evaluates related sequential always blocks, such as computing always_ff @
(posedge...) outputs. Then Verilator evaluates combinatorial logic.
Note combinatorial logic is not computed before sequential always blocks
are computed (for speed reasons). Therefore it is best to set any non-clock
inputs up with a separate eval() call before changing clocks().
Alternatively, if all always_ff statements use only the posedge of clocks,
or all inputs go directly to always_ff statements, as is typical, then you
can change non-clock inputs on the negative edge of the input clock, which
will be faster as there will be fewer eval() calls.
For more information on evaluation, see docs/internals.adoc in the
distribution.
=head1 BENCHMARKING & OPTIMIZATION =head1 BENCHMARKING & OPTIMIZATION
For best performance, run Verilator with the "-O3 --x-assign fast For best performance, run Verilator with the "-O3 --x-assign fast
@@ -1954,27 +2001,27 @@ OPT, OPT_FAST, or OPT_SLOW lib/verilated.mk. Or, use the -CFLAGS and/or
the compiler or linker. Or, just for one run, pass them on the command the compiler or linker. Or, just for one run, pass them on the command
line to make: line to make:
make OPT_FAST="-O2 -fno-stack-protector" -f Vour.mk Vour__ALL.a make OPT_FAST="-Os -fno-stack-protector" -f Vour.mk Vour__ALL.a
OPT_FAST specifies optimizations for those programs that are part of the OPT_FAST specifies optimizations for those programs that are part of the
fast path, mostly code that is executed every cycle. OPT_SLOW specifies fast path, mostly code that is executed every cycle. OPT_SLOW specifies
optimizations for slow-path files (plus tracing), which execute only optimizations for slow-path files (plus tracing), which execute only
rarely, yet take a long time to compile with optimization on. OPT rarely, yet take a long time to compile with optimization on. OPT
specifies overall optimization and affects all compiles, including those specifies overall optimization and affects all compiles, including those
OPT_FAST and OPT_SLOW control. For best results, use OPT="-O2", and link OPT_FAST and OPT_SLOW control. For best results, use OPT="-Os", and link
with "-static". Nearly the same results can be had with much better with "-static". Nearly the same results can be had with much better
compile times with OPT_FAST="-O1 -fstrict-aliasing". Higher optimization compile times with OPT_FAST="-O1 -fstrict-aliasing". Higher optimization
such as "-O3" may help, but gcc compile times may be excessive under O3 on such as "-O2" or "-O3" may help, but gcc compile times may be excessive
even medium sized designs. Alternatively, some larger designs report under O3 on even medium sized designs.
better performance using "-Os".
Unfortunately, using the optimizer with SystemC files can result in Unfortunately, using the optimizer with SystemC files can result in
compiles taking several minutes. (The SystemC libraries have many little compiles taking several minutes. (The SystemC libraries have many little
inlined functions that drive the compiler nuts.) inlined functions that drive the compiler nuts.)
For best results, use GCC 3.3 or newer. GCC 3.2 and earlier have For best results, use the latest clang compiler (about 10% faster than
optimization bugs around pointer aliasing detection, which can result in 2x GCC). Note the now fairly old GCC 3.2 and earlier have optimization bugs
performance losses. around pointer aliasing detection, which can result in 2x performance
losses.
If you will be running many simulations on a single compile, investigate If you will be running many simulations on a single compile, investigate
feedback driven compilation. With GCC, using -fprofile-arcs, then feedback driven compilation. With GCC, using -fprofile-arcs, then
@@ -1985,6 +2032,9 @@ especially if you link in DPI code. To enable LTO on GCC, pass "-flto" in
both compilation and link. Note LTO may cause excessive compile times on both compilation and link. Note LTO may cause excessive compile times on
large designs. large designs.
Using profile driven compiler optimization, with feedback from a real
design, can yield up to30% improvements.
If you are using your own makefiles, you may want to compile the Verilated If you are using your own makefiles, you may want to compile the Verilated
code with -DVL_INLINE_OPT=inline. This will inline functions, however this code with -DVL_INLINE_OPT=inline. This will inline functions, however this
requires that all cpp files be compiled in a single compiler run. requires that all cpp files be compiled in a single compiler run.
@@ -1995,7 +2045,7 @@ either oprofile or gprof to see where in the C++ code the time is spent.
Run the gprof output through verilator_profcfunc and it will tell you what Run the gprof output through verilator_profcfunc and it will tell you what
Verilog line numbers on which most of the time is being spent. Verilog line numbers on which most of the time is being spent.
When done, please let the author know the results. I like to keep tabs on When done, please let the author know the results. We like to keep tabs on
how Verilator compares, and may be able to suggest additional improvements. how Verilator compares, and may be able to suggest additional improvements.
@@ -2070,7 +2120,7 @@ After running Make, the C++ compiler may produce the following:
A generic Linux/OS variable specifying what directories have shared object A generic Linux/OS variable specifying what directories have shared object
(.so) files. This path should include SystemC and any other shared objects (.so) files. This path should include SystemC and any other shared objects
needed at simultion runtime. needed at simulation runtime.
=item OBJCACHE =item OBJCACHE
@@ -2114,16 +2164,16 @@ specified, it will come from a default optionally specified at configure
time (before Verilator was compiled), or computed from time (before Verilator was compiled), or computed from
SYSTEMC/lib-SYSTEMC_ARCH. SYSTEMC/lib-SYSTEMC_ARCH.
=item VCS_HOME
If set, specifies the directory containing the Synopsys VCS distribution.
When set, a 'make test' in the Verilator distribution will also run VCS
baseline regression tests.
=item VERILATOR_BIN =item VERILATOR_BIN
If set, specifies an alternative name of the Verilator binary. May be used If set, specifies an alternative name of the C<verilator> binary. May be
for debugging and selecting between multiple operating system builds. used for debugging and selecting between multiple operating system builds.
=item VERILATOR_COVERAGE_BIN
If set, specifies an alternative name of the C<verilator_coverage binary>.
May be used for debugging and selecting between multiple operating system
builds.
=item VERILATOR_GDB =item VERILATOR_GDB
@@ -2199,7 +2249,7 @@ example:
Note signals are read and written as member variables of the lower module. Note signals are read and written as member variables of the lower module.
You call the eval() method to evaluate the model. When the simulation is You call the eval() method to evaluate the model. When the simulation is
complete call the final() method to wrap up any SystemVerilog final blocks, complete call the final() method to wrap up any SystemVerilog final blocks,
and complete any assertions. and complete any assertions. See L</"EVALUATION LOOP">.
=head1 CONNECTING TO SYSTEMC =head1 CONNECTING TO SYSTEMC
@@ -2674,7 +2724,7 @@ The remainder of this section describe behavior with --threads 1 or
VL_THREADED is defined when compiling a threaded Verilated module, causing VL_THREADED is defined when compiling a threaded Verilated module, causing
the Verilated support classes become threadsafe. the Verilated support classes become threadsafe.
The thread used for constructing a model must the the same thread that The thread used for constructing a model must be the same thread that
calls eval() into the model, this is called the "eval thread". The thread calls eval() into the model, this is called the "eval thread". The thread
used to perform certain global operations such as saving and tracing must used to perform certain global operations such as saving and tracing must
be done by a "main thread". In most cases the eval thread and main thread be done by a "main thread". In most cases the eval thread and main thread
@@ -2737,8 +2787,8 @@ controlled by configuration files, typically named with the .vlt
extension. An example: extension. An example:
`verilator_config `verilator_config
lint_off -msg WIDTH lint_off -rule WIDTH
lint_off -msg CASEX -file "silly_vendor_code.v" lint_off -rule CASEX -file "silly_vendor_code.v"
This disables WIDTH warnings globally, and CASEX for a specific file. This disables WIDTH warnings globally, and CASEX for a specific file.
@@ -2756,8 +2806,7 @@ The grammar of configuration commands is as follows:
=item `verilator_config =item `verilator_config
Take remaining text up the the next `verilog mode switch and treat it as Take remaining text and treat it as Verilator configuration commands.
Verilator configuration commands.
=item coverage_on [-file "<filename>" [-lines <line> [ - <line> ]]] =item coverage_on [-file "<filename>" [-lines <line> [ - <line> ]]]
@@ -2768,9 +2817,11 @@ Enable/disable coverage for the specified filename (or wildcard with '*' or
omitted). Often used to ignore an entire module for coverage analysis omitted). Often used to ignore an entire module for coverage analysis
purposes. purposes.
=item lint_on [-msg <message>] [-file "<filename>" [-lines <line> [ - <line>]]] =item lint_on [-rule <message>] [-file "<filename>" [-lines <line> [ - <line>]]]
=item lint_off [-msg <message>] [-file "<filename>" [-lines <line> [ - <line>]]] =item lint_off [-rule <message>] [-file "<filename>" [-lines <line> [ - <line>]]]
=item lint_off [-rule <message>] [-file "<filename>"] [-match "<string>"]
Enable/disables the specified lint warning, in the specified filename (or Enable/disables the specified lint warning, in the specified filename (or
wildcard with '*' or '?', or all files if omitted) and range of line wildcard with '*' or '?', or all files if omitted) and range of line
@@ -2779,10 +2830,17 @@ numbers (or all lines if omitted).
With lint_off using '*' will override any lint_on directives in the source, With lint_off using '*' will override any lint_on directives in the source,
i.e. the warning will still not be printed. i.e. the warning will still not be printed.
If the -msg is omitted, all lint warnings (see list in -Wno-lint) are If the -rule is omitted, all lint warnings (see list in -Wno-lint) are
enabled/disabled. This will override all later lint warning enables for enabled/disabled. This will override all later lint warning enables for
the specified region. the specified region.
If -match is set the linter warnings are matched against this (wildcard)
string and are waived in case they match iff rule and file (with wildcard)
also match.
In previous versions -rule was named -msg. The latter is deprecated, but
still works with a deprecation info, it may be removed in future versions.
=item tracing_on [-file "<filename>" [-lines <line> [ - <line> ]]] =item tracing_on [-file "<filename>" [-lines <line> [ - <line> ]]]
=item tracing_off [-file "<filename>" [-lines <line> [ - <line> ]]] =item tracing_off [-file "<filename>" [-lines <line> [ - <line> ]]]
@@ -2794,6 +2852,135 @@ and range of line numbers (or all lines if omitted).
For tracing_off, cells below any module in the files/ranges specified will For tracing_off, cells below any module in the files/ranges specified will
also not be traced. also not be traced.
=item clock_enable -module "<modulename>" -var "<signame>"
Indicate the signal is used to gate a clock, and the user takes responsibility
for insuring there are no races related to it.
Same as /*verilator clock_enable*/, see L</"LANGUAGE EXTENSIONS"> for
more information and an example.
=item clocker -module "<modulename>" [-task "<taskname>"] -var "<signame>"
=item clocker -module "<modulename>" [-function "<funcname>"] -var "<signame>"
=item no_clocker -module "<modulename>" [-task "<taskname>"] -var "<signame>"
=item no_clocker -module "<modulename>" [-function "<funcname>"] -var "<signame>"
Indicate the signal is used as clock or not. This information is used by
Verilator to mark the signal as clocker and propagate the clocker attribute
automatically to derived signals. See C<--clk> for more information.
Same as /*verilator clocker*/, see L</"LANGUAGE EXTENSIONS"> for more
information.
=item coverage_block_off -module "<modulename>" -block "<blockname>"
=item coverage_block_off -file "<filename>" -line <lineno>
Specifies the entire begin/end block should be ignored for coverage
analysis purposes. Can either be specified as a named block or as a
filename and line number.
Same as /*verilator coverage_block_off*/, see L</"LANGUAGE
EXTENSIONS"> for more information.
=item full_case -file "<filename>" -lines <lineno>
=item parallel_case -file "<filename>" -lines <lineno>
Same as "//synopsys full_case" and "//synopsys parallel_case". When
these synthesis directives are discovered, Verilator will either
formally prove the directive to be true, or failing that, will insert
the appropriate code to detect failing cases at simulation runtime and
print an "Assertion failed" error message.
=item inline -module "<modulename>"
Specifies the module may be inlined into any modules that use this
module. This is useful to speed up simulation runtime with some small
loss of trace visibility and modularity. Note signals under inlined
submodules will be named I<submodule>__DOT__I<subsignal> as C++ does
not allow "." in signal names. When tracing such signals the tracing
routines will replace the __DOT__ with the period.
Same as /*verilator inline_module*/, see L</"LANGUAGE EXTENSIONS"> for
more information.
=item isolate_assignments -module "<modulename>" [-task "<taskname>"] -var "<signame>"
=item isolate_assignments -module "<modulename>" [-function "<funcname>"] -var "<signame>"
=item isolate_assignments -module "<modulename>" -function "<fname>"
Used to indicate the assignments to this signal in any blocks should be
isolated into new blocks. When there is a large combinatorial block that
is resulting in a UNOPTFLAT warning, attaching this to the signal causing
a false loop may clear up the problem.
Same as /* verilator isolate_assignments */, see L</"LANGUAGE
EXTENSIONS"> for more information.
=item no_inline -module "<modulename>"
Specifies the module should not be inlined into any modules that use
this module. This is useful especially at the top level module to
reduce the size of the interface class, to aid compile time at a small
performance loss.
Same as /*verilator no_inline_module*/, see L</"LANGUAGE EXTENSIONS">
for more information.
=item no_inline [-module "<modulename>"] -task "<taskname>"
=item no_inline [-module "<modulename>"] -function "<funcname>"
Specify the function or task should not be inlined into where it is
used. This may reduce the size of the final executable when a task is
used a very large number of times. For this flag to work, the task
and tasks below it must be pure; they cannot reference any variables
outside the task itself.
Same as /*verilator no_inline_task*/, see L</"LANGUAGE EXTENSIONS">
for more information.
=item sc_bv -module "<modulename>" [-task "<taskname>"] -var "<signame>"
=item sc_bv -module "<modulename>" [-function "<funcname>"] -var "<signame>"
Sets the port to be of sc_bv<I<width>> type, instead of bool, vluint32_t or
vluint64_t. This may be useful if the port width is parameterized and
different of such modules interface a templated module (such as a transactor)
or for other reasons. In general you should avoid using this attribute when
not necessary as with increasing usage of sc_bv the performance decreases
significantly.
Same as /*verilator sc_bv*/, see L</"LANGUAGE EXTENSIONS"> for more
information.
=item sformat [-module "<modulename>"] [-task "<taskname>"] -var "<signame>"
=item sformat [-module "<modulename>"] [-function "<funcname>"] -var "<signame>"
Final input of a function or task "input string" to indicate the
function or task should pass all remaining arguments through
$sformatf. This allows creation of DPI functions with $display like
behavior. See the test_regress/t/t_dpi_display.v file for an example.
Same as /*verilator sformat*/, see L</"LANGUAGE EXTENSIONS"> for more
information.
=item split_var [-module "<modulename>"] [-task "<taskname>"] -var "<varname>"
=item split_var [-module "<modulename>"] [-function "<funcname>"] -var "<varname>"
Break the variable into multiple pieces typically to resolve UNOPTFLAT
performance issues. Typically the variables to attach this to are
recommeded by Verilator itself, see UNOPTFLAT.
Same as /*verilator split_var*/, see L</"LANGUAGE EXTENSIONS"> for more
information.
=back =back
@@ -2929,7 +3116,8 @@ per the C standard (it's unspecified in Verilog).
Specifies the entire begin/end block should be ignored for coverage Specifies the entire begin/end block should be ignored for coverage
analysis. Must be inside a basic block, e.g. within a begin/end pair. analysis. Must be inside a basic block, e.g. within a begin/end pair.
Same as /* verilator coverage_block_off */. Same as /* verilator coverage_block_off */ and C<coverage_block_off> in
L</"CONFIGURATION FILES">.
=item `systemc_header =item `systemc_header
@@ -2995,7 +3183,7 @@ may `ifdef around compiler specific constructs.
=item `verilator_config =item `verilator_config
Take remaining text up the the next `verilog mode switch and treat it as Take remaining text up to the next `verilog mode switch and treat it as
Verilator configuration commands. Verilator configuration commands.
=item `verilog =item `verilog
@@ -3019,7 +3207,10 @@ analysis.) For example:
The clock_enable attribute will cause the clock gate to be ignored in the The clock_enable attribute will cause the clock gate to be ignored in the
scheduling algorithm, sometimes required for correct clock behavior, and scheduling algorithm, sometimes required for correct clock behavior, and
always improving performance. It's also a good idea to enable the always improving performance. It's also a good idea to enable the
IMPERFECTSCH warning, to insure all clock enables are properly recognized. IMPERFECTSCH warning, to ensure all clock enables are properly recognized.
Same as C<clock_enable> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
=item /*verilator clocker*/ =item /*verilator clocker*/
@@ -3030,11 +3221,17 @@ not. This information is used by Verilator to mark the signal as clocker
and propagate the clocker attribute automatically to derived signals. See and propagate the clocker attribute automatically to derived signals. See
C<--clk> for more information. C<--clk> for more information.
Same as C<clocker> and C<no_clocker> in configuration files, see
L</"CONFIGURATION FILES"> for more information.
=item /*verilator coverage_block_off*/ =item /*verilator coverage_block_off*/
Specifies the entire begin/end block should be ignored for coverage Specifies the entire begin/end block should be ignored for coverage
analysis purposes. analysis purposes.
Same as C<coverage_block_off> in configuration files, see
L</"CONFIGURATION FILES"> for more information.
=item /*verilator coverage_off*/ =item /*verilator coverage_off*/
Specifies that following lines of code should have coverage disabled. Specifies that following lines of code should have coverage disabled.
@@ -3055,6 +3252,9 @@ submodules will be named I<submodule>__DOT__I<subsignal> as C++ does not
allow "." in signal names. When tracing such signals the tracing routines allow "." in signal names. When tracing such signals the tracing routines
will replace the __DOT__ with the period. will replace the __DOT__ with the period.
Same as C<inline> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator isolate_assignments*/ =item /*verilator isolate_assignments*/
Used after a signal declaration to indicate the assignments to this signal Used after a signal declaration to indicate the assignments to this signal
@@ -3091,6 +3291,9 @@ It would then internally break it into (sort of):
end end
end end
Same as C<isolate_assignments> in configuration files, see
L</"CONFIGURATION FILES"> for more information.
=item /*verilator lint_off I<msg>*/ =item /*verilator lint_off I<msg>*/
Disable the specified warning message for any warnings following the comment. Disable the specified warning message for any warnings following the comment.
@@ -3126,6 +3329,9 @@ modules that use this module. This is useful especially at the top level
module to reduce the size of the interface class, to aid compile time at a module to reduce the size of the interface class, to aid compile time at a
small performance loss. small performance loss.
Same as C<no_inline> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
=item /*verilator no_inline_task*/ =item /*verilator no_inline_task*/
Used in a function or task variable definition section to specify the Used in a function or task variable definition section to specify the
@@ -3134,6 +3340,9 @@ reduce the size of the final executable when a task is used a very large
number of times. For this flag to work, the task and tasks below it must number of times. For this flag to work, the task and tasks below it must
be pure; they cannot reference any variables outside the task itself. be pure; they cannot reference any variables outside the task itself.
Same as C<no_inline> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
=item /*verilator public*/ (parameter) =item /*verilator public*/ (parameter)
Used after a parameter declaration to indicate the emitted C code should Used after a parameter declaration to indicate the emitted C code should
@@ -3161,6 +3370,9 @@ Instead of using public variables, consider instead making a DPI or public
function that accesses the variable. This is nicer as it provides an function that accesses the variable. This is nicer as it provides an
obvious entry point that is also compatible across simulators. obvious entry point that is also compatible across simulators.
Same as C<public> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator public*/ (task/function) =item /*verilator public*/ (task/function)
Used inside the declaration section of a function or task declaration to Used inside the declaration section of a function or task declaration to
@@ -3183,6 +3395,9 @@ the model will NOT notice changes made to variables in these functions.
You may want to use DPI exports instead, as it's compatible with other You may want to use DPI exports instead, as it's compatible with other
simulators. simulators.
Same as C<public> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator public_flat*/ (variable) =item /*verilator public_flat*/ (variable)
Used after an input, output, register, or wire declaration to indicate the Used after an input, output, register, or wire declaration to indicate the
@@ -3191,11 +3406,17 @@ signal. This will not declare this module public, which means the name of
the signal or path to it may change based upon the module inlining which the signal or path to it may change based upon the module inlining which
takes place. takes place.
Same as C<public_flat> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
=item /*verilator public_flat_rd*/ (variable) =item /*verilator public_flat_rd*/ (variable)
Used after an input, output, register, or wire declaration to indicate the Used after an input, output, register, or wire declaration to indicate the
signal should be declared public_flat (see above), but read-only. signal should be declared public_flat (see above), but read-only.
Same as C<public_flat_rd> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
=item /*verilator public_flat_rw @(<edge_list>) */ (variable) =item /*verilator public_flat_rw @(<edge_list>) */ (variable)
Used after an input, output, register, or wire declaration to indicate the Used after an input, output, register, or wire declaration to indicate the
@@ -3204,6 +3425,9 @@ where writes should be considered to have the timing specified by the given
sensitivity edge list. Set for all variables, ports and wires using the sensitivity edge list. Set for all variables, ports and wires using the
--public-flat-rw switch. --public-flat-rw switch.
Same as C<public_flat_rw> in configuration files, see L</"CONFIGURATION
FILES"> for more information.
=item /*verilator public_module*/ =item /*verilator public_module*/
Used after a module statement to indicate the module should not be inlined Used after a module statement to indicate the module should not be inlined
@@ -3212,9 +3436,12 @@ Verilator automatically sets this attribute when the module contains any
public signals or `systemc_ directives. Also set for all modules when public signals or `systemc_ directives. Also set for all modules when
using the --public switch. using the --public switch.
Same as C<public> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator sc_clock*/ =item /*verilator sc_clock*/
Rarely needed. Used after an input declaration to indicate the signal Deprecated. Used after an input declaration to indicate the signal
should be declared in SystemC as a sc_clock instead of a bool. This was should be declared in SystemC as a sc_clock instead of a bool. This was
needed in SystemC 1.1 and 1.2 only; versions 2.0 and later do not require needed in SystemC 1.1 and 1.2 only; versions 2.0 and later do not require
clock pins to be sc_clocks and this is no longer needed. clock pins to be sc_clocks and this is no longer needed.
@@ -3226,7 +3453,10 @@ type, instead of bool, vluint32_t or vluint64_t. This may be useful if
the port width is parameterized and different of such modules interface the port width is parameterized and different of such modules interface
a templated module (such as a transactor) or for other reasons. In general a templated module (such as a transactor) or for other reasons. In general
you should avoid using this attribute when not necessary as with increasing you should avoid using this attribute when not necessary as with increasing
usage of sc_bv the performance increases significantly. usage of sc_bv the performance decreases significantly.
Same as C<sc_bv> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator sformat*/ =item /*verilator sformat*/
@@ -3235,6 +3465,39 @@ indicate the function or task should pass all remaining arguments through
$sformatf. This allows creation of DPI functions with $display like $sformatf. This allows creation of DPI functions with $display like
behavior. See the test_regress/t/t_dpi_display.v file for an example. behavior. See the test_regress/t/t_dpi_display.v file for an example.
Same as C<sformat> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator split_var*/
Attached to a variable or a net declaration to break the variable into
multiple pieces typically to resolve UNOPTFLAT performance issues.
Typically the variables to attach this to are recommeded by Verilator
itself, see UNOPTFLAT below.
For example, Verilator will internally convert a variable with the
metacomment such as:
logic [7:0] x [0:1] /*verilator split_var*/;
To:
logic [7:0] x__BRA__0__KET__ /*verilator split_var*/;
logic [7:0] x__BRA__1__KET__ /*verilator split_var*/;
Note that the generated packed variables retain the split_var metacomment
because they may be split into further smaller pieces accorting to the
access patterns.
This only supports unpacked arrays, packed arrays, and packed structs of
integer types (reg, logic, bit, byte, int...); otherwise if a split was
requested but cannot occur a SPLITVAR warning is issued. Splitting large
arrays may slow donw the Verilation speed, so use this only on variables
that require it.
Same as C<split_var> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator tag <text...>*/ =item /*verilator tag <text...>*/
Attached after a variable or structure member to indicate opaque (to Attached after a variable or structure member to indicate opaque (to
@@ -3317,7 +3580,7 @@ that Verilator will print a list of known scopes to help your debugging.
=head2 Floating Point =head2 Floating Point
Floating Point (real) numbers are supported. Short floating point (shortreal) numbers are converted to real.
=head2 Latches =head2 Latches
@@ -3507,6 +3770,11 @@ Assignment patterns with order based, default, constant integer (array) or
member identifier (struct/union) keys are supported. Data type keys and member identifier (struct/union) keys are supported. Data type keys and
keys which are computed from a constant expression are not supported. keys which are computed from a constant expression are not supported.
=item `uselib
Uselib, a vendor specific library specification method, is ignored along
with anything following it until the end of that line.
=item cast operator =item cast operator
Casting is supported only between simple scalar types, signed and unsigned, Casting is supported only between simple scalar types, signed and unsigned,
@@ -3565,17 +3833,29 @@ $unsigned, $warning.
Generally supported. Generally supported.
=item $display, $write, $fdisplay, $fwrite, $swrite
$display and friends must have a constant format string as the first
argument (as with C's printf). The rare usage which lists variables
standalone without a format is not supported.
=item $displayb, $displayh, $displayo, $writeb, $writeh, $writeo, etc =item $displayb, $displayh, $displayo, $writeb, $writeh, $writeo, etc
The sized display functions are rarely used and so not supported. Replace The sized display functions are rarely used and so not supported. Replace
them with a $write with the appropriate format specifier. them with a $write with the appropriate format specifier.
=item $dump/$dumpports and related
$dumpfile or $dumpports will create a VCD or FST file (which is based on
the --trace argument given when the model was Verilated). This will take
effect starting at the next eval() call. If you have multiple Verilated
designs under the same C model, then this will dump signals only from the
design containing the $dumpvar.
$dumpvars and $dumpports module identifier is ignored; the traced instances
will always start at the top of the design. The levels argument is also
ignored, use tracing_on/tracing_off pragmas instead.
$dumpportson/$dumpportsoff/$dumpportsall/$dumpportslimit filename argument
is ignored, only a single trace file may be active at once.
$dumpall/$dumpportsall, $dumpon/$dumpportson, $dumpoff/$dumpportsoff, and
$dumplimit/$dumpportlimit are currently ignored.
=item $finish, $stop =item $finish, $stop
The rarely used optional parameter to $finish and $stop is ignored. The rarely used optional parameter to $finish and $stop is ignored.
@@ -3645,7 +3925,24 @@ checking across the designs, and prevents other users from compiling your
code without knowing the magic set of disables needed to successfully code without knowing the magic set of disables needed to successfully
compile your design. compile your design.
List of all warnings: =head2 Error and Warning Format
Warnings and errors printed by Verilator always match this regular
expression:
%(Error|Warning)(-[A-Z0-9_]+)?: ((\S+):(\d+):((\d+):)? )?.*
Errors and warning start with a percent sign (historical heritage from
Digital Equipment Corporation). Some errors or warning have a code
attached, with meanings described below. Some errors also have a filename,
line number and optional column number (starting at column 1 to match GCC).
Following an the error message, Verilator will typically show the user's
source code corresponding to the error, prefixed by the line number and a "
| ". Following this is typically an arrow and ~ pointing at the error on
the source line directly above.
=head2 List of all warnings
=over 4 =over 4
@@ -3743,6 +4040,14 @@ generally unrolls small loops. You may want to try increasing
--unroll-count (and occasionally --unroll-stmts) which will raise the small --unroll-count (and occasionally --unroll-stmts) which will raise the small
loop bar to avoid this error. loop bar to avoid this error.
=item BOUNDED
This indicates that bounded queues (e.g. "var name[$ : 3]") are
unsupported.
Ignoring this warning may make Verilator simulations differ from other
simulators.
=item BSSPACE =item BSSPACE
Warns that a backslash is followed by a space then a newline. Likely the Warns that a backslash is followed by a space then a newline. Likely the
@@ -4185,6 +4490,29 @@ Ignoring this warning may make Verilator simulations differ from other
simulators, if the increased precision of real affects your model or DPI simulators, if the increased precision of real affects your model or DPI
calls. calls.
=item SPLITVAR
Warns that a variable with a C<split_var> metacomment was not split.
Some possible reasons for this are:
* The datatype of the variable is not supported for splitting. (e.g. is a
real).
* The access pattern of the variable can not be determined
statically. (e.g. is accessed as a memory).
* The index of the array exceeds the array size.
* The variable is accessed from outside using dotted reference.
(e.g. top.instance0.variable0 = 1).
* The variable is not declared in a module, but in a package or an
interface.
* The variable is a parameter, localparam, genvar, or queue.
* The variable is tirstate or bidirectional. (e.g. inout or ref).
=item STMTDLY =item STMTDLY
Warns that you have a statement with a delayed time in front of it, for Warns that you have a statement with a delayed time in front of it, for
@@ -4316,6 +4644,11 @@ being generated from an always statement that consumed high bits of the
same bus processed by another series of always blocks. The fix is the same bus processed by another series of always blocks. The fix is the
same; split it into two separate signals generated from each block. same; split it into two separate signals generated from each block.
Another way to resolve this warning is to add a C<split_var> metacomment
described above. This will cause the variable to be split internally,
potentially resolving the conflict. If you run with --report-unoptflat
Verilator will suggest possible candidates for C<split_var>.
The UNOPTFLAT warning may also be due to clock enables, identified from the The UNOPTFLAT warning may also be due to clock enables, identified from the
reported path going through a clock gating cell. To fix these, use the reported path going through a clock gating cell. To fix these, use the
clock_enable meta comment described above. clock_enable meta comment described above.
@@ -4463,6 +4796,37 @@ that is not yet supported in Verilator. See the Limitations chapter.
=back =back
=head1 DEPRECATIONS
The following deprecated items are scheduled for future removal:
=over 4
=item Pre-C++11 compiler support
Verilator supports pre-C++11 compilers for non-threaded models when
configured with --enable-prec11. This flag will be removed and C++11
compilers will be required for both compiling Verilator and compiling
Verilated models no sooner than September 2020.
=item SystemC 2.1 and earlier support
Support for SystemC versions 2.1 and earlier and the related sc_clock
variable attribute will be removed no sooner than July 2020.
=item Configuration File -msg
The -msg argument to lint_off has been replaced with -rule. -msg is
planned for removal no sooner than January 2021.
=item XML locations
The XML C<fl> attribute has been replaced with C<loc>. C<fl> is planned
for removal no sooner than January 2021.
=back
=head1 FAQ/FREQUENTLY ASKED QUESTIONS =head1 FAQ/FREQUENTLY ASKED QUESTIONS
=over 4 =over 4
@@ -4551,19 +4915,20 @@ designs have topped 16GB.
See the next question for tracing in SystemC mode. See the next question for tracing in SystemC mode.
Add the --trace switch to Verilator, and in your top level C code, call A. Add the --trace switch to Verilator, and in your top level C code, call
Verilated::traceEverOn(true). Then create a VerilatedVcdC object, and Verilated::traceEverOn(true). Then you may use $dumpfile and $dumpvars to
in your main loop call "trace_object->dump(time)" every time step, and enable traces, same as with any Verilog simulator. See
finally call "trace_object->close()". For an example, see below and the C<examples/make_tracing_c>.
examples/make_tracing_c/sim_main.cpp file of the distribution.
You also need to compile verilated_vcd_c.cpp and add it to your link, B. Or, for finer-grained control, or C++ files with multiple Verilated
preferably by adding the dependencies in $(VK_GLOBAL_OBJS) to your modules you may also create the trace purely from C++. Create a
Makefile's link rule. This is done for you if using the Verilator --exe VerilatedVcdC object, and in your main loop call "trace_object->dump(time)"
flag. every time step, and finally call "trace_object->close()". You also need
to compile verilated_vcd_c.cpp and add it to your link, preferably by
Note you can also call ->trace on multiple Verilated objects with the same adding the dependencies in $(VK_GLOBAL_OBJS) to your Makefile's link rule.
trace file if you want all data to land in the same output file. This is done for you if using the Verilator --exe flag. Note you can also
call ->trace on multiple Verilated objects with the same trace file if you
want all data to land in the same output file.
#include "verilated_vcd_c.h" #include "verilated_vcd_c.h"
... ...
@@ -4583,11 +4948,17 @@ trace file if you want all data to land in the same output file.
=item How do I generate waveforms (traces) in SystemC? =item How do I generate waveforms (traces) in SystemC?
Add the --trace switch to Verilator, and in your top level C sc_main code, A. Add the --trace switch to Verilator, and in your top level sc_main, call
include verilated_vcd_sc.h. Then call Verilated::traceEverOn(true). Then Verilated::traceEverOn(true). Then you may use $dumpfile and $dumpvars to
create a VerilatedVcdSc object as you would create a normal SystemC trace enable traces, same as with any Verilog simulator, see the non-SystemC
file. For an example, see the call to VerilatedVcdSc in the example in C<examples/make_tracing_c>. This will trace only the module
examples/make_tracing_sc/sc_main.cpp file of the distribution, and below. containing the $dumpvar.
B. Or, you may create a trace purely from SystemC, which may trace all
Verilated designs in the SystemC model. Create a VerilatedVcdSc object as
you would create a normal SystemC trace file. For an example, see the call
to VerilatedVcdSc in the examples/make_tracing_sc/sc_main.cpp file of the
distribution, and below.
Alternatively you may use the C++ trace mechanism described in the previous Alternatively you may use the C++ trace mechanism described in the previous
question, however the timescale and timeprecision will not inherited from question, however the timescale and timeprecision will not inherited from
@@ -4617,23 +4988,23 @@ trace file if you want all data to land in the same output file.
=item How do I generate FST waveforms (traces) in C++? =item How do I generate FST waveforms (traces) in C++?
FST a format by GTKWave. FST a format by GTKWave. This version provides a basic FST support. To
This version provides a basic FST support. dump FST format, add the --trace-fst switch to Verilator and either A. use
To dump FST format, add the --trace-fst switch to Verilator and change the include $dumpfile/$dumpvars in Verilog as described in the VCD example above, or
path in the testbench to: B. in C++ change the include described in the VCD example above:
#include "verilated_fst_c.h" #include "verilated_fst_c.h"
VerilatedFstC* tfp = new VerilatedFstC; VerilatedFstC* tfp = new VerilatedFstC;
Note that currently supporting both FST and VCD in a single simulation is impossible, Note that currently supporting both FST and VCD in a single simulation is
but such requirement could be rare. impossible, but such requirement should be rare.
=item How do I generate FST waveforms (traces) in SystemC? =item How do I generate FST waveforms (aka dumps or traces) in SystemC?
The FST library from GTKWave does not currently support SystemC; use VCD The FST library from GTKWave does not currently support SystemC; use VCD
format instead. format instead.
=item How do I view waveforms (traces)? =item How do I view waveforms (aka dumps or traces)?
Verilator makes standard VCD (Value Change Dump) and FST files. VCD files are viewable Verilator makes standard VCD (Value Change Dump) and FST files. VCD files are viewable
with the public domain GTKWave (recommended) or Dinotrace (legacy) with the public domain GTKWave (recommended) or Dinotrace (legacy)
@@ -4694,7 +5065,7 @@ Most synthesis tools similarly define SYNTHESIS for you.
=item Why do I get "unexpected `do'" or "unexpected `bit'" errors? =item Why do I get "unexpected `do'" or "unexpected `bit'" errors?
Do, bit, ref, return, and other words are now SystemVerilog keywords. You Do, bit, ref, return, and other words are now SystemVerilog keywords. You
should change your code to not use them to insure it works with newer should change your code to not use them to ensure it works with newer
tools. Alternatively, surround them by the Verilog 2005/SystemVerilog tools. Alternatively, surround them by the Verilog 2005/SystemVerilog
begin_keywords pragma to indicate Verilog 2001 code. begin_keywords pragma to indicate Verilog 2001 code.
@@ -4844,7 +5215,7 @@ SystemC module *may* be faster.)
=head1 BUGS =head1 BUGS
First, check the the coding limitations section. First, check the coding limitations section.
Next, try the --debug switch. This will enable additional internal Next, try the --debug switch. This will enable additional internal
assertions, and may help identify the problem. assertions, and may help identify the problem.
@@ -5016,11 +5387,15 @@ remain anonymous.
The latest version is available from L<https://verilator.org>. The latest version is available from L<https://verilator.org>.
Copyright 2003-2019 by Wilson Snyder. Verilator is free software; you can Copyright 2003-2020 by Wilson Snyder. This program is free software; you can
redistribute it and/or modify the Verilator internals under the terms of redistribute it and/or modify the Verilator internals under the terms of
either the GNU Lesser General Public License Version 3 or the Perl Artistic either the GNU Lesser General Public License Version 3 or the Perl Artistic
License Version 2.0. License Version 2.0.
All Verilog and C++/SystemC code quoted within this documentation file are
released as Creative Commons Public Domain (CC0). Many example files and
test files are likewise released under CC0 into effectively the Public
Domain as described in the files themselves.
=head1 SEE ALSO =head1 SEE ALSO
@@ -5028,7 +5403,7 @@ L<verilator_coverage>, L<verilator_gantt>, L<verilator_profcfunc>, L<make>,
L<verilator --help> which is the source for this document, L<verilator --help> which is the source for this document,
and internals.txt in the distribution. and docs/internals.adoc in the distribution.
=cut =cut
+8 -13
View File
@@ -1,18 +1,11 @@
: # -*-Mode: perl;-*- use perl, wherever it is #!/usr/bin/env perl
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
###################################################################### ######################################################################
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# #
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
###################################################################### ######################################################################
require 5.006_001; require 5.006_001;
@@ -271,10 +264,12 @@ Specifies a module search directory.
The latest version is available from L<https://verilator.org>. The latest version is available from L<https://verilator.org>.
Copyright 2003-2019 by Wilson Snyder. Verilator is free software; you can Copyright 2003-2020 by Wilson Snyder. This program is free software; you
redistribute it and/or modify the Verilator internals under the terms of can redistribute it and/or modify the Verilator internals under the terms
either the GNU Lesser General Public License Version 3 or the Perl Artistic of either the GNU Lesser General Public License Version 3 or the Perl
License Version 2.0. Artistic License Version 2.0.
SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
=head1 AUTHORS =head1 AUTHORS
+7 -7
View File
@@ -1,10 +1,7 @@
: # -*-Mode: perl;-*- use perl, wherever it is #!/usr/bin/env perl
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
# See copyright, etc in below POD section. # See copyright, etc in below POD section.
###################################################################### ######################################################################
require 5.006_001;
use warnings; use warnings;
use Getopt::Long; use Getopt::Long;
use IO::File; use IO::File;
@@ -236,9 +233,12 @@ Do not show differences in line numbering.
The latest version is available from L<https://verilator.org>. The latest version is available from L<https://verilator.org>.
Copyright 2005-2019 by Wilson Snyder. This package is free software; you can Copyright 2005-2020 by Wilson Snyder. This program is free software; you
redistribute it and/or modify it under the terms of either the GNU Lesser can redistribute it and/or modify it under the terms of either the GNU
General Public License Version 3 or the Perl Artistic License Version 2.0. Lesser General Public License Version 3 or the Perl Artistic License
Version 2.0.
SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
=head1 AUTHORS =head1 AUTHORS
+10 -9
View File
@@ -1,11 +1,9 @@
: # -*-Mode: perl;-*- use perl, wherever it is #!/usr/bin/env perl
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
# See copyright, etc in below POD section. # See copyright, etc in below POD section.
###################################################################### ######################################################################
use strict;
use warnings; use warnings;
use strict;
use Getopt::Long; use Getopt::Long;
use IO::File; use IO::File;
use Pod::Usage; use Pod::Usage;
@@ -125,13 +123,13 @@ sub report {
} }
my $nthreads = scalar keys %Threads; my $nthreads = scalar keys %Threads;
$Global{cpus}{cpu_time} = {}; $Global{cpus} = {};
foreach my $thread (keys %Threads) { foreach my $thread (keys %Threads) {
# Make potentially multiple characters per column # Make potentially multiple characters per column
foreach my $start (keys %{$Threads{$thread}}) { foreach my $start (keys %{$Threads{$thread}}) {
my $cpu = $Threads{$thread}{$start}{cpu}; my $cpu = $Threads{$thread}{$start}{cpu};
my $elapsed = $Threads{$thread}{$start}{end} - $start; my $elapsed = $Threads{$thread}{$start}{end} - $start;
$Global{cpus}{cpu_time}{$cpu} += $elapsed; $Global{cpus}{$cpu}{cpu_time} += $elapsed;
} }
} }
@@ -540,9 +538,12 @@ verilator_gantt.vcd.
The latest version is available from L<https://verilator.org>. The latest version is available from L<https://verilator.org>.
Copyright 2018-2019 by Wilson Snyder. Verilator is free software; you can Copyright 2018-2020 by Wilson Snyder. This program is free software; you
redistribute it and/or modify it under the terms of either the GNU Lesser can redistribute it and/or modify it under the terms of either the GNU
General Public License Version 3 or the Perl Artistic License Version 2.0. Lesser General Public License Version 3 or the Perl Artistic License
Version 2.0.
SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
=head1 AUTHORS =head1 AUTHORS
+6 -6
View File
@@ -1,11 +1,11 @@
: # -*-Mode: perl;-*- use perl, wherever it is #!/usr/bin/env perl
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
# DESCRIPTION: Print include statements for each ARGV # DESCRIPTION: Print include statements for each ARGV
# #
# Copyright 2003-2019 by Wilson Snyder. This package is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU Lesser # can redistribute it and/or modify it under the terms of either the GNU
# General Public License Version 3 or the Perl Artistic License Version 2.0. # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
###################################################################### ######################################################################
require 5.005; require 5.005;
+7 -6
View File
@@ -1,6 +1,4 @@
: # -*-Mode: perl;-*- use perl, wherever it is #!/usr/bin/env perl
eval 'exec perl -wS $0 ${1+"$@"}'
if 0;
# See copyright, etc in below POD section. # See copyright, etc in below POD section.
###################################################################### ######################################################################
@@ -230,9 +228,12 @@ Displays this message and program version and exits.
The latest version is available from L<https://verilator.org>. The latest version is available from L<https://verilator.org>.
Copyright 2007-2019 by Wilson Snyder. Verilator is free software; you can Copyright 2007-2020 by Wilson Snyder. This program is free software; you
redistribute it and/or modify it under the terms of either the GNU Lesser can redistribute it and/or modify it under the terms of either the GNU
General Public License Version 3 or the Perl Artistic License Version 2.0. Lesser General Public License Version 3 or the Perl Artistic License
Version 2.0.
SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
=head1 AUTHORS =head1 AUTHORS
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# DESCRIPTION: Verilator: Build script for vcddiff
#
# Copyright 2019 by Todd Strader. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
set -e
# NB: it would be better to add this via a PPA
TMP_DIR=$(mktemp -d)
git -C "${TMP_DIR}" clone https://github.com/veripool/vcddiff
VCDDIFF_DIR=${TMP_DIR}/vcddiff
git -C "${VCDDIFF_DIR}" checkout 5112f88b7ba8818dce9dfb72619e64a1fc19542c
make -C "${VCDDIFF_DIR}"
sudo cp "${VCDDIFF_DIR}/vcddiff" /usr/local/bin
+3 -2
View File
@@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
# DESCRIPTION: Verilator: Travis CI build script # DESCRIPTION: Verilator: Travis CI build script
# #
# Copyright 2019 by Todd Strader. This program is free software; you can # Copyright 2019 by Todd Strader. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
# This script builds and caches the Verilator binaries for Travis CI # This script builds and caches the Verilator binaries for Travis CI
# (and possibly other CI platforms). The Verilator CI system uses this # (and possibly other CI platforms). The Verilator CI system uses this
+58
View File
@@ -0,0 +1,58 @@
# DESCRIPTION: Dockerfile for env to build and fully test Verilator
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
FROM ubuntu:18.04
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install --no-install-recommends -y \
autoconf=2.69-11 \
bc=1.07.1-2 \
bison=2:3.0.4.dfsg-1build1 \
build-essential=12.4ubuntu1 \
ca-certificates=20180409 \
cmake=3.10.2-1ubuntu2.18.04.1 \
flex=2.6.4-6 \
gdb=8.1-0ubuntu3.2 \
gcc-6=6.5.0-2ubuntu1~18.04 \
gcc-5=5.5.0-12ubuntu1 \
gcc-4.8=4.8.5-4ubuntu8 \
git=1:2.17.1-1ubuntu0.5 \
gtkwave=3.3.86-1 \
g++-6=6.5.0-2ubuntu1~18.04 \
g++-5=5.5.0-12ubuntu1 \
g++-4.8=4.8.5-4ubuntu8 \
libfl2=2.6.4-6 \
libfl-dev=2.6.4-6 \
numactl=2.0.11-2.1ubuntu0.1 \
perl=5.26.1-6ubuntu0.3 \
python3=3.6.7-1~18.04 \
wget=1.19.4-1ubuntu2.2 \
zlibc=0.9k-4.3 \
zlib1g=1:1.2.11.dfsg-0ubuntu2 \
zlib1g-dev=1:1.2.11.dfsg-0ubuntu2 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
COPY build-systemc.sh /tmp/
RUN ./build-systemc.sh
RUN cpan install -fi Unix::Processors Parallel::Forker Bit::Vector
RUN git clone https://github.com/veripool/vcddiff.git && \
make -C vcddiff && \
cp -p vcddiff/vcddiff /usr/local/bin/vcddiff && \
rm -rf vcddiff
COPY build.sh /tmp/build.sh
ENV VERILATOR_AUTHOR_SITE=1
ENTRYPOINT [ "/tmp/build.sh" ]
+49
View File
@@ -0,0 +1,49 @@
= Verilator Docker Build Environment
This Verilator Build container is set up to compile and test a Verilator
build. It uses the following parameters:
* Source repository (default: https://github.com/verilator/verilator)
* Source revision (default: master)
* GCC version (4.8.5, 5.5.0, 6.5.0, 7.4.0, default: 7.4.0)
The container is published as `verilator/verilator-buildenv` on
https://hub.docker.com/repository/docker/verilator/verilator-buildenv[docker hub].
To run the basic build using the current Verilator master:
docker run -ti verilator/verilator-buildenv
To also run tests:
docker run -ti verilator/verilator-buildenv test
To change the compiler:
docker run -ti -e CC=gcc-4.8 -e CXX=g++-4.8 verilator/verilator-buildenv test
The tests that involve gdb are not working due to security restrictions.
To run those too:
....
docker run -ti -v ${PWD}:/tmp/repo -e REPO=/tmp/repo -e REV=`git rev-parse --short HEAD` -e CC=gcc-4.8 -e CXX=g++-4.8 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined verilator/verilator-buildenv test
....
Rather then building using a remote git repository you may prefer to use a
working copy on the local filesystem. Mount the local working copy path as
a volume and use that in place of git. When doing this be careful to have
all changes committed to the local git area. To build the current HEAD from
top of a repository:
....
docker run -ti -v ${PWD}:/tmp/repo -e REPO=/tmp/repo -e REV=`git rev-parse --short HEAD` --cap-add=SYS_PTRACE --security-opt seccomp=unconfined verilator/verilator-buildenv test
....
== Rebuilding
To rebuild the Verilator-buildenv docker image, run:
docker build .
This will also build SystemC under all supported compiler variants to
reduce the SystemC testing time.
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash -e
# DESCRIPTION: Build SystemC in Ubuntu 18.04 with different g++/gcc
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
build_variant () {
version=$($1 --version | grep gcc | awk '{print $4}')
mkdir "/usr/local/systemc-2.3.3-gcc$version"
mkdir build
cd build
../configure --prefix="/usr/local/systemc-2.3.3-gcc$version" CC="$1" CXX="$2" LD="$2"
make -j
make install
cd ..
rm -r build
}
wget https://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.3.tar.gz
tar -xzf systemc-2.3.3.tar.gz
cd systemc-2.3.3
build_variant gcc g++
build_variant gcc-6 g++-6
build_variant gcc-5 g++-5
build_variant gcc-4.8 g++-4.8
cd ..
rm -r systemc-2.3.3*
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash -e
# DESCRIPTION: Build Verilator (inside container)
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
: "${REPO:=https://github.com/verilator/verilator}"
: "${REV:=master}"
: "${CC:=gcc}"
: "${CXX:=g++}"
GCCVERSION=$(${CC} --version | grep gcc | awk '{print $4}')
export SYSTEMC_INCLUDE="/usr/local/systemc-2.3.3-gcc${GCCVERSION}/include"
export SYSTEMC_LIBDIR="/usr/local/systemc-2.3.3-gcc${GCCVERSION}/lib-linux64"
export LD_LIBRARY_PATH=${SYSTEMC_LIBDIR}
SRCS=$PWD/verilator
git clone "$REPO" "$SRCS"
cd "$SRCS"
git checkout "$REV"
autoconf
./configure --enable-longtests
make -j $(nproc)
if [ "${1:-''}" == "test" ]; then
make test
fi
+48
View File
@@ -0,0 +1,48 @@
# DESCRIPTION: Dockerfile for image to run Verilator inside
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
FROM ubuntu:18.04
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
autoconf=2.69-11 \
bc=1.07.1-2 \
bison=2:3.0.4.dfsg-1build1 \
build-essential=12.4ubuntu1 \
ca-certificates=20180409 \
flex=2.6.4-6 \
git=1:2.17.1-1ubuntu0.5 \
libfl-dev=2.6.4-6 \
perl=5.26.1-6ubuntu0.3 \
python3=3.6.7-1~18.04 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ARG REPO=https://github.com/verilator/verilator
ARG SOURCE_COMMIT=master
WORKDIR /tmp
# Add an exception for the linter, we want to cd here in one layer
# to reduce the number of layers (and thereby size).
# hadolint ignore=DL3003
RUN git clone "${REPO}" verilator && \
cd verilator && \
git checkout "${SOURCE_COMMIT}" && \
autoconf && \
./configure && \
make -j "$(nproc)" && \
make install && \
cd .. && \
rm -r verilator
COPY verilator-wrap.sh /usr/local/bin/verilator-wrap.sh
WORKDIR /work
ENTRYPOINT [ "/usr/local/bin/verilator-wrap.sh" ]
+59
View File
@@ -0,0 +1,59 @@
= Verilator Executable Docker Container
The Verilator Executable Docker Container allows you to run Verilator
easily as a docker image, e.g.:
docker run -ti verilator/verilator:latest --version
This will install the container, run the latest Verilator and print
Verilator's version.
Containers are automatically built for all released versions, so you may
easily compare results across versions, e.g.:
docker run -ti verilator/verilator:4.030 --version
Verilator needs to read and write files on the local system. To simplify
this process, use the `verilator-docker` convenience script. This script
takes the version number, and all remaining arguments are passed through to
Verilator. e.g.:
./verilator-docker 4.030 --version
or
./verilator-docker 4.030 --cc test.v
If you prefer not to use `verilator-docker` you must give the container
access to your files as a volume with appropriate user rights. For example
to Verilate test.v:
....
docker run -ti -v ${PWD}:/work --user $(id -u):$(id -g) verilator/verilator:latest --cc test.v
....
This method can only access files below the current directory. An
alternative is setup the volume `-workdir`.
You can also work in the container by setting the entrypoint
(don't forget to mount a volume if you want your work persistent):
docker run -ti --entrypoint /bin/bash verilator/verilator:latest
You can also use the container to build Verilator at a specific
commit:
docker build --build-arg SOURCE_COMMIT=<commit> .
== Internals
The Dockerfile builds Verilator and removes the tree when completed to
reduce the image size. The entrypoint is set as a wrapper script
(`verilator-wrap.sh`). That script 1. calls Verilator, and 2. copies the
Verilated runtime files to the `obj_dir` or the `-Mdir` respectively. This
allows the user to have the files to they may later build the C++ output
with the matching runtime files. The wrapper also patches the Verilated
Makefile accordingly.
There is also a hook defined that is run by docker hub via automated
builds.
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# DESCRIPTION: Docker hub hook to pass SOURCE_COMMIT
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
docker build --build-arg SOURCE_COMMIT=${SOURCE_COMMIT} -f $DOCKERFILE_PATH -t $IMAGE_NAME .
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# DESCRIPTION: Docker hub hook to tag the latest release (stable)
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
if [ "$SOURCE_BRANCH"="stable" ]; then
docker tag $IMAGE_NAME $DOCKER_REPO:latest
docker push $DOCKER_REPO:latest
fi
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# DESCRIPTION: Wrap a verilator call to run a docker container
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
docker pull verilator/verilator:$1 >/dev/null
docker run -ti -v ${PWD}:/work --user $(id -u):$(id -g) verilator/verilator:$1 "${@:2}"
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# DESCRIPTION: Wrap a Verilator call and copy vlt includes
# (inside docker container)
#
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
perl /usr/local/bin/verilator "$@"
status=$?
if [ $status -ne 0 ]; then
exit $status
fi
# Check if user set an obj_dir
obj_dir=$(echo " $@" | grep -oP '\s--Mdir\s*\K\S+')
if [ "$obj_dir" == "" ]; then
obj_dir="obj_dir"
fi
# If the run was successful: Copy required files to allow build without this container
if [ -e ${obj_dir} ]; then
# Copy files required for the build
mkdir -p ${obj_dir}/vlt
cp -r /usr/local/share/verilator/bin ${obj_dir}/vlt
cp -r /usr/local/share/verilator/include ${obj_dir}/vlt
# Point Makefile to that folder
perl -i -pe 's/VERILATOR_ROOT = \/usr\/local\/share\/verilator/VERILATOR_ROOT = vlt/g' ${obj_dir}/*.mk
fi
+10 -2
View File
@@ -1,10 +1,12 @@
#!/bin/bash #!/bin/bash
# DESCRIPTION: Verilator: Travis CI test script # DESCRIPTION: Verilator: Travis CI test script
# #
# Copyright 2019 by Todd Strader. This program is free software; you can # Copyright 2019 by Todd Strader. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
set -e set -e
export DRIVER_FLAGS='-j 0 --quiet --rerun' export DRIVER_FLAGS='-j 0 --quiet --rerun'
@@ -19,6 +21,12 @@ case $1 in
vltmt) vltmt)
make -C test_regress SCENARIOS=--vltmt make -C test_regress SCENARIOS=--vltmt
;; ;;
vltmt0)
make -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=0/2
;;
vltmt1)
make -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=1/2
;;
*) *)
echo "Usage: test.sh (dist|vlt|vltmt)" echo "Usage: test.sh (dist|vlt|vltmt)"
exit -1 exit -1
+95 -12
View File
@@ -1,12 +1,13 @@
# DESCRIPTION: Process this file with autoconf to produce a configure script. # DESCRIPTION: Process this file with autoconf to produce a configure script.
# #
# Copyright 2003-2019 by Wilson Snyder. Verilator is free software; you can # Copyright 2003-2020 by Wilson Snyder. Verilator is free software; you
# redistribute it and/or modify it under the terms of either the GNU Lesser # can redistribute it and/or modify it under the terms of either the GNU Lesser
# General Public License Version 3 or the Perl Artistic License Version 2.0. # General Public License Version 3 or the Perl Artistic License Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
#AC_INIT([Verilator],[#.### YYYY-MM-DD]) #AC_INIT([Verilator],[#.### YYYY-MM-DD])
#AC_INIT([Verilator],[#.### devel]) #AC_INIT([Verilator],[#.### devel])
AC_INIT([Verilator],[4.024 2019-12-08], AC_INIT([Verilator],[4.032 2020-04-04],
[https://verilator.org], [https://verilator.org],
[verilator],[https://verilator.org]) [verilator],[https://verilator.org])
# When releasing, also update header of Changes file # When releasing, also update header of Changes file
@@ -25,11 +26,43 @@ AC_ARG_ENABLE([maintainer-mode],
AC_ARG_ENABLE([silent-rules], AC_ARG_ENABLE([silent-rules],
[AS_HELP_STRING([--disable-silent-rules], [ignored])]) [AS_HELP_STRING([--disable-silent-rules], [ignored])])
# Flag to enable linking specific libraries statically
AC_MSG_CHECKING(whether to perform partial static linking of Verilator binary)
AC_ARG_ENABLE([partial-static],
[AS_HELP_STRING([--disable-partial-static],
[By default, for Verilation peformance, Verilator
is linked against some of its dependencies
statically. Use this to link the Verilator binary
fully dynamically.])],
[case "${enableval}" in
yes) CFG_ENABLE_PARTIAL_STATIC=yes ;;
no) CFG_ENABLE_PARTIAL_STATIC=no ;;
*) AC_MSG_ERROR([bad value '${enableval}' for --disable-partial-static]) ;;
esac],
CFG_ENABLE_PARTIAL_STATIC=yes)
AC_MSG_RESULT($CFG_ENABLE_PARTIAL_STATIC)
# Flag to enable linking Verilator with tcmalloc if available
AC_MSG_CHECKING(whether to use tcmalloc)
AC_ARG_ENABLE([tcmalloc],
[AS_HELP_STRING([--enable-tcmalloc],
[Use libtcmalloc_minimal for faster dynamic memory
management in Verilator binary@<:@default=check@:>@])],
[case "${enableval}" in
yes) CFG_WITH_TCMALLOC=yes ;;
no) CFG_WITH_TCMALLOC=no ;;
*) AC_MSG_ERROR([bad value '${enableval}' for --enable-tcmalloc]) ;;
esac],
[CFG_WITH_TCMALLOC=check;])
AC_MSG_RESULT($CFG_WITH_TCMALLOC)
# Special Substitutions - CFG_WITH_DEFENV # Special Substitutions - CFG_WITH_DEFENV
AC_MSG_CHECKING(whether to use hardcoded paths) AC_MSG_CHECKING(whether to use hardcoded paths)
AC_ARG_ENABLE([defenv], AC_ARG_ENABLE([defenv],
[AS_HELP_STRING([--disable-defenv], [AS_HELP_STRING([--disable-defenv],
[disable using some hardcoded data paths extracted from some default environment variables (the default is to use hardcoded paths)])], [disable using some hardcoded data paths extracted
from some default environment variables (the default
is to use hardcoded paths) in Verilator binary])],
[case "${enableval}" in [case "${enableval}" in
yes) CFG_WITH_DEFENV=yes ;; yes) CFG_WITH_DEFENV=yes ;;
no) CFG_WITH_DEFENV=no ;; no) CFG_WITH_DEFENV=no ;;
@@ -43,7 +76,8 @@ AC_MSG_RESULT($CFG_WITH_DEFENV)
AC_MSG_CHECKING(whether to show and stop on compilation warnings) AC_MSG_CHECKING(whether to show and stop on compilation warnings)
AC_ARG_ENABLE([ccwarn], AC_ARG_ENABLE([ccwarn],
[AS_HELP_STRING([--enable-ccwarn], [AS_HELP_STRING([--enable-ccwarn],
[enable showing and stopping on compilation warnings])], [enable showing and stopping on compilation warnings
in Verilator binrary and Verilated makefiles])],
[case "${enableval}" in [case "${enableval}" in
yes) CFG_WITH_CCWARN=yes ;; yes) CFG_WITH_CCWARN=yes ;;
no) CFG_WITH_CCWARN=no ;; no) CFG_WITH_CCWARN=no ;;
@@ -79,7 +113,8 @@ AC_MSG_RESULT($CFG_WITH_LONGTESTS)
AC_MSG_CHECKING(whether allow pre-C++11) AC_MSG_CHECKING(whether allow pre-C++11)
AC_ARG_ENABLE([prec11], AC_ARG_ENABLE([prec11],
[AS_HELP_STRING([--enable-prec11], [AS_HELP_STRING([--enable-prec11],
[enable pre-C++11 compilers])], [enable pre-C++11 compilers for Verilator binary
and Verilated makefiles])],
[case "${enableval}" in [case "${enableval}" in
yes) CFG_WITH_PREC11=yes ;; yes) CFG_WITH_PREC11=yes ;;
no) CFG_WITH_PREC11=no ;; no) CFG_WITH_PREC11=no ;;
@@ -209,15 +244,26 @@ AC_DEFUN([_MY_LDLIBS_CHECK_FLAG],
LIBS="$ACO_SAVE_LIBS" LIBS="$ACO_SAVE_LIBS"
]) ])
AC_DEFUN([_MY_LDLIBS_CHECK_OPT], AC_DEFUN([_MY_LDLIBS_CHECK_IFELSE],
[# _MY_LDLIBS_CHECK_OPT(flag) -- Check if linker supports specific options [# _MY_LDLIBS_CHECK_IFELSE(flag,action-if-supported,action-if-not-supported)
# If it does, append flag to variable # Check if linker supports specific flag, if it does do action-if-supported
_MY_LDLIBS_CHECK_FLAG($2) # otherwise do action-if-not-supported
_MY_LDLIBS_CHECK_FLAG($1)
if test "$_my_result" = "yes" ; then if test "$_my_result" = "yes" ; then
$1="$$1 $2" true
$2
else
true
$3
fi fi
]) ])
AC_DEFUN([_MY_LDLIBS_CHECK_OPT],
[# _MY_LDLIBS_CHECK_OPT(variable, flag) -- Check if linker supports specific
# options. If it does, append flag to variable.
_MY_LDLIBS_CHECK_IFELSE($2, $1="$$1 $2")
])
# Flag to select newest language standard supported # Flag to select newest language standard supported
# Macros work such that first option that passes is the one we take # Macros work such that first option that passes is the one we take
# gnu++17 code is clean, but SystemC in 2018 doesn't link with it (bug1339) # gnu++17 code is clean, but SystemC in 2018 doesn't link with it (bug1339)
@@ -256,7 +302,6 @@ AC_SUBST(CFG_CXXFLAGS_WEXTRA)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments) _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Qunused-arguments)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-faligned-new) _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-faligned-new)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter) _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-unused-parameter)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-undefined-bool-conversion)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow) _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-Wno-shadow)
AC_SUBST(CFG_CXXFLAGS_SRC) AC_SUBST(CFG_CXXFLAGS_SRC)
@@ -310,6 +355,44 @@ m4_foreach([ldflag], [
AC_SUBST(CFG_LDLIBS_THREADS) AC_SUBST(CFG_LDLIBS_THREADS)
AC_SUBST(CFG_LDFLAGS_THREADS_CMAKE) AC_SUBST(CFG_LDFLAGS_THREADS_CMAKE)
# When linking partially statically
if test "$CFG_ENABLE_PARTIAL_STATIC" = "yes"; then
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -static-libgcc)
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -static-libstdc++)
_MY_LDLIBS_CHECK_OPT(CFG_LDFLAGS_SRC, -Xlinker -gc-sections)
LTCMALLOC=-l:libtcmalloc_minimal.a
else
LTCMALLOC=-ltcmalloc_minimal
fi
AC_SUBST(CFG_LDFLAGS_SRC)
# The pthread library is required by tcmalloc, so add it if it exists. If it
# does not, the tcmalloc check below will fail anyway, and linking against
# pthreads is harmless otherwise.
CFG_LIBS="$LIBS $CFG_LIBS"
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -lpthread)
# Check libraries for MingW
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -lbcrypt)
_MY_LDLIBS_CHECK_OPT(CFG_LIBS, -lpsapi)
# Check if tcmalloc is available based on --enable-tcmalloc
_MY_LDLIBS_CHECK_IFELSE(
$LTCMALLOC,
[if test "$CFG_WITH_TCMALLOC" != "no"; then
CFG_LIBS="$LTCMALLOC $CFG_LIBS";
# If using tcmalloc, add some extra options to make the compiler not assume
# it is using it's own versions of the standard library functions
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-malloc)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-calloc)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-realloc)
_MY_CXX_CHECK_OPT(CFG_CXXFLAGS_SRC,-fno-builtin-free)
fi],
[if test "$CFG_WITH_TCMALLOC" = "yes"; then
AC_MSG_ERROR([--enable-tcmalloc was given but test for ${LTCMALLOC} failed])
fi])
AC_SUBST(CFG_LIBS)
# Set CFG_WITH_THREADED if can support threading # Set CFG_WITH_THREADED if can support threading
AC_MSG_CHECKING(whether $CXX supports Verilated threads) AC_MSG_CHECKING(whether $CXX supports Verilated threads)
ACO_SAVE_CXXFLAGS="$CXXFLAGS" ACO_SAVE_CXXFLAGS="$CXXFLAGS"
+9 -9
View File
@@ -11,7 +11,7 @@ contributions flow more efficiently.
https://verilator.org/issues[Verilator Issues]. https://verilator.org/issues[Verilator Issues].
* If you're unable to find an open issue addressing the problem, * If you're unable to find an open issue addressing the problem,
https://verilator.org/issues/new[open a new issue]. https://verilator.org/issues/new[open a new Verilator issue].
** Be sure to include a **code sample** or an **executable test case** ** Be sure to include a **code sample** or an **executable test case**
demonstrating the bug and expected behavior that is not occurring. demonstrating the bug and expected behavior that is not occurring.
@@ -24,8 +24,8 @@ contributions flow more efficiently.
* Please https://verilator.org/issues/new[Open a new issue]. * Please https://verilator.org/issues/new[Open a new issue].
* You may attach a patch to the issue, or (preferred) may point to a GitHub * You may attach a patch to the issue, or (preferred) may request a GitHub
repository branch within your GitHub account. pull request.
** Verilator uses Travis CI to provide continuous integration. You may ** Verilator uses Travis CI to provide continuous integration. You may
want to setup Travis CI on your GitHub branch to ensure your changes want to setup Travis CI on your GitHub branch to ensure your changes
@@ -50,13 +50,13 @@ contributions flow more efficiently.
link:CONTRIBUTORS[docs/CONTRIBUTORS] and you are agreeing all future link:CONTRIBUTORS[docs/CONTRIBUTORS] and you are agreeing all future
contributions are also certified. contributions are also certified.
** We occasionally accept contributions where people do not want their ** We occasionally accept contributions where people do not want their name
name published. Please email us; you must still certify your published. Please email us; you must still privately certify your
contribution using email. contribution.
* Your test contributions are generally considered released into the public * Your test contributions are generally considered released into the
domain, unless you request otherwise or put a GNU/Artistic license on Creative Commons Public Domain (CC0), unless you request otherwise or put
your test file. a GNU/Artistic license on your file.
* Most important is we get your patch. If you'd like to clean up * Most important is we get your patch. If you'd like to clean up
indentation and related issues ahead of our feedback, that is indentation and related issues ahead of our feedback, that is
+11
View File
@@ -8,9 +8,11 @@ all.
Ahmed El-Mahmoudy Ahmed El-Mahmoudy
Alex Chadwick Alex Chadwick
Chris Randall Chris Randall
David Stanford
Driss Hafdi Driss Hafdi
Eric Rippey Eric Rippey
Garrett Smith Garrett Smith
Geza Lore
Gianfranco Costamagna Gianfranco Costamagna
Howard Su Howard Su
Iztok Jeras Iztok Jeras
@@ -19,15 +21,24 @@ John Coiner
Julien Margetts Julien Margetts
Kanad Kanhere Kanad Kanhere
Kevin Kiningham Kevin Kiningham
Kuba Ober
Lukasz Dalek Lukasz Dalek
Maarten De Braekeleer Maarten De Braekeleer
Maciej Sobkowski
Marco Widmer
Matthew Ballance Matthew Ballance
Mike Popoloski Mike Popoloski
Patrick Stewart Patrick Stewart
Peter Monsson
Philipp Wagner Philipp Wagner
Pieter Kapsenberg
Richard Myers Richard Myers
Sean Cross
Sebastien Van Cauwenberghe Sebastien Van Cauwenberghe
Stefan Wallentowitz Stefan Wallentowitz
Tobias Rosenkranz
Tobias Wölfel
Todd Strader Todd Strader
Wilson Snyder Wilson Snyder
Yutetsu TAKATSUKASA
Yves Mathieu Yves Mathieu
+3 -7
View File
@@ -7,15 +7,11 @@
# #
#***************************************************************************** #*****************************************************************************
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# Verilator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# #
#****************************************************************************/ #****************************************************************************/
# #
+2 -8
View File
@@ -1,9 +1,10 @@
// DESCRIPTION: Verilator: List of To Do issues. // DESCRIPTION: Verilator: List of To Do issues.
// //
// Copyright 2004-2019 by Wilson Snyder. This program is free software; you can // Copyright 2004-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
* Language support: * Language support:
** Fix ordering of each bit separately in a signal (mips) ** Fix ordering of each bit separately in a signal (mips)
@@ -22,17 +23,10 @@
** Assertions ** Assertions
** Tristate support ** Tristate support
* Configure/Make/Install
** Distribute with flex/bison already expanded?
Flex library not needed. Probably too difficult to be worth it.
* Testing: * Testing:
** Capture all inputs into global "rerun it" file
** Code to make wrapper that sets signals, so can do comparison checks ** Code to make wrapper that sets signals, so can do comparison checks
** New random program generator ** New random program generator
** Better graph viewer with search and zoom ** Better graph viewer with search and zoom
** Port and test against opencores.org code
** // verilator debug in code so can see only tree affecting those nodes
* Usability: * Usability:
** Detect and pre-remove most UNOPTFLATs ** Detect and pre-remove most UNOPTFLATs
+159
View File
@@ -0,0 +1,159 @@
clang-format is used to standardize the indentation of the internal C++
code.
For the most part clang-format changes provide good consistency, the two
main exceptions being the indentation of preprocessor directives, and
tables of statements.
Reformatting is generally performed only before other large changes are to
be made to a file. The following files are not yet clang-format clean:
clang-format -i include/verilated.h
clang-format -i include/verilated_dpi.h
clang-format -i include/verilated_fst_c.h
clang-format -i include/verilated_heavy.h
clang-format -i include/verilated_imp.h
clang-format -i include/verilated_save.h
clang-format -i include/verilated_sym_props.h
clang-format -i include/verilated_unordered_set_map.h
clang-format -i include/verilated_vcd_c.h
clang-format -i include/verilatedos.h
clang-format -i include/verilated.cpp
clang-format -i include/verilated_cov.cpp
clang-format -i include/verilated_dpi.cpp
clang-format -i include/verilated_fst_c.cpp
clang-format -i include/verilated_save.cpp
clang-format -i include/verilated_threads.cpp
clang-format -i include/verilated_vcd_c.cpp
clang-format -i include/verilated_vpi.cpp
clang-format -i src/V3Ast.h
clang-format -i src/V3AstNodes.h
clang-format -i src/V3EmitCBase.h
clang-format -i src/V3Error.h
clang-format -i src/V3File.h
clang-format -i src/V3FileLine.h
clang-format -i src/V3Global.h
clang-format -i src/V3Graph.h
clang-format -i src/V3GraphDfa.h
clang-format -i src/V3GraphStream.h
clang-format -i src/V3Hashed.h
clang-format -i src/V3LanguageWords.h
clang-format -i src/V3LinkDot.h
clang-format -i src/V3List.h
clang-format -i src/V3Number.h
clang-format -i src/V3Options.h
clang-format -i src/V3OrderGraph.h
clang-format -i src/V3Os.h
clang-format -i src/V3ParseImp.h
clang-format -i src/V3ParseSym.h
clang-format -i src/V3Partition.h
clang-format -i src/V3PartitionGraph.h
clang-format -i src/V3PreLex.h
clang-format -i src/V3PreProc.h
clang-format -i src/V3Scoreboard.h
clang-format -i src/V3SenTree.h
clang-format -i src/V3Simulate.h
clang-format -i src/V3Stats.h
clang-format -i src/V3String.h
clang-format -i src/V3SymTable.h
clang-format -i src/V3TSP.h
clang-format -i src/V3Task.h
clang-format -i src/V3WidthCommit.h
clang-format -i src/V3Active.cpp
clang-format -i src/V3ActiveTop.cpp
clang-format -i src/V3Assert.cpp
clang-format -i src/V3AssertPre.cpp
clang-format -i src/V3Ast.cpp
clang-format -i src/V3AstNodes.cpp
clang-format -i src/V3Begin.cpp
clang-format -i src/V3Branch.cpp
clang-format -i src/V3Broken.cpp
clang-format -i src/V3CCtors.cpp
clang-format -i src/V3Case.cpp
clang-format -i src/V3Cast.cpp
clang-format -i src/V3Cdc.cpp
clang-format -i src/V3Changed.cpp
clang-format -i src/V3Clean.cpp
clang-format -i src/V3Clock.cpp
clang-format -i src/V3Combine.cpp
clang-format -i src/V3Const.cpp
clang-format -i src/V3Coverage.cpp
clang-format -i src/V3CoverageJoin.cpp
clang-format -i src/V3Dead.cpp
clang-format -i src/V3Delayed.cpp
clang-format -i src/V3Depth.cpp
clang-format -i src/V3DepthBlock.cpp
clang-format -i src/V3EmitC.cpp
clang-format -i src/V3EmitCInlines.cpp
clang-format -i src/V3EmitCMake.cpp
clang-format -i src/V3EmitCSyms.cpp
clang-format -i src/V3EmitMk.cpp
clang-format -i src/V3EmitV.cpp
clang-format -i src/V3EmitXml.cpp
clang-format -i src/V3Error.cpp
clang-format -i src/V3Expand.cpp
clang-format -i src/V3File.cpp
clang-format -i src/V3FileLine.cpp
clang-format -i src/V3Gate.cpp
clang-format -i src/V3GenClk.cpp
clang-format -i src/V3Graph.cpp
clang-format -i src/V3GraphAcyc.cpp
clang-format -i src/V3GraphAlg.cpp
clang-format -i src/V3GraphDfa.cpp
clang-format -i src/V3GraphPathChecker.cpp
clang-format -i src/V3GraphTest.cpp
clang-format -i src/V3Hashed.cpp
clang-format -i src/V3Inline.cpp
clang-format -i src/V3Inst.cpp
clang-format -i src/V3InstrCount.cpp
clang-format -i src/V3Life.cpp
clang-format -i src/V3LifePost.cpp
clang-format -i src/V3LinkCells.cpp
clang-format -i src/V3LinkDot.cpp
clang-format -i src/V3LinkJump.cpp
clang-format -i src/V3LinkLValue.cpp
clang-format -i src/V3LinkLevel.cpp
clang-format -i src/V3LinkParse.cpp
clang-format -i src/V3LinkResolve.cpp
clang-format -i src/V3Localize.cpp
clang-format -i src/V3Name.cpp
clang-format -i src/V3Number.cpp
clang-format -i src/V3Number_test.cpp
clang-format -i src/V3Options.cpp
clang-format -i src/V3Order.cpp
clang-format -i src/V3Os.cpp
clang-format -i src/V3Param.cpp
clang-format -i src/V3ParseGrammar.cpp
clang-format -i src/V3ParseImp.cpp
clang-format -i src/V3ParseLex.cpp
clang-format -i src/V3Partition.cpp
clang-format -i src/V3PreProc.cpp
clang-format -i src/V3PreShell.cpp
clang-format -i src/V3Premit.cpp
clang-format -i src/V3ProtectLib.cpp
clang-format -i src/V3Reloop.cpp
clang-format -i src/V3Scope.cpp
clang-format -i src/V3Scoreboard.cpp
clang-format -i src/V3Slice.cpp
clang-format -i src/V3Split.cpp
clang-format -i src/V3SplitAs.cpp
clang-format -i src/V3SplitVar.cpp
clang-format -i src/V3Stats.cpp
clang-format -i src/V3StatsReport.cpp
clang-format -i src/V3String.cpp
clang-format -i src/V3Subst.cpp
clang-format -i src/V3TSP.cpp
clang-format -i src/V3Table.cpp
clang-format -i src/V3Task.cpp
clang-format -i src/V3Trace.cpp
clang-format -i src/V3TraceDecl.cpp
clang-format -i src/V3Tristate.cpp
clang-format -i src/V3Undriven.cpp
clang-format -i src/V3Unknown.cpp
clang-format -i src/V3Unroll.cpp
clang-format -i src/V3Width.cpp
clang-format -i src/V3WidthSel.cpp
clang-format -i src/Verilator.cpp
+1 -1
View File
@@ -3,4 +3,4 @@
* \section intro_sec Introduction * \section intro_sec Introduction
* *
* This is a full doxygen analysis of the Verilator source tree. * This is a full doxygen analysis of the Verilator source tree.
*/ */
+20 -8
View File
@@ -21,9 +21,14 @@ Git, below, maybe a better alternative.) To install as a package:
If this works, skip down to <<Running Verilator>>. If this works, skip down to <<Running Verilator>>.
=== Docker
Verilator is available in pre-built Docker containers. See
https://github.com/verilator/verilator/blob/master/ci/docker/run/README.adoc
=== Git === Git
Alternatively, installing Verilator with Git provides the most flexibility. Installing Verilator with Git provides the most flexibility.
For additional options and details see the additional sections below. In For additional options and details see the additional sections below. In
brief: brief:
@@ -79,6 +84,10 @@ To build Verilator you will need to install some standard packages:
sudo apt-get install autoconf sudo apt-get install autoconf
sudo apt-get install flex bison sudo apt-get install flex bison
The following are optional, but improve compilation speed:
sudo apt-get install libgoogle-perftools-dev
Additionally, to build or run Verilator you need these standard packages: Additionally, to build or run Verilator you need these standard packages:
sudo apt-get install perl python3 sudo apt-get install perl python3
@@ -89,18 +98,20 @@ Additionally, to build or run Verilator you need these standard packages:
Those developing Verilator may also want these (see internals.adoc): Those developing Verilator may also want these (see internals.adoc):
sudo apt-get install gdb asciidoctor graphviz sudo apt-get install gdb asciidoctor graphviz cmake
cpan install Pod::Perldoc cpan install Pod::Perldoc
cpan install Unix::Processors cpan install Unix::Processors
cpan install Parallel::Forker
cpan install Bit::Vector
==== Install SystemC ==== Install SystemC
If you will be using SystemC (vs straight C++ output), download If you will be using SystemC (vs straight C++ output), download
http://www.systemc.org[SystemC]. Follow their installation instructions. https://www.accellera.org/downloads/standards/systemc[SystemC].
You will need to set `SYSTEMC_INCLUDE` to point to the include directory Follow their installation instructions. You will need to set `SYSTEMC_INCLUDE`
with systemc.h in it, and `SYSTEMC_LIBDIR` to points to the directory with to point to the include directory with `systemc.h` in it, and `SYSTEMC_LIBDIR`
libsystemc.a in it. (Older installations may set `SYSTEMC` and to points to the directory with `libsystemc.a` in it. (Older installations
`SYSTEMC_ARCH` instead.) may set `SYSTEMC` and `SYSTEMC_ARCH` instead.)
==== Install GTKWave ==== Install GTKWave
@@ -289,6 +300,7 @@ or https://verilator.org/verilator_doc.pdf[Verilator manual (PDF)].
== License == License
Copyright 2008-2019 by Wilson Snyder. Verilator is free software; you can Copyright 2008-2020 by Wilson Snyder. Verilator is free software; you can
redistribute it and/or modify it under the terms of either the GNU Lesser redistribute it and/or modify it under the terms of either the GNU Lesser
General Public License Version 3 or the Perl Artistic License Version 2.0. General Public License Version 3 or the Perl Artistic License Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
+28 -5
View File
@@ -70,7 +70,10 @@ The AST is represented at the top level by the class `AstNode`. This
abstract class has derived classes for the individual components abstract class has derived classes for the individual components
(e.g. `AstGenerate` for a generate block) or groups of components (e.g. `AstGenerate` for a generate block) or groups of components
(e.g. `AstNodeFTask` for functions and tasks, which in turn has `AstFunc` (e.g. `AstNodeFTask` for functions and tasks, which in turn has `AstFunc`
and `AstTask` as derived classes). and `AstTask` as derived classes). An important property of the `AstNode`
type hierarchy is that all non-final subclasses of `AstNode` (i.e.: those
which themselves have subclasses) must be abstract as well, and be named
with the prefix `AstNode*`. The `astgen` (see below) script relies on this.
Each `AstNode` has pointers to up to four children, accessed by the `op1p` Each `AstNode` has pointers to up to four children, accessed by the `op1p`
through `op4p` methods. These methods are then abstracted in a specific through `op4p` methods. These methods are then abstracted in a specific
@@ -382,12 +385,19 @@ changed; if clear, checking those signals for changes may be skipped.
== Coding Conventions == Coding Conventions
=== Compiler Version and C++11
Verilator supports GCC 4.4.7 and newer. GCC 4.4.7 does not support C++11,
therefore C++11 is generally not required. Exceptions may be made to
require C++11 for features that are only practical with C++11,
e.g. threads.
=== Indentation and Naming Style === Indentation and Naming Style
We will work with contributors to fix up indentation style issues, but it We will work with contributors to fix up indentation style issues, but it
is appreciated if you could match our style: is appreciated if you could match our style:
* All files should contain the magic header to insure standard indentation: * All files should contain the magic header to ensure standard indentation:
+ +
// -*- mode: C++; c-file-style: "cc-mode" -*- // -*- mode: C++; c-file-style: "cc-mode" -*-
+ +
@@ -615,13 +625,17 @@ with e.g. "sudo cpan install Parallel::Forker".
* vcddiff to find differences in VCD outputs. See the readme at * vcddiff to find differences in VCD outputs. See the readme at
https://github.com/veripool/vcddiff https://github.com/veripool/vcddiff
* Cmake for build paths that use it.
* Bit::Vector to test vgen.pl
=== Controlling the Test Driver === Controlling the Test Driver
Test drivers are written in PERL. All invoke the main test driver script, Test drivers are written in PERL. All invoke the main test driver script,
which can provide detailed help on all the features available when writing which can provide detailed help on all the features available when writing
a test driver. a test driver.
test_regress/t/driver.pl --help test_regress/driver.pl --help
For convenience, a summary of the most commonly used features is provided For convenience, a summary of the most commonly used features is provided
here. All drivers require a call to `compile` subroutine to compile the here. All drivers require a call to `compile` subroutine to compile the
@@ -706,6 +720,13 @@ respectively 16,384 and 4,096. The method of doing this is system
dependent, but on Fedora Linux it would require editing the dependent, but on Fedora Linux it would require editing the
`/etc/security/limits.conf` file as root. `/etc/security/limits.conf` file as root.
=== Manual Test Execution
A specific regression test can be executed manually. To start the "EXAMPLE"
test, run the following command.
test_regress/t/t_EXAMPLE.pl
=== Continuous Integration === Continuous Integration
Verilator has a https://travis-ci.com/verilator/verilator[Travis CI environment] Verilator has a https://travis-ci.com/verilator/verilator[Travis CI environment]
@@ -952,7 +973,8 @@ src/VParseGrammar.y, as this grammar supports the full SystemVerilog
language and has a lot of back-and-forth with Verilator's grammar. Copy language and has a lot of back-and-forth with Verilator's grammar. Copy
the appropriate rules to src/verilog.y and modify the productions. the appropriate rules to src/verilog.y and modify the productions.
. If a new Ast type is needed, add it to V3AstNodes.h. . If a new Ast type is needed, add it to V3AstNodes.h. Follow the convention
described above about the AstNode type hierarchy.
. Now you can run "test_regress/t/t_{new testcase}.pl --debug" and it'll . Now you can run "test_regress/t/t_{new testcase}.pl --debug" and it'll
probably fail but you'll see a test_regress/obj_dir/t_{newtestcase}/*.tree probably fail but you'll see a test_regress/obj_dir/t_{newtestcase}/*.tree
@@ -973,6 +995,7 @@ list in `src/Makefile_obj.in` and reconfigure.
== Distribution == Distribution
Copyright 2008-2019 by Wilson Snyder. Verilator is free software; you can Copyright 2008-2020 by Wilson Snyder. Verilator is free software; you can
redistribute it and/or modify it under the terms of either the GNU Lesser redistribute it and/or modify it under the terms of either the GNU Lesser
General Public License Version 3 or the Perl Artistic License Version 2.0. General Public License Version 3 or the Perl Artistic License Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
+72
View File
@@ -0,0 +1,72 @@
= Verilator XML Output
:toc: right
// Github doesn't render unless absolute URL
image::https://www.veripool.org/img/verilator_256_200_min.png[Logo,256,200,role="right"]
== Introduction
This document describes Verilator's XML output. For more general information
please see https://verilator.org[verilator.org].
== General
Verilator's XML output is enabled with the `--xml-only` flag. It contains
limited information about the elaborated design including files, modules,
instance hierarchy, logic and data types. There is no formal schema since part
of the structure of the XML document matches the compiled code which would
require the schema to describe legal SystemVerilog structure. The intended
usage is to enable other downstream tools to take advantage of Verilator's
parser.
== Structure
The XML document is consists of 4 sections within the top level `verilator_xml`
element:
`<files>`...`</files>`::
This section contains a list of all design files read, including the
built-in constructs and the command line as their own entries. Each
`<file>` has an attribute `id` which is a short ASCII string unique to that
file. Other elements' `loc` attributes use this id to refer to a particular
file.
`<module_files>`...`</module_files>`::
All files containing Verilog module definitions are listed in this section.
This element's contents is a subset of the `<files>` element's contents.
`<cells>`...`</cells>`::
The cells section of the XML document contains the design instance
hierarchy. Each instance is represented with the `<cell>` element with the
following attributes:
* `fl` (deprecated): The file id and line number where the module was
instanced. Use `loc` instead.
* `loc`: The file id, first line number, last line number, first column
number and last column number of the identifier where the module was
instanced, separated by commas.
* `name`: The instance name.
* `submodname`: The module name uniquified with particular parameter values (if any).
* `hier`: The full hierarchy path.
`<netlist>`...`</netlist>`::
The netlist section contains a number of `<module>`...`</module>` elements,
each describing the contents of that module, and a single `<typetable>`...
`</typetable>` element which lists all used types used within the
modules. Each type has a numeric `id` attribute that is referred to by
elements in the `<module>` elements using the `dtype_id` attribute.
== Distribution
Copyright 2020-2020 by Wilson Snyder. Verilator is free software; you can
redistribute it and/or modify it under the terms of either the GNU Lesser
General Public License Version 3 or the Perl Artistic License Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
+3 -2
View File
@@ -5,10 +5,11 @@
# This is an example cmake script to build a verilog to systemc project # This is an example cmake script to build a verilog to systemc project
# using cmake and verilator. # using cmake and verilator.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -6,10 +6,11 @@
# This makefile is here for testing the examples and should # This makefile is here for testing the examples and should
# generally not be added to a CMake project. # generally not be added to a CMake project.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -5,10 +5,11 @@
# This is an example cmake script to build a verilog to SystemC project # This is an example cmake script to build a verilog to SystemC project
# using CMake and Verilator. # using CMake and Verilator.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -6,10 +6,11 @@
# This makefile is here for testing the examples and should # This makefile is here for testing the examples and should
# generally not be added to a CMake project. # generally not be added to a CMake project.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -5,10 +5,11 @@
# This is an example cmake script to build a verilog to systemc project # This is an example cmake script to build a verilog to systemc project
# using cmake and verilator. # using cmake and verilator.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -6,10 +6,11 @@
# This makefile is here for testing the examples and should # This makefile is here for testing the examples and should
# generally not be added to a CMake project. # generally not be added to a CMake project.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+4 -3
View File
@@ -5,10 +5,11 @@
# This is an example cmake script to build a verilog to systemc project # This is an example cmake script to build a verilog to systemc project
# using cmake and verilator. # using cmake and verilator.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
@@ -34,5 +35,5 @@ add_executable(example ../make_tracing_c/sim_main.cpp)
# Add the Verilated circuit to the target # Add the Verilated circuit to the target
verilate(example COVERAGE TRACE verilate(example COVERAGE TRACE
INCLUDE_DIRS "../make_tracing_c" INCLUDE_DIRS "../make_tracing_c"
VERILATOR_ARGS -f ../make_tracing_c/input.vc -O2 -x-assign 0 VERILATOR_ARGS -f ../make_tracing_c/input.vc -Os -x-assign 0
SOURCES ../make_tracing_c/top.v) SOURCES ../make_tracing_c/top.v)
+3 -2
View File
@@ -6,10 +6,11 @@
# This makefile is here for testing the examples and should # This makefile is here for testing the examples and should
# generally not be added to a CMake project. # generally not be added to a CMake project.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+4 -3
View File
@@ -5,10 +5,11 @@
# This is an example cmake script to build a verilog to SystemC project # This is an example cmake script to build a verilog to SystemC project
# using CMake and Verilator. # using CMake and Verilator.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
@@ -41,7 +42,7 @@ add_executable(example ../make_tracing_sc/sc_main.cpp)
# Add the Verilated circuit to the target # Add the Verilated circuit to the target
verilate(example SYSTEMC COVERAGE TRACE verilate(example SYSTEMC COVERAGE TRACE
INCLUDE_DIRS "../make_tracing_sc" INCLUDE_DIRS "../make_tracing_sc"
VERILATOR_ARGS -f ../make_tracing_sc/input.vc -O2 -x-assign 0 VERILATOR_ARGS -f ../make_tracing_sc/input.vc -Os -x-assign 0
SOURCES ../make_tracing_sc/top.v) SOURCES ../make_tracing_sc/top.v)
verilator_link_systemc(example) verilator_link_systemc(example)
+3 -2
View File
@@ -6,10 +6,11 @@
# This makefile is here for testing the examples and should # This makefile is here for testing the examples and should
# generally not be added to a CMake project. # generally not be added to a CMake project.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -5,10 +5,11 @@
# This calls the object directory makefile. That allows the objects to # This calls the object directory makefile. That allows the objects to
# be placed in the "current directory" which simplifies the Makefile. # be placed in the "current directory" which simplifies the Makefile.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
# Check for sanity to avoid later confusion # Check for sanity to avoid later confusion
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2017 by Wilson Snyder. // any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//====================================================================== //======================================================================
// Include common routines // Include common routines
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2017 by Wilson Snyder. // any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// See also the EXAMPLE section in the verilator manpage/document. // See also the EXAMPLE section in the verilator manpage/document.
module top; module top;
+3 -2
View File
@@ -5,10 +5,11 @@
# This calls the object directory makefile. That allows the objects to # This calls the object directory makefile. That allows the objects to
# be placed in the "current directory" which simplifies the Makefile. # be placed in the "current directory" which simplifies the Makefile.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
# Check for sanity to avoid later confusion # Check for sanity to avoid later confusion
+3 -2
View File
@@ -1,8 +1,9 @@
// -*- SystemC -*- // -*- SystemC -*-
// DESCRIPTION: Verilator Example: Top level main for invoking SystemC model // DESCRIPTION: Verilator Example: Top level main for invoking SystemC model
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2017 by Wilson Snyder. // any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//====================================================================== //======================================================================
// SystemC global header // SystemC global header
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2017 by Wilson Snyder. // any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// See also the EXAMPLE section in the verilator manpage/document. // See also the EXAMPLE section in the verilator manpage/document.
module top; module top;
+4 -3
View File
@@ -5,10 +5,11 @@
# This calls the object directory makefiles. That allows the objects to # This calls the object directory makefiles. That allows the objects to
# be placed in the "current directory" which simplifies the Makefile. # be placed in the "current directory" which simplifies the Makefile.
# #
# Copyright 2019 by Todd Strader. This program is free software; you can # Copyright 2019 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
# Check for sanity to avoid later confusion # Check for sanity to avoid later confusion
@@ -34,7 +35,7 @@ VERILATOR_FLAGS =
# Generate C++ # Generate C++
VERILATOR_FLAGS += -cc VERILATOR_FLAGS += -cc
# Optimize # Optimize
VERILATOR_FLAGS += -O2 -x-assign 0 VERILATOR_FLAGS += -Os -x-assign 0
# Warn abount lint issues; may not want this on less solid designs # Warn abount lint issues; may not want this on less solid designs
VERILATOR_FLAGS += -Wall VERILATOR_FLAGS += -Wall
# Make waveforms # Make waveforms
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: --protect-lib example secret module // DESCRIPTION: Verilator: --protect-lib example secret module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2019 by Todd Strader. // any use, without warranty, 2019 by Todd Strader.
// SPDX-License-Identifier: CC0-1.0
// This module will be used as libsecret.a or libsecret.so without // This module will be used as libsecret.a or libsecret.so without
// exposing the source. // exposing the source.
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: --protect-lib example module // DESCRIPTION: Verilator: --protect-lib example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2019 by Todd Strader. // any use, without warranty, 2019 by Todd Strader.
// SPDX-License-Identifier: CC0-1.0
//====================================================================== //======================================================================
// See examples/tracing_c for notes on tracing // See examples/tracing_c for notes on tracing
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: --protect-lib example module // DESCRIPTION: Verilator: --protect-lib example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2019 by Todd Strader. // any use, without warranty, 2019 by Todd Strader.
// SPDX-License-Identifier: CC0-1.0
// See also the EXAMPLE section in the verilator manpage/document. // See also the EXAMPLE section in the verilator manpage/document.
module top (input clk); module top (input clk);
+10 -4
View File
@@ -5,10 +5,11 @@
# This calls the object directory makefile. That allows the objects to # This calls the object directory makefile. That allows the objects to
# be placed in the "current directory" which simplifies the Makefile. # be placed in the "current directory" which simplifies the Makefile.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
# Check for sanity to avoid later confusion # Check for sanity to avoid later confusion
@@ -38,7 +39,7 @@ VERILATOR_FLAGS += -cc --exe
# Generate makefile dependencies (not shown as complicates the Makefile) # Generate makefile dependencies (not shown as complicates the Makefile)
#VERILATOR_FLAGS += -MMD #VERILATOR_FLAGS += -MMD
# Optimize # Optimize
VERILATOR_FLAGS += -O2 -x-assign 0 VERILATOR_FLAGS += -Os -x-assign 0
# Warn abount lint issues; may not want this on less solid designs # Warn abount lint issues; may not want this on less solid designs
VERILATOR_FLAGS += -Wall VERILATOR_FLAGS += -Wall
# Make waveforms # Make waveforms
@@ -52,6 +53,9 @@ VERILATOR_FLAGS += --coverage
# Add this trace to get a backtrace in gdb # Add this trace to get a backtrace in gdb
#VERILATOR_FLAGS += --gdbbt #VERILATOR_FLAGS += --gdbbt
# Input files for Verilator
VERILATOR_INPUT = -f input.vc top.v sim_main.cpp
###################################################################### ######################################################################
default: run default: run
@@ -61,7 +65,7 @@ run:
@echo @echo
@echo "-- VERILATE ----------------" @echo "-- VERILATE ----------------"
$(VERILATOR) $(VERILATOR_FLAGS) -f input.vc top.v sim_main.cpp $(VERILATOR) $(VERILATOR_FLAGS) $(VERILATOR_INPUT)
@echo @echo
@echo "-- COMPILE -----------------" @echo "-- COMPILE -----------------"
@@ -72,11 +76,13 @@ run:
@echo @echo
@echo "-- RUN ---------------------" @echo "-- RUN ---------------------"
@rm -rf logs
@mkdir -p logs @mkdir -p logs
obj_dir/Vtop +trace obj_dir/Vtop +trace
@echo @echo
@echo "-- COVERAGE ----------------" @echo "-- COVERAGE ----------------"
@rm -rf logs/annotated
$(VERILATOR_COVERAGE) --annotate logs/annotated logs/coverage.dat $(VERILATOR_COVERAGE) --annotate logs/annotated logs/coverage.dat
@echo @echo
+4 -3
View File
@@ -5,10 +5,11 @@
# #
# This is executed in the object directory, and called by ../Makefile # This is executed in the object directory, and called by ../Makefile
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
####################################################################### #######################################################################
@@ -38,7 +39,7 @@ endif
# SystemC takes minutes to optimize, thus it is off by default. # SystemC takes minutes to optimize, thus it is off by default.
OPT_SLOW = OPT_SLOW =
# Fast path optimizations. Most time is spent in these classes. # Fast path optimizations. Most time is spent in these classes.
OPT_FAST = -O2 -fstrict-aliasing OPT_FAST = -Os -fstrict-aliasing
#OPT_FAST = -O #OPT_FAST = -O
#OPT_FAST = #OPT_FAST =
+27 -48
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2017 by Wilson Snyder. // any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//====================================================================== //======================================================================
// Include common routines // Include common routines
@@ -10,11 +11,6 @@
// Include model header, generated from Verilating "top.v" // Include model header, generated from Verilating "top.v"
#include "Vtop.h" #include "Vtop.h"
// If "verilator --trace" is used, include the tracing class
#if VM_TRACE
# include <verilated_vcd_c.h>
#endif
// Current simulation time (64-bit unsigned) // Current simulation time (64-bit unsigned)
vluint64_t main_time = 0; vluint64_t main_time = 0;
// Called by $time in Verilog // Called by $time in Verilog
@@ -36,31 +32,21 @@ int main(int argc, char** argv, char** env) {
// May be overridden by commandArgs // May be overridden by commandArgs
Verilated::randReset(2); Verilated::randReset(2);
// Verilator must compute traced signals
Verilated::traceEverOn(true);
// Pass arguments so Verilated code can see them, e.g. $value$plusargs // Pass arguments so Verilated code can see them, e.g. $value$plusargs
// This needs to be called before you create any model // This needs to be called before you create any model
Verilated::commandArgs(argc, argv); Verilated::commandArgs(argc, argv);
// Create logs/ directory in case we have traces to put under it
Verilated::mkdir("logs");
// Construct the Verilated model, from Vtop.h generated from Verilating "top.v" // Construct the Verilated model, from Vtop.h generated from Verilating "top.v"
Vtop* top = new Vtop; // Or use a const unique_ptr, or the VL_UNIQUE_PTR wrapper Vtop* top = new Vtop; // Or use a const unique_ptr, or the VL_UNIQUE_PTR wrapper
#if VM_TRACE
// If verilator was invoked with --trace argument,
// and if at run time passed the +trace argument, turn on tracing
VerilatedVcdC* tfp = NULL;
const char* flag = Verilated::commandArgsPlusMatch("trace");
if (flag && 0==strcmp(flag, "+trace")) {
Verilated::traceEverOn(true); // Verilator must compute traced signals
VL_PRINTF("Enabling waves into logs/vlt_dump.vcd...\n");
tfp = new VerilatedVcdC;
top->trace(tfp, 99); // Trace 99 levels of hierarchy
Verilated::mkdir("logs");
tfp->open("logs/vlt_dump.vcd"); // Open the dump file
}
#endif
// Set some inputs // Set some inputs
top->reset_l = !0; top->reset_l = !0;
top->fastclk = 0;
top->clk = 0; top->clk = 0;
top->in_small = 1; top->in_small = 1;
top->in_quad = 0x1234; top->in_quad = 0x1234;
@@ -72,31 +58,29 @@ int main(int argc, char** argv, char** env) {
while (!Verilated::gotFinish()) { while (!Verilated::gotFinish()) {
main_time++; // Time passes... main_time++; // Time passes...
// Toggle clocks and such // Toggle a fast (time/2 period) clock
top->fastclk = !top->fastclk; top->clk = !top->clk;
if ((main_time % 10) == 3) {
top->clk = 1;
}
if ((main_time % 10) == 8) {
top->clk = 0;
}
if (main_time > 1 && main_time < 10) {
top->reset_l = !1; // Assert reset
} else {
top->reset_l = !0; // Deassert reset
}
// Assign some other inputs // Toggle control signals on an edge that doesn't correspond
top->in_quad += 0x12; // to where the controls are sampled; in this example we do
// this only on a negedge of clk, because we know
// reset is not sampled there.
if (!top->clk) {
if (main_time > 1 && main_time < 10) {
top->reset_l = !1; // Assert reset
} else {
top->reset_l = !0; // Deassert reset
}
// Assign some other inputs
top->in_quad += 0x12;
}
// Evaluate model // Evaluate model
// (If you have multiple models being simulated in the same
// timestep then instead of eval(), call eval_step() on each, then
// eval_end_step() on each.)
top->eval(); top->eval();
#if VM_TRACE
// Dump trace data for this cycle
if (tfp) tfp->dump(main_time);
#endif
// Read outputs // Read outputs
VL_PRINTF("[%" VL_PRI64 "d] clk=%x rstl=%x iquad=%" VL_PRI64 "x" VL_PRINTF("[%" VL_PRI64 "d] clk=%x rstl=%x iquad=%" VL_PRI64 "x"
" -> oquad=%" VL_PRI64"x owide=%x_%08x_%08x\n", " -> oquad=%" VL_PRI64"x owide=%x_%08x_%08x\n",
@@ -107,11 +91,6 @@ int main(int argc, char** argv, char** env) {
// Final model cleanup // Final model cleanup
top->final(); top->final();
// Close trace if opened
#if VM_TRACE
if (tfp) { tfp->close(); tfp = NULL; }
#endif
// Coverage analysis (since test passed) // Coverage analysis (since test passed)
#if VM_COVERAGE #if VM_COVERAGE
Verilated::mkdir("logs"); Verilated::mkdir("logs");
+3 -19
View File
@@ -1,31 +1,17 @@
// DESCRIPTION: Verilator: Verilog Test module // DESCRIPTION: Verilator: Verilog Test module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2003 by Wilson Snyder. // any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ====================================================================== // ======================================================================
module sub module sub
( (
input clk, input clk,
input fastclk,
input reset_l input reset_l
); );
// Example counter/flop // Example counter/flop
reg [31:0] count_f;
always_ff @ (posedge fastclk) begin
if (!reset_l) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
count_f <= 32'h0;
// End of automatics
end
else begin
count_f <= count_f + 1;
end
end
// Another example flop
reg [31:0] count_c; reg [31:0] count_c;
always_ff @ (posedge clk) begin always_ff @ (posedge clk) begin
if (!reset_l) begin if (!reset_l) begin
@@ -37,8 +23,6 @@ module sub
else begin else begin
count_c <= count_c + 1; count_c <= count_c + 1;
if (count_c >= 3) begin if (count_c >= 3) begin
$display("[%0t] fastclk is %0d times faster than clk\n",
$time, count_f/count_c);
// This write is a magic value the Makefile uses to make sure the // This write is a magic value the Makefile uses to make sure the
// test completes successfully. // test completes successfully.
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
+8 -4
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2003 by Wilson Snyder. // any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ====================================================================== // ======================================================================
// This is intended to be a complex example of several features, please also // This is intended to be a complex example of several features, please also
@@ -11,7 +12,6 @@ module top
( (
// Declare some signals so we can see how I/O works // Declare some signals so we can see how I/O works
input clk, input clk,
input fastclk,
input reset_l, input reset_l,
output wire [1:0] out_small, output wire [1:0] out_small,
@@ -31,11 +31,15 @@ module top
sub sub (/*AUTOINST*/ sub sub (/*AUTOINST*/
// Inputs // Inputs
.clk (clk), .clk (clk),
.fastclk (fastclk),
.reset_l (reset_l)); .reset_l (reset_l));
// Print some stuff as an example // Print some stuff as an example
initial begin initial begin
if ($test$plusargs("trace") != 0) begin
$display("[%0t] Tracing to logs/vlt_dump.vcd...\n", $time);
$dumpfile("logs/vlt_dump.vcd");
$dumpvars();
end
$display("[%0t] Model running...\n", $time); $display("[%0t] Model running...\n", $time);
end end
+12 -5
View File
@@ -5,10 +5,11 @@
# This calls the object directory makefile. That allows the objects to # This calls the object directory makefile. That allows the objects to
# be placed in the "current directory" which simplifies the Makefile. # be placed in the "current directory" which simplifies the Makefile.
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
# Check for sanity to avoid later confusion # Check for sanity to avoid later confusion
@@ -38,7 +39,7 @@ VERILATOR_FLAGS += -sc --exe
# Generate makefile dependencies (not shown as complicates the Makefile) # Generate makefile dependencies (not shown as complicates the Makefile)
#VERILATOR_FLAGS += -MMD #VERILATOR_FLAGS += -MMD
# Optimize # Optimize
VERILATOR_FLAGS += -O2 -x-assign 0 VERILATOR_FLAGS += -Os -x-assign 0
# Warn abount lint issues; may not want this on less solid designs # Warn abount lint issues; may not want this on less solid designs
VERILATOR_FLAGS += -Wall VERILATOR_FLAGS += -Wall
# Make waveforms # Make waveforms
@@ -52,6 +53,9 @@ VERILATOR_FLAGS += --coverage
# Add this trace to get a backtrace in gdb # Add this trace to get a backtrace in gdb
#VERILATOR_FLAGS += --gdbbt #VERILATOR_FLAGS += --gdbbt
# Input files for Verilator
VERILATOR_INPUT = -f input.vc top.v sc_main.cpp
# Check if SC exists via a verilator call (empty if not) # Check if SC exists via a verilator call (empty if not)
SYSTEMC_EXISTS := $(shell $(VERILATOR) --getenv SYSTEMC_INCLUDE) SYSTEMC_EXISTS := $(shell $(VERILATOR) --getenv SYSTEMC_INCLUDE)
@@ -69,10 +73,10 @@ run:
@echo @echo
@echo "-- VERILATE ----------------" @echo "-- VERILATE ----------------"
$(VERILATOR) $(VERILATOR_FLAGS) -f input.vc top.v sc_main.cpp $(VERILATOR) $(VERILATOR_FLAGS) $(VERILATOR_INPUT)
@echo @echo
@echo "-- COMPILE ----------------=" @echo "-- COMPILE -----------------"
# To compile, we can either just do what Verilator asks, # To compile, we can either just do what Verilator asks,
# or call a submakefile where we can override the rules ourselves # or call a submakefile where we can override the rules ourselves
# $(MAKE) -j 4 -C obj_dir -f Vtop.mk # $(MAKE) -j 4 -C obj_dir -f Vtop.mk
@@ -80,11 +84,13 @@ run:
@echo @echo
@echo "-- RUN ---------------------" @echo "-- RUN ---------------------"
@rm -rf logs
@mkdir -p logs @mkdir -p logs
obj_dir/Vtop +trace obj_dir/Vtop +trace
@echo @echo
@echo "-- COVERAGE ----------------" @echo "-- COVERAGE ----------------"
@rm -rf logs/annotated
$(VERILATOR_COVERAGE) --annotate logs/annotated logs/coverage.dat $(VERILATOR_COVERAGE) --annotate logs/annotated logs/coverage.dat
@echo @echo
@@ -92,6 +98,7 @@ run:
@echo "To see waveforms, open vlt_dump.vcd in a waveform viewer" @echo "To see waveforms, open vlt_dump.vcd in a waveform viewer"
@echo @echo
###################################################################### ######################################################################
# Other targets # Other targets
+4 -3
View File
@@ -5,10 +5,11 @@
# #
# This is executed in the object directory, and called by ../Makefile # This is executed in the object directory, and called by ../Makefile
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
####################################################################### #######################################################################
@@ -46,7 +47,7 @@ endif
# SystemC takes minutes to optimize, thus it is off by default. # SystemC takes minutes to optimize, thus it is off by default.
OPT_SLOW = OPT_SLOW =
# Fast path optimizations. Most time is spent in these classes. # Fast path optimizations. Most time is spent in these classes.
OPT_FAST = -O2 -fstrict-aliasing OPT_FAST = -Os -fstrict-aliasing
#OPT_FAST = -O #OPT_FAST = -O
#OPT_FAST = #OPT_FAST =
+6 -2
View File
@@ -1,8 +1,9 @@
// -*- SystemC -*- // -*- SystemC -*-
// DESCRIPTION: Verilator Example: Top level main for invoking SystemC model // DESCRIPTION: Verilator Example: Top level main for invoking SystemC model
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2017 by Wilson Snyder. // any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//====================================================================== //======================================================================
// SystemC global header // SystemC global header
@@ -37,6 +38,9 @@ int sc_main(int argc, char* argv[]) {
// This needs to be called before you create any model // This needs to be called before you create any model
Verilated::commandArgs(argc, argv); Verilated::commandArgs(argc, argv);
// Create logs/ directory in case we have traces to put under it
Verilated::mkdir("logs");
// General logfile // General logfile
ios::sync_with_stdio(); ios::sync_with_stdio();
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog Test module // DESCRIPTION: Verilator: Verilog Test module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2003 by Wilson Snyder. // any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ====================================================================== // ======================================================================
module sub module sub
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2003 by Wilson Snyder. // any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ====================================================================== // ======================================================================
// This is intended to be a complex example of several features, please also // This is intended to be a complex example of several features, please also
+3 -2
View File
@@ -2,10 +2,11 @@
# #
# DESCRIPTION: Verilator Example: XML tests # DESCRIPTION: Verilator Example: XML tests
# #
# Copyright 2003-2019 by Wilson Snyder. This program is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU # can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0. # Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
# #
###################################################################### ######################################################################
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog Test module // DESCRIPTION: Verilator: Verilog Test module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2019 by Wilson Snyder. // any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ====================================================================== // ======================================================================
module sub module sub
+3 -2
View File
@@ -1,7 +1,8 @@
// DESCRIPTION: Verilator: Verilog example module // DESCRIPTION: Verilator: Verilog example module
// //
// This file ONLY is placed into the Public Domain, for any use, // This file ONLY is placed under the Creative Commons Public Domain, for
// without warranty, 2019 by Wilson Snyder. // any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// ====================================================================== // ======================================================================
module top module top
+4 -2
View File
@@ -84,8 +84,10 @@ Example usage:
-v <filename> Verilog library -v <filename> Verilog library
-y <dir> Directory to search for modules -y <dir> Directory to search for modules
This file ONLY is placed into the Public Domain, for any use, without This file ONLY is placed under the Creative Commons Public Domain, for
warranty, 2019 by Wilson Snyder.""" any use, without warranty, 2019 by Wilson Snyder.
SPDX-License-Identifier: CC0-1.0
"""
) )
parser.add_argument('-debug', '--debug', parser.add_argument('-debug', '--debug',
action='store_const', const=9, action='store_const', const=9,
+4 -2
View File
@@ -108,8 +108,10 @@ Example usage:
-v <filename> Verilog library -v <filename> Verilog library
-y <dir> Directory to search for modules -y <dir> Directory to search for modules
This file ONLY is placed into the Public Domain, for any use, without This file ONLY is placed under the Creative Commons Public Domain, for
warranty, 2019 by Wilson Snyder.""" any use, without warranty, 2019 by Wilson Snyder.
SPDX-License-Identifier: CC0-1.0
"""
) )
parser.add_argument('-debug', '--debug', parser.add_argument('-debug', '--debug',
action='store_const', const=9, action='store_const', const=9,
+2 -2
View File
@@ -22,6 +22,8 @@
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
SPDX-License-Identifier: MIT
*/ */
#include "fastlz.h" #include "fastlz.h"
@@ -418,9 +420,7 @@ static FASTLZ_INLINE int FASTLZ_DECOMPRESSOR(const void* input, int length, void
const flzuint8* ip = (const flzuint8*) input; const flzuint8* ip = (const flzuint8*) input;
const flzuint8* ip_limit = ip + length; const flzuint8* ip_limit = ip + length;
flzuint8* op = (flzuint8*) output; flzuint8* op = (flzuint8*) output;
#ifdef FASTLZ_SAFE
flzuint8* op_limit = op + maxout; flzuint8* op_limit = op + maxout;
#endif
flzuint32 ctrl = (*ip++) & 31; flzuint32 ctrl = (*ip++) & 31;
int loop = 1; int loop = 1;
+2
View File
@@ -22,6 +22,8 @@
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
SPDX-License-Identifier: MIT
*/ */
#ifndef FASTLZ_H #ifndef FASTLZ_H
+136 -3
View File
@@ -18,6 +18,8 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
*/ */
/* /*
@@ -133,9 +135,9 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
// Boolean expression more often true than false /* Boolean expression more often true than false */
#define FST_LIKELY(x) __builtin_expect(!!(x), 1) #define FST_LIKELY(x) __builtin_expect(!!(x), 1)
// Boolean expression more often false than true /* Boolean expression more often false than true */
#define FST_UNLIKELY(x) __builtin_expect(!!(x), 0) #define FST_UNLIKELY(x) __builtin_expect(!!(x), 0)
#else #else
#define FST_LIKELY(x) (!!(x)) #define FST_LIKELY(x) (!!(x))
@@ -737,6 +739,9 @@ off_t hier_file_len;
uint32_t *valpos_mem; uint32_t *valpos_mem;
unsigned char *curval_mem; unsigned char *curval_mem;
unsigned char *outval_mem; /* for two-state / Verilator-style value changes */
uint32_t outval_alloc_siz;
char *filename; char *filename;
fstHandle maxhandle; fstHandle maxhandle;
@@ -1021,7 +1026,9 @@ if(!xc->curval_mem)
static void fstDestroyMmaps(struct fstWriterContext *xc, int is_closing) static void fstDestroyMmaps(struct fstWriterContext *xc, int is_closing)
{ {
#if !defined __CYGWIN__ && !defined __MINGW32__
(void)is_closing; (void)is_closing;
#endif
fstMunmap(xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t)); fstMunmap(xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t));
xc->valpos_mem = NULL; xc->valpos_mem = NULL;
@@ -1944,6 +1951,11 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
} }
} }
fstDestroyMmaps(xc, 1); fstDestroyMmaps(xc, 1);
if(xc->outval_mem)
{
free(xc->outval_mem); xc->outval_mem = NULL;
xc->outval_alloc_siz = 0;
}
/* write out geom section */ /* write out geom section */
fflush(xc->geom_handle); fflush(xc->geom_handle);
@@ -2913,7 +2925,7 @@ if(FST_LIKELY((xc) && (handle <= xc->maxhandle)))
{ {
xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */ xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz); xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
if(VL_UNLIKELY(!xc->vchg_mem)) if(FST_UNLIKELY(!xc->vchg_mem))
{ {
fprintf(stderr, FST_APIMESS "Could not realloc() in fstWriterEmitValueChange, exiting.\n"); fprintf(stderr, FST_APIMESS "Could not realloc() in fstWriterEmitValueChange, exiting.\n");
exit(255); exit(255);
@@ -2998,6 +3010,127 @@ if(FST_LIKELY((xc) && (handle <= xc->maxhandle)))
} }
} }
void fstWriterEmitValueChange32(void *ctx, fstHandle handle,
uint32_t bits, uint32_t val) {
char buf[32];
char *s = buf;
uint32_t i;
for (i = 0; i < bits; ++i)
{
*s++ = '0' + ((val >> (bits - i - 1)) & 1);
}
fstWriterEmitValueChange(ctx, handle, buf);
}
void fstWriterEmitValueChange64(void *ctx, fstHandle handle,
uint32_t bits, uint64_t val) {
char buf[64];
char *s = buf;
uint32_t i;
for (i = 0; i < bits; ++i)
{
*s++ = '0' + ((val >> (bits - i - 1)) & 1);
}
fstWriterEmitValueChange(ctx, handle, buf);
}
void fstWriterEmitValueChangeVec32(void *ctx, fstHandle handle,
uint32_t bits, const uint32_t *val) {
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
if (FST_UNLIKELY(bits <= 32))
{
fstWriterEmitValueChange32(ctx, handle, bits, val[0]);
}
else if(FST_LIKELY(xc))
{
int bq = bits / 32;
int br = bits & 31;
int i;
int w;
uint32_t v;
unsigned char* s;
if (FST_UNLIKELY(bits > xc->outval_alloc_siz))
{
xc->outval_alloc_siz = bits*2 + 1;
xc->outval_mem = (unsigned char*)realloc(xc->outval_mem, xc->outval_alloc_siz);
if (FST_UNLIKELY(!xc->outval_mem))
{
fprintf(stderr,
FST_APIMESS "Could not realloc() in fstWriterEmitValueChangeVec32, exiting.\n");
exit(255);
}
}
s = xc->outval_mem;
{
w = bq;
v = val[w];
for (i = 0; i < br; ++i)
{
*s++ = '0' + ((v >> (br - i - 1)) & 1);
}
}
for (w = bq - 1; w >= 0; --w)
{
v = val[w];
for (i = (32 - 4); i >= 0; i -= 4) {
s[0] = '0' + ((v >> (i + 3)) & 1);
s[1] = '0' + ((v >> (i + 2)) & 1);
s[2] = '0' + ((v >> (i + 1)) & 1);
s[3] = '0' + ((v >> (i + 0)) & 1);
s += 4;
}
}
fstWriterEmitValueChange(ctx, handle, xc->outval_mem);
}
}
void fstWriterEmitValueChangeVec64(void *ctx, fstHandle handle,
uint32_t bits, const uint64_t *val) {
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
if (FST_UNLIKELY(bits <= 64))
{
fstWriterEmitValueChange64(ctx, handle, bits, val[0]);
}
else if(FST_LIKELY(xc))
{
int bq = bits / 64;
int br = bits & 63;
int i;
int w;
uint32_t v;
unsigned char* s;
if (FST_UNLIKELY(bits > xc->outval_alloc_siz))
{
xc->outval_alloc_siz = bits*2 + 1;
xc->outval_mem = (unsigned char*)realloc(xc->outval_mem, xc->outval_alloc_siz);
if (FST_UNLIKELY(!xc->outval_mem))
{
fprintf(stderr,
FST_APIMESS "Could not realloc() in fstWriterEmitValueChangeVec64, exiting.\n");
exit(255);
}
}
s = xc->outval_mem;
{
w = bq;
v = val[w];
for (i = 0; i < br; ++i)
{
*s++ = '0' + ((v >> (br - i - 1)) & 1);
}
}
for (w = bq - 1; w >= 0; --w) {
v = val[w];
for (i = (64 - 4); i >= 0; i -= 4)
{
s[0] = '0' + ((v >> (i + 3)) & 1);
s[1] = '0' + ((v >> (i + 2)) & 1);
s[2] = '0' + ((v >> (i + 1)) & 1);
s[3] = '0' + ((v >> (i + 0)) & 1);
s += 4;
}
}
fstWriterEmitValueChange(ctx, handle, xc->outval_mem);
}
}
void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len) void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len)
{ {
+10
View File
@@ -18,6 +18,8 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
*/ */
#ifndef FST_API_H #ifndef FST_API_H
@@ -355,6 +357,14 @@ fstHandle fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDi
void fstWriterEmitDumpActive(void *ctx, int enable); void fstWriterEmitDumpActive(void *ctx, int enable);
void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle); void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle);
void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val); void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val);
void fstWriterEmitValueChange32(void *ctx, fstHandle handle,
uint32_t bits, uint32_t val);
void fstWriterEmitValueChange64(void *ctx, fstHandle handle,
uint32_t bits, uint64_t val);
void fstWriterEmitValueChangeVec32(void *ctx, fstHandle handle,
uint32_t bits, const uint32_t *val);
void fstWriterEmitValueChangeVec64(void *ctx, fstHandle handle,
uint32_t bits, const uint64_t *val);
void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len); void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len);
void fstWriterEmitTimeChange(void *ctx, uint64_t tim); void fstWriterEmitTimeChange(void *ctx, uint64_t tim);
void fstWriterFlushContext(void *ctx); void fstWriterFlushContext(void *ctx);
+2
View File
@@ -27,6 +27,8 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SPDX-License-Identifier: BSD-2-Clause
You can contact the author at : You can contact the author at :
- LZ4 source repository : https://github.com/Cyan4973/lz4 - LZ4 source repository : https://github.com/Cyan4973/lz4
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
+2
View File
@@ -28,6 +28,8 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SPDX-License-Identifier: BSD-2-Clause
You can contact the author at : You can contact the author at :
- LZ4 source repository : https://github.com/Cyan4973/lz4 - LZ4 source repository : https://github.com/Cyan4973/lz4
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
+2 -3
View File
@@ -18,6 +18,8 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
*/ */
#ifndef WAVE_ALLOCA_H #ifndef WAVE_ALLOCA_H
@@ -33,9 +35,6 @@
#else #else
#include <malloc.h> #include <malloc.h>
#endif #endif
#elif defined(_MSC_VER)
#include <malloc.h>
#define alloca _alloca
#endif #endif
#define wave_alloca alloca #define wave_alloca alloca
#endif #endif
+475 -345
View File
File diff suppressed because it is too large Load Diff
+388 -303
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -2,9 +2,11 @@
###################################################################### ######################################################################
# DESCRIPTION: Makefile commands for all verilated target files # DESCRIPTION: Makefile commands for all verilated target files
# #
# Copyright 2003-2019 by Wilson Snyder. Verilator is free software; you can # Copyright 2003-2020 by Wilson Snyder. This program is free software; you
# redistribute it and/or modify it under the terms of either the GNU Lesser # can redistribute it and/or modify it under the terms of either the GNU
# General Public License Version 3 or the Perl Artistic License Version 2.0. # Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
###################################################################### ######################################################################
PERL = @PERL@ PERL = @PERL@
@@ -86,7 +88,7 @@ LDLIBS += $(VM_USER_LDLIBS)
# SystemC takes minutes to optimize, thus it is off by default. # SystemC takes minutes to optimize, thus it is off by default.
#OPT_SLOW = #OPT_SLOW =
# Fast path optimizations. Most time is spent in these classes. # Fast path optimizations. Most time is spent in these classes.
#OPT_FAST = -O2 -fstrict-aliasing #OPT_FAST = -Os -fstrict-aliasing
#OPT_FAST = -O #OPT_FAST = -O
#OPT_FAST = #OPT_FAST =
+3 -7
View File
@@ -4,15 +4,11 @@
// //
//************************************************************************* //*************************************************************************
// //
// Copyright 2003-2019 by Wilson Snyder. This program is free software; you can // Copyright 2003-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License. // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// This is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// //
//========================================================================= //=========================================================================
// //
+3 -7
View File
@@ -1,15 +1,11 @@
// -*- mode: C++; c-file-style: "cc-mode" -*- // -*- mode: C++; c-file-style: "cc-mode" -*-
//************************************************************************* //*************************************************************************
// //
// Copyright 2003-2019 by Wilson Snyder. This program is free software; you can // Copyright 2003-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License. // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// //
//************************************************************************* //*************************************************************************
/// ///
+11 -14
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2001-2019 by Wilson Snyder. This program is free software; // Copyright 2001-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
@@ -73,12 +70,12 @@ private:
public: public:
// METHODS // METHODS
// cppcheck-suppress truncLongCastReturn // cppcheck-suppress truncLongCastReturn
virtual vluint64_t count() const { return *m_countp; } virtual vluint64_t count() const VL_OVERRIDE { return *m_countp; }
virtual void zero() const { *m_countp = 0; } virtual void zero() const VL_OVERRIDE { *m_countp = 0; }
// CONSTRUCTORS // CONSTRUCTORS
// cppcheck-suppress noExplicitConstructor // cppcheck-suppress noExplicitConstructor
VerilatedCoverItemSpec(T* countp) : m_countp(countp) { *m_countp = 0; } explicit VerilatedCoverItemSpec(T* countp) : m_countp(countp) { *m_countp = 0; }
virtual ~VerilatedCoverItemSpec() {} virtual ~VerilatedCoverItemSpec() VL_OVERRIDE {}
}; };
//============================================================================= //=============================================================================
@@ -222,7 +219,7 @@ private:
void clearGuts() VL_REQUIRES(m_mutex) { void clearGuts() VL_REQUIRES(m_mutex) {
for (ItemList::const_iterator it=m_items.begin(); it!=m_items.end(); ++it) { for (ItemList::const_iterator it=m_items.begin(); it!=m_items.end(); ++it) {
VerilatedCovImpItem* itemp = *(it); VerilatedCovImpItem* itemp = *(it);
delete itemp; VL_DO_DANGLING(delete itemp, itemp);
} }
m_items.clear(); m_items.clear();
m_indexValues.clear(); m_indexValues.clear();
@@ -244,7 +241,7 @@ public:
for (ItemList::iterator it=m_items.begin(); it!=m_items.end(); ++it) { for (ItemList::iterator it=m_items.begin(); it!=m_items.end(); ++it) {
VerilatedCovImpItem* itemp = *(it); VerilatedCovImpItem* itemp = *(it);
if (!itemMatchesString(itemp, matchp)) { if (!itemMatchesString(itemp, matchp)) {
delete itemp; VL_DO_DANGLING(delete itemp, itemp);
} else { } else {
newlist.push_back(itemp); newlist.push_back(itemp);
} }
+15 -12
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2001-2019 by Wilson Snyder. This program is free software; // Copyright 2001-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
@@ -32,9 +29,15 @@
/// Conditionally compile coverage code /// Conditionally compile coverage code
#ifdef VM_COVERAGE #ifdef VM_COVERAGE
# define VL_IF_COVER(stmts) do { stmts ; } while(0) # define VL_IF_COVER(stmts) \
do { \
stmts; \
} while (false)
#else #else
# define VL_IF_COVER(stmts) do { if(0) { stmts ; } } while(0) # define VL_IF_COVER(stmts) \
do { \
if (false) { stmts; } \
} while (false)
#endif #endif
//============================================================================= //=============================================================================
@@ -65,10 +68,10 @@
/// VL_COVER_INSERT(&m_cases[i], "comment", "Coverage Case", "i", cvtToNumStr(i)); /// VL_COVER_INSERT(&m_cases[i], "comment", "Coverage Case", "i", cvtToNumStr(i));
/// } /// }
#define VL_COVER_INSERT(countp,args...) \ #define VL_COVER_INSERT(countp,...) \
VL_IF_COVER(VerilatedCov::_inserti(countp); \ VL_IF_COVER(VerilatedCov::_inserti(countp); \
VerilatedCov::_insertf(__FILE__, __LINE__); \ VerilatedCov::_insertf(__FILE__, __LINE__); \
VerilatedCov::_insertp("hier", name(), args)) VerilatedCov::_insertp("hier", name(), __VA_ARGS__))
//============================================================================= //=============================================================================
/// Convert VL_COVER_INSERT value arguments to strings /// Convert VL_COVER_INSERT value arguments to strings
+5 -8
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2001-2019 by Wilson Snyder. This program is free software; // Copyright 2001-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
+5 -9
View File
@@ -1,15 +1,11 @@
// -*- mode: C++; c-file-style: "cc-mode" -*- // -*- mode: C++; c-file-style: "cc-mode" -*-
//************************************************************************* //*************************************************************************
// //
// Copyright 2009-2019 by Wilson Snyder. This program is free software; you can // Copyright 2009-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License. // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// //
//========================================================================= //=========================================================================
/// ///
@@ -46,8 +42,8 @@
VL_FATAL_MT(__FILE__, __LINE__, "", \ VL_FATAL_MT(__FILE__, __LINE__, "", \
(std::string("%%Error: Unsupported DPI function: ")+VL_FUNC).c_str()) (std::string("%%Error: Unsupported DPI function: ")+VL_FUNC).c_str())
#define _VL_SVDPI_WARN(message...) \ #define _VL_SVDPI_WARN(...) \
VL_PRINTF_MT(message) VL_PRINTF_MT(__VA_ARGS__)
// Function requires a "context" in the import declaration // Function requires a "context" in the import declaration
#define _VL_SVDPI_CONTEXT_WARN() \ #define _VL_SVDPI_CONTEXT_WARN() \
+3 -7
View File
@@ -1,15 +1,11 @@
// -*- mode: C++; c-file-style: "cc-mode" -*- // -*- mode: C++; c-file-style: "cc-mode" -*-
//************************************************************************* //*************************************************************************
// //
// Copyright 2003-2019 by Wilson Snyder. This program is free software; you can // Copyright 2003-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License. // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// //
//************************************************************************* //*************************************************************************
/// ///
+38 -74
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2001-2019 by Wilson Snyder. This program is free software; // Copyright 2001-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
@@ -20,6 +17,7 @@
//============================================================================= //=============================================================================
// SPDIFF_OFF // SPDIFF_OFF
#define __STDC_LIMIT_MACROS // UINT64_MAX
#include "verilatedos.h" #include "verilatedos.h"
#include "verilated.h" #include "verilated.h"
#include "verilated_fst_c.h" #include "verilated_fst_c.h"
@@ -47,6 +45,7 @@
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
# include <io.h> # include <io.h>
#else #else
# include <stdint.h>
# include <unistd.h> # include <unistd.h>
#endif #endif
@@ -62,9 +61,12 @@ protected:
vluint32_t m_code; ///< Starting code number vluint32_t m_code; ///< Starting code number
// CONSTRUCTORS // CONSTRUCTORS
VerilatedFstCallInfo(VerilatedFstCallback_t icb, VerilatedFstCallback_t fcb, VerilatedFstCallInfo(VerilatedFstCallback_t icb, VerilatedFstCallback_t fcb,
VerilatedFstCallback_t changecb, VerilatedFstCallback_t changecb, void* ut)
void* ut, vluint32_t code) : m_initcb(icb)
: m_initcb(icb), m_fullcb(fcb), m_changecb(changecb), m_userthis(ut), m_code(code) {} , m_fullcb(fcb)
, m_changecb(changecb)
, m_userthis(ut)
, m_code(1) {}
~VerilatedFstCallInfo() {} ~VerilatedFstCallInfo() {}
}; };
@@ -72,10 +74,11 @@ protected:
// VerilatedFst // VerilatedFst
VerilatedFst::VerilatedFst(void* fst) VerilatedFst::VerilatedFst(void* fst)
: m_fst(fst), : m_fst(fst)
m_fullDump(true), , m_fullDump(true)
m_scopeEscape('.') { , m_nextCode(1)
m_valueStrBuffer.reserve(64+1); // Need enough room for quad , m_scopeEscape('.') {
m_valueStrBuffer.reserve(64 + 1); // Need enough room for quad
} }
void VerilatedFst::open(const char* filename) VL_MT_UNSAFE { void VerilatedFst::open(const char* filename) VL_MT_UNSAFE {
@@ -86,10 +89,12 @@ void VerilatedFst::open(const char* filename) VL_MT_UNSAFE {
fstWriterSetParallelMode(m_fst, 1); fstWriterSetParallelMode(m_fst, 1);
#endif #endif
m_curScope.clear(); m_curScope.clear();
m_nextCode = 1;
for (vluint32_t ent = 0; ent< m_callbacks.size(); ++ent) { for (vluint32_t ent = 0; ent< m_callbacks.size(); ++ent) {
VerilatedFstCallInfo* cip = m_callbacks[ent]; VerilatedFstCallInfo* cip = m_callbacks[ent];
cip->m_code = 1; cip->m_code = m_nextCode;
// Initialize; callbacks will call decl* which update m_nextCode
(cip->m_initcb)(this, cip->m_userthis, cip->m_code); (cip->m_initcb)(this, cip->m_userthis, cip->m_code);
} }
@@ -116,9 +121,15 @@ void VerilatedFst::declDTypeEnum(int dtypenum, const char* name, vluint32_t elem
m_local2fstdtype[dtypenum] = enumNum; m_local2fstdtype[dtypenum] = enumNum;
} }
void VerilatedFst::declSymbol(vluint32_t code, const char* name, void VerilatedFst::declSymbol(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
int dtypenum, fstVarDir vardir, fstVarType vartype, fstVarType vartype, bool array, int arraynum, vluint32_t len,
int arraynum, vluint32_t len) { vluint32_t bits) {
// Make sure deduplicate tracking increments for future declarations
int codesNeeded = 1 + int(bits / 32);
//Not supported: if (tri) codesNeeded *= 2; // Space in change array for __en signals
m_nextCode = std::max(m_nextCode, code + codesNeeded);
std::pair<Code2SymbolType::iterator, bool> p std::pair<Code2SymbolType::iterator, bool> p
= m_code2symbol.insert(std::make_pair(code, static_cast<fstHandle>(NULL))); = m_code2symbol.insert(std::make_pair(code, static_cast<fstHandle>(NULL)));
std::istringstream nameiss(name); std::istringstream nameiss(name);
@@ -153,8 +164,7 @@ void VerilatedFst::declSymbol(vluint32_t code, const char* name,
std::stringstream name_ss; std::stringstream name_ss;
name_ss << symbol_name; name_ss << symbol_name;
if (arraynum >= 0) if (array) name_ss << "(" << arraynum << ")";
name_ss << "(" << arraynum << ")";
std::string name_str = name_ss.str(); std::string name_str = name_ss.str();
if (dtypenum > 0) { if (dtypenum > 0) {
@@ -172,17 +182,16 @@ void VerilatedFst::declSymbol(vluint32_t code, const char* name,
//============================================================================= //=============================================================================
// Callbacks // Callbacks
void VerilatedFst::addCallback( void VerilatedFst::addCallback(VerilatedFstCallback_t initcb, VerilatedFstCallback_t fullcb,
VerilatedFstCallback_t initcb, VerilatedFstCallback_t fullcb, VerilatedFstCallback_t changecb, void* userthis) VL_MT_UNSAFE_ONE {
VerilatedFstCallback_t changecb, void* userthis) VL_MT_UNSAFE_ONE {
m_assertOne.check(); m_assertOne.check();
if (VL_UNLIKELY(isOpen())) { if (VL_UNLIKELY(isOpen())) {
std::string msg = (std::string("Internal: ")+__FILE__+"::"+__FUNCTION__ std::string msg = (std::string("Internal: ") + __FILE__ + "::" + __FUNCTION__
+" called with already open file"); + " called with already open file");
VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str());
} }
VerilatedFstCallInfo* vci = new VerilatedFstCallInfo(initcb, fullcb, changecb, userthis, 1); VerilatedFstCallInfo* cip = new VerilatedFstCallInfo(initcb, fullcb, changecb, userthis);
m_callbacks.push_back(vci); m_callbacks.push_back(cip);
} }
//============================================================================= //=============================================================================
@@ -191,7 +200,7 @@ void VerilatedFst::addCallback(
void VerilatedFst::dump(vluint64_t timeui) { void VerilatedFst::dump(vluint64_t timeui) {
if (!isOpen()) return; if (!isOpen()) return;
if (VL_UNLIKELY(m_fullDump)) { if (VL_UNLIKELY(m_fullDump)) {
m_fullDump = false; // No need for more full dumps m_fullDump = false; // No more need for next dump to be full
for (vluint32_t ent = 0; ent< m_callbacks.size(); ++ent) { for (vluint32_t ent = 0; ent< m_callbacks.size(); ++ent) {
VerilatedFstCallInfo* cip = m_callbacks[ent]; VerilatedFstCallInfo* cip = m_callbacks[ent];
(cip->m_fullcb)(this, cip->m_userthis, cip->m_code); (cip->m_fullcb)(this, cip->m_userthis, cip->m_code);
@@ -205,51 +214,6 @@ void VerilatedFst::dump(vluint64_t timeui) {
} }
} }
//=============================================================================
// Helpers
char* VerilatedFst::word2Str(vluint32_t newval, int bits) {
// Constructor makes sure m_valueStrBuffer.reserve() > 32+1
char* s = m_valueStrBuffer.data();
for (int i = 0; i < bits; ++i) {
*s++ = '0' + ((newval>>(bits-i-1))&1);
}
*s = '\0';
return m_valueStrBuffer.data();
}
char* VerilatedFst::quad2Str(vluint64_t newval, int bits) {
// Constructor makes sure m_valueStrBuffer.reserve() > 64+1
char* s = m_valueStrBuffer.data();
for (int i = 0; i < bits; ++i) {
*s++ = '0' + ((newval>>(bits-i-1))&1);
}
*s = '\0';
return m_valueStrBuffer.data();
}
char* VerilatedFst::array2Str(const vluint32_t* newval, int bits) {
int bq = VL_BITWORD_I(bits), br = VL_BITBIT_I(bits);
m_valueStrBuffer.reserve(bits+1);
char* s = m_valueStrBuffer.data();
vluint32_t v = newval[bq];
for (int i = 0; i < br; ++i) {
*s++ = '0' + ((v>>(br-i-1))&1);
}
for (int w = bq-1; w >= 0; --w) {
v = newval[w];
for (int i = 28; i >= 0; i-=4) {
s[0] = '0' + ((v>>(i+3))&1);
s[1] = '0' + ((v>>(i+2))&1);
s[2] = '0' + ((v>>(i+1))&1);
s[3] = '0' + ((v>>(i+0))&1);
s+=4;
}
}
*s = '\0';
return m_valueStrBuffer.data();
}
//******************************************************************** //********************************************************************
// Local Variables: // Local Variables:
// End: // End:
+33 -32
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2001-2019 by Wilson Snyder. This program is free software; // Copyright 2001-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
@@ -50,6 +47,7 @@ private:
void* m_fst; void* m_fst;
VerilatedAssertOneThread m_assertOne; ///< Assert only called from single thread VerilatedAssertOneThread m_assertOne; ///< Assert only called from single thread
bool m_fullDump; bool m_fullDump;
vluint32_t m_nextCode; ///< Next code number to assign
char m_scopeEscape; char m_scopeEscape;
std::string m_module; std::string m_module;
CallbackVec m_callbacks; ///< Routines to perform dumping CallbackVec m_callbacks; ///< Routines to perform dumping
@@ -60,15 +58,13 @@ private:
VL_UNCOPYABLE(VerilatedFst); VL_UNCOPYABLE(VerilatedFst);
void declSymbol(vluint32_t code, const char* name, void declSymbol(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum, vluint32_t len); bool array, int arraynum, vluint32_t len, vluint32_t bits);
// helpers // helpers
std::vector<char> m_valueStrBuffer; std::vector<char> m_valueStrBuffer;
char* word2Str(vluint32_t newval, int bits);
char* quad2Str(vluint64_t newval, int bits);
char* array2Str(const vluint32_t *newval, int bits);
public: public:
explicit VerilatedFst(void* fst=NULL); explicit VerilatedFst(void* fst=NULL);
~VerilatedFst() { if (m_fst == NULL) { fstWriterClose(m_fst); } } ~VerilatedFst() { if (m_fst == NULL) { fstWriterClose(m_fst); } }
void changeThread() { m_assertOne.changeThread(); }
bool isOpen() const { return m_fst != NULL; } bool isOpen() const { return m_fst != NULL; }
void open(const char* filename) VL_MT_UNSAFE; void open(const char* filename) VL_MT_UNSAFE;
void flush() VL_MT_UNSAFE { fstWriterFlushContext(m_fst); } void flush() VL_MT_UNSAFE { fstWriterFlushContext(m_fst); }
@@ -106,33 +102,36 @@ public:
/// Inside dumping routines, declare a signal /// Inside dumping routines, declare a signal
void declBit(vluint32_t code, const char* name, void declBit(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum) { bool array, int arraynum) {
declSymbol(code, name, dtypenum, vardir, vartype, arraynum, 1); declSymbol(code, name, dtypenum, vardir, vartype, array, arraynum, 1, 1);
} }
void declBus(vluint32_t code, const char* name, void declBus(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum, int msb, int lsb) { bool array, int arraynum, int msb, int lsb) {
declSymbol(code, name, dtypenum, vardir, vartype, arraynum, msb - lsb + 1); declSymbol(code, name, dtypenum, vardir, vartype, array, arraynum, msb - lsb + 1,
msb - lsb + 1);
} }
void declDouble(vluint32_t code, const char* name, void declDouble(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum) { bool array, int arraynum) {
declSymbol(code, name, dtypenum, vardir, vartype, arraynum, 2); declSymbol(code, name, dtypenum, vardir, vartype, array, arraynum, 2, 64);
} }
void declFloat(vluint32_t code, const char* name, void declFloat(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum) { bool array, int arraynum) {
declSymbol(code, name, dtypenum, vardir, vartype, arraynum, 1); declSymbol(code, name, dtypenum, vardir, vartype, array, arraynum, 1, 32);
} }
void declQuad(vluint32_t code, const char* name, void declQuad(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum, int msb, int lsb) { bool array, int arraynum, int msb, int lsb) {
declSymbol(code, name, dtypenum, vardir, vartype, arraynum, msb - lsb + 1); declSymbol(code, name, dtypenum, vardir, vartype, array, arraynum, msb - lsb + 1,
msb - lsb + 1);
} }
void declArray(vluint32_t code, const char* name, void declArray(vluint32_t code, const char* name,
int dtypenum, fstVarDir vardir, fstVarType vartype, int dtypenum, fstVarDir vardir, fstVarType vartype,
int arraynum, int msb, int lsb) { bool array, int arraynum, int msb, int lsb) {
declSymbol(code, name, dtypenum, vardir, vartype, arraynum, msb - lsb + 1); declSymbol(code, name, dtypenum, vardir, vartype, array, arraynum, msb - lsb + 1,
msb - lsb + 1);
} }
/// Inside dumping routines, dump one signal if it has changed /// Inside dumping routines, dump one signal if it has changed
@@ -140,7 +139,7 @@ public:
fstWriterEmitValueChange(m_fst, m_code2symbol[code], newval ? "1" : "0"); fstWriterEmitValueChange(m_fst, m_code2symbol[code], newval ? "1" : "0");
} }
void chgBus(vluint32_t code, const vluint32_t newval, int bits) { void chgBus(vluint32_t code, const vluint32_t newval, int bits) {
fstWriterEmitValueChange(m_fst, m_code2symbol[code], word2Str(newval, bits)); fstWriterEmitValueChange32(m_fst, m_code2symbol[code], bits, newval);
} }
void chgDouble(vluint32_t code, const double newval) { void chgDouble(vluint32_t code, const double newval) {
double val = newval; double val = newval;
@@ -151,10 +150,10 @@ public:
fstWriterEmitValueChange(m_fst, m_code2symbol[code], &val); fstWriterEmitValueChange(m_fst, m_code2symbol[code], &val);
} }
void chgQuad(vluint32_t code, const vluint64_t newval, int bits) { void chgQuad(vluint32_t code, const vluint64_t newval, int bits) {
fstWriterEmitValueChange(m_fst, m_code2symbol[code], quad2Str(newval, bits)); fstWriterEmitValueChange64(m_fst, m_code2symbol[code], bits, newval);
} }
void chgArray(vluint32_t code, const vluint32_t* newval, int bits) { void chgArray(vluint32_t code, const vluint32_t* newval, int bits) {
fstWriterEmitValueChange(m_fst, m_code2symbol[code], array2Str(newval, bits)); fstWriterEmitValueChangeVec32(m_fst, m_code2symbol[code], bits, newval);
} }
void fullBit(vluint32_t code, const vluint32_t newval) { void fullBit(vluint32_t code, const vluint32_t newval) {
@@ -170,10 +169,10 @@ public:
void fullArray(vluint32_t code, const vluint32_t* newval, int bits) { void fullArray(vluint32_t code, const vluint32_t* newval, int bits) {
chgArray(code, newval, bits); } chgArray(code, newval, bits); }
void declTriBit (vluint32_t code, const char* name, int arraynum); void declTriBit(vluint32_t code, const char* name, int arraynum);
void declTriBus (vluint32_t code, const char* name, int arraynum, int msb, int lsb); void declTriBus(vluint32_t code, const char* name, int arraynum, int msb, int lsb);
void declTriQuad (vluint32_t code, const char* name, int arraynum, int msb, int lsb); void declTriQuad(vluint32_t code, const char* name, int arraynum, int msb, int lsb);
void declTriArray (vluint32_t code, const char* name, int arraynum, int msb, int lsb); void declTriArray(vluint32_t code, const char* name, int arraynum, int msb, int lsb);
void fullTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri); void fullTriBit(vluint32_t code, const vluint32_t newval, const vluint32_t newtri);
void fullTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits); void fullTriBus(vluint32_t code, const vluint32_t newval, const vluint32_t newtri, int bits);
void fullTriQuad(vluint32_t code, const vluint64_t newval, const vluint32_t newtri, int bits); void fullTriQuad(vluint32_t code, const vluint64_t newval, const vluint32_t newtri, int bits);
@@ -201,7 +200,9 @@ class VerilatedFstC {
VL_UNCOPYABLE(VerilatedFstC); VL_UNCOPYABLE(VerilatedFstC);
public: public:
explicit VerilatedFstC(void* filep=NULL) : m_sptrace(filep) {} explicit VerilatedFstC(void* filep=NULL) : m_sptrace(filep) {}
~VerilatedFstC() {} ~VerilatedFstC() { close(); }
/// Routines can only be called from one thread; allow next call from different thread
void changeThread() { spTrace()->changeThread(); }
public: public:
// ACCESSORS // ACCESSORS
/// Is file open? /// Is file open?
+142 -31
View File
@@ -1,15 +1,11 @@
// -*- mode: C++; c-file-style: "cc-mode" -*- // -*- mode: C++; c-file-style: "cc-mode" -*-
//************************************************************************* //*************************************************************************
// //
// Copyright 2010-2019 by Wilson Snyder. This program is free software; you can // Copyright 2010-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License. // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// //
//************************************************************************* //*************************************************************************
/// ///
@@ -37,11 +33,43 @@
//=================================================================== //===================================================================
// String formatters (required by below containers) // String formatters (required by below containers)
extern std::string VL_TO_STRING(CData obj); extern std::string VL_TO_STRING(CData lhs);
extern std::string VL_TO_STRING(SData obj); extern std::string VL_TO_STRING(SData lhs);
extern std::string VL_TO_STRING(IData obj); extern std::string VL_TO_STRING(IData lhs);
extern std::string VL_TO_STRING(QData obj); extern std::string VL_TO_STRING(QData lhs);
inline std::string VL_TO_STRING(const std::string& obj) { return "\""+obj+"\""; } inline std::string VL_TO_STRING(const std::string& obj) { return "\"" + obj + "\""; }
extern std::string VL_TO_STRING_W(int words, WDataInP obj);
//===================================================================
// Readmem/Writemem operation classes
class VlReadMem {
bool m_hex; // Hex format
int m_bits; // Bit width of values
const std::string& m_filename; // Filename
QData m_end; // End address (as specified by user)
FILE* m_fp; // File handle for filename
QData m_addr; // Next address to read
int m_linenum; // Line number last read from file
public:
VlReadMem(bool hex, int bits, const std::string& filename, QData start, QData end);
~VlReadMem();
bool isOpen() const { return m_fp != NULL; }
int linenum() const { return m_linenum; }
bool get(QData& addrr, std::string& valuer);
void setData(void* valuep, const std::string& rhs);
};
class VlWriteMem {
int m_bits; // Bit width of values
FILE* m_fp; // File handle for filename
QData m_addr; // Next address to write
public:
VlWriteMem(bool hex, int bits, const std::string& filename, QData start, QData end);
~VlWriteMem();
bool isOpen() const { return m_fp != NULL; }
void print(QData addr, bool addrstamp, const void* valuep);
};
//=================================================================== //===================================================================
// Verilog array container // Verilog array container
@@ -72,6 +100,10 @@ VlWide<T_Words>& VL_CVT_W_A(WDataInP inp, const VlWide<T_Words>&) {
return *((VlWide<T_Words>*)inp); return *((VlWide<T_Words>*)inp);
} }
template <std::size_t T_Words>
std::string VL_TO_STRING(const VlWide<T_Words>& obj) {
return VL_TO_STRING_W(T_Words, obj.data());
}
//=================================================================== //===================================================================
// Verilog associative array container // Verilog associative array container
@@ -126,7 +158,7 @@ public:
int next(T_Key& indexr) const { int next(T_Key& indexr) const {
typename Map::const_iterator it = m_map.find(indexr); typename Map::const_iterator it = m_map.find(indexr);
if (VL_UNLIKELY(it == m_map.end())) return 0; if (VL_UNLIKELY(it == m_map.end())) return 0;
it++; ++it;
if (VL_UNLIKELY(it == m_map.end())) return 0; if (VL_UNLIKELY(it == m_map.end())) return 0;
indexr = it->first; indexr = it->first;
return 1; return 1;
@@ -180,12 +212,42 @@ std::string VL_TO_STRING(const VlAssocArray<T_Key, T_Value>& obj) {
return obj.to_string(); return obj.to_string();
} }
template <class T_Key, class T_Value>
void VL_READMEM_N(bool hex, int bits, const std::string& filename,
VlAssocArray<T_Key, T_Value>& obj, QData start, QData end) VL_MT_SAFE {
VlReadMem rmem(hex, bits, filename, start, end);
if (VL_UNLIKELY(!rmem.isOpen())) return;
while (true) {
QData addr;
std::string data;
if (rmem.get(addr /*ref*/, data /*ref*/)) {
rmem.setData(&(obj.at(addr)), data);
} else {
break;
}
}
}
template <class T_Key, class T_Value>
void VL_WRITEMEM_N(bool hex, int bits, const std::string& filename,
const VlAssocArray<T_Key, T_Value>& obj, QData start, QData end) VL_MT_SAFE {
VlWriteMem wmem(hex, bits, filename, start, end);
if (VL_UNLIKELY(!wmem.isOpen())) return;
for (typename VlAssocArray<T_Key, T_Value>::const_iterator it = obj.begin(); it != obj.end();
++it) {
QData addr = it->first;
if (addr >= start && addr <= end) wmem.print(addr, true, &(it->second));
}
}
//=================================================================== //===================================================================
// Verilog queue container // Verilog queue and dynamic array container
// There are no multithreaded locks on this; the base variable must // There are no multithreaded locks on this; the base variable must
// be protected by other means // be protected by other means
// //
template <class T_Value> class VlQueue { // Bound here is the maximum size() allowed, e.g. 1 + SystemVerilog bound
// For dynamic arrays it is always zero
template <class T_Value, size_t T_MaxSize = 0> class VlQueue {
private: private:
// TYPES // TYPES
typedef std::deque<T_Value> Deque; typedef std::deque<T_Value> Deque;
@@ -214,10 +276,30 @@ public:
void clear() { m_deque.clear(); } void clear() { m_deque.clear(); }
void erase(size_t index) { if (VL_LIKELY(index < m_deque.size())) m_deque.erase(index); } void erase(size_t index) { if (VL_LIKELY(index < m_deque.size())) m_deque.erase(index); }
// Dynamic array new[] becomes a renew()
void renew(size_t size) {
clear();
m_deque.resize(size, atDefault());
}
// Dynamic array new[]() becomes a renew_copy()
void renew_copy(size_t size, const VlQueue<T_Value,T_MaxSize>& rhs) {
if (size == 0) {
clear();
} else {
*this = rhs;
m_deque.resize(size, atDefault());
}
}
// function void q.push_front(value) // function void q.push_front(value)
void push_front(const T_Value& value) { m_deque.push_front(value); } void push_front(const T_Value& value) {
m_deque.push_front(value);
if (VL_UNLIKELY(T_MaxSize != 0 && m_deque.size() > T_MaxSize)) m_deque.pop_back();
}
// function void q.push_back(value) // function void q.push_back(value)
void push_back(const T_Value& value) { m_deque.push_back(value); } void push_back(const T_Value& value) {
if (VL_LIKELY(T_MaxSize == 0 || m_deque.size() < T_MaxSize)) m_deque.push_back(value);
}
// function value_t q.pop_front(); // function value_t q.pop_front();
T_Value pop_front() { T_Value pop_front() {
if (m_deque.empty()) return m_defaultValue; if (m_deque.empty()) return m_defaultValue;
@@ -234,6 +316,7 @@ public:
// because we need to be able to insert only when the value is set // because we need to be able to insert only when the value is set
T_Value& at(size_t index) { T_Value& at(size_t index) {
static T_Value s_throwAway; static T_Value s_throwAway;
// Needs to work for dynamic arrays, so does not use T_MaxSize
if (VL_UNLIKELY(index >= m_deque.size())) { if (VL_UNLIKELY(index >= m_deque.size())) {
s_throwAway = atDefault(); s_throwAway = atDefault();
return s_throwAway; return s_throwAway;
@@ -243,6 +326,7 @@ public:
// Accessing. Verilog: v = assoc[index] // Accessing. Verilog: v = assoc[index]
const T_Value& at(size_t index) const { const T_Value& at(size_t index) const {
static T_Value s_throwAway; static T_Value s_throwAway;
// Needs to work for dynamic arrays, so does not use T_MaxSize
if (VL_UNLIKELY(index >= m_deque.size())) return atDefault(); if (VL_UNLIKELY(index >= m_deque.size())) return atDefault();
else return m_deque[index]; else return m_deque[index];
} }
@@ -278,14 +362,14 @@ std::string VL_TO_STRING(const VlQueue<T_Value>& obj) {
extern std::string VL_CVT_PACK_STR_NW(int lwords, WDataInP lwp) VL_MT_SAFE; extern std::string VL_CVT_PACK_STR_NW(int lwords, WDataInP lwp) VL_MT_SAFE;
inline std::string VL_CVT_PACK_STR_NQ(QData lhs) VL_PURE { inline std::string VL_CVT_PACK_STR_NQ(QData lhs) VL_PURE {
WData lw[2]; VL_SET_WQ(lw, lhs); WData lw[VL_WQ_WORDS_E]; VL_SET_WQ(lw, lhs);
return VL_CVT_PACK_STR_NW(2, lw); return VL_CVT_PACK_STR_NW(VL_WQ_WORDS_E, lw);
} }
inline std::string VL_CVT_PACK_STR_NN(const std::string& lhs) VL_PURE { inline std::string VL_CVT_PACK_STR_NN(const std::string& lhs) VL_PURE {
return lhs; return lhs;
} }
inline std::string VL_CVT_PACK_STR_NI(IData lhs) VL_PURE { inline std::string VL_CVT_PACK_STR_NI(IData lhs) VL_PURE {
WData lw[1]; lw[0] = lhs; WData lw[VL_WQ_WORDS_E]; VL_SET_WI(lw, lhs);
return VL_CVT_PACK_STR_NW(1, lw); return VL_CVT_PACK_STR_NW(1, lw);
} }
inline std::string VL_CONCATN_NNN(const std::string& lhs, const std::string& rhs) VL_PURE { inline std::string VL_CONCATN_NNN(const std::string& lhs, const std::string& rhs) VL_PURE {
@@ -298,7 +382,7 @@ inline std::string VL_REPLICATEN_NNQ(int,int,int, const std::string& lhs, IData
} }
inline std::string VL_REPLICATEN_NNI(int obits,int lbits,int rbits, inline std::string VL_REPLICATEN_NNI(int obits,int lbits,int rbits,
const std::string& lhs, IData rep) VL_PURE { const std::string& lhs, IData rep) VL_PURE {
return VL_REPLICATEN_NNQ(obits,lbits,rbits,lhs,rep); return VL_REPLICATEN_NNQ(obits, lbits, rbits, lhs, rep);
} }
inline IData VL_LEN_IN(const std::string& ld) { return ld.length(); } inline IData VL_LEN_IN(const std::string& ld) { return ld.length(); }
@@ -306,12 +390,12 @@ extern std::string VL_TOLOWER_NN(const std::string& ld);
extern std::string VL_TOUPPER_NN(const std::string& ld); extern std::string VL_TOUPPER_NN(const std::string& ld);
extern IData VL_FOPEN_NI(const std::string& filename, IData mode) VL_MT_SAFE; extern IData VL_FOPEN_NI(const std::string& filename, IData mode) VL_MT_SAFE;
extern void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, extern void VL_READMEM_N(bool hex, int bits, QData depth, int array_lsb,
const std::string& filename, const std::string& filename, void* memp, QData start,
void* memp, IData start, IData end) VL_MT_SAFE; QData end) VL_MT_SAFE;
extern void VL_WRITEMEM_N(bool hex, int width, int depth, int array_lsb, extern void VL_WRITEMEM_N(bool hex, int bits, QData depth, int array_lsb,
const std::string& filename, const std::string& filename, const void* memp, QData start,
const void* memp, IData start, IData end) VL_MT_SAFE; QData end) VL_MT_SAFE;
extern IData VL_SSCANF_INX(int lbits, const std::string& ld, extern IData VL_SSCANF_INX(int lbits, const std::string& ld,
const char* formatp, ...) VL_MT_SAFE; const char* formatp, ...) VL_MT_SAFE;
extern void VL_SFORMAT_X(int obits_ignored, std::string& output, extern void VL_SFORMAT_X(int obits_ignored, std::string& output,
@@ -320,18 +404,18 @@ extern std::string VL_SFORMATF_NX(const char* formatp, ...) VL_MT_SAFE;
extern IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_MT_SAFE; extern IData VL_VALUEPLUSARGS_INW(int rbits, const std::string& ld, WDataOutP rwp) VL_MT_SAFE;
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, CData& rdr) VL_MT_SAFE { inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, CData& rdr) VL_MT_SAFE {
WData rwp[2]; // WData must always be at least 2 WData rwp[2]; // WData must always be at least 2
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp); IData got = VL_VALUEPLUSARGS_INW(rbits, ld, rwp);
if (got) rdr = rwp[0]; if (got) rdr = rwp[0];
return got; return got;
} }
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, SData& rdr) VL_MT_SAFE { inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, SData& rdr) VL_MT_SAFE {
WData rwp[2]; // WData must always be at least 2 WData rwp[2]; // WData must always be at least 2
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp); IData got = VL_VALUEPLUSARGS_INW(rbits, ld, rwp);
if (got) rdr = rwp[0]; if (got) rdr = rwp[0];
return got; return got;
} }
inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, IData& rdr) VL_MT_SAFE { inline IData VL_VALUEPLUSARGS_INI(int rbits, const std::string& ld, IData& rdr) VL_MT_SAFE {
WData rwp[2]; // WData must always be at least 2 WData rwp[2];
IData got = VL_VALUEPLUSARGS_INW(rbits, ld, rwp); IData got = VL_VALUEPLUSARGS_INW(rbits, ld, rwp);
if (got) rdr = rwp[0]; if (got) rdr = rwp[0];
return got; return got;
@@ -344,10 +428,37 @@ inline IData VL_VALUEPLUSARGS_INQ(int rbits, const std::string& ld, QData& rdr)
} }
inline IData VL_VALUEPLUSARGS_INQ(int rbits, const std::string& ld, double& rdr) VL_MT_SAFE { inline IData VL_VALUEPLUSARGS_INQ(int rbits, const std::string& ld, double& rdr) VL_MT_SAFE {
WData rwp[2]; WData rwp[2];
IData got = VL_VALUEPLUSARGS_INW(rbits,ld,rwp); IData got = VL_VALUEPLUSARGS_INW(rbits, ld, rwp);
if (got) rdr = VL_CVT_D_Q(VL_SET_QW(rwp)); if (got) rdr = VL_CVT_D_Q(VL_SET_QW(rwp));
return got; return got;
} }
extern IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_SAFE; extern IData VL_VALUEPLUSARGS_INN(int, const std::string& ld, std::string& rdr) VL_MT_SAFE;
//======================================================================
// Strings
extern std::string VL_PUTC_N(const std::string& lhs, IData rhs, CData ths) VL_PURE;
extern CData VL_GETC_N(const std::string& lhs, IData rhs) VL_PURE;
extern std::string VL_SUBSTR_N(const std::string& lhs, IData rhs, IData ths) VL_PURE;
inline IData VL_CMP_NN(const std::string& lhs, const std::string& rhs, bool ignoreCase) VL_PURE {
// SystemVerilog does not allow a string variable to contain '\0'.
// So C functions such as strcmp() can correctly compare strings.
int result;
if (ignoreCase) {
result = VL_STRCASECMP(lhs.c_str(), rhs.c_str());
} else {
result = std::strcmp(lhs.c_str(), rhs.c_str());
}
return result;
}
extern IData VL_ATOI_N(const std::string& str, int base) VL_PURE;
//======================================================================
// Dumping
extern const char* vl_dumpctl_filenamep(bool setit = false,
const std::string& filename = "") VL_MT_SAFE;
#endif // Guard #endif // Guard
+3 -7
View File
@@ -1,15 +1,11 @@
// -*- mode: C++; c-file-style: "cc-mode" -*- // -*- mode: C++; c-file-style: "cc-mode" -*-
//************************************************************************* //*************************************************************************
// //
// Copyright 2009-2019 by Wilson Snyder. This program is free software; you can // Copyright 2009-2020 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU // redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License. // Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0. // Version 2.0.
// // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// //
//========================================================================= //=========================================================================
/// ///
+7 -10
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2001-2019 by Wilson Snyder. This program is free software; // Copyright 2001-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
@@ -187,7 +184,7 @@ void VerilatedSave::flush() VL_MT_UNSAFE_ONE {
m_assertOne.check(); m_assertOne.check();
if (VL_UNLIKELY(!isOpen())) return; if (VL_UNLIKELY(!isOpen())) return;
vluint8_t* wp = m_bufp; vluint8_t* wp = m_bufp;
while (1) { while (true) {
ssize_t remaining = (m_cp - wp); ssize_t remaining = (m_cp - wp);
if (remaining==0) break; if (remaining==0) break;
errno = 0; errno = 0;
@@ -216,7 +213,7 @@ void VerilatedRestore::fill() VL_MT_UNSAFE_ONE {
m_endp = m_bufp + (m_endp - m_cp); m_endp = m_bufp + (m_endp - m_cp);
m_cp = m_bufp; // Reset buffer m_cp = m_bufp; // Reset buffer
// Read into buffer starting at m_endp // Read into buffer starting at m_endp
while (1) { while (true) {
ssize_t remaining = (m_bufp+bufferSize() - m_endp); ssize_t remaining = (m_bufp+bufferSize() - m_endp);
if (remaining==0) break; if (remaining==0) break;
errno = 0; errno = 0;
+37 -40
View File
@@ -3,14 +3,11 @@
// //
// THIS MODULE IS PUBLICLY LICENSED // THIS MODULE IS PUBLICLY LICENSED
// //
// Copyright 2012-2019 by Wilson Snyder. This program is free software; // Copyright 2000-2020 by Wilson Snyder. This program is free software; you
// you can redistribute it and/or modify it under the terms of either the GNU // can redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. // Lesser General Public License Version 3 or the Perl Artistic License
// // Version 2.0.
// This is distributed in the hope that it will be useful, but WITHOUT ANY // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// //
//============================================================================= //=============================================================================
/// ///
@@ -35,14 +32,14 @@ class VerilatedSerialize {
protected: protected:
// MEMBERS // MEMBERS
// For speed, keep m_cp as the first member of this structure // For speed, keep m_cp as the first member of this structure
vluint8_t* m_cp; ///< Current pointer into m_bufp buffer vluint8_t* m_cp; ///< Current pointer into m_bufp buffer
vluint8_t* m_bufp; ///< Output buffer vluint8_t* m_bufp; ///< Output buffer
bool m_isOpen; ///< True indicates open file/stream bool m_isOpen; ///< True indicates open file/stream
std::string m_filename; ///< Filename, for error messages std::string m_filename; ///< Filename, for error messages
VerilatedAssertOneThread m_assertOne; ///< Assert only called from single thread VerilatedAssertOneThread m_assertOne; ///< Assert only called from single thread
inline static size_t bufferSize() { return 256*1024; } // See below for slack calculation inline static size_t bufferSize() { return 256 * 1024; } // See below for slack calculation
inline static size_t bufferInsertSize() { return 16*1024; } inline static size_t bufferInsertSize() { return 16 * 1024; }
void header() VL_MT_UNSAFE_ONE; void header() VL_MT_UNSAFE_ONE;
void trailer() VL_MT_UNSAFE_ONE; void trailer() VL_MT_UNSAFE_ONE;
@@ -94,15 +91,15 @@ class VerilatedDeserialize {
protected: protected:
// MEMBERS // MEMBERS
// For speed, keep m_cp as the first member of this structure // For speed, keep m_cp as the first member of this structure
vluint8_t* m_cp; ///< Current pointer into m_bufp buffer vluint8_t* m_cp; ///< Current pointer into m_bufp buffer
vluint8_t* m_bufp; ///< Output buffer vluint8_t* m_bufp; ///< Output buffer
vluint8_t* m_endp; ///< Last valid byte in m_bufp buffer vluint8_t* m_endp; ///< Last valid byte in m_bufp buffer
bool m_isOpen; ///< True indicates open file/stream bool m_isOpen; ///< True indicates open file/stream
std::string m_filename; ///< Filename, for error messages std::string m_filename; ///< Filename, for error messages
VerilatedAssertOneThread m_assertOne; ///< Assert only called from single thread VerilatedAssertOneThread m_assertOne; ///< Assert only called from single thread
inline static size_t bufferSize() { return 256*1024; } // See below for slack calculation inline static size_t bufferSize() { return 256 * 1024; } // See below for slack calculation
inline static size_t bufferInsertSize() { return 16*1024; } inline static size_t bufferInsertSize() { return 16 * 1024; }
virtual void fill() = 0; virtual void fill() = 0;
void header() VL_MT_UNSAFE_ONE; void header() VL_MT_UNSAFE_ONE;
@@ -164,12 +161,12 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VerilatedSave() { m_fd = -1; } VerilatedSave() { m_fd = -1; }
virtual ~VerilatedSave() { close(); } virtual ~VerilatedSave() VL_OVERRIDE { close(); }
// METHODS // METHODS
void open(const char* filenamep) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors void open(const char* filenamep) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors
void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); } void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); }
virtual void close() VL_MT_UNSAFE_ONE; virtual void close() VL_OVERRIDE VL_MT_UNSAFE_ONE;
virtual void flush() VL_MT_UNSAFE_ONE; virtual void flush() VL_OVERRIDE VL_MT_UNSAFE_ONE;
}; };
//============================================================================= //=============================================================================
@@ -183,68 +180,68 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
VerilatedRestore() { m_fd = -1; } VerilatedRestore() { m_fd = -1; }
virtual ~VerilatedRestore() { close(); } virtual ~VerilatedRestore() VL_OVERRIDE { close(); }
// METHODS // METHODS
void open(const char* filenamep) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors void open(const char* filenamep) VL_MT_UNSAFE_ONE; ///< Open the file; call isOpen() to see if errors
void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); } void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); }
virtual void close() VL_MT_UNSAFE_ONE; virtual void close() VL_OVERRIDE VL_MT_UNSAFE_ONE;
virtual void flush() VL_MT_UNSAFE_ONE {} virtual void flush() VL_OVERRIDE VL_MT_UNSAFE_ONE {}
virtual void fill() VL_MT_UNSAFE_ONE; virtual void fill() VL_OVERRIDE VL_MT_UNSAFE_ONE;
}; };
//============================================================================= //=============================================================================
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint64_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint64_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint64_t& rhs){ inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint64_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint32_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint32_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint32_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint32_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint16_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint16_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint16_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint16_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint8_t& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, vluint8_t& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint8_t& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, vluint8_t& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, bool& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, bool& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, bool& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, bool& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, double& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, double& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, double& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, double& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, float& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, float& rhs) {
return os.write(&rhs, sizeof(rhs)); return os.write(&rhs, sizeof(rhs));
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, float& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, float& rhs) {
return os.read(&rhs, sizeof(rhs)); return os.read(&rhs, sizeof(rhs));
} }
inline VerilatedSerialize& operator<<(VerilatedSerialize& os, std::string& rhs) { inline VerilatedSerialize& operator<<(VerilatedSerialize& os, std::string& rhs) {
vluint32_t len = rhs.length(); vluint32_t len = rhs.length();
os<<len; os << len;
return os.write(rhs.data(), len); return os.write(rhs.data(), len);
} }
inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& rhs) { inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, std::string& rhs) {
vluint32_t len = 0; vluint32_t len = 0;
os>>len; os >> len;
rhs.resize(len); rhs.resize(len);
return os.read((void*)rhs.data(), len); return os.read((void*)rhs.data(), len);
} }

Some files were not shown because too many files have changed in this diff Show More