Compare commits

...
318 Commits
Author SHA1 Message Date
steve c66d319d9c UPdate to 20021027 snapshot. 2002-10-28 02:26:41 +00:00
steve ae27165ffe Add Virtex code generators for left shift,
subtraction, and GE comparators.
2002-10-28 02:05:56 +00:00
steve 32f1ca6f8b draw lpm ff with aset_expr taken into account. 2002-10-23 04:39:35 +00:00
steve 9ce2806710 Fix synth2 handling of aset/aclr signals where
flip-flops are split by begin-end blocks.
2002-10-23 01:45:24 +00:00
steve 3d4593d4d5 Synthesizer support for synchronous begin-end blocks. 2002-10-21 01:42:08 +00:00
steve df5ae54ec7 Handle conditional error cases better. 2002-10-20 19:19:37 +00:00
steve fbee1b424d Properly set or clear expression lookaside for binary expressions. 2002-10-20 02:55:37 +00:00
steve 555017b525 Snapshot 20021019 2002-10-19 23:38:49 +00:00
steve 1e170ee005 bourne shell compatibility. 2002-10-19 23:18:52 +00:00
steve 43501809b1 Redo the parameter vector support to allow
parameter names in range expressions.
2002-10-19 22:59:49 +00:00
steve c0c67a101a Fix spelling of the scalared keyword. 2002-10-13 05:01:44 +00:00
steve 1eb714e097 More verbose eval_const assert message. 2002-10-13 05:01:07 +00:00
steve 54a8e12856 Fix symbol underscore needs for Mac OS X. 2002-10-03 18:03:35 +00:00
steve 6203f05ef9 Add pal target enable help message. 2002-10-03 17:57:54 +00:00
steve 703ad04067 Allow expression lookaside map to spam statements. 2002-09-27 20:24:42 +00:00
steve 778e96330d Add thread expression lookaside map. 2002-09-27 16:33:34 +00:00
steve e3eb89fb12 Remove excess debug messages. 2002-09-26 03:42:10 +00:00
steve 166621bcb3 Generate vvp code for asynch set/reset of NetFF. 2002-09-26 03:18:04 +00:00
steve 879a5a4cbe Synthesize async set/reset is certain cases. 2002-09-26 01:13:14 +00:00
steve 9faabfe995 Fix missing endifs within supressed ifdefs. 2002-09-25 02:23:08 +00:00
steve 6f23fa61ac Allow results in register bits 47 in certain cases. 2002-09-24 04:20:32 +00:00
steve 30b6cf7821 Include user specified libraries on the link line. 2002-09-24 01:50:53 +00:00
steve 6258011210 More detailed check of process edge events. 2002-09-24 00:58:35 +00:00
steve 7557a46382 Remove some now useless asserts. 2002-09-21 23:47:30 +00:00
steve a0a91f358c Snapshot 20020921 2002-09-21 21:29:09 +00:00
steve 0128286966 Allow constant bit selects out of range. 2002-09-21 21:28:18 +00:00
steve acd5e86e04 Fix disable in arbitrary fork/join situations. 2002-09-21 04:55:00 +00:00
steve ab94b0a636 disable threads with children. 2002-09-20 03:59:34 +00:00
steve de6d696667 Add support for cbAfterDelay. 2002-09-20 02:42:11 +00:00
steve 63946c4cfb More careful cd command. 2002-09-20 02:41:36 +00:00
steve 475b603d15 Relax position constrations of ifdef and friends. 2002-09-19 20:33:27 +00:00
steve 096956cda9 Fix multiple source on the command line. 2002-09-18 23:25:18 +00:00
steve 3d3116d48b Add support for binary NOR operator. 2002-09-18 04:29:55 +00:00
steve 616360d751 Spelling errors. 2002-09-18 04:08:45 +00:00
steve 7a5c30d297 printf size warning. 2002-09-18 03:34:07 +00:00
steve 9c5ab36a8b Fix switch case warnings. 2002-09-18 03:33:10 +00:00
steve 466656b167 Allow forward references of memories. 2002-09-18 02:55:18 +00:00
steve 5d6567cb02 Generate vvp code for structural flip-flops. 2002-09-17 05:37:45 +00:00
steve c44c123ef5 Connect output of block to net_out, instead of statement outputs. 2002-09-17 04:40:28 +00:00
steve 4ecbf56e2b Account for part select in l-value. 2002-09-17 04:39:20 +00:00
steve ed9a2c4b3f Proper initialization of the memories table. 2002-09-17 00:42:22 +00:00
steve 90751b9250 Reject multiple probes on synchronous logic. 2002-09-16 21:55:06 +00:00
steve 7d8011669d snapshot 20020915 2002-09-16 03:48:56 +00:00
steve eb81062d85 Add to synth2 support for synthesis of
synchronous logic. This includes DFF enables
 modeled by if/then/else.
2002-09-16 00:30:33 +00:00
steve 8fbacc966e compile error. 2002-09-16 00:28:51 +00:00
steve 75801a12e3 Display FF enables. 2002-09-16 00:28:25 +00:00
steve 9f1ce170e6 Generate code for 8:1 muxes msing F5 and F6 muxes. 2002-09-15 21:52:19 +00:00
steve 327c8826f4 Generate Virtex code for 4:1 mux slices. 2002-09-14 05:19:19 +00:00
steve fb0383d2bd single bit optimization for != in expressions,
and expand ++ and != results if needed.
2002-09-13 04:09:51 +00:00
steve 28725d0d74 Optimize ==1 when in context where x vs z doesnt matter. 2002-09-13 03:12:50 +00:00
steve dac99b9374 Add support for binary nand operator. 2002-09-12 15:49:43 +00:00
steve 1573477caf Account for buffer overrun in memory word names. 2002-09-12 15:13:07 +00:00
steve 70a7513781 Support $ in preprocessor identifiers. 2002-09-11 19:42:37 +00:00
steve 0277035496 Fix wrecked rbuf in vpi_get_str of signals and memories. 2002-09-11 16:06:57 +00:00
steve 33f462fdf6 Actually set strength pointer when getting strength val. 2002-09-10 02:27:11 +00:00
steve 639b9f346f Snapshot 20020907 2002-09-08 01:39:23 +00:00
steve 447fee6f43 Fix padding of operand of unary minus. 2002-09-08 01:37:13 +00:00
steve c9212a9a09 Implement vpi_remove_cb for cbValueChange. 2002-09-07 04:54:51 +00:00
steve ea21fab379 Add support for %v is the display system task.
Change the encoding of H and L outputs from
 the bufif devices so that they are logic x.
2002-09-06 04:56:28 +00:00
steve 4d090b64bd List tran devices as unsupported. 2002-09-04 16:19:39 +00:00
steve 7e1e44e87a Properly cast signedness of parameters with ranges. 2002-09-01 03:01:48 +00:00
steve 0a2a9dcd94 Fix leaking vthread bits in ?: eval. 2002-09-01 01:42:34 +00:00
steve c9b4b66af2 Watch for x indices in l-value of non-blocking assignments. 2002-09-01 00:19:35 +00:00
steve 7b6678b2a1 Fix reverse bit ordered bit select in continuous assignment. 2002-08-31 03:48:50 +00:00
steve e79f62c5fa Generate x out for x select on wide muxes. 2002-08-29 03:04:01 +00:00
steve 60046cc790 update for 20020828 snapshot. 2002-08-28 20:30:53 +00:00
steve 3fca25181a Evaluate nonblocking assign r-values. 2002-08-28 18:54:36 +00:00
steve cbca31555d Add the %subi instruction, and use it where possible. 2002-08-28 18:38:07 +00:00
steve d5aa700b4b Generate %load/nx for indexed load of nets. 2002-08-28 17:15:35 +00:00
steve 1db8319bce Add the %load/nx opcode to index vpi nets. 2002-08-28 17:15:06 +00:00
steve aa390f2a91 Fix l-value indexing of memories and vectors so that
an unknown (x) index causes so cell to be addresses.

 Fix tangling of label identifiers in the fork-join
 code generator.
2002-08-27 05:39:57 +00:00
steve bd9e66d333 Missing declaration of ivl_memory_scope. 2002-08-24 05:03:40 +00:00
steve c34e318f8c Fix = vs == error. 2002-08-24 05:02:58 +00:00
steve 4fc858b676 Fix missing semi-colon warning. 2002-08-24 05:02:37 +00:00
steve ac8b582b3d Rewire time formatting to handle all cases. 2002-08-24 02:02:44 +00:00
steve 6f748d3d4f Macro arguments not supported. 2002-08-24 00:52:49 +00:00
steve 2854a524f0 Watch signed comparisons, that lead to infinite loops. 2002-08-22 23:34:52 +00:00
steve 985c34bfd9 Fix behavioral eval of x?a:b expressions. 2002-08-22 03:38:40 +00:00
steve 63f97d8ec6 Carry mux output delays. 2002-08-21 02:28:03 +00:00
steve d2ac85e2c7 Copy gate delays when doing gate delay substitutions. 2002-08-20 04:12:22 +00:00
steve 1b42f6232f Support parameters with defined ranges. 2002-08-20 04:11:53 +00:00
steve 4de141ab1d Support parameters with defined ranges. 2002-08-19 02:39:16 +00:00
steve 8ab2ec6f86 Allow release to handle removal of target net. 2002-08-19 00:06:11 +00:00
steve 2fad8d4cff Detect temporaries in sequential block synthesis. 2002-08-18 22:07:16 +00:00
steve d94b0fe3c8 Terminate if the functors signal errors. 2002-08-18 22:06:29 +00:00
steve 98956ef88f Snapshot 20020817 2002-08-18 01:07:05 +00:00
steve ac21d96bd8 x in index values leads to 0. 2002-08-18 01:05:50 +00:00
steve c794aa02b8 Fix intermix of node functors and node delete. 2002-08-16 05:18:27 +00:00
steve dd564ab321 add dumpvars_compiletf to check first argument. 2002-08-15 02:12:20 +00:00
steve c0046e845e Handle special case of empty system task argument list. 2002-08-15 02:11:54 +00:00
steve 640767b748 Constants can self-size themselves in unsized contexts. 2002-08-14 03:57:27 +00:00
steve d4eaede435 Do not elide named blocks. 2002-08-13 05:35:00 +00:00
steve 52bf4e613f conditional ident string using autoconfig. 2002-08-12 01:34:58 +00:00
steve 9533a8dbdf Escape the backslash in the windows file name. 2002-08-12 01:27:48 +00:00
steve 774f78cd3e Autoconfig ident support. 2002-08-12 00:27:10 +00:00
steve aca1dcf848 Add missing Log and Ident strings. 2002-08-11 23:47:04 +00:00
steve d24cd015b6 Remove VVM option. 2002-08-11 23:39:33 +00:00
steve 4d41525a91 No longer any nead for -rdynamic flag 2002-08-10 22:36:59 +00:00
steve b170a85fef Kill links to vvm. 2002-08-10 22:27:13 +00:00
steve 90c6bc3a61 Add attributes documentation. 2002-08-10 22:27:00 +00:00
steve a4f6217a2f Missing symbols for mingw. 2002-08-10 22:23:22 +00:00
steve faff19af7b vvp.pdf comes from the man page. 2002-08-10 22:12:01 +00:00
steve bc86bd4efa Remove useless error messages. 2002-08-10 22:07:38 +00:00
steve b4b18f3f30 Observe attributes to control synthesis. 2002-08-10 22:07:08 +00:00
steve 1bcacf06d4 The default attribute value is 1. 2002-08-10 21:59:39 +00:00
steve 27178cedda Allow vpiIntegerVar as parameter to $value$plusarg 2002-08-10 17:00:31 +00:00
steve 6151d796a2 More unsupported items in the list. 2002-08-10 16:57:27 +00:00
steve 6ace9659e0 Get local StringHeap.h 2002-08-07 02:36:10 +00:00
steve 14942b4b43 Dead code. 2002-08-07 02:17:14 +00:00
steve 9ede67ea63 List net delays as unsupported. 2002-08-07 02:07:12 +00:00
steve cc74d2a6b0 Add force to nets. 2002-08-07 00:54:39 +00:00
steve ea779ac7dd Documentation, and excessive inlines. 2002-08-07 00:54:20 +00:00
steve 693e9e5ad0 Store only the base name of memories. 2002-08-05 04:18:45 +00:00
steve a1bc8ca6ca Snapshot 20020804 2002-08-04 22:47:23 +00:00
steve 4e753a2c15 dll uses StringHeap for named items. 2002-08-04 19:13:16 +00:00
steve 89314d4772 Do not use hierarchical names of memories to
generate vvp labels. -tdll target does not
 used hierarchical name string to look up the
 memory objects in the design.
2002-08-04 18:28:14 +00:00
steve 41f7ecacfc Eliminate use of ivl_signal_name for signal labels. 2002-08-03 22:30:48 +00:00
steve dd8da912f5 Fix suffix parsing of library index. 2002-08-03 22:30:00 +00:00
steve 65ad911a2a Grammer fixes. 2002-08-02 01:52:02 +00:00
steve 37331d1c1b Add port name to pin size error message. 2002-07-31 23:55:38 +00:00
steve db2c842d15 Account for the tail readonly callbacks. 2002-07-31 03:22:44 +00:00
steve c0e22a6533 Set vpi_mode_flag to represent cpReadOnlySync actions. 2002-07-31 03:22:23 +00:00
steve bb87c368b8 Asynchronous synthesis of sequential blocks. 2002-07-29 00:00:28 +00:00
steve 76665b9404 Fix NetBlock destructor to delete substatements. 2002-07-28 23:58:44 +00:00
steve a265ba2162 dump NOT gates. 2002-07-28 23:57:22 +00:00
steve 461a0fa2fb $attribute deprecation note. 2002-07-26 02:08:02 +00:00
steve e51bbcb85a Add monitoron and monitoroff system tasks. 2002-07-25 03:35:51 +00:00
steve 58ec62c895 Rewrite find_similar_event to support doing
all event matching and replacement in one
 shot, saving time in the scans.
2002-07-24 16:24:45 +00:00
steve 843e1f9c44 Save event matching for nodangle. 2002-07-24 16:22:59 +00:00
steve 45382144c3 Verbose messages. 2002-07-24 16:21:52 +00:00
steve e2f537628f integral type/ptrdiff_t warning. 2002-07-23 15:11:41 +00:00
steve 91baa938e2 Fix display of no arguments. 2002-07-23 02:41:15 +00:00
steve 7fcaeacd65 Careful not to overrun vector buffer. 2002-07-23 02:36:34 +00:00
steve 2478d6f5d3 Set ivl_target delays for case compare logic. 2002-07-22 21:07:40 +00:00
steve fbc1f6fb81 Initialize the lcounter_ to 0. 2002-07-22 21:07:08 +00:00
steve 57aee7ca26 Add vpi_chk_error and vpi_control functions. 2002-07-19 01:57:26 +00:00
steve 2fcfe9f2c3 vpi_iterate returns 0 on error. 2002-07-19 01:12:50 +00:00
steve 2df2619029 Support put of wide vpiVectorVal to signal. 2002-07-19 00:36:36 +00:00
steve 9260d0d245 New e-mail address for Yasuhisa Kato 2002-07-18 02:18:30 +00:00
steve 15becdaee4 Need driver for sure in assign feedback and other cases. 2002-07-18 02:06:37 +00:00
steve 80c9db3c88 Careful with assign to self. 2002-07-18 00:24:22 +00:00
steve c5d03d3a25 Fix uninitialized thread pointer in named event. 2002-07-17 18:30:01 +00:00
steve 9e1570dc80 Implementation of vpi_handle_by_name, and
add the vpiVariables iterator.
2002-07-17 05:13:43 +00:00
steve 68da84e84a Allow wide rvalues assigned to narrow nex_out. 2002-07-16 04:40:48 +00:00
steve 18ba73382e Fix check for select size. 2002-07-16 03:15:11 +00:00
steve dabbfdb80a Fix dangling pointer in pop_scope. 2002-07-15 03:57:30 +00:00
steve 4eea8720a0 Improve temporary file name guess. 2002-07-15 00:33:50 +00:00
steve 41239078a9 Fix initialization of symbol table string heap. 2002-07-15 00:21:42 +00:00
steve e375078dda Infinite loop in nex_input of NetBlock objects. 2002-07-14 23:47:58 +00:00
steve da6b4c447f No longer need the .exe on generated files. 2002-07-14 23:32:31 +00:00
steve b72c0a0089 Do temp file creation by hand. 2002-07-14 23:11:35 +00:00
steve fbaf8f91bb Fix vpiScope iterator. 2002-07-14 02:52:05 +00:00
steve 329e943e4e Use result buf for event and scope names. 2002-07-12 18:23:30 +00:00
steve 31bd3e6056 Use all bits of ?: condit expression. 2002-07-12 18:10:45 +00:00
steve 15b94050ce Remember to scan IntegerVars. 2002-07-12 17:09:21 +00:00
steve c610699227 Eliminate use of vpiInternalScope. 2002-07-12 17:08:13 +00:00
steve f0d2e20342 Scan scope objects before subscopes. 2002-07-12 17:02:38 +00:00
steve 26a80005d6 Fix typo. 2002-07-12 16:30:44 +00:00
steve 5cf033a6ad Remove vvm files from spec file. 2002-07-12 04:05:50 +00:00
steve e41ee7632d Document the IVERILOG_DUMPER variable. 2002-07-12 02:35:35 +00:00
steve 66a86433e7 Make types array static, not on stack. 2002-07-12 02:10:20 +00:00
steve 2354a90e9f Eliminate use of vpiInternalScope. 2002-07-12 02:08:10 +00:00
steve b7aaf51fbd vpiIntegerVars can have callbacks. 2002-07-12 02:07:36 +00:00
steve 5a885165b2 vpi_iterate return null if there is nothing to iterate. 2002-07-12 02:04:44 +00:00
steve a748604418 Library dir case insensitivity includes the suffix. 2002-07-10 04:34:18 +00:00
steve e1a4e27173 Dynamic resizevpi result buf in more places. 2002-07-09 03:24:37 +00:00
steve 2b06a293b6 Fix split of root btree node. 2002-07-09 03:20:51 +00:00
steve 472f98affe Generate code for wide muxes. 2002-07-08 04:04:07 +00:00
steve 8114523be2 Asynchronous synthesis of case statements. 2002-07-07 22:32:15 +00:00
steve 33ee1da817 Smart synthesis of binary AND expressions. 2002-07-07 22:31:39 +00:00
steve 301040a67a Avoid emitting to vvp local net symbols. 2002-07-05 21:26:17 +00:00
steve 54b96ea7bd Count different types of functors. 2002-07-05 20:08:44 +00:00
steve d0dfe2e7e7 Allow set of output name. 2002-07-05 17:17:20 +00:00
steve fd8ceac170 Names of vpi objects allocated as vpip_strings. 2002-07-05 17:14:15 +00:00
steve a05d8c2823 Symbol table uses more efficient key string allocator,
and remove all the symbol tables after compile is done.
2002-07-05 04:40:59 +00:00
steve 626f418ab0 Track opcode memory space. 2002-07-05 03:46:43 +00:00
steve 5792220dcb Remove the vpi object symbol table after compile. 2002-07-05 02:50:57 +00:00
steve 29d5d44f03 More detailed Mac OS X instructions. 2002-07-04 16:37:59 +00:00
steve b2762f63a2 Fix s_vpi_vecval array byte size. 2002-07-04 16:37:07 +00:00
steve 7d97f8a964 initial statements are not asynchronous. 2002-07-04 00:24:16 +00:00
steve d3e63088d8 Dynamic size result buffer for _str and _get_value functions. 2002-07-03 23:39:57 +00:00
steve dddaa0ebcf More configure information in iverilog-vpi. 2002-07-03 23:20:12 +00:00
steve ccbb1e5f5a don't pollute name space
fix vecval for Z/X cases
2002-07-03 23:16:27 +00:00
steve 3f1cd14f6c Fix scope search for events. 2002-07-03 05:34:59 +00:00
steve 70abb2ce5c Clear drive cache on link or unlink. 2002-07-03 03:08:47 +00:00
steve 3f80bead1b vpiName, vpiFullName support in memory types,
length checks for *_get_str() buffers,
 temporary buffers for *_get_str() data,
 dynamic storage for vpi_get_data() in memory types
 shared with signal white space
2002-07-03 02:09:38 +00:00
steve 93bb4283b8 Change the signal to a net when assignments go away. 2002-07-02 03:02:57 +00:00
steve 5b5b31286b Include synth2 in synthesis targets. 2002-07-02 03:02:02 +00:00
steve c5bde6560c Limit word writing to vector limits. 2002-07-01 15:36:12 +00:00
steve cb4eb6236c Ignore generated pdf and ps files. 2002-07-01 03:54:08 +00:00
steve d5e9e13555 synth_asych of if/else requires redirecting the target
if sub-statements. Use NetNet objects to manage the
 situation.
2002-07-01 00:54:21 +00:00
steve 3595b6d186 Carry can propagate to the otp in addi. 2002-07-01 00:52:47 +00:00
steve 210010a390 Get vpiVectorVal for memories. 2002-06-30 04:35:47 +00:00
steve 99b3cc4464 vpiVectorVal of very wide signals. 2002-06-30 02:52:36 +00:00
steve 9b6b081e38 Add structure for asynchronous logic synthesis. 2002-06-30 02:21:31 +00:00
steve b54ee3b1cd Fix mishandling of incorect defparam error message. 2002-06-25 02:39:34 +00:00
steve 9fc4e1eddd Cache calculated driven value. 2002-06-25 01:33:22 +00:00
steve 73cca6ec39 include malloc.h only when available. 2002-06-25 01:33:01 +00:00
steve 58c2e12507 Make link_drive_constant cache its results in
the Nexus, to improve cprop performance.
2002-06-24 01:49:38 +00:00
steve 6dd80611a1 Export ivl_signal_integer fro windows. 2002-06-23 20:41:19 +00:00
steve c2132039d2 Variable substitution in command files. 2002-06-23 20:10:51 +00:00
steve d8d07eb129 trivial performance boost. 2002-06-23 18:23:09 +00:00
steve f9768cd579 spelling error. 2002-06-23 18:22:43 +00:00
steve b6a15b2f4d Wide unary minus in continuous assignments. 2002-06-22 04:22:40 +00:00
steve 5eca5d9948 Carry integerness throughout the compilation. 2002-06-21 04:59:35 +00:00
steve f4a4ee00d0 Add support for special integer vectors. 2002-06-21 04:58:55 +00:00
steve cd94019733 Remove NetTmp and add NetSubnet class. 2002-06-19 04:20:03 +00:00
steve d7fb47268f Shuffle link_drivers_constant for speed. 2002-06-19 04:18:46 +00:00
steve b4b5ac9944 Normalize run-time index expressions for bit selects 2002-06-16 20:39:12 +00:00
steve df0b81d94d Generate runtime code to normalize indices. 2002-06-16 19:19:16 +00:00
steve 067d09720c Rounding error. 2002-06-15 02:35:49 +00:00
steve 870c35eece sign extend signed vectors vpiIntVal. 2002-06-14 22:05:28 +00:00
steve a82c178fd9 Fix expression width for repeat concatenations. 2002-06-14 21:38:41 +00:00
steve 809bd18e66 Uninstall removed ivl from libdir. 2002-06-14 04:17:12 +00:00
steve 4f0ffa2258 Compiler portability. 2002-06-14 03:25:51 +00:00
steve f45b17973c Add acc_fetch_argc/argv/version (mruff) 2002-06-11 15:19:12 +00:00
steve 0bbea355c2 More specify syntax. 2002-06-11 13:58:04 +00:00
steve 2be3507422 Stub value change callbacks for consts and modules. 2002-06-11 03:47:34 +00:00
steve d6c946f390 Spelling patch (Larry Doolittle) 2002-06-11 03:34:33 +00:00
steve 96b6eb6b30 Get tf_asynchon/off name right. 2002-06-11 03:29:14 +00:00
steve 9cef973d9b Add NetRamDq synthsesis from memory l-values. 2002-06-08 23:42:46 +00:00
steve 88722a2831 Add tf_putlongp and tf_putp. 2002-06-07 16:21:12 +00:00
steve d6b5c67313 Add a bunch of acc/tf functions. (mruff) 2002-06-07 02:58:58 +00:00
steve 4fed9d6532 Simply give up on constants with indices. 2002-06-07 02:57:54 +00:00
steve 28e0616543 Use standard name for iostream. 2002-06-06 18:57:18 +00:00
steve 6173e6b78a Better error for identifier index eval. 2002-06-06 18:57:04 +00:00
steve b5018cd994 distclean rm some generated makefiles. 2002-06-06 18:48:02 +00:00
steve f19a7c617d improved uninstall target. 2002-06-05 18:52:14 +00:00
steve 53d8cdd9f8 Add support for memory words in l-value of
non-blocking assignments, and remove the special
 NetAssignMem_ and NetAssignMemNB classes.
2002-06-05 03:44:25 +00:00
steve 4bac5c06ba Dump l-value memory indices. 2002-06-05 03:43:14 +00:00
steve 91a755d0e8 Add support for memory words in l-value of
blocking assignments, and remove the special
 NetAssignMem class.
2002-06-04 05:38:43 +00:00
steve 8cae7a4d44 Add misctf support to libveriuser 2002-06-04 01:42:58 +00:00
steve 11d1c45e45 Add asynchon and asynchoff 2002-06-04 01:40:03 +00:00
steve 5454a15b94 Fix return type of tf_getinstance. 2002-06-03 21:52:59 +00:00
steve 3ad0ec77ce Add verinum != operator. 2002-06-03 04:04:24 +00:00
steve 3966e852ac Ignore memories and named events. 2002-06-03 03:56:06 +00:00
steve 83bfa9345f compile warnings. 2002-06-03 03:55:14 +00:00
steve 7d1d3847d8 Better typing for veriusertfs table. 2002-06-03 00:08:42 +00:00
steve a91c4f66ce Check for null pointers from users. 2002-06-02 19:05:50 +00:00
steve ca2486ea61 Add acc_handle_tfarg and acc_next_topmode 2002-06-02 19:03:29 +00:00
steve 24a2487c18 Generate %cmpi/u where appropriate. 2002-06-02 18:57:17 +00:00
steve d68153dea3 Add %cmpi/u instruction. 2002-06-02 18:55:58 +00:00
steve 89329fc0cc Add tf_getinstance function. 2002-06-02 18:54:59 +00:00
steve cba5a22714 Generate %muli instructions when possible. 2002-05-31 20:04:57 +00:00
steve 1ce50993f0 Add the %muli instruction. 2002-05-31 20:04:22 +00:00
steve 2c0c934ad5 Add tf_getlongtime (mruff) 2002-05-31 18:25:51 +00:00
steve b6db8b63ec Check for and don't dereference null pointers,
Avoid copy of static objects.
 (mruff)
2002-05-31 18:21:39 +00:00
steve f1ab9e63fa Add support for $timeformat. 2002-05-31 04:26:54 +00:00
steve 12c574d5c9 Call padding reserved. 2002-05-31 04:26:44 +00:00
steve af6f0c800f Slight improvement in %mov performance. 2002-05-31 04:09:58 +00:00
steve 48f65cef40 Word oriented bit storage. 2002-05-31 00:05:49 +00:00
steve b5a1d116fa Add the veriusertf_register funciton. 2002-05-30 02:37:26 +00:00
steve b9339d3c60 Add tf_nump from mruff. 2002-05-30 02:12:17 +00:00
steve 0838dd24a4 Add tf_error and tf_warning from mruff 2002-05-30 02:10:08 +00:00
steve 9537fd7f0b Implement acc_product_version. 2002-05-30 02:06:05 +00:00
steve 95876feb46 Use addi with wide immediate values. 2002-05-30 01:57:23 +00:00
steve 19d817503d Offset lvalue index expressions. 2002-05-29 22:05:54 +00:00
steve b6b364a09d Add %addi, which is faster to simulate. 2002-05-29 16:29:34 +00:00
steve f704d4d3ff Use binary search to speed up deep lookups. 2002-05-29 05:37:35 +00:00
steve 450b9ab85c Callbacks can happen during calltf functions. 2002-05-28 22:55:20 +00:00
steve a1774bd3bd ivl indexes the search path for libraries, and
supports case insensitive module-to-file lookup.
2002-05-28 20:46:51 +00:00
steve 5aa69516bb ivl indexes the search path for libraries, and
supports case insensitive module-to-file lookup.
2002-05-28 20:40:37 +00:00
steve c594dcec52 Add new iverilog-vpi man page. 2002-05-28 05:21:30 +00:00
steve 8126384726 ignore generated iverilog-vpi files. 2002-05-28 05:21:13 +00:00
steve 96e6a9b02f Update to new capabilities. 2002-05-28 05:20:41 +00:00
steve d44ff4fd91 Pass library paths through -Cfile instead of command line. 2002-05-28 02:25:03 +00:00
steve 9a4ee873e1 Add the ivl -C flag for bulk configuration
from the driver, and use that to run library
 modules through the preprocessor.
2002-05-28 00:50:39 +00:00
steve 597ed1681a Predefine __ICARUS__ 2002-05-27 23:14:06 +00:00
steve bcd49b94dd Able to disable thread self. 2002-05-27 00:53:10 +00:00
steve 422754f36f Support carrying the scope of named begin-end
blocks down to the code generator, and have
 the vvp code generator use that to support disable.
2002-05-27 00:08:45 +00:00
steve bfad382fd1 Carry Verilog 2001 attributes with processes,
all the way through to the ivl_target API.

 Divide signal reference counts between rval
 and lval references.
2002-05-26 01:39:02 +00:00
steve 8941a594ee include iostream for gcc 3.1 2002-05-25 16:51:37 +00:00
steve 6bd8ab46d5 Eval ^ and &0 expressions. 2002-05-25 16:43:47 +00:00
steve 57f2ad6d15 Better padding of constants. 2002-05-25 16:43:22 +00:00
steve 33efeca0da Only match plusargs. 2002-05-24 21:46:21 +00:00
steve be1888ed5f Implement mc_scan_plusargs. 2002-05-24 20:29:07 +00:00
steve 6ede18d41c support GCC __attributes__ for printf formats. 2002-05-24 19:05:30 +00:00
steve d63e994ea5 Detect long division by zero. 2002-05-24 04:55:13 +00:00
steve 700887d657 Verilog 2001 attriubtes on nets/wires. 2002-05-24 04:36:23 +00:00
steve 42674be38b Support language generation flag -g. 2002-05-24 01:13:00 +00:00
steve fde7cd8f10 Add support for $bits (SystemVerilog) 2002-05-24 00:44:54 +00:00
steve 7ce713356e Define SIZEOF_UNSIGNED_LONG_LONG 2002-05-24 00:43:16 +00:00
steve 6511fc610b Add the acc_user.h header file. 2002-05-23 03:46:42 +00:00
steve 8dd4f77f3f Add the io_printf function to libveriuser. 2002-05-23 03:35:42 +00:00
steve 004bfad348 Link the veriuser library. 2002-05-23 03:35:05 +00:00
steve ff90a5735d Export the vpi_vprintf function. 2002-05-23 03:34:46 +00:00
steve e6c0629626 Add language support for Verilog-2001 attribute
syntax. Hook this support into existing $attribute
 handling, and add number and void value types.

 Add to the ivl_target API new functions for access
 of complex attributes attached to gates.
2002-05-23 03:08:50 +00:00
steve 01efffedfc Ignore Named events in vcd signal scan. 2002-05-23 01:07:26 +00:00
steve 74c219f171 Add ranges and signed to port list declarations. 2002-05-20 02:06:01 +00:00
steve bf10c5762a Parse port_declaration_lists from the 2001 Standard. 2002-05-19 23:37:28 +00:00
steve ca9abaf0c5 Start the libveriuser library. 2002-05-19 05:21:00 +00:00
steve cfab250671 Add callbacks for vpiNamedEvent objects. 2002-05-19 05:18:16 +00:00
steve b1c0f7306d Add vpi support for named events.
Add vpi_mode_flag to track the mode of the
 vpi engine. This is for error checking.
2002-05-18 02:34:11 +00:00
steve a156d8b8ce Add vpiIndex update. 2002-05-17 16:13:08 +00:00
steve a7b7781fe9 Rewire vpiMemory and vpiMemoryWord handles to
support proper iteration of words, and the
 vpiIndex value.
2002-05-17 04:12:19 +00:00
steve 21fe6afe8d null terminate the reversed decimal string 2002-05-17 04:05:38 +00:00
steve 48da46986b Support set by string for reg objects. 2002-05-15 04:48:46 +00:00
steve 8d6239301f Count compile errors. 2002-05-15 01:25:25 +00:00
steve 2e6807493f Make clean should remove iverilog-vpi. 2002-05-15 01:25:07 +00:00
steve 94cef20e49 task calls and forks push the thread event in the queue. 2002-05-12 23:44:41 +00:00
steve c787a36af2 Accept errors in memory index expression. 2002-05-12 19:16:58 +00:00
steve da0c4c7565 Get thread vectors by vpiIntVal. 2002-05-12 00:32:21 +00:00
steve 9c28f085d8 Set and get memory words by string value. 2002-05-11 04:39:35 +00:00
steve e9af0c7485 Support scope iterate over vpiNet,vpiReg/vpiMemory. 2002-05-10 16:00:57 +00:00
steve be54bfdc21 ignore vpiMemory objects in vcd dumper. 2002-05-10 16:00:16 +00:00
steve c6a6f4bc79 Allow for C++ source files. 2002-05-10 03:54:46 +00:00
steve 88ae1b7b3c Handle null time and calltf pointers. 2002-05-09 03:34:31 +00:00
steve f5d3b78653 Use else clause instead of ! to preface wait events. 2002-05-07 05:06:07 +00:00
steve 68f1316eba Fix uninitialized memory accesses. 2002-05-07 04:15:43 +00:00
steve e70e04d6e8 Handle x case of unary ! properly. 2002-05-07 03:49:58 +00:00
steve a3eb6868ea Allow parameters in concatenation of widths are defined. 2002-05-06 02:30:27 +00:00
steve 186759c95e Do not need mangle.o unless vvm us used. 2002-05-06 00:50:38 +00:00
steve 8667b9a35d Put off evaluation of concatenation repeat expresions
until after parameters are defined. This allows parms
 to be used in repeat expresions.

 Add the builtin $signed system function.
2002-05-05 21:11:49 +00:00
steve 00defb0265 Credit for Mike Ruff amd Mike Runyan. 2002-05-04 03:19:35 +00:00
steve 822a085d97 Properly free vpi callback objects. 2002-05-04 03:17:29 +00:00
steve f23aec7f14 Add simulator event callbacks. 2002-05-04 03:03:17 +00:00
steve fb457128bf Add vpiModule iterator to vpiScope objects. 2002-05-03 15:44:11 +00:00
steve d126a414bd Spelling errors. 2002-04-30 04:26:42 +00:00
334 changed files with 17510 additions and 8691 deletions
+1
View File
@@ -5,6 +5,7 @@ parse.cc.output
syn-rules.cc
syn-rules.cc.output
lexor.cc
iverilog-vpi
ivl
ivl.exp
dep
+33 -12
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: Attrib.cc,v 1.2 2001/07/25 03:10:48 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: Attrib.cc,v 1.5 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -36,14 +36,15 @@ Attrib::~Attrib()
delete[] list_;
}
void Attrib::set_attributes(const map<string,string>&attr)
#if 0
void Attrib::copy_attributes(const map<string,verinum>&attr)
{
assert(list_ == 0);
nlist_ = attr.size();
list_ = new cell_[nlist_];
map<string,string>::const_iterator idx;
map<string,verinum>::const_iterator idx;
unsigned jdx;
for (idx = attr.begin(), jdx = 0 ; idx != attr.end() ; idx ++, jdx++) {
struct cell_*tmp = list_ + jdx;
@@ -51,8 +52,9 @@ void Attrib::set_attributes(const map<string,string>&attr)
tmp->val = (*idx).second;
}
}
#endif
string Attrib::attribute(const string&key) const
const verinum& Attrib::attribute(const string&key) const
{
for (unsigned idx = 0 ; idx < nlist_ ; idx += 1) {
@@ -60,10 +62,11 @@ string Attrib::attribute(const string&key) const
return list_[idx].val;
}
return "";
static const verinum null;
return null;
}
void Attrib::attribute(const string&key, const string&value)
void Attrib::attribute(const string&key, const verinum&value)
{
unsigned idx;
@@ -92,7 +95,7 @@ bool Attrib::has_compat_attributes(const Attrib&that) const
for (idx = 0 ; idx < that.nlist_ ; idx += 1) {
string tmp = attribute(that.list_[idx].key);
verinum tmp = attribute(that.list_[idx].key);
if (tmp != that.list_[idx].val)
return false;
}
@@ -100,18 +103,18 @@ bool Attrib::has_compat_attributes(const Attrib&that) const
return true;
}
unsigned Attrib::size() const
unsigned Attrib::attr_cnt() const
{
return nlist_;
}
string Attrib::key(unsigned idx) const
const char* Attrib::attr_key(unsigned idx) const
{
assert(idx < nlist_);
return list_[idx].key;
return list_[idx].key.c_str();
}
string Attrib::value(unsigned idx) const
const verinum& Attrib::attr_value(unsigned idx) const
{
assert(idx < nlist_);
return list_[idx].val;
@@ -120,6 +123,24 @@ string Attrib::value(unsigned idx) const
/*
* $Log: Attrib.cc,v $
* Revision 1.5 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.4 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.3 2002/05/23 03:08:50 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.2 2001/07/25 03:10:48 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
+29 -11
View File
@@ -18,12 +18,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: Attrib.h,v 1.1 2000/12/04 17:37:03 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: Attrib.h,v 1.4 2002/08/12 01:34:58 steve Exp $"
#endif
# include <string>
# include <map>
# include "verinum.h"
/*
* This class keeps a map of key/value pairs. The map can be set from
@@ -35,21 +35,21 @@ class Attrib {
Attrib();
~Attrib();
void set_attributes(const map<string,string>&attr);
string attribute(const string&key) const;
void attribute(const string&key, const string&value);
const verinum&attribute(const string&key) const;
void attribute(const string&key, const verinum&value);
bool has_compat_attributes(const Attrib&that) const;
/* Provide a means of iterating over the entries in the map. */
unsigned size() const;
string key(unsigned idx) const;
string value(unsigned idx) const;
unsigned attr_cnt() const;
const char* attr_key(unsigned idx) const;
const verinum& attr_value(unsigned idx) const;
private:
struct cell_ {
string key;
string val;
string key;
verinum val;
};
unsigned nlist_;
@@ -62,6 +62,24 @@ class Attrib {
/*
* $Log: Attrib.h,v $
* Revision 1.4 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.3 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.2 2002/05/23 03:08:50 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.1 2000/12/04 17:37:03 steve
* Add Attrib class for holding NetObj attributes.
*
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: HName.cc,v 1.3 2002/01/05 04:36:06 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: HName.cc,v 1.4 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -253,6 +253,9 @@ ostream& operator<< (ostream&out, const hname_t&that)
/*
* $Log: HName.cc,v $
* Revision 1.4 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.3 2002/01/05 04:36:06 steve
* include malloc.h only when available.
*
+13 -6
View File
@@ -18,14 +18,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: HName.h,v 1.1 2001/12/03 04:47:14 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: HName.h,v 1.3 2002/08/12 01:34:58 steve Exp $"
#endif
#ifdef HAVE_IOSFWD
# include <iosfwd>
#else
class ostream;
# include <iostream>
#ifdef __GNUC__
#if __GNUC__ > 2
using namespace std;
#endif
#endif
/*
@@ -78,6 +79,12 @@ extern bool operator == (const hname_t&, const hname_t&);
/*
* $Log: HName.h,v $
* Revision 1.3 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2002/06/14 03:25:51 steve
* Compiler portability.
*
* Revision 1.1 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: LineInfo.cc,v 1.2 2001/07/25 03:10:48 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: LineInfo.cc,v 1.3 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -44,6 +44,9 @@ void LineInfo::set_line(const LineInfo&that)
/*
* $Log: LineInfo.cc,v $
* Revision 1.3 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2001/07/25 03:10:48 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
+5 -2
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: LineInfo.h,v 1.5 2000/11/30 17:31:42 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: LineInfo.h,v 1.6 2002/08/12 01:34:58 steve Exp $"
#endif
# include <string>
@@ -52,6 +52,9 @@ class LineInfo {
/*
* $Log: LineInfo.h,v $
* Revision 1.6 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.5 2000/11/30 17:31:42 steve
* Change LineInfo to store const C strings.
*
+58 -30
View File
@@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.119 2002/04/21 04:59:07 steve Exp $"
#ident "$Id: Makefile.in,v 1.134 2002/09/16 00:30:33 steve Exp $"
#
#
SHELL = /bin/sh
@@ -38,6 +38,7 @@ VPATH = $(srcdir)
bindir = @bindir@
libdir = @libdir@
includedir = $(prefix)/include
mandir = @mandir@
dllib=@DLLIB@
rdynamic=@rdynamic@
@@ -66,12 +67,8 @@ ifeq ('@HAVE_IPAL@','yes')
TARGETS += tgt-pal
endif
ifeq (@ENABLE_VVM@,yes)
SUB_VVM = vvm
endif
all: ivl@EXEEXT@ libvpi.a
for dir in $(SUBDIRS) $(SUB_VVM); do (cd $$dir ; $(MAKE) all); done
for dir in $(SUBDIRS) ; do (cd $$dir ; $(MAKE) all); done
cd vpi ; $(MAKE) all
cd ivlpp ; $(MAKE) all
cd driver ; $(MAKE) VERSION=$(VERSION) all
@@ -98,46 +95,42 @@ check: all
vvp/vvp -M./vpi ./check.vvp | grep 'Hello, World'
clean:
rm -f *.o parse.cc parse.cc.output parse.h dep/*.d lexor.cc lexor_keyword.cc ivl@EXEEXT@ libivl.a libvpi.a
rm -f *.o parse.cc parse.cc.output parse.h dep/*.d lexor.cc lexor_keyword.cc ivl@EXEEXT@ libivl.a libvpi.a iverilog-vpi
cd vpi ; $(MAKE) clean
cd driver ; $(MAKE) clean
cd ivlpp ; $(MAKE) clean
cd tgt-verilog ; $(MAKE) clean
cd tgt-stub ; $(MAKE) clean
for dir in $(SUBDIRS) $(SUB_VVM); do (cd $$dir ; $(MAKE) clean); done
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) clean); done
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) clean); done
distclean: clean
for dir in $(SUBDIRS) $(SUB_VVM); do (cd $$dir ; $(MAKE) distclean); done
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) distclean); done
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) distclean); done
rm -f vvm/Makefile
rm -f vpi/Makefile
rm -f ivlpp/Makefile
rm -f driver/Makefile
rm -f config.status config.cache config.log
rm -f Makefile
rm -f tgt-pal/Makefile tgt-stub/Makefile tgt-verilog/Makefile
ifeq (@ENABLE_VVM@,yes)
TT_VVM = t-vvm.o
endif
TT = t-dll.o t-dll-api.o t-dll-expr.o t-dll-proc.o t-xnf.o
FF = cprop.o nodangle.o synth.o synth2.o syn-rules.o xnfio.o
TT = t-dll.o t-dll-api.o t-dll-expr.o t-dll-proc.o $(TT_VVM) t-xnf.o
FF = nodangle.o synth.o syn-rules.o xnfio.o
O = main.o cprop.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
O = main.o async.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
elab_lval.o elab_net.o elab_anet.o elab_pexpr.o elab_scope.o \
elab_sig.o emit.o eval.o eval_rconst.o \
elab_sig.o emit.o eval.o eval_attrib.o eval_rconst.o \
eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
load_module.o mangle.o netlist.o netmisc.o net_assign.o \
load_module.o netlist.o netmisc.o net_assign.o \
net_design.o net_event.o net_expr.o net_force.o net_func.o \
net_link.o net_modulo.o net_nex_input.o \
net_link.o net_modulo.o net_nex_input.o net_nex_output.o \
net_proc.o net_scope.o net_udp.o pad_to_width.o \
parse.o parse_misc.o pform.o pform_dump.o \
set_width.o \
set_width.o sync.o \
verinum.o verireal.o target.o targets.o \
Attrib.o HName.o LineInfo.o Module.o PDelays.o PEvent.o \
PExpr.o PGate.o \
PTask.o PFunction.o PWire.o Statement.o \
PTask.o PFunction.o PWire.o Statement.o StringHeap.o \
$(FF) $(TT)
Makefile: Makefile.in config.h.in config.status
@@ -177,13 +170,14 @@ ifeq (@WIN32@,yes)
else
iverilog-vpi: iverilog-vpi.sh
sed -e 's;@SHARED@;@shared@;' -e 's;@PIC@;@PICFLAG@;' $< > $@
sed -e 's;@SHARED@;@shared@;' -e 's;@PIC@;@PICFLAG@;' \
-e 's;@INCLUDEDIR@;@includedir@;' -e 's;@LIBDIR@;@libdir@;' $< > $@
chmod +x $@
endif
%.o: %.cc
@[ -d dep ] || mkdir dep
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o
$(CXX) @ident_support@ $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o
mv $*.d dep/$*.d
@@ -206,17 +200,32 @@ lexor_keyword.o: lexor_keyword.cc
lexor_keyword.cc: lexor_keyword.gperf
gperf -o -i 7 -C -k 1-3,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)
iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
man -t $(srcdir)/iverilog-vpi.man > iverilog-vpi.ps
iverilog-vpi.pdf: iverilog-vpi.ps
ps2pdf iverilog-vpi.ps iverilog-vpi.pdf
ifeq (@WIN32@,yes)
INSTALL_DOC = $(prefix)/iverilog-vpi.pdf
INSTALL_DOCDIR =
all: iverilog-vpi.pdf
else
INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
INSTALL_DOCDIR = $(mandir)/man1
endif
ifeq (@WIN32@,yes)
WIN32_INSTALL = $(prefix)/hello.vl $(prefix)/sqrt.vl $(prefix)/QUICK_START.txt
else
WIN32_INSTALL = $(bindir)/iverilog-vpi
endif
install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/vpi_user.h $(libdir)/libvpi.a $(WIN32_INSTALL)
install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/vpi_user.h $(includedir)/acc_user.h $(includedir)/veriuser.h $(libdir)/libvpi.a $(WIN32_INSTALL) $(INSTALL_DOC)
cd vpi ; $(MAKE) install
cd ivlpp ; $(MAKE) install
cd driver ; $(MAKE) install
for tgt in $(SUBDIRS) $(SUB_VVM); do (cd $$tgt ; $(MAKE) install); done
for tgt in $(SUBDIRS); do (cd $$tgt ; $(MAKE) install); done
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) install); done
$(bindir)/iverilog-vpi: ./iverilog-vpi
@@ -238,6 +247,18 @@ $(includedir)/ivl_target.h: $(srcdir)/ivl_target.h
$(includedir)/vpi_user.h: $(srcdir)/vpi_user.h
$(INSTALL_DATA) $(srcdir)/vpi_user.h $(includedir)/vpi_user.h
$(includedir)/acc_user.h: $(srcdir)/acc_user.h
$(INSTALL_DATA) $(srcdir)/acc_user.h $(includedir)/acc_user.h
$(includedir)/veriuser.h: $(srcdir)/veriuser.h
$(INSTALL_DATA) $(srcdir)/veriuser.h $(includedir)/veriuser.h
$(mandir)/man1/iverilog-vpi.1: $(srcdir)/iverilog-vpi.man
$(INSTALL_DATA) $(srcdir)/iverilog-vpi.man $(mandir)/man1/iverilog-vpi.1
$(prefix)/iverilog-vpi.pdf: iverilog-vpi.pdf
$(INSTALL_DATA) iverilog-vpi.pdf $(prefix)/iverilog-vpi.pdf
# In windows installations, put a few examples and the quick_start
# into the destination directory.
ifeq (@WIN32@,yes)
@@ -255,19 +276,26 @@ $(prefix)/QUICK_START.txt: $(srcdir)/QUICK_START.txt
endif
installdirs: mkinstalldirs
$(srcdir)/mkinstalldirs $(bindir) $(includedir) $(libdir)/ivl
$(srcdir)/mkinstalldirs $(bindir) $(includedir) $(libdir)/ivl \
$(mandir) $(mandir)/man1
uninstall:
rm -f $(libdir)/ivl/ivl@EXEEXT@
rm -f $(libdir)/ivl/iverilog.conf
rm -f $(libdir)/ivl/ivl
-rmdir $(libdir)/ivl
rm -f $(libdir)/libvpi.a
rm -f $(bindir)/verilog
rm -f $(bindir)/iverilog-vpi
rm -f $(bindir)/gverilog@EXEEXT@
rm -f $(includedir)/ivl_target.h
rm -f $(includedir)/vpi_user.h
rm -f $(includedir)/acc_user.h
rm -f $(includedir)/veriuser.h
rm -f $(mandir)/man1/iverilog-vpi.1
cd driver ; $(MAKE) uninstall
cd vpi ; $(MAKE) uninstall
cd ivlpp ; $(MAKE) uninstall
for tgt in $(SUBDIRS) $(SUB_VVM); do (cd $$tgt ; $(MAKE) uninstall); done
for tgt in $(SUBDIRS); do (cd $$tgt ; $(MAKE) uninstall); done
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) uninstall); done
+16 -13
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Module.cc,v 1.17 2001/12/03 04:47:14 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: Module.cc,v 1.19 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -27,12 +27,9 @@
# include "PWire.h"
# include <assert.h>
Module::Module(const char*name, const svector<Module::port_t*>*pp)
Module::Module(const char*name)
: name_(strdup(name))
{
if (pp)
ports_ = *pp;
}
Module::~Module()
@@ -72,7 +69,7 @@ void Module::add_behavior(PProcess*b)
unsigned Module::port_count() const
{
return ports_.count();
return ports.count();
}
/*
@@ -82,11 +79,11 @@ unsigned Module::port_count() const
*/
const svector<PEIdent*>& Module::get_port(unsigned idx) const
{
assert(idx < ports_.count());
assert(idx < ports.count());
static svector<PEIdent*> zero;
if (ports_[idx])
return ports_[idx]->expr;
if (ports[idx])
return ports[idx]->expr;
else
return zero;
}
@@ -94,11 +91,11 @@ const svector<PEIdent*>& Module::get_port(unsigned idx) const
unsigned Module::find_port(const string&name) const
{
assert(name != "");
for (unsigned idx = 0 ; idx < ports_.count() ; idx += 1)
if (ports_[idx]->name == name)
for (unsigned idx = 0 ; idx < ports.count() ; idx += 1)
if (ports[idx]->name == name)
return idx;
return ports_.count();
return ports.count();
}
@@ -142,6 +139,12 @@ const list<PProcess*>& Module::get_behaviors() const
/*
* $Log: Module.cc,v $
* Revision 1.19 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.18 2002/05/19 23:37:28 steve
* Parse port_declaration_lists from the 2001 Standard.
*
* Revision 1.17 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
+24 -9
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Module.h,v 1.24 2001/12/03 04:47:14 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: Module.h,v 1.27 2002/08/19 02:39:16 steve Exp $"
#endif
# include <list>
@@ -60,15 +60,21 @@ class Module : public LineInfo {
};
public:
explicit Module(const char*name, const svector<port_t*>*);
explicit Module(const char*name);
~Module();
/* The module has parameters that are evaluated when the
module is elaborated. During parsing, I put the parameters
into this map. */
map<string,PExpr*>parameters;
map<string,PExpr*>localparams;
struct param_expr_t {
PExpr*expr;
PExpr*msb;
PExpr*lsb;
bool signed_flag;
};
map<string,param_expr_t>parameters;
map<string,param_expr_t>localparams;
/* The module also has defparam assignments which don't create
new parameters within the module, but may be used to set
@@ -84,6 +90,10 @@ class Module : public LineInfo {
a parameter-index to its name. */
list<string> param_names;
/* This is an array of port descriptors, which is in turn a
named array of PEident pointers. */
svector<port_t*> ports;
/* Keep a table of named events declared in the module. */
map<string,PEvent*>events;
@@ -127,10 +137,6 @@ class Module : public LineInfo {
private:
char* name_;
/* This is an array of port descriptors, which is in turn a
named array of PEident pointers. */
svector<port_t*> ports_;
map<hname_t,PWire*> wires_;
list<PGate*> gates_;
list<PProcess*> behaviors_;
@@ -145,6 +151,15 @@ class Module : public LineInfo {
/*
* $Log: Module.h,v $
* Revision 1.27 2002/08/19 02:39:16 steve
* Support parameters with defined ranges.
*
* Revision 1.26 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.25 2002/05/19 23:37:28 steve
* Parse port_declaration_lists from the 2001 Standard.
*
* Revision 1.24 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PDelays.cc,v 1.8 2001/12/29 20:19:31 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PDelays.cc,v 1.9 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -131,6 +131,9 @@ void PDelays::eval_delays(Design*des, NetScope*scope,
/*
* $Log: PDelays.cc,v $
* Revision 1.9 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.8 2001/12/29 20:19:31 steve
* Do not delete delay expressions of UDP instances.
*
+14 -7
View File
@@ -1,7 +1,7 @@
#ifndef __PDelays_H
#define __PDelays_H
/*
* Copyright (c) 1999 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -18,17 +18,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PDelays.h,v 1.5 2001/12/29 20:19:31 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PDelays.h,v 1.7 2002/08/12 01:34:58 steve Exp $"
#endif
# include "svector.h"
# include <string>
# include <iostream>
#ifdef HAVE_IOSFWD
# include <iosfwd>
#else
class ostream;
#ifdef __GNUC__
#if __GNUC__ > 2
using namespace std;
#endif
#endif
class Design;
@@ -71,6 +72,12 @@ ostream& operator << (ostream&o, const PDelays&);
/*
* $Log: PDelays.h,v $
* Revision 1.7 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.6 2002/06/14 03:25:51 steve
* Compiler portability.
*
* Revision 1.5 2001/12/29 20:19:31 steve
* Do not delete delay expressions of UDP instances.
*
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PEvent.cc,v 1.2 2001/07/25 03:10:48 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PEvent.cc,v 1.3 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -40,6 +40,9 @@ string PEvent::name() const
/*
* $Log: PEvent.cc,v $
* Revision 1.3 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2001/07/25 03:10:48 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
+5 -2
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PEvent.h,v 1.5 2001/12/03 04:47:14 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PEvent.h,v 1.6 2002/08/12 01:34:58 steve Exp $"
#endif
# include "LineInfo.h"
@@ -53,6 +53,9 @@ class PEvent : public LineInfo {
/*
* $Log: PEvent.h,v $
* Revision 1.6 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.5 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
+10 -4
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PExpr.cc,v 1.29 2001/12/30 21:32:03 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PExpr.cc,v 1.31 2002/08/19 02:39:16 steve Exp $"
#endif
# include "config.h"
@@ -161,12 +161,12 @@ bool PEIdent::is_constant(Module*mod) const
{
if (mod == 0) return false;
{ map<string,PExpr*>::const_iterator cur;
{ map<string,Module::param_expr_t>::const_iterator cur;
cur = mod->parameters.find(path_.peek_name(0));
if (cur != mod->parameters.end()) return true;
}
{ map<string,PExpr*>::const_iterator cur;
{ map<string,Module::param_expr_t>::const_iterator cur;
cur = mod->localparams.find(path_.peek_name(0));
if (cur != mod->localparams.end()) return true;
}
@@ -256,6 +256,12 @@ bool PEUnary::is_constant(Module*m) const
/*
* $Log: PExpr.cc,v $
* Revision 1.31 2002/08/19 02:39:16 steve
* Support parameters with defined ranges.
*
* Revision 1.30 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.29 2001/12/30 21:32:03 steve
* Support elaborate_net for PEString objects.
*
+23 -2
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PExpr.h,v 1.59 2002/04/23 03:53:59 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PExpr.h,v 1.62 2002/08/12 01:34:58 steve Exp $"
#endif
# include <string>
@@ -270,6 +270,10 @@ class PEIdent : public PExpr {
Link::strength_t drive0,
Link::strength_t drive1) const;
private:
NetAssign_* elaborate_mem_lval_(Design*des, NetScope*scope,
NetMemory*mem) const;
};
class PENumber : public PExpr {
@@ -328,6 +332,7 @@ class PEString : public PExpr {
virtual NetEConst*elaborate_expr(Design*des, NetScope*,
bool sys_task_arg =false) const;
virtual NetEConst*elaborate_pexpr(Design*des, NetScope*sc) const;
verinum* PEString::eval_const(const Design*, const NetScope*) const;
virtual bool is_constant(Module*) const;
@@ -496,6 +501,22 @@ class PECallFunction : public PExpr {
/*
* $Log: PExpr.h,v $
* Revision 1.62 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.61 2002/06/04 05:38:43 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.60 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.59 2002/04/23 03:53:59 steve
* Add support for non-constant bit select.
*
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PFunction.cc,v 1.5 2001/07/25 03:10:48 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PFunction.cc,v 1.6 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -54,6 +54,9 @@ void PFunction::set_output(PWire*o)
/*
* $Log: PFunction.cc,v $
* Revision 1.6 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.5 2001/07/25 03:10:48 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PGate.cc,v 1.13 2001/11/22 06:20:59 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PGate.cc,v 1.14 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -192,6 +192,9 @@ const char* PGModule::get_type()
/*
* $Log: PGate.cc,v $
* Revision 1.14 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.13 2001/11/22 06:20:59 steve
* Use NetScope instead of string for scope path.
*
+14 -3
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PGate.h,v 1.22 2001/11/22 06:20:59 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PGate.h,v 1.24 2002/08/12 01:34:58 steve Exp $"
#endif
# include "svector.h"
@@ -79,7 +79,7 @@ class PGate : public LineInfo {
void strength0(strength_t);
void strength1(strength_t);
map<string,string> attributes;
map<string,PExpr*> attributes;
virtual void dump(ostream&out) const;
virtual void elaborate(Design*des, NetScope*scope) const;
@@ -222,6 +222,17 @@ class PGModule : public PGate {
/*
* $Log: PGate.h,v $
* Revision 1.24 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.23 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.22 2001/11/22 06:20:59 steve
* Use NetScope instead of string for scope path.
*
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PTask.cc,v 1.6 2001/07/25 03:10:48 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PTask.cc,v 1.7 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -48,6 +48,9 @@ void PTask::set_statement(Statement*s)
/*
* $Log: PTask.cc,v $
* Revision 1.7 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.6 2001/07/25 03:10:48 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
+5 -2
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PTask.h,v 1.11 2001/11/22 06:20:59 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PTask.h,v 1.12 2002/08/12 01:34:58 steve Exp $"
#endif
# include "LineInfo.h"
@@ -98,6 +98,9 @@ class PFunction : public LineInfo {
/*
* $Log: PTask.h,v $
* Revision 1.12 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.11 2001/11/22 06:20:59 steve
* Use NetScope instead of string for scope path.
*
+16 -3
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PUdp.h,v 1.5 2001/04/22 23:09:45 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PUdp.h,v 1.7 2002/08/12 01:34:58 steve Exp $"
#endif
# include <map>
@@ -27,6 +27,8 @@
# include <string>
# include "verinum.h"
class PExpr;
svector<string>::svector<string>(unsigned size)
: nitems_(size), items_(new string[size])
{
@@ -68,7 +70,7 @@ class PUdp {
verinum::V initial;
map<string,string> attributes;
map<string,PExpr*> attributes;
void dump(ostream&out) const;
@@ -82,6 +84,17 @@ class PUdp {
/*
* $Log: PUdp.h,v $
* Revision 1.7 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.6 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.5 2001/04/22 23:09:45 steve
* More UDP consolidation from Stephan Boettcher.
*
+31 -5
View File
@@ -16,23 +16,34 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PWire.cc,v 1.8 2002/01/26 05:28:28 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PWire.cc,v 1.10 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
# include "PWire.h"
# include <assert.h>
PWire::PWire(const hname_t&n, NetNet::Type t, NetNet::PortType pt)
: hname_(n), type_(t), port_type_(pt), signed_(false), lidx_(0), ridx_(0)
: hname_(n), type_(t), port_type_(pt), signed_(false), isint_(false),
lidx_(0), ridx_(0)
{
if (t == NetNet::INTEGER) {
type_ = NetNet::REG;
signed_ = true;
isint_ = true;
}
}
PWire::PWire(char*n, NetNet::Type t, NetNet::PortType pt)
: hname_(n), type_(t), port_type_(pt), signed_(false), lidx_(0), ridx_(0)
: hname_(n), type_(t), port_type_(pt), signed_(false), isint_(false),
lidx_(0), ridx_(0)
{
if (t == NetNet::INTEGER) {
type_ = NetNet::REG;
signed_ = true;
isint_ = true;
}
}
NetNet::Type PWire::get_wire_type() const
@@ -57,6 +68,10 @@ bool PWire::set_wire_type(NetNet::Type t)
if (t == NetNet::REG) { type_ = t; return true; }
return false;
case NetNet::REG:
if (t == NetNet::INTEGER) {
isint_ = true;
return true;
}
if (t == NetNet::REG) return true;
return false;
default:
@@ -103,6 +118,11 @@ bool PWire::get_signed() const
return signed_;
}
bool PWire::get_isint() const
{
return isint_;
}
void PWire::set_range(PExpr*m, PExpr*l)
{
msb_ = svector<PExpr*>(msb_,m);
@@ -120,6 +140,12 @@ void PWire::set_memory_idx(PExpr*ldx, PExpr*rdx)
/*
* $Log: PWire.cc,v $
* Revision 1.10 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.9 2002/06/21 04:59:35 steve
* Carry integerness throughout the compilation.
*
* Revision 1.8 2002/01/26 05:28:28 steve
* Detect scalar/vector declarion mismatch.
*
+19 -3
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: PWire.h,v 1.11 2001/12/03 04:47:14 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: PWire.h,v 1.14 2002/08/12 01:34:58 steve Exp $"
#endif
# include "netlist.h"
@@ -64,12 +64,13 @@ class PWire : public LineInfo {
void set_signed(bool flag);
bool get_signed() const;
bool get_isint() const;
void set_range(PExpr*msb, PExpr*lsb);
void set_memory_idx(PExpr*ldx, PExpr*rdx);
map<string,string> attributes;
map<string,PExpr*> attributes;
// Write myself to the specified stream.
void dump(ostream&out) const;
@@ -81,6 +82,7 @@ class PWire : public LineInfo {
NetNet::Type type_;
NetNet::PortType port_type_;
bool signed_;
bool isint_; // original type of integer
// These members hold expressions for the bit width of the
// wire. If they do not exist, the wire is 1 bit wide.
@@ -99,6 +101,20 @@ class PWire : public LineInfo {
/*
* $Log: PWire.h,v $
* Revision 1.14 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.13 2002/06/21 04:59:35 steve
* Carry integerness throughout the compilation.
*
* Revision 1.12 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.11 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
+119 -126
View File
@@ -12,11 +12,10 @@ home page at <http://www.icarus.com/eda/verilog>.
Icarus Verilog is not aimed at being a simulator in the traditional
sense, but a compiler that generates code employed by back-end
tools. These back-end tools currently include a simulator written in
C++ called VVM, another faster simulator called VVP, an XNF (Xilinx
Netlist Format) generator and an EDIF fpga netlist generator. In the
future, backends are expected for EDIF/LPM, structural Verilog, VHDL,
etc.
tools. These back-end tools currently include a simulator engine
called VVP, an XNF (Xilinx Netlist Format) generator and an EDIF fpga
netlist generator. In the future, backends are expected for EDIF/LPM,
structural Verilog, VHDL, etc.
For instructions on how to run Icarus Verilog,
see the ``iverilog'' man page.
@@ -40,7 +39,7 @@ on a UNIX-like system:
- GNU Make
The Makefiles use some GNU extensions, so a basic POSIX
make will not work. Linux systems typically come with a
satisfactory make. BSD based systems (i.e. NetBSD, FreeBSD)
satisfactory make. BSD based systems (i.e., NetBSD, FreeBSD)
typically have GNU make as the gmake program.
- ISO C++ Compiler
@@ -153,10 +152,10 @@ The elaborate() function performs the elaboration.
One can see a human readable version of the final, elaborated and
optimized netlist by using the ``-N <path>'' flag to the compiler. If
elaboration succeeds, the final netlist (i.e. after optimizations but
elaboration succeeds, the final netlist (i.e., after optimizations but
before code generation) will be dumped into the file named <path>.
Elaboration is actually performed it two steps: scopes and parameters
Elaboration is actually performed in two steps: scopes and parameters
first, followed by the structural and behavioral elaboration.
3.3.1 Scope Elaboration
@@ -185,19 +184,19 @@ simply passing through the pform.
This is actually a collection of processing steps that perform
optimizations that do not depend on the target technology. Examples of
some useful transformations would be,
some useful transformations are
- eliminate null effect circuitry,
- eliminate null effect circuitry
- combinational reduction
- constant propagation
The actual functions performed are specified on the ivl command line by
the -F flags (See below).
the -F flags (see below).
3.5 Code Generation
This step takes the design netlist and uses it to drive the code
generator. (See target.h.) This may require transforming the
generator (see target.h). This may require transforming the
design to suit the technology.
The emit() method of the Design class performs this step. It runs
@@ -209,6 +208,9 @@ command line.
3.6 ATTRIBUTES
NOTE: The $attribute syntax will soon be deprecated in favor of the
Verilog-2001 attribute syntax, which is cleaner and standardized.
The parser accepts, as an extension to Verilog, the $attribute module
item. The syntax of the $attribute item is:
@@ -237,6 +239,11 @@ between processing steps. Processing steps that are aware of others
may place attributes on netlist objects to communicate information to
later steps.
Icarus Verilog also accepts the Verilog 2001 syntax for
attributes. They have the same general meaning as with the $attribute
syntax, but they are attached to objects by position instead of by
name. Also, the key is a Verilog identifier instead of a string.
4.0 Running iverilog
The preferred way to invoke the compiler is with the iverilog(1)
@@ -244,102 +251,8 @@ command. This program invokes the preprocessor (ivlpp) and the
compiler (ivl) with the proper command line options to get the job
done in a friendly way. See the iverilog(1) man page for usage details.
4.1 Running IVL Directly (not recommended)
NOTE: The preferred method of running Icarus Verilog is the
iverilog command described above. The instructions below may
change at any time without notice.
The ivl command is the compiler driver, that invokes the parser,
optimization functions and the code generator, but not the preprocessor.
Usage: ivl <options>... file
ivl -h
ivl -V
-F <name>
Use this flag to request an optimization function be applied
to the netlist before it is sent to the target output
stage. Any number of -F options may be given, to specify a
variety of processing steps. The steps will be applied in
order, with the output of one uses as the input to the next.
The function is specified by name. Use the "ivl -h" command to
get a list of configured function names.
-h
Print usage information, and exit.
-m <module>
Cause a named VPI module to be included in the module
list. This parameter appends the named module to the end of
the VPI_MODULE_LIST. This is an ordered list of modules to be
loaded into the simulation at runtime.
This list can also be set with -fVPI_MODULE_LIST=<list> which
sets the list completely. Then, -m after this will append
module names to the list specified. The default list
includes "system".
-N <file>
Dump the elaborated netlist to the named file. The netlist is
the folly elaborated netlist, after all the function modules
are applied and right before the output generator is
called. This is an aid for debugging the compiler, and the
output generator in particular.
-o <file>
Normally, the generated result is sent to standard
output. Use the -o flag to specify an output file for the
generated result.
-P <file>
Write the PForm of the parsed input to the specified file.
The pform is the compiler's understanding of the input after
parsing and before elaboration. This is an aid for debugging
the compiler.
-p <assign>
Use this flag to set a parameter value. The format of the
assignment is <key>=<value> where key is any string up to the
first '=', and <value> is the rest of the option. If the '='
is omitted, then the key is assigned the empty string.
The useful keys are defined by the functions and the target in
use. These assignments are specifically useful for passing
target specific information to the target back-end, or
options/parameters to optimization functions, if any are defined.
-s <module>
Normally, ivl will locate all the modules that are defined but
never instantiated, and use these as the design roots for
elaboration. This flag allows the choice of root module(s) to
be manually overridden. It can be used more than once on the
command line if multiple root modules are needed.
-T [min|typ|max]
Normally, ivl will select typ values from min:type:max
expressions and print a warning. This flag tells the compiler
exactly which value to choose, and suppresses the warning.
-t <name>
Select the output format for the compiled result. Use the
"ivl -h" command to get a list of configured targets.
-v Print progress indications, and (if supported by the system)
executions times in ivl precessing steps.
-V
Print version and copyright information for ivl, and exit.
-y <dir>
Add the specified directory to the library search path. If
missing modules are discovered during elaboration, ivl will
attempt to locate an implementation by searching the library
directories for a Verilog source file with the same name as
the module.
4.2 EXAMPLES
4.1 EXAMPLES
Example: Compiling "hello.vl"
@@ -356,7 +269,7 @@ endmodule
--------------------------------------------------------------
Insure that "iverilog" is on your search path, and the vpi library
Ensure that "iverilog" is on your search path, and the vpi library
is available.
To compile the program:
@@ -383,14 +296,6 @@ Verilog web page for the current state of support for Verilog, and in
particular, browse the bug report database for reported unsupported
constructs.
- block disable not supported, i.e.:
begin : foo
[...]
disable foo; // sorry
[...]
end
- real data types not supported. This includes real and
realtime. However, floating point constants in delay expressions
are supported so that `timescale works properly.
@@ -402,8 +307,94 @@ constructs.
- trireg is not supported. tri0 and tri1 are supported.
- force to nets are not supported. Force to variables, and
assign/deassign, are supported.
- tran primitives, i.e. tran, tranif1, tranif0, rtran, rtranif1
and rtranif0 are not supported.
- Module instance arrays are not supported, although gate instance
arrays do work.
- Net delays, of the form "wire #N foo;" do not work. Delays in
every other context do work properly, including the V2001 form
"wire #5 foo = bar;"
- Event controls inside non-blocking assignments are not supported.
i.e.: a <= @(posedge clk) b;
- Lists of named events of the form @(event_1 or event_2) are not
supported. Named events are otherwise supported, and lists of
other kinds of events are also supported.
- Macro arguments are not supported. `define macros are supported,
but they cannot take arguments.
5.1 Nonstandard Constructs or Behaviors
Icarus Verilog includes some features that are not part of the
IEEE1364 standard, but have well defined meaning, and also sometimes
gives nonstandard (but extended) meanings to some features of the
language that are defined.
$sizeof(<expr>)
$bits(<expr>)
The $bits system function returns the size in bits of the
expression that is its argument. The result of this
function is undefined if the argument doesn't have a
self-determined size.
The $sizeof function is deprecated in favor of $bits, which is
the same thing, but included in the SystemVerilog definition.
Builtin system functions
Certain of the system functions have well defined meanings, so
can theoretically be evaluated at compile time, instead of
using runtime VPI code. Doing so means that VPI cannot
override the definitions of functions handled in this
manner. On the other hand, this makes them synthesizeable, and
also allows for more aggressive constant propagation. The
functions handled in this manner are:
$bits
$signed
$sizeof
$unsigned
Implementations of these system functions in VPI modules will
be ignored.
Preprocessing Library Modules
Icarus Verilog does preprocess modules that are loaded from
libraries via the -y mechanism. However, the only macros
defined during compilation of that file are those that it
defines itself (or includes) or that are defined on the
command line or command file.
Specifically, macros defined in the non-library source files
are not remembered when the library module is loaded. This is
intentional. If it were otherwise, then compilation results
might vary depending on the order that libraries are loaded,
and that is too unpredictable.
It is said that some commercial compilers do allow macro
definitions to span library modules. That's just plain weird.
Width in %t Time Formats
Standard Verilog does not allow width fields in the %t formats
of display strings. For example, this is illegal:
$display("Time is %0t", %time);
Standard Verilog instead relies on the $timeformat to
completely specify the format.
Icarus Verilog allows the programmer to specify the field
with. The "%t" format in Icarus Verilog works exactly as it
does in standard Verilog. However, if the programmer chooses
to specify a minimum width (i.e., "%5t"), then for that display
Icarus Verilog will override the $timeformat minimum width and
use the explicit minimum width.
6.0 CREDITS
@@ -420,11 +411,13 @@ Verilog guidance, and especially testing from many people, including
Guy Hutchison <[email protected]>
Ales Hvezda <[email protected]>
Venkat Iyer <[email protected]>
Yasuhisa Kato <ykato@mac.com>
Yasuhisa Kato <kato@y.email.ne.jp>
James Lee <[email protected]>
Peter Monta <[email protected]>
Daniel H. Nelsen <[email protected]>
Stefan Petersen <[email protected]>
Michael Ruff <[email protected]>
Mike Runyan <[email protected]>
Jason Schonberg <[email protected]>
Stuart Sutherland <[email protected]>
Stephen Tell <[email protected]>
@@ -455,7 +448,7 @@ removed from the list) send e-mail to me.
Hamish Moffatt <[email protected]>
Macintosh -- MacO/S
Yasuhisa Kato <ykato@mac.com>
Yasuhisa Kato <kato@y.email.ne.jp>
Mac O/S X
Timothy J. Wood <[email protected]>
@@ -478,10 +471,10 @@ just the systems where precompiled binaries are publicly available.
6.2 TEST SUITE MANAGER
Steve Wilson <stevew@home.com> or <[email protected]> has taken on
the large task of managing the test suite. He has maintained the
regression test scripts, the driver list, received submissions from
myself and others, and has written a great many tests on his own. Any
compiler writer, for any language, will tell you that the test suite
is at least as important as the compiler code itself.
Steve Wilson <stevew@ka6s.com> has taken on the large task of managing
the test suite. He has maintained the regression test scripts, the
driver list, received submissions from myself and others, and has
written a great many tests on his own. Any compiler writer, for any
language, will tell you that the test suite is at least as important
as the compiler code itself.
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Statement.cc,v 1.27 2002/04/21 22:31:02 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: Statement.cc,v 1.28 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -295,6 +295,9 @@ PWhile::~PWhile()
/*
* $Log: Statement.cc,v $
* Revision 1.28 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.27 2002/04/21 22:31:02 steve
* Redo handling of assignment internal delays.
* Leave it possible for them to be calculated
+19 -4
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: Statement.h,v 1.33 2002/04/21 22:31:02 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: Statement.h,v 1.36 2002/08/12 01:34:58 steve Exp $"
#endif
# include <string>
@@ -56,6 +56,8 @@ class PProcess : public LineInfo {
Type type() const { return type_; }
Statement*statement() { return statement_; }
map<string,PExpr*> attributes;
virtual void dump(ostream&out, unsigned ind) const;
private:
@@ -117,8 +119,6 @@ class PAssign : public PAssign_ {
virtual NetProc* elaborate(Design*des, NetScope*scope) const;
private:
NetProc*assign_to_memory_(class NetMemory*, PExpr*,
Design*des, NetScope*scope) const;
};
class PAssignNB : public PAssign_ {
@@ -453,6 +453,21 @@ class PWhile : public Statement {
/*
* $Log: Statement.h,v $
* Revision 1.36 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.35 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.34 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.33 2002/04/21 22:31:02 steve
* Redo handling of assignment internal delays.
* Leave it possible for them to be calculated
+77
View File
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
* ---
* You should also have recieved a copy of the Picture Elements
* Binary Software License offer along with the source. This offer
* allows you to obtain the right to redistribute the software in
* binary (compiled) form. If you have not received it, contact
* Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704.
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: StringHeap.cc,v 1.2 2002/08/12 01:34:58 steve Exp $"
#endif
# include "StringHeap.h"
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
# include <stdlib.h>
# include <string.h>
# include <assert.h>
StringHeap::StringHeap()
{
cell_base_ = 0;
cell_ptr_ = HEAPCELL;
}
StringHeap::~StringHeap()
{
// This is a planned memory leak. The string heap is indended
// to hold permanently-allocated strings.
}
const char* StringHeap::add(const char*text)
{
unsigned len = strlen(text);
assert((len+1) <= HEAPCELL);
unsigned rem = HEAPCELL - cell_ptr_;
if (rem < (len+1)) {
cell_base_ = (char*)malloc(HEAPCELL);
cell_ptr_ = 0;
}
char*res = cell_base_ + cell_ptr_;
memcpy(res, text, len);
cell_ptr_ += len;
cell_base_[cell_ptr_++] = 0;
return res;
}
/*
* $Log: StringHeap.cc,v $
* Revision 1.2 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/08/04 19:13:16 steve
* dll uses StringHeap for named items.
*
*/
+53
View File
@@ -0,0 +1,53 @@
#ifndef __StringHeap_H
#define __StringHeap_H
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: StringHeap.h,v 1.2 2002/08/12 01:34:58 steve Exp $"
#endif
class StringHeap {
public:
StringHeap();
~StringHeap();
const char*add(const char*);
private:
enum { HEAPCELL = 0x10000 };
char*cell_base_;
unsigned cell_ptr_;
private: // not implemented
StringHeap(const StringHeap&);
StringHeap& operator= (const StringHeap&);
};
/*
* $Log: StringHeap.h,v $
* Revision 1.2 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/08/04 19:13:16 steve
* dll uses StringHeap for named items.
*
*/
#endif
+159
View File
@@ -0,0 +1,159 @@
#ifndef __acc_user_H
#define __acc_user_H
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: acc_user.h,v 1.6 2002/08/12 01:34:58 steve Exp $"
#endif
/*
* This header file contains the definitions and declarations needed
* by an Icarus Verilog user using acc_ routines.
*
* NOTE: Icarus Verilog does not support acc_ routines. This is just a
* stub. The functions that are implemented here are actually
* implemented using VPI routines.
*/
#ifdef __cplusplus
# define EXTERN_C_START extern "C" {
# define EXTERN_C_END }
#else
# define EXTERN_C_START
# define EXTERN_C_END
# define bool int
#endif
EXTERN_C_START
/*
* This is a declaration of the "handle" type that is compatible with
* the vpiHandle from vpi_user.h.
*/
typedef struct __vpiHandle *handle;
/* OBJECT TYPES */
#define accScope 21
#define accScalar 300
#define accVector 302
/* type VALUES FOR t_setval_delay STRUCTURE */
#define accNoDelay 0
#define accInertialDelay 1
#define accTransportDelay 2
#define accPureTransportDelay 3
#define accForceFlag 4
#define accReleaseFlag 5
/* type VALUES FOR t_setval_value STRUCTURE */
#define accBinStrVal 1
#define accOctStrVal 2
#define accDecStrVal 3
#define accHexStrVal 4
#define accScalarVal 5
#define accIntVal 6
#define accRealVal 7
#define accStringVal 8
#define accVectorVal 9
/* type VALUES FOR t_acc_time STRUCTURE */
#define accTime 1
#define accSimTime 2
#define accRealTime 3
typedef struct t_acc_time {
int type;
int low, high;
double real;
} s_acc_time, *p_acc_time;
typedef struct t_setval_delay {
s_acc_time time;
int model;
} s_setval_delay, *p_setval_delay;
typedef struct t_acc_vecval {
int aval;
int bval;
} s_acc_vecval, *p_acc_vecval;
typedef struct t_setval_value {
int format;
union {
char*str;
int scalar;
int integer;
double real;
p_acc_vecval vector;
} value;
} s_setval_value, *p_setval_value, s_acc_value, *p_acc_value;
extern int acc_error_flag;
extern int acc_initialize(void);
extern void acc_close(void);
extern int acc_fetch_argc(void);
extern char**acc_fetch_argv(void);
extern char* acc_fetch_fullname(handle obj);
extern int acc_fetch_tfarg_int(int n);
extern char* acc_fetch_tfarg_str(int n);
extern handle acc_handle_tfarg(int n);
extern handle acc_next_topmod(handle prev_topmod);
extern int acc_object_of_type(handle object, int type);
extern char*acc_product_version(void);
extern int acc_set_value(handle obj, p_setval_value value,
p_setval_delay delay);
extern char* acc_version(void);
EXTERN_C_END
/*
* $Log: acc_user.h,v $
* Revision 1.6 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.5 2002/06/11 15:19:12 steve
* Add acc_fetch_argc/argv/version (mruff)
*
* Revision 1.4 2002/06/07 02:58:58 steve
* Add a bunch of acc/tf functions. (mruff)
*
* Revision 1.3 2002/06/02 19:03:29 steve
* Add acc_handle_tfarg and acc_next_topmode
*
* Revision 1.2 2002/05/30 02:06:05 steve
* Implement acc_product_version.
*
* Revision 1.1 2002/05/23 03:46:42 steve
* Add the acc_user.h header file.
*
*/
#endif
+97
View File
@@ -0,0 +1,97 @@
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: async.cc,v 1.4 2002/08/18 22:07:16 steve Exp $"
#endif
# include "config.h"
# include "functor.h"
# include "netlist.h"
# include <assert.h>
bool NetAssign::is_asynchronous()
{
return true;
}
bool NetCondit::is_asynchronous()
{
return false;
}
bool NetEvWait::is_asynchronous()
{
/* The "sense" set contains the set of Nexa that are in the
sensitivity list. We also presume here that the list is
only LEVEL sensitive. */
NexusSet*sense = new NexusSet;
for (unsigned idx = 0 ; idx < nevents_ ; idx += 1) {
NexusSet*tmp = event(idx)->nex_async_();
if (tmp == 0) {
delete sense;
return false;
}
sense->add(*tmp);
delete tmp;
}
NexusSet*inputs = statement_->nex_input();
if (! sense->contains(*inputs)) {
delete sense;
delete inputs;
return false;
}
delete sense;
delete inputs;
return true;
}
bool NetProc::is_asynchronous()
{
return false;
}
bool NetProcTop::is_asynchronous()
{
if (type_ == NetProcTop::KINITIAL)
return false;
return statement_->is_asynchronous();
}
/*
* $Log: async.cc,v $
* Revision 1.4 2002/08/18 22:07:16 steve
* Detect temporaries in sequential block synthesis.
*
* Revision 1.3 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2002/07/04 00:24:16 steve
* initial statements are not asynchronous.
*
* Revision 1.1 2002/06/30 02:21:31 steve
* Add structure for asynchronous logic synthesis.
*
*/
+49
View File
@@ -0,0 +1,49 @@
ATTRIBUTES TO CONTROL SYNTHESIS
The following is a summary of Verilog attributes that Icarus Verilog
understands within Verilog source files to control synthesis
behavior. This section documents generic synthesis attributes. For
target specific attributes, see target specific documentation.
These attributes only effect the behavior of the synthesizer. For
example, the ivl_combinational will not generate an error message
if the Verilog is being compiled for simulation. (It may generate a
warning.)
* Attributes for "always" and "initial" statements
(* ivl_combinational *)
This attribute tells the compiler that the statement models
combinational logic. If the compiler finds that it cannot make
combinational logic out of a marked always statement, it will
report an error.
This attribute can be used to prevent accidentally inferring
latches or flip-flops where the user intended combinational
logic.
(* ivl_synthesis_on *)
This attribute tells the compiler that the marked always statement
is synthesizeable. The compiler will attempt to synthesize the
code in the marked "always" statement. If it cannot in any way
synthesize it, then it will report an error.
(* ivl_synthesis_off *)
If this value is attached to an "always" statement, then the
compiler will *not* synthesize the "always" statment. This can be
used, for example, to mark embedded test bench code.
* Attributes for signals (wire/reg/integer/tri/etc.)
[ none defined yet ]
* Other Attributes
[ none defined yet ]
+2 -2
View File
@@ -9,10 +9,10 @@
echo "Autoconf in root..."
autoconf
for dir in vpip vvp tgt-vvp tgt-fpga
for dir in vpip vvp tgt-vvp tgt-fpga libveriuser
do
echo "Autoconf in $dir..."
( cd $dir ; autoconf )
( cd ./$dir ; autoconf )
done
echo "Precompiling lexor_keyword.gperf"
+33 -24
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: compiler.h,v 1.9 2002/04/22 00:53:39 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: compiler.h,v 1.13 2002/08/12 01:34:58 steve Exp $"
#endif
# include <list>
@@ -75,12 +75,41 @@ extern bool warn_timescale;
/* This is true if verbose output is requested. */
extern bool verbose_flag;
/* This is an ordered list of libraries to search. */
extern list<const char*>library_dirs;
/* This is an ordered list of library suffixxes to search. */
extern list<const char*>library_suff;
extern int build_library_index(const char*path, bool key_case_sensitive);
/* This is the generation of Verilog that the compiler is asked to
support. */
enum generation_t {
GN_VER1995 = 1,
GN_VER2001 = 2,
GN_SYSVER30 = 3,
GN_DEFAULT = 3
};
extern generation_t generation_flag;
/* This is the string to use to invoke the preprocessor. */
extern char*ivlpp_string;
/*
* $Log: compiler.h,v $
* Revision 1.13 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.12 2002/05/28 20:40:37 steve
* ivl indexes the search path for libraries, and
* supports case insensitive module-to-file lookup.
*
* Revision 1.11 2002/05/28 00:50:39 steve
* Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library
* modules through the preprocessor.
*
* Revision 1.10 2002/05/24 01:13:00 steve
* Support language generation flag -g.
*
* Revision 1.9 2002/04/22 00:53:39 steve
* Do not allow implicit wires in sensitivity lists.
*
@@ -89,25 +118,5 @@ extern list<const char*>library_suff;
*
* Revision 1.7 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.6 2001/10/20 23:02:40 steve
* Add automatic module libraries.
*
* Revision 1.5 2000/10/31 17:49:02 steve
* Support time variables.
*
* Revision 1.4 2000/08/20 04:13:56 steve
* Add ivl_target support for logic gates, and
* make the interface more accessible.
*
* Revision 1.3 2000/03/17 21:50:25 steve
* Switch to control warnings.
*
* Revision 1.2 2000/02/23 02:56:54 steve
* Macintosh compilers do not support ident.
*
* Revision 1.1 1999/06/06 20:42:48 steve
* Make compiler width a compile time constant.
*
*/
#endif
+4 -3
View File
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: config.h.in,v 1.4 2002/02/16 03:18:53 steve Exp $"
#ident "$Id: config.h.in,v 1.5 2002/08/11 23:39:33 steve Exp $"
#endif
#if defined(__cplusplus)
@@ -44,10 +44,11 @@
# undef HAVE_LIBREADLINE
# undef HAVE_SYS_WAIT_H
# undef ENABLE_VVM
/*
* $Log: config.h.in,v $
* Revision 1.5 2002/08/11 23:39:33 steve
* Remove VVM option.
*
* Revision 1.4 2002/02/16 03:18:53 steve
* Make vvm optional, normally off.
*
+82 -74
View File
@@ -2,16 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(netlist.h)
AC_CONFIG_HEADER(config.h)
AC_ARG_ENABLE(vvm, vvm target -- the obsolete vvm code generator,
AC_DEFINE(ENABLE_VVM))
if test "${enable_vvm+set}" = set
then
ENABLE_VVM=yes
else
ENABLE_VVM=no
fi
AC_SUBST(ENABLE_VVM)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
@@ -56,7 +46,8 @@ do_times=no
AC_MSG_RESULT($do_times)
AC_CHECK_HEADER(ipal.h, HAVE_IPAL=yes, HAVE_IPAL=)
AC_ARG_WITH(ipal,enable PAL target,
AC_ARG_WITH(ipal,
[ --with-ipal enable PAL target],
if test "$with_ipal" = no; then
echo Disabling ipal support
HAVE_IPAL=
@@ -84,66 +75,6 @@ AC_LANG_C
AC_CANONICAL_HOST
# $host
#######################
## test for underscores. The vpi module loader in vvm needs to know this
## in order to know the name of the start symbol for the .vpi module.
#######################
AC_CYGWIN
AC_EXEEXT
AC_MINGW32
WIN32=no
AC_MSG_CHECKING("Checking for windows")
if test "$CYGWIN" = "yes" -o "$MINGW32" = "yes"
then
WIN32=yes
fi
AC_SUBST(WIN32)
AC_MSG_RESULT($WIN32)
AC_SUBST(EXEEXT)
AC_MSG_CHECKING("for leading and/or trailing underscores")
cat << EOF > underscore.c
void underscore(void){}
EOF
$CC -shared -c underscore.c > /dev/null 2>&1
CC_LEADING_UNDERSCORE=no
CC_TRAILING_UNDERSCORE=no
output=`nm underscore.o|grep _underscore 2>&1`
if test ! -z "$output" -a -z "$CYGWIN" -a -z "$MINGW32"; then
CC_LEADING_UNDERSCORE=yes
AC_DEFINE(NEED_LU)
fi
output=`nm underscore.o|grep underscore_ 2>&1`
if test ! -z "$output"; then
CC_TRAILING_UNDERSCORE=yes
AC_DEFINE(NEED_TU)
fi
if test "$CC_LEADING_UNDERSCORE" = yes; then
AC_DEFINE(WLU)
fi
if test "$CC_TRAILING_UNDERSCORE" = yes; then
AC_DEFINE(WTU)
fi
rm underscore.c underscore.o
AC_MSG_RESULT("$CC_LEADING_UNDERSCORE $CC_TRAILING_UNDERSCORE")
#######################
## end of test for underscores
#######################
# The -fPIC flag is used to tell the compiler to make position
# independent code. It is needed when making shared objects.
@@ -241,10 +172,87 @@ case "${host}" in
esac
AC_SUBST(shared)
AC_MSG_RESULT($shared)
#######################
## test for underscores. The vpi module loader needs to know this
## in order to know the name of the start symbol for the .vpi module.
#######################
AC_CONFIG_SUBDIRS(vpip vvp tgt-vvp tgt-fpga)
AC_CYGWIN
AC_EXEEXT
AC_MINGW32
AC_OUTPUT(Makefile vpi/Makefile ivlpp/Makefile vvm/Makefile driver/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-verilog/Makefile tgt-pal/Makefile)
WIN32=no
AC_MSG_CHECKING("Checking for windows")
if test "$CYGWIN" = "yes" -o "$MINGW32" = "yes"
then
WIN32=yes
fi
AC_SUBST(WIN32)
AC_MSG_RESULT($WIN32)
AC_SUBST(EXEEXT)
AC_MSG_CHECKING("for leading and/or trailing underscores")
cat << EOF > underscore.c
void underscore(void){}
EOF
$CC $shared -c underscore.c > /dev/null 2>&1
CC_LEADING_UNDERSCORE=no
CC_TRAILING_UNDERSCORE=no
output=`nm underscore.o|grep _underscore 2>&1`
if test ! -z "$output" -o $WIN32 = "yes"; then
CC_LEADING_UNDERSCORE=yes
AC_DEFINE(NEED_LU)
fi
output=`nm underscore.o|grep underscore_ 2>&1`
if test ! -z "$output"; then
CC_TRAILING_UNDERSCORE=yes
AC_DEFINE(NEED_TU)
fi
if test "$CC_LEADING_UNDERSCORE" = yes; then
AC_DEFINE(WLU)
fi
if test "$CC_TRAILING_UNDERSCORE" = yes; then
AC_DEFINE(WTU)
fi
rm underscore.c underscore.o
AC_MSG_RESULT("$CC_LEADING_UNDERSCORE $CC_TRAILING_UNDERSCORE")
#######################
## end of test for underscores
#######################
AC_MSG_CHECKING("for ident support in C compiler")
ident_support='-DHAVE_CVS_IDENT=1'
case "${host}" in
*-*-cygwin*)
ident_support=
;;
*-*-darwin*)
ident_support=
;;
*-*-machten*)
ident_support=
;;
esac
AC_SUBST(ident_support)
AC_MSG_RESULT($ident_support)
AC_CONFIG_SUBDIRS(vvp tgt-vvp tgt-fpga libveriuser)
AC_OUTPUT(Makefile vpi/Makefile ivlpp/Makefile driver/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-verilog/Makefile tgt-pal/Makefile)
+104 -31
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: cprop.cc,v 1.33 2002/04/14 02:51:37 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: cprop.cc,v 1.39 2002/08/20 04:12:22 steve Exp $"
#endif
# include "config.h"
@@ -56,7 +56,7 @@ void cprop_functor::signal(Design*des, NetNet*obj)
void cprop_functor::lpm_add_sub(Design*des, NetAddSub*obj)
{
// For now, only additions are handled.
if (obj->attribute("LPM_Direction") != "ADD")
if (obj->attribute("LPM_Direction") != verinum("ADD"))
return;
// If the low bit on the A side is 0, then eliminate it from
@@ -64,8 +64,8 @@ void cprop_functor::lpm_add_sub(Design*des, NetAddSub*obj)
// result. Don't reduce the adder smaller then a 1-bit
// adder. These will be eliminated later.
while ((obj->width() > 1)
&& link_drivers_constant(obj->pin_DataA(0))
&& (driven_value(obj->pin_DataA(0)) == verinum::V0)) {
&& obj->pin_DataA(0).nexus()->drivers_constant()
&& (obj->pin_DataA(0).nexus()->driven_value() == verinum::V0)) {
NetAddSub*tmp = 0;
tmp = new NetAddSub(obj->scope(), obj->name(), obj->width()-1);
@@ -89,8 +89,8 @@ void cprop_functor::lpm_add_sub(Design*des, NetAddSub*obj)
// Now do the same thing on the B side.
while ((obj->width() > 1)
&& link_drivers_constant(obj->pin_DataB(0))
&& (driven_value(obj->pin_DataB(0)) == verinum::V0)) {
&& obj->pin_DataB(0).nexus()->drivers_constant()
&& (obj->pin_DataB(0).nexus()->driven_value() == verinum::V0)) {
NetAddSub*tmp = 0;
tmp = new NetAddSub(obj->scope(), obj->name(), obj->width()-1);
@@ -160,12 +160,12 @@ void cprop_functor::lpm_compare_eq_(Design*des, NetCompare*obj)
be completely eliminated and replaced with a constant 0. */
for (unsigned idx = 0 ; idx < obj->width() ; idx += 1) {
if (! link_drivers_constant(obj->pin_DataA(idx)))
if (! obj->pin_DataA(idx).nexus()->drivers_constant())
continue;
if (! link_drivers_constant(obj->pin_DataB(idx)))
if (! obj->pin_DataB(idx).nexus()->drivers_constant())
continue;
if (driven_value(obj->pin_DataA(idx)) ==
driven_value(obj->pin_DataB(idx)))
if (obj->pin_DataA(idx).nexus()->driven_value() ==
obj->pin_DataB(idx).nexus()->driven_value())
continue;
NetConst*zero = new NetConst(scope, obj->name(), verinum::V0);
@@ -181,11 +181,11 @@ void cprop_functor::lpm_compare_eq_(Design*des, NetCompare*obj)
unsigned top = obj->width();
for (unsigned idx = 0 ; idx < top ; ) {
if (! link_drivers_constant(obj->pin_DataA(idx))) {
if (! obj->pin_DataA(idx).nexus()->drivers_constant()) {
idx += 1;
continue;
}
if (! link_drivers_constant(obj->pin_DataB(idx))) {
if (! obj->pin_DataB(idx).nexus()->drivers_constant()) {
idx += 1;
continue;
}
@@ -310,12 +310,12 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
on the output of an AND gate. */
while (idx < top) {
if (! link_drivers_constant(obj->pin(idx))) {
if (! obj->pin(idx).nexus()->drivers_constant()) {
idx += 1;
continue;
}
if (driven_value(obj->pin(idx)) == verinum::V1) {
if (obj->pin(idx).nexus()->driven_value()==verinum::V1) {
obj->pin(idx).unlink();
top -= 1;
if (idx < top) {
@@ -326,7 +326,7 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
continue;
}
if (driven_value(obj->pin(idx)) != verinum::V0) {
if (obj->pin(idx).nexus()->driven_value() != verinum::V0) {
idx += 1;
xs += 1;
continue;
@@ -348,6 +348,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
assert(0);
}
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -373,6 +377,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
assert(0);
}
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -416,6 +424,11 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
default:
assert(0);
}
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -427,12 +440,16 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
}
/* Finally, this cleans up the gate by creating a
new [N]OR gate that has the right number of
new [N]AND gate that has the right number of
inputs, connected in the right place. */
if (top < obj->pin_count()) {
NetLogic*tmp = new NetLogic(scope,
obj->name(), top,
obj->type());
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -457,12 +474,12 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
on the output of an OR gate. */
while (idx < top) {
if (! link_drivers_constant(obj->pin(idx))) {
if (! obj->pin(idx).nexus()->drivers_constant()) {
idx += 1;
continue;
}
if (driven_value(obj->pin(idx)) == verinum::V0) {
if (obj->pin(idx).nexus()->driven_value() == verinum::V0) {
obj->pin(idx).unlink();
top -= 1;
if (idx < top) {
@@ -473,7 +490,7 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
continue;
}
if (driven_value(obj->pin(idx)) != verinum::V1) {
if (obj->pin(idx).nexus()->driven_value() != verinum::V1) {
idx += 1;
continue;
}
@@ -494,6 +511,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
assert(0);
}
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -519,6 +540,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
assert(0);
}
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -547,6 +572,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
default:
assert(0);
}
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -564,6 +593,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
NetLogic*tmp = new NetLogic(scope,
obj->name(), top,
obj->type());
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -588,12 +621,12 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
last input to this position. It's like bubbling
all the 0 inputs to the end. */
while (idx < top) {
if (! link_drivers_constant(obj->pin(idx))) {
if (! obj->pin(idx).nexus()->drivers_constant()) {
idx += 1;
continue;
}
if (driven_value(obj->pin(idx)) == verinum::V0) {
if (obj->pin(idx).nexus()->driven_value() == verinum::V0) {
obj->pin(idx).unlink();
top -= 1;
if (idx < top) {
@@ -618,12 +651,12 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
unsigned one = 0, ones = 0;
idx = 1;
while (idx < top) {
if (! link_drivers_constant(obj->pin(idx))) {
if (! obj->pin(idx).nexus()->drivers_constant()) {
idx += 1;
continue;
}
if (driven_value(obj->pin(idx)) == verinum::V1) {
if (obj->pin(idx).nexus()->driven_value() == verinum::V1) {
if (one == 0) {
one = idx;
ones += 1;
@@ -666,6 +699,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
: verinum::V0;
NetConst*tmp = new NetConst(scope, obj->name(), out);
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -682,9 +719,9 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
if ((top == 3) && (ones == 1)) {
unsigned save;
if (! link_drivers_constant(obj->pin(1)))
if (! obj->pin(1).nexus()->drivers_constant())
save = 1;
else if (driven_value(obj->pin(1)) != verinum::V1)
else if (obj->pin(1).nexus()->driven_value() != verinum::V1)
save = 1;
else
save = 2;
@@ -700,6 +737,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
obj->name(), 2,
NetLogic::BUF);
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -725,6 +766,10 @@ void cprop_functor::lpm_logic(Design*des, NetLogic*obj)
obj->name(), 2,
NetLogic::NOT);
tmp->rise_time(obj->rise_time());
tmp->fall_time(obj->fall_time());
tmp->decay_time(obj->decay_time());
des->add_node(tmp);
tmp->pin(0).drive0(obj->pin(0).drive0());
tmp->pin(0).drive1(obj->pin(0).drive1());
@@ -777,12 +822,12 @@ void cprop_functor::lpm_mux(Design*des, NetMux*obj)
connected to the select input. */
bool flag = true;
for (unsigned idx = 0 ; idx < obj->width() ; idx += 1) {
if (! link_drivers_constant(obj->pin_Data(idx, 0))) {
if (! obj->pin_Data(idx, 0).nexus()->drivers_constant()) {
flag = false;
break;
}
if (driven_value(obj->pin_Data(idx, 0)) != verinum::Vz) {
if (obj->pin_Data(idx, 0).nexus()->driven_value() != verinum::Vz) {
flag = false;
break;
}
@@ -809,12 +854,12 @@ void cprop_functor::lpm_mux(Design*des, NetMux*obj)
NetMux with an array of BUFIF0 devices. */
flag = true;
for (unsigned idx = 0 ; idx < obj->width() ; idx += 1) {
if (! link_drivers_constant(obj->pin_Data(idx, 1))) {
if (! obj->pin_Data(idx, 1).nexus()->drivers_constant()) {
flag = false;
break;
}
if (driven_value(obj->pin_Data(idx, 1)) != verinum::Vz) {
if (obj->pin_Data(idx, 1).nexus()->driven_value() != verinum::Vz) {
flag = false;
break;
}
@@ -915,7 +960,7 @@ void cprop_dc_functor::lpm_const(Design*des, NetConst*obj)
// If the net has an eref, then there is an
// expression somewhere that reads this signal. So
// the constant does get read.
if (tmp->get_eref() > 0)
if (tmp->peek_eref() > 0)
return;
// If the net is a port of the root module, then
@@ -949,6 +994,34 @@ void cprop(Design*des)
/*
* $Log: cprop.cc,v $
* Revision 1.39 2002/08/20 04:12:22 steve
* Copy gate delays when doing gate delay substitutions.
*
* Revision 1.38 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.37 2002/06/25 01:33:22 steve
* Cache calculated driven value.
*
* Revision 1.36 2002/06/24 01:49:38 steve
* Make link_drive_constant cache its results in
* the Nexus, to improve cprop performance.
*
* Revision 1.35 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.34 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.33 2002/04/14 02:51:37 steve
* Fix bug removing pairs of ones in XOR.
*
+117 -37
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: design_dump.cc,v 1.122 2002/03/09 02:10:22 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: design_dump.cc,v 1.135 2002/10/23 01:47:17 steve Exp $"
#endif
# include "config.h"
@@ -93,7 +93,7 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
o << " inout";
break;
}
o << " (eref=" << get_eref() << ")";
o << " (eref=" << peek_eref() << ", lref=" << peek_lref() << ")";
if (scope())
o << " scope=" << scope()->name();
o << " #(" << rise_time() << "," << fall_time() << "," <<
@@ -117,6 +117,13 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
dump_obj_attr(o, ind+4);
}
void NetSubnet::dump_net(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "** " << name() << " is a NetSubnet **"
<< endl;
NetNet::dump_net(o, ind);
}
void NetMemory::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << name_ << "[" << width_ << "] " <<
@@ -174,9 +181,9 @@ void NetObj::dump_node_pins(ostream&o, unsigned ind) const
void NetObj::dump_obj_attr(ostream&o, unsigned ind) const
{
unsigned idx;
for (idx = 0 ; idx < attributes_.size() ; idx += 1) {
o << setw(ind) << "" << attributes_.key(idx) << " = \"" <<
attributes_.value(idx) << "\"" << endl;
for (idx = 0 ; idx < attr_cnt() ; idx += 1) {
o << setw(ind) << "" << attr_key(idx) << " = \"" <<
attr_value(idx) << "\"" << endl;
}
}
@@ -264,7 +271,8 @@ void NetConst::dump_node(ostream&o, unsigned ind) const
void NetFF::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "LPM_FF: " << name()
<< " scope=" << (scope()? scope()->name() : "") << endl;
<< " scope=" << (scope()? scope()->name() : "")
<< " aset_value=" << aset_value_ << endl;
dump_node_pins(o, ind+4);
dump_obj_attr(o, ind+4);
@@ -413,6 +421,11 @@ void NetProcTop::dump(ostream&o, unsigned ind) const
break;
}
for (unsigned idx = 0 ; idx < attr_cnt() ; idx += 1) {
o << setw(ind+2) << "" << "(* " << attr_key(idx) << " = "
<< attr_value(idx) << " *)" << endl;
}
statement_->dump(o, ind+2);
}
@@ -426,6 +439,14 @@ void NetAssign_::dump_lval(ostream&o) const
} else {
o << "[" << (loff_+lwid_-1) << ":" << loff_ << "]";
}
} else if (mem_) {
// Is there an obvious way to flag memories in the dump
// as different from the _real_ bit mux case?
// o << "**memory**";
o << mem_->name() << "[";
if (bmux_) o << *bmux_;
else o << "**oops**";
o << "]";
} else {
o << "";
}
@@ -472,30 +493,13 @@ void NetAssignNB::dump(ostream&o, unsigned ind) const
}
void NetAssignMem::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "";
o << "/* " << get_line() << " */" << endl;
o << setw(ind) << "";
o << memory()->name() << "[" << *index() << "] = ";
rval()->dump(o);
o << ";" << endl;
}
void NetAssignMemNB::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "";
o << "/* " << get_line() << " */" << endl;
o << setw(ind) << "";
o << memory()->name() << "[" << *index() << "] <= ";
rval()->dump(o);
o << ";" << endl;
}
/* Dump a block statement */
void NetBlock::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << type_ << endl;
o << setw(ind) << "" << type_;
if (subscope_)
o << " : " << subscope_->name();
o << endl;
if (last_) {
const NetProc*cur = last_;
@@ -655,8 +659,12 @@ void NetPDelay::dump(ostream&o, unsigned ind) const
void NetRelease::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "release " << lval_->name() << "; "
<< "/* " << get_line() << " */" << endl;
if (lval_)
o << setw(ind) << "" << "release " << lval_->name() << "; "
<< "/* " << get_line() << " */" << endl;
else
o << setw(ind) << "" << "release (null); "
<< "/* " << get_line() << " */" << endl;
}
void NetRepeat::dump(ostream&o, unsigned ind) const
@@ -692,17 +700,26 @@ void NetScope::dump(ostream&o) const
/* Dump the parameters for this scope. */
{
map<string,NetExpr*>::const_iterator pp;
map<string,param_expr_t>::const_iterator pp;
for (pp = parameters_.begin()
; pp != parameters_.end() ; pp ++) {
o << " parameter " << (*pp).first << " = " <<
*(*pp).second << ";" << endl;
o << " parameter ";
if ((*pp).second.signed_flag)
o << "signed ";
if ((*pp).second.msb)
o << "[" << *(*pp).second.msb
<< ":" << *(*pp).second.lsb << "] ";
o << (*pp).first << " = " <<
*(*pp).second.expr << ";" << endl;
}
for (pp = localparams_.begin()
; pp != localparams_.end() ; pp ++) {
o << " localparam " << (*pp).first << " = " <<
*(*pp).second << ";" << endl;
*(*pp).second.expr << ";" << endl;
}
}
@@ -850,8 +867,12 @@ void NetEBinary::dump(ostream&o) const
void NetEConcat::dump(ostream&o) const
{
if (repeat_ != 1)
o << repeat_;
if (repeat_calculated_) {
if (repeat_value_ != 1)
o << repeat_value_;
} else if (repeat_) {
o << "<" << *repeat_ << ">";
}
if (parms_[0])
o << "{" << *parms_[0];
@@ -914,7 +935,10 @@ void NetEMemory::dump(ostream&o) const
void NetEParam::dump(ostream&o) const
{
o << "<" << scope_->name() << "." << name_ << ">";
if (scope_ != 0)
o << "<" << scope_->name() << "." << name_ << ">";
else
o << "<" << name_ << ">";
}
void NetETernary::dump(ostream&o) const
@@ -980,6 +1004,62 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.135 2002/10/23 01:47:17 steve
* Fix synth2 handling of aset/aclr signals where
* flip-flops are split by begin-end blocks.
*
* Revision 1.134 2002/10/19 22:59:49 steve
* Redo the parameter vector support to allow
* parameter names in range expressions.
*
* Revision 1.133 2002/08/19 00:06:11 steve
* Allow release to handle removal of target net.
*
* Revision 1.132 2002/08/13 05:35:00 steve
* Do not elide named blocks.
*
* Revision 1.131 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.130 2002/08/04 18:28:14 steve
* Do not use hierarchical names of memories to
* generate vvp labels. -tdll target does not
* used hierarchical name string to look up the
* memory objects in the design.
*
* Revision 1.129 2002/06/19 04:20:03 steve
* Remove NetTmp and add NetSubnet class.
*
* Revision 1.128 2002/06/14 21:38:41 steve
* Fix expression width for repeat concatenations.
*
* Revision 1.127 2002/06/08 23:42:46 steve
* Add NetRamDq synthsesis from memory l-values.
*
* Revision 1.126 2002/06/05 03:44:25 steve
* Add support for memory words in l-value of
* non-blocking assignments, and remove the special
* NetAssignMem_ and NetAssignMemNB classes.
*
* Revision 1.125 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.124 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.123 2002/05/05 21:11:49 steve
* Put off evaluation of concatenation repeat expresions
* until after parameters are defined. This allows parms
* to be used in repeat expresions.
*
* Add the builtin $signed system function.
*
* Revision 1.122 2002/03/09 02:10:22 steve
* Add the NetUserFunc netlist node.
*
+9 -2
View File
@@ -15,9 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dosify.c,v 1.1 2001/08/03 17:06:47 steve Exp $
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: dosify.c,v 1.3 2002/08/12 01:34:58 steve Exp $"
#endif
/*
* This is a simple program to make a dosified copy of the
@@ -68,6 +69,12 @@ int main(int argc, char*argv[])
/*
* $Log: dosify.c,v $
* Revision 1.3 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2002/08/11 23:47:04 steve
* Add missing Log and Ident strings.
*
* Revision 1.1 2001/08/03 17:06:47 steve
* Add install of examples for Windows.
*
+3
View File
@@ -10,3 +10,6 @@ cfparse.output
cflexor.c
foo.*
iverilog
iverilog.ps
iverilog.pdf
tmp.pdf
+8 -6
View File
@@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.11 2002/02/03 07:05:36 steve Exp $"
#ident "$Id: Makefile.in,v 1.15 2002/08/10 22:36:59 steve Exp $"
#
#
SHELL = /bin/sh
@@ -37,7 +37,6 @@ includedir = $(prefix)/include
mandir = @mandir@
dllib=@DLLIB@
rdynamic=@rdynamic@
CC = @CC@
CXX = @CXX@
@@ -56,7 +55,7 @@ clean:
rm -f *.o lexor.c parse.c parse.h parse.output
rm -f cflexor.c cfparse.c cfparse.h cfparse.output
O = main.o build_string.o lexor.o parse.o cflexor.o cfparse.o
O = main.o build_string.o lexor.o parse.o substit.o cflexor.o cfparse.o
iverilog@EXEEXT@: $O
$(CC) $(LDFLAGS) $O -o iverilog@EXEEXT@ @EXTRALIBS@
@@ -75,7 +74,7 @@ cfparse.h cfparse.c: cfparse.y
main.o: main.c globals.h
$(CC) $(CFLAGS) -c -DCXX='"@CXX@"' -DIVL_ROOT='"@libdir@/ivl"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DRDYNAMIC=\"$(rdynamic)\" -DDLLIB='"@DLLIB@"' -DEXEEXT='"@EXEEXT@"' $(srcdir)/main.c
$(CC) $(CFLAGS) -c -DCXX='"@CXX@"' -DIVL_ROOT='"@libdir@/ivl"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DDLLIB='"@DLLIB@"' $(srcdir)/main.c
build_string.o: build_string.c globals.h
lexor.o: lexor.c parse.h globals.h
@@ -83,8 +82,11 @@ parse.o: parse.c globals.h
cflexor.o: cflexor.c cfparse.h cfparse_misc.h globals.h
cfparse.o: cfparse.c globals.h cfparse_misc.h
iverilog.pdf: $(srcdir)/iverilog.man
man -t $(srcdir)/iverilog.man | ps2pdf - iverilog.pdf
iverilog.ps: $(srcdir)/iverilog.man
man -t $(srcdir)/iverilog.man > iverilog.ps
iverilog.pdf: iverilog.ps
ps2pdf iverilog.ps iverilog.pdf
ifeq (@WIN32@,yes)
INSTALL_DOC = $(prefix)/iverilog.pdf
+28 -18
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: build_string.c,v 1.7 2002/04/04 05:26:13 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: build_string.c,v 1.11 2002/08/12 01:35:01 steve Exp $"
#endif
# include "config.h"
@@ -72,6 +72,18 @@ int build_string(char*output, size_t olen, const char*pattern)
olen -= strlen(base);
break;
case 'C':
strcpy(output, iconfig_path);
output += strlen(iconfig_path);
olen -= strlen(iconfig_path);
break;
case 'g':
strcpy(output, generation);
output += strlen(generation);
olen -= strlen(generation);
break;
case 'f':
if (f_list) {
strcpy(output, f_list);
@@ -138,22 +150,6 @@ int build_string(char*output, size_t olen, const char*pattern)
olen -= strlen(warning_flags);
break;
case 'y':
if (library_flags) {
strcpy(output, library_flags);
output += strlen(library_flags);
olen -= strlen(library_flags);
}
break;
case 'Y':
if (library_flags2) {
strcpy(output, library_flags2);
output += strlen(library_flags2);
olen -= strlen(library_flags2);
}
break;
}
pattern += 1;
@@ -169,6 +165,20 @@ int build_string(char*output, size_t olen, const char*pattern)
/*
* $Log: build_string.c,v $
* Revision 1.11 2002/08/12 01:35:01 steve
* conditional ident string using autoconfig.
*
* Revision 1.10 2002/05/28 02:25:03 steve
* Pass library paths through -Cfile instead of command line.
*
* Revision 1.9 2002/05/28 00:50:39 steve
* Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library
* modules through the preprocessor.
*
* Revision 1.8 2002/05/24 01:13:00 steve
* Support language generation flag -g.
*
* Revision 1.7 2002/04/04 05:26:13 steve
* Add dependency generation.
*
+5 -1
View File
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: cflexor.lex,v 1.5 2001/12/08 04:13:07 steve Exp $"
#ident "$Id: cflexor.lex,v 1.6 2002/05/28 20:40:37 steve Exp $"
#endif
# include "cfparse.h"
@@ -70,6 +70,10 @@ static int comment_enter;
"+incdir+" { BEGIN(PLUS_ARGS); return TOK_INCDIR; }
"+libdir+" { BEGIN(PLUS_ARGS); return TOK_LIBDIR; }
"+libdir-nocase+" { BEGIN(PLUS_ARGS); return TOK_LIBDIR_NOCASE; }
"+libext+" { BEGIN(PLUS_ARGS); return TOK_LIBEXT; }
+30 -8
View File
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: cfparse.y,v 1.6 2002/01/02 02:39:34 steve Exp $"
#ident "$Id: cfparse.y,v 1.8 2002/06/23 20:10:51 steve Exp $"
#endif
@@ -58,7 +58,7 @@ static void translate_file_name(char*text)
};
%token TOK_Da TOK_Dv TOK_Dy
%token TOK_DEFINE TOK_INCDIR TOK_LIBEXT
%token TOK_DEFINE TOK_INCDIR TOK_LIBDIR TOK_LIBDIR_NOCASE TOK_LIBEXT
%token <text> TOK_PLUSARG TOK_PLUSWORD TOK_STRING
%%
@@ -78,9 +78,11 @@ item
of a source file. Add the file to the file list. */
: TOK_STRING
{ translate_file_name($1);
process_file_name($1);
{ char*tmp = substitutions($1);
translate_file_name(tmp);
process_file_name(tmp);
free($1);
free(tmp);
}
/* The -a flag is completely ignored. */
@@ -91,11 +93,13 @@ item
as an ordinary source file. */
| TOK_Dv TOK_STRING
{ translate_file_name($2);
process_file_name($2);
{ char*tmp = substitutions($2);
translate_file_name(tmp);
process_file_name(tmp);
fprintf(stderr, "%s:%u: Ignoring -v in front of %s\n",
@1.text, @1.first_line, $2);
free($2);
free(tmp);
}
/* This rule matches "-y <path>" sequences. This does the same thing
@@ -103,8 +107,24 @@ item
directory list. */
| TOK_Dy TOK_STRING
{ process_library_switch($2);
{ char*tmp = substitutions($2);
process_library_switch(tmp);
free($2);
free(tmp);
}
| TOK_LIBDIR TOK_PLUSARG
{ char*tmp = substitutions($2);
process_library_switch(tmp);
free($2);
free(tmp);
}
| TOK_LIBDIR_NOCASE TOK_PLUSARG
{ char*tmp = substitutions($2);
process_library_nocase_switch(tmp);
free($2);
free(tmp);
}
| TOK_DEFINE TOK_PLUSARG
@@ -151,8 +171,10 @@ inc_args
;
inc_arg : TOK_PLUSARG
{ process_include_dir($1);
{ char*tmp = substitutions($1);
process_include_dir(tmp);
free($1);
free(tmp);
}
;
+5 -2
View File
@@ -19,8 +19,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: cfparse_misc.h,v 1.3 2002/01/02 02:39:34 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: cfparse_misc.h,v 1.4 2002/08/12 01:35:01 steve Exp $"
#endif
/*
@@ -40,6 +40,9 @@ extern YYLTYPE yylloc;
/*
* $Log: cfparse_misc.h,v $
* Revision 1.4 2002/08/12 01:35:01 steve
* conditional ident string using autoconfig.
*
* Revision 1.3 2002/01/02 02:39:34 steve
* Use my own cfltype to defend against bison 1.30.
*
+30 -2
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: globals.h,v 1.11 2002/04/04 05:26:13 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: globals.h,v 1.16 2002/08/12 01:35:01 steve Exp $"
#endif
# include <stddef.h>
@@ -27,6 +27,9 @@
/* This is the base (i.e. -B<value>) of the Icarus Verilog files. */
extern const char*base;
/* This is the path to the iconfig file sent to ivl. */
extern char* iconfig_path;
/* This is a list of all the -f<key>=<value> options from the
command line, concatenated together. */
extern char*f_list;
@@ -54,11 +57,18 @@ extern int synth_flag;
/* This is the name of the selected target. */
extern const char*targ;
/* This is the language generation flag. */
extern const char*generation;
/* Perform variable substitutions on the string. */
extern char* substitutions(const char*str);
/* Add the name to the list of source files. */
extern void process_file_name(const char*name);
/* Add the name to the list of library directories. */
extern void process_library_switch(const char*name);
extern void process_library_nocase_switch(const char*name);
extern void process_library2_switch(const char*name);
/* Add a new include file search directory */
@@ -82,6 +92,24 @@ extern int build_string(char*out, size_t olen, const char*pattern);
/*
* $Log: globals.h,v $
* Revision 1.16 2002/08/12 01:35:01 steve
* conditional ident string using autoconfig.
*
* Revision 1.15 2002/06/23 20:10:51 steve
* Variable substitution in command files.
*
* Revision 1.14 2002/05/28 20:40:37 steve
* ivl indexes the search path for libraries, and
* supports case insensitive module-to-file lookup.
*
* Revision 1.13 2002/05/28 00:50:40 steve
* Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library
* modules through the preprocessor.
*
* Revision 1.12 2002/05/24 01:13:00 steve
* Support language generation flag -g.
*
* Revision 1.11 2002/04/04 05:26:13 steve
* Add dependency generation.
*
+43 -5
View File
@@ -1,10 +1,10 @@
.TH iverilog 1 "$Date: 2002/04/24 02:02:31 $" Version "$Date: 2002/04/24 02:02:31 $"
.TH iverilog 1 "$Date: 2002/06/23 20:10:51 $" Version "$Date: 2002/06/23 20:10:51 $"
.SH NAME
iverilog - Icarus Verilog compiler
.SH SYNOPSIS
.B iverilog
[-ESVv] [-Cpath] [-ccmdfile] [-Dmacro[=defn]] [-pflag=value]
[-ESVv] [-Cpath] [-ccmdfile] [-g1|-g2|-g3.0] [-Dmacro[=defn]] [-pflag=value]
[-Iincludedir] [-mmodule] [-Mfile] [-Nfile] [-ooutputfilename]
[-stopmodule] [-ttype] [-Tmin/typ/max] [-Wclass] [-ypath] sourcefile
@@ -55,6 +55,15 @@ is the Verilog input, but with file inclusions and macro references
expanded and removed. This is useful, for example, to preprocess
Verilog source for use by other compilers.
.TP 8
.B -g1\fI|\fP-g2\fI|\fP-g3.0
Select the Verilog language \fIgeneration\fP to support in the
compiler. This selects between \fIIEEE1364-1995\fP(1),
\fIIEEE1364-2001\fP(2), or \fISystemVerilog 3.0\fP(3.0). Normally,
Icarus Verilog defaults to the latest known generation of the
language. This flag is most useful to restrict the language to a set
supported by tools of specific generations, for compatibility with
other tools.
.TP 8
.B -I\fIincludedir\fP
Append directory \fIincludedir\fP to list of directories searched
for Verilog include files. The \fB-I\fP switch may be used many times
@@ -178,7 +187,7 @@ mostly by EDIF format output.
.SH "WARNING TYPES"
These are the types of warnings that can be selected by the \fB-W\fP
switch. All the warning types (other then \fBall\fP) can also be
prefixed with \fBno-\fP to turn of that warning. This is most useful
prefixed with \fBno-\fP to turn off that warning. This is most useful
after a \fB-Wall\fP argument to suppress isolated warning types.
.TP 8
@@ -208,7 +217,8 @@ well as # comments, if the # starts the line.
.TP 8
.I "file name"
A simple file name or file path is taken to be the name of a Verilog
source file. The path starts with the first non-white-space character.
source file. The path starts with the first non-white-space
character. Variables are substitued in file names.
.TP 8
.B -y\ \fIlibdir\fP
@@ -216,6 +226,8 @@ A \fB-y\fP token prefixes a library directory in the command file,
exactly like it does on the command line. The parameter to the \fB-y\fP
flag may be on the same line or the next non-comment line.
Variables in the \fIlibdir\fP are substituted.
.TP 8
.B +incdir+\fIincludedir\fP
The \fB+incdir+\fP token in command files gives directories to search
@@ -224,6 +236,8 @@ command line. The difference is that multiple \fI+includedir\fP
directories are valid parameters to a single \fB+incdir+\fP token,
although you may also have multiple \fB+incdir+\fP lines.
Variables in the \fIincludedir\fP are substituted.
.TP 8
.B +libext+\fIext\fP
The \fB+libext\fP token in command files fives file extensions to try
@@ -231,6 +245,18 @@ when looking for a library file. This is useful in conjunction with
\fB-y\fP flags to list suffixes to try in each directory before moving
on to the next library directory.
.TP 8
.B +libdir+\fIdir\fP
This is another way to specify library directories. See the -y flag.
.TP 8
.B +libdir-nocase+\fIdir\fP
This is like the \fB+libdir\fP statement, but file names inside the
directories declared here are case insensitive. The missing module
name in a lookup need not match the file name case, as long as the
letters are correct. For example, "foo" matches "Foo.v" but not
"bar.v".
.TP 8
.B +define+\fINAME\fP=\fIvalue\fP
The \fB+define+\fP token is the same as the \fB-D\fP option on the
@@ -247,6 +273,18 @@ become munged.
.B +tolower-filename\fP
This is similar to the \fB+toupper-filename\fP hack described above.
.SH "VARIABLES IN COMMAND FILES"
In certain cases, iverilog supports variables in command files. These
are strings of the form "$(\fIvarname\fP)", where \fIvarname\fP is the
name of the environment variable to read. The entire string is
replaced with the contents of that variable. Variables are only
substitued in contexts that explicitly support them, including file
and directory strings.
Variable values come from the operating system environment, and not
from preprocessor defines elsewhere in the file or the command line.
.SH EXAMPLES
These examples assume that you have a Verilog source file called hello.v in
the current directory
@@ -278,7 +316,7 @@ vvp(1),
.SH COPYRIGHT
.nf
Copyright \(co 2000 Stephen Williams
Copyright \(co 2002 Stephen Williams
This document can be freely redistributed according to the terms of the
GNU General Public License version 2.0
+153 -129
View File
@@ -16,13 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: main.c,v 1.36 2002/04/24 02:02:31 steve Exp $"
#ident "$Id: main.c,v 1.47 2002/08/12 01:27:48 steve Exp $"
# include "config.h"
const char HELP[] =
"Usage: iverilog [-ESvV] [-B base] [-C path] [-c cmdfile]\n"
"Usage: iverilog [-ESvV] [-B base] [-C path] [-c cmdfile] [-g1|-g2|-g3.0]\n"
" [-D macro[=defn]] [-I includedir] [-M depfile] [-m module]\n"
" [-N file] [-o filename] [-p flag=value]\n"
" [-s topmodule] [-t target] [-T min|typ|max]\n"
@@ -44,6 +44,7 @@ const char HELP[] =
#ifdef __MINGW32__
#include <windows.h>
#include <libiberty.h>
#endif
#if HAVE_GETOPT_H
@@ -68,10 +69,6 @@ extern const char*optarg;
# define IVL_ROOT "."
#endif
#ifndef RDYNAMIC
# define RDYNAMIC "-rdynamic"
#endif
# include "globals.h"
#ifdef __MINGW32__
@@ -84,14 +81,14 @@ extern void cfreset(FILE*fd, const char*path);
const char*base = 0;
const char*mtm = 0;
const char*opath = "a.out" EXEEXT;
const char*opath = "a.out";
const char*npath = 0;
const char*targ = "vvp";
const char*depfile = 0;
const char*generation = "-g3.0";
char warning_flags[16] = "";
char *library_flags = 0;
char *library_flags2 = 0;
char*inc_list = 0;
char*def_list = 0;
@@ -108,6 +105,9 @@ char*source_path = 0;
FILE*source_file = 0;
unsigned source_count = 0;
char*iconfig_path = 0;
FILE*iconfig_file = 0;
int synth_flag = 0;
int verbose_flag = 0;
int command_file = 0;
@@ -119,6 +119,43 @@ char tmp[MAXSIZE];
static char ivl_root[MAXSIZE];
static const char*my_tempfile(const char*str, FILE**fout)
{
FILE*file;
int retry;
static char pathbuf[8192];
const char*tmpdir = getenv("TMP");
if (tmpdir == 0)
tmpdir = getenv("TMPDIR");
if (tmpdir == 0)
tmpdir = getenv("TEMP");
#ifdef __MINGW32__
if (tmpdir == 0)
tmpdir = "C:\\TEMP";
#else
if (tmpdir == 0)
tmpdir = "/tmp";
#endif
assert(tmpdir);
assert((strlen(tmpdir) + strlen(str)) < sizeof pathbuf - 10);
srand(getpid());
retry = 100;
file = NULL;
while ((retry > 0) && (file == NULL)) {
unsigned code = rand();
sprintf(pathbuf, "%s%c%s%04x", tmpdir, sep, str, code);
file = fopen(pathbuf, "w");
retry -= 1;
}
*fout = file;
return pathbuf;
}
/*
* This is the default target type. It looks up the bits that are
* needed to run the command from the configuration file (which is
@@ -159,6 +196,7 @@ static int t_default(char*cmd, unsigned ncmd)
rc = system(cmd);
remove(source_path);
remove(iconfig_path);
if (rc != 0) {
if (rc == 127) {
fprintf(stderr, "Failed to execute: %s\n", cmd);
@@ -175,97 +213,6 @@ static int t_default(char*cmd, unsigned ncmd)
return 0;
}
/*
* This function handles the vvm target. After preprocessing, run the
* ivl translator to get C++, then run g++ to make an executable
* program out of that.
*/
static int t_vvm(char*cmd, unsigned ncmd)
{
int rc;
const char*pattern = lookup_pattern("<ivl>");
if (pattern == 0) {
fprintf(stderr, "No such target: %s\n", targ);
return -1;
}
tmp[0] = ' ';
tmp[1] = '|';
tmp[2] = ' ';
rc = build_string(tmp+3, sizeof tmp - 3, pattern);
cmd = realloc(cmd, ncmd+3+rc+1);
#ifdef __MINGW32__
{
char *t;
for (t = tmp; *t; t++)
{
if (*t == '/') *t = '\\';
}
}
#endif
strcpy(cmd+ncmd, tmp);
if (verbose_flag)
printf("translate: %s\n", cmd);
rc = system(cmd);
remove(source_path);
if (rc != 0) {
if (WIFEXITED(rc)) {
fprintf(stderr, "errors translating Verilog program.\n");
return WEXITSTATUS(rc);
} else {
fprintf(stderr, "Command signaled: %s\n", cmd);
return -1;
}
}
#if defined(__MINGW32__)
/* In the Windows world, the path to headers and libraries
for vvm is relative the ivl_root, which is in something like:
d:\iverilog\lib\ivl <-- ivl_root
d:\iverilog\include <-- vvm headers
d:\iverilog\lib <-- vvm libraries
So we make up all the ugly references that are the g++
command line to compile a .cc file generated by vvm. */
sprintf(tmp, "%s " RDYNAMIC " -s -fno-exceptions -o %s "
"-I%s\\..\\..\\include -L%s\\.. %s.cc -lvvm -lvpip %s",
CXX, opath, ivl_root, ivl_root, opath, DLLIB);
#else
/* In the UNIX universe, life is easy. The configure script
has figured everything out and wrote it into the Makefile,
which passes it on as the IVL_INC and IVL_LIB defines. */
sprintf(tmp, "%s " RDYNAMIC " -s -fno-exceptions -o %s -I%s "
"-L%s %s.cc -lvvm -lvpip %s", CXX, opath, IVL_INC,
IVL_LIB, opath, DLLIB);
#endif
if (verbose_flag)
printf("compile: %s\n", tmp);
rc = system(tmp);
if (rc != 0) {
if (WIFEXITED(rc)) {
fprintf(stderr, "errors compiling translated program.\n");
return WEXITSTATUS(rc);
} else {
fprintf(stderr, "Command signaled: %s\n", tmp);
return -1;
}
}
sprintf(tmp, "%s.cc", opath);
unlink(tmp);
return 0;
}
static void process_warning_switch(const char*name)
{
@@ -298,28 +245,17 @@ static void process_warning_switch(const char*name)
void process_library_switch(const char *name)
{
if (library_flags) {
library_flags = realloc(library_flags,
strlen(library_flags) + strlen(name) + 5);
strcat(library_flags, " -y ");
} else {
library_flags = malloc(strlen(name) + 4);
strcpy(library_flags, "-y ");
}
strcat(library_flags, name);
fprintf(iconfig_file, "-y:%s\n", name);
}
void process_library_nocase_switch(const char *name)
{
fprintf(iconfig_file, "-yl:%s\n", name);
}
void process_library2_switch(const char *name)
{
if (library_flags2) {
library_flags2 = realloc(library_flags2,
strlen(library_flags2) + strlen(name) + 5);
strcat(library_flags2, " -Y ");
} else {
library_flags2 = malloc(strlen(name) + 4);
strcpy(library_flags2, "-Y ");
}
strcat(library_flags2, name);
fprintf(iconfig_file, "-Y:%s\n", name);
}
void process_include_dir(const char *name)
@@ -358,6 +294,30 @@ void process_file_name(const char*name)
source_count += 1;
}
int process_generation(const char*name)
{
if (strcmp(name,"1") == 0)
generation = "-g1";
else if (strcmp(name,"2") == 0)
generation = "-g2";
else if (strcmp(name,"3.0") == 0)
generation = "-g3.0";
else {
fprintf(stderr, "Unknown/Unsupported Language generation "
"%s\n", name);
fprintf(stderr, "Supported generations are:\n");
fprintf(stderr, " 1 -- IEEE1364-1995 (Verilog 1)\n"
" 2 -- IEEE1364-2001 (Verilog 2001)\n"
" 3.0 -- SystemVerilog 3.0\n");
return 1;
}
return 0;
}
int main(int argc, char **argv)
{
const char*config_path = 0;
@@ -365,7 +325,7 @@ int main(int argc, char **argv)
unsigned ncmd;
int e_flag = 0;
int version_flag = 0;
int opt, idx;
int opt, idx, rc;
char*cp;
#ifdef __MINGW32__
@@ -397,6 +357,7 @@ int main(int argc, char **argv)
base = ivl_root;
}
#else
/* In a UNIX environment, the IVL_ROOT from the Makefile is
dependable. It points to the $prefix/lib/ivl directory,
@@ -405,9 +366,9 @@ int main(int argc, char **argv)
base = ivl_root;
#endif
source_path = strdup(tempnam(NULL, "ivrlg"));
assert(source_path);
source_file = fopen(source_path, "w");
/* Create a temporary file for communicating input parameters
to the preprocessor. */
source_path = strdup(my_tempfile("ivrlg", &source_file));
if (NULL == source_file) {
fprintf(stderr, "%s: Error opening temporary file %s\n",
argv[0], source_path);
@@ -415,7 +376,19 @@ int main(int argc, char **argv)
return 1;
}
while ((opt = getopt(argc, argv, "B:C:c:D:Ef:hI:M:m:N::o:p:Ss:T:t:vVW:y:Y:")) != EOF) {
/* Create another temporary file for passing configuration
information to ivl. */
iconfig_path = strdup(my_tempfile("ivrlh", &iconfig_file));
if (NULL == iconfig_file) {
fprintf(stderr, "%s: Error opening temporary file %s\n",
argv[0], iconfig_path);
fprintf(stderr, "%s: Please check TMP or TMPDIR.\n", argv[0]);
fclose(source_file);
remove(source_path);
return 1;
}
while ((opt = getopt(argc, argv, "B:C:c:D:Ef:g:hI:M:m:N::o:p:Ss:T:t:vVW:y:Y:")) != EOF) {
switch (opt) {
case 'B':
@@ -450,6 +423,11 @@ int main(int argc, char **argv)
}
break;
case 'g':
rc = process_generation(optarg);
if (rc != 0)
return -1;
break;
case 'h':
fprintf(stderr, "%s\n", HELP);
return 1;
@@ -601,7 +579,7 @@ int main(int argc, char **argv)
/* Start building the preprocess command line. */
sprintf(tmp, "%s%civlpp %s%s -f%s ", base,sep,
sprintf(tmp, "%s%civlpp %s%s -D__ICARUS__=1 -f%s ", base,sep,
verbose_flag?" -v":"",
e_flag?"":" -L", source_path);
@@ -645,6 +623,9 @@ int main(int argc, char **argv)
rc = system(cmd);
remove(source_path);
fclose(iconfig_file);
remove(iconfig_path);
if (rc != 0) {
if (WIFEXITED(rc)) {
fprintf(stderr, "errors preprocessing Verilog program.\n");
@@ -658,17 +639,60 @@ int main(int argc, char **argv)
return 0;
}
if (strcmp(targ,"vvm") == 0)
return t_vvm(cmd, ncmd);
else {
return t_default(cmd, ncmd);
}
/* Write the preprocessor command needed to preprocess a
single file. This may be used to preprocess library
files. */
fprintf(iconfig_file, "ivlpp:%s%civlpp -D__ICARUS__ -L %s %s\n",
base, sep,
inc_list? inc_list : "",
def_list? def_list : "");
/* Done writing to the iconfig file. Close it now. */
fclose(iconfig_file);
return t_default(cmd, ncmd);
return 0;
}
/*
* $Log: main.c,v $
* Revision 1.47 2002/08/12 01:27:48 steve
* Escape the backslash in the windows file name.
*
* Revision 1.46 2002/08/10 22:36:59 steve
* No longer any nead for -rdynamic flag
*
* Revision 1.45 2002/08/10 22:27:13 steve
* Kill links to vvm.
*
* Revision 1.44 2002/07/15 00:33:50 steve
* Improve temporary file name guess.
*
* Revision 1.43 2002/07/14 23:32:31 steve
* No longer need the .exe on generated files.
*
* Revision 1.42 2002/07/14 23:11:35 steve
* Do temp file creation by hand.
*
* Revision 1.41 2002/05/28 20:40:37 steve
* ivl indexes the search path for libraries, and
* supports case insensitive module-to-file lookup.
*
* Revision 1.40 2002/05/28 02:25:03 steve
* Pass library paths through -Cfile instead of command line.
*
* Revision 1.39 2002/05/28 00:50:40 steve
* Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library
* modules through the preprocessor.
*
* Revision 1.38 2002/05/27 23:14:06 steve
* Predefine __ICARUS__
*
* Revision 1.37 2002/05/24 01:13:00 steve
* Support language generation flag -g.
*
* Revision 1.36 2002/04/24 02:02:31 steve
* add -Wno- arguments to the driver.
*
+112
View File
@@ -0,0 +1,112 @@
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: substit.c,v 1.4 2002/08/12 01:35:01 steve Exp $"
#endif
# include <string.h>
# include <stdlib.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
char* substitutions(const char*str)
{
size_t nbuf = strlen(str) + 1;
char*buf = malloc(nbuf);
char*cp = buf;
while (*str) {
if ((str[0] == '$') && (str[1] == '(')) {
/* If I find a $(x) string in the source, replace
it in the destination with the contents of the
environment variable x. */
char*name;
char*value;
const char*ep = strchr(str, ')');
str += 2;
name = malloc(ep-str+1);
strncpy(name, str, ep-str);
name[ep-str] = 0;
str = ep + 1;
value = getenv(name);
free(name);
if (value == 0)
continue;
if (strlen(value) >= (nbuf - (cp-buf))) {
size_t old_size = cp - buf;
nbuf = (cp - buf) + strlen(value) + 1;
buf = realloc(buf, nbuf);
cp = buf + old_size;
}
strcpy(cp, value);
cp += strlen(cp);
} else {
if ( (cp - buf) == nbuf ) {
size_t old_size = nbuf;
nbuf = old_size + 32;
buf = realloc(buf, nbuf);
cp = buf + old_size;
}
*cp++ = *str++;
}
}
/* Add the trailing nul to the string, and reallocate the
buffer to be a tight fit. */
if ( (cp - buf) == nbuf ) {
size_t old_size = nbuf;
nbuf = old_size + 1;
buf = realloc(buf, nbuf);
buf[old_size] = 0;
} else {
*cp++ = 0;
nbuf = cp - buf;
buf = realloc(buf, nbuf);
}
return buf;
}
/*
* $Log: substit.c,v $
* Revision 1.4 2002/08/12 01:35:01 steve
* conditional ident string using autoconfig.
*
* Revision 1.3 2002/08/11 23:47:04 steve
* Add missing Log and Ident strings.
*
* Revision 1.2 2002/06/25 01:33:01 steve
* include malloc.h only when available.
*
* Revision 1.1 2002/06/23 20:10:51 steve
* Variable substitution in command files.
*
*/
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: dup_expr.cc,v 1.7 2002/01/28 00:52:41 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: dup_expr.cc,v 1.8 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -74,6 +74,9 @@ NetEUnary* NetEUnary::dup_expr() const
/*
* $Log: dup_expr.cc,v $
* Revision 1.8 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.7 2002/01/28 00:52:41 steve
* Add support for bit select of parameters.
* This leads to a NetESelect node and the
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_anet.cc,v 1.4 2001/12/03 04:47:14 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_anet.cc,v 1.5 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -149,6 +149,9 @@ NetNet* PEIdent::elaborate_anet(Design*des, NetScope*scope) const
/*
* $Log: elab_anet.cc,v $
* Revision 1.5 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.4 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
+85 -11
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_expr.cc,v 1.57 2002/04/27 05:03:46 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_expr.cc,v 1.66 2002/09/21 21:28:18 steve Exp $"
#endif
# include "config.h"
@@ -120,7 +120,8 @@ NetEBinary* PEBinary::elaborate_expr_base_(Design*des,
case '^':
case '&':
case '|':
case 'O':
case 'O': // NOR (~|)
case 'A': // NAND (~&)
case 'X':
tmp = new NetEBBits(op_, lp, rp);
tmp->set_line(*this);
@@ -182,6 +183,34 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope) const
return sub;
}
/* Interpret the internal $sizeof system function to return
the bit width of the sub-expression. The value of the
sub-expression is not used, so the expression itself can be
deleted. */
if ((strcmp(path_.peek_name(0), "$sizeof") == 0)
|| (strcmp(path_.peek_name(0), "$bits") == 0)) {
if ((parms_.count() != 1) || (parms_[0] == 0)) {
cerr << get_line() << ": error: The $bits() function "
<< "takes exactly one(1) argument." << endl;
des->errors += 1;
return 0;
}
if (strcmp(path_.peek_name(0), "$sizeof") == 0)
cerr << get_line() << ": warning: $sizeof is deprecated."
<< " Use $bits() instead." << endl;
PExpr*expr = parms_[0];
NetExpr*sub = expr->elaborate_expr(des, scope, true);
verinum val (sub->expr_width(), 8*sizeof(unsigned));
delete sub;
sub = new NetEConst(val);
sub->set_line(*this);
return sub;
}
unsigned wid = 32;
if (strcmp(path_.peek_name(0), "$time") == 0)
@@ -322,7 +351,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope, bool) const
NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const
{
unsigned repeat = 1;
NetExpr* repeat = 0;
/* If there is a repeat expression, then evaluate the constant
value and set the repeat count. */
@@ -338,20 +367,21 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const
cerr << get_line() << ": : The expression is: "
<< *tmp << endl;
des->errors += 1;
return 0;
}
repeat = rep->value().as_ulong();
repeat = rep;
}
/* Make the empty concat expression. */
NetEConcat*tmp = new NetEConcat(parms_.count(), repeat);
tmp->set_line(*this);
unsigned wid_sum = 0;
/* Elaborate all the parameters and attach them to the concat node. */
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) {
assert(parms_[idx]);
NetExpr*ex = parms_[idx]->elaborate_expr(des, scope);
NetExpr*ex = elab_and_eval(des, scope, parms_[idx]);
if (ex == 0) continue;
ex->set_line(*parms_[idx]);
@@ -363,9 +393,12 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const
des->errors += 1;
}
wid_sum += ex->expr_width();
tmp->set(idx, ex);
}
tmp->set_width(wid_sum * tmp->repeat());
return tmp;
}
@@ -600,11 +633,21 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
unsigned idx = net->sb_to_idx(msv);
if (idx >= net->pin_count()) {
cerr << get_line() << ": internal error: "
<< "bit " << msv << " out of range of net "
/* The bit select is out of range of the
vector. This is legal, but returns a
constant 1'bx value. */
verinum x (verinum::Vx);
NetEConst*tmp = new NetEConst(x);
tmp->set_line(*this);
cerr << get_line() << ": warning: Bit select ["
<< msv << "] out of range of vector "
<< net->name() << "[" << net->msb()
<< ":" << net->lsb() << "]." << endl;
return 0;
cerr << get_line() << ": : Replacing "
<< "expression with a constant 1'bx." << endl;
delete msn;
return tmp;
}
NetESignal*tmp = new NetESignal(net, idx, idx);
@@ -665,7 +708,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
assert(idx_ == 0);
NetExpr*i = msb_->elaborate_expr(des, scope);
if (msb_ && i == 0) {
cerr << get_line() << ": error: Unable to exaborate "
cerr << get_line() << ": error: Unable to elaborate "
"index expression `" << *msb_ << "'" << endl;
des->errors += 1;
return 0;
@@ -842,6 +885,37 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const
/*
* $Log: elab_expr.cc,v $
* Revision 1.66 2002/09/21 21:28:18 steve
* Allow constant bit selects out of range.
*
* Revision 1.65 2002/09/18 04:08:45 steve
* Spelling errors.
*
* Revision 1.64 2002/09/12 15:49:43 steve
* Add support for binary nand operator.
*
* Revision 1.63 2002/08/19 02:39:16 steve
* Support parameters with defined ranges.
*
* Revision 1.62 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.61 2002/06/14 21:38:41 steve
* Fix expression width for repeat concatenations.
*
* Revision 1.60 2002/05/24 00:44:54 steve
* Add support for $bits (SystemVerilog)
*
* Revision 1.59 2002/05/06 02:30:27 steve
* Allow parameters in concatenation of widths are defined.
*
* Revision 1.58 2002/05/05 21:11:49 steve
* Put off evaluation of concatenation repeat expresions
* until after parameters are defined. This allows parms
* to be used in repeat expresions.
*
* Add the builtin $signed system function.
*
* Revision 1.57 2002/04/27 05:03:46 steve
* Preserve stringiness string part select and concatenation.
*
+33 -11
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_lval.cc,v 1.18 2002/03/09 04:02:26 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_lval.cc,v 1.20 2002/08/12 01:34:58 steve Exp $"
#endif
# include "config.h"
@@ -67,7 +67,7 @@
*/
NetAssign_* PExpr::elaborate_lval(Design*des, NetScope*scope) const
{
NetNet*ll = 0; //XXXXelaborate_net(des, scope, 0, 0, 0, 0);
NetNet*ll = 0;
if (ll == 0) {
cerr << get_line() << ": Assignment l-value too complex."
<< endl;
@@ -139,14 +139,13 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
if (reg == 0) {
NetMemory*mem = des->find_memory(scope, path_);
if (mem != 0) {
cerr << get_line() << ": sorry: I cannot handle "
<< "memories in this l-value context." << endl;
} else {
cerr << get_line() << ": error: Could not find variable ``"
<< path_ << "'' in ``" << scope->name() <<
"''" << endl;
}
if (mem != 0)
return elaborate_mem_lval_(des, scope, mem);
cerr << get_line() << ": error: Could not find variable ``"
<< path_ << "'' in ``" << scope->name() <<
"''" << endl;
des->errors += 1;
return 0;
}
@@ -275,6 +274,21 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetScope*scope) const
return lv;
}
NetAssign_* PEIdent::elaborate_mem_lval_(Design*des, NetScope*scope,
NetMemory*mem) const
{
assert(msb_ && !lsb_);
NetExpr*ix = msb_->elaborate_expr(des, scope);
if (ix == 0)
return 0;
NetAssign_*lv = new NetAssign_(mem);
lv->set_bmux(ix);
lv->set_part(0, mem->width());
return lv;
}
NetAssign_* PENumber::elaborate_lval(Design*des, NetScope*) const
{
cerr << get_line() << ": error: Constant values not allowed "
@@ -285,6 +299,14 @@ NetAssign_* PENumber::elaborate_lval(Design*des, NetScope*) const
/*
* $Log: elab_lval.cc,v $
* Revision 1.20 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.19 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.18 2002/03/09 04:02:26 steve
* Constant expressions are not l-values for task ports.
*
+207 -94
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_net.cc,v 1.89 2002/04/23 03:53:59 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_net.cc,v 1.101 2002/09/18 04:29:55 steve Exp $"
#endif
# include "config.h"
@@ -67,6 +67,8 @@ NetNet* PEBinary::elaborate_net(Design*des, NetScope*scope,
case '|': // Bitwise OR
case '&':
case '^':
case 'A': // Bitwise NAND (~&)
case 'O': // Bitwise NOR (~|)
case 'X': // Exclusing NOR
return elaborate_net_bit_(des, scope, width, rise, fall, decay);
case 'E': // === (case equals)
@@ -138,9 +140,9 @@ NetNet* PEBinary::elaborate_net(Design*des, NetScope*scope,
osig = 0;
}
if (NetTmp*tmp = dynamic_cast<NetTmp*>(lsig))
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(lsig))
delete tmp;
if (NetTmp*tmp = dynamic_cast<NetTmp*>(rsig))
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(rsig))
delete tmp;
return osig;
@@ -240,10 +242,10 @@ NetNet* PEBinary::elaborate_net_add_(Design*des, NetScope*scope,
switch (op_) {
case '+':
gate->attribute("LPM_Direction", "ADD");
gate->attribute("LPM_Direction", verinum("ADD"));
break;
case '-':
gate->attribute("LPM_Direction", "SUB");
gate->attribute("LPM_Direction", verinum("SUB"));
break;
}
@@ -340,6 +342,20 @@ NetNet* PEBinary::elaborate_net_bit_(Design*des, NetScope*scope,
}
break;
case 'A': // NAND (~&)
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) {
NetLogic*gate = new NetLogic(scope, scope->local_hsymbol(),
3, NetLogic::NAND);
connect(gate->pin(1), lsig->pin(idx));
connect(gate->pin(2), rsig->pin(idx));
connect(gate->pin(0), osig->pin(idx));
gate->rise_time(rise);
gate->fall_time(fall);
gate->decay_time(decay);
des->add_node(gate);
}
break;
case '|': // Bitwise OR
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) {
NetLogic*gate = new NetLogic(scope, scope->local_hsymbol(),
@@ -354,6 +370,20 @@ NetNet* PEBinary::elaborate_net_bit_(Design*des, NetScope*scope,
}
break;
case 'O': // Bitwise NOR
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) {
NetLogic*gate = new NetLogic(scope, scope->local_hsymbol(),
3, NetLogic::NOR);
connect(gate->pin(1), lsig->pin(idx));
connect(gate->pin(2), rsig->pin(idx));
connect(gate->pin(0), osig->pin(idx));
gate->rise_time(rise);
gate->fall_time(fall);
gate->decay_time(decay);
des->add_node(gate);
}
break;
default:
assert(0);
}
@@ -398,6 +428,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
verinum::V0);
des->add_node(tmp);
zero = new NetNet(scope, scope->local_hsymbol(), NetNet::WIRE);
zero->local_flag(true);
connect(tmp->pin(0), zero->pin(0));
}
@@ -744,7 +775,9 @@ NetNet* PEBinary::elaborate_net_log_(Design*des, NetScope*scope,
/* The reduced logical value is a new nexus, create a
temporary signal to represent it. */
NetNet*tmp = new NetTmp(scope, scope->local_hsymbol());
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
NetNet::IMPLICIT, 1);
tmp->local_flag(true);
connect(gate->pin(1), tmp->pin(0));
des->add_node(gate_t);
@@ -763,7 +796,9 @@ NetNet* PEBinary::elaborate_net_log_(Design*des, NetScope*scope,
/* The reduced logical value is a new nexus, create a
temporary signal to represent it. */
NetNet*tmp = new NetTmp(scope, scope->local_hsymbol());
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
NetNet::IMPLICIT, 1);
tmp->local_flag(true);
connect(gate->pin(2), tmp->pin(0));
des->add_node(gate_t);
@@ -944,7 +979,9 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, NetScope*scope,
if (lsig->pin_count() < lwidth) {
NetConst*zero = new NetConst(scope, scope->local_hsymbol(),
verinum::V0);
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol());
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
NetNet::IMPLICIT, 1);
tmp->local_flag(true);
des->add_node(zero);
connect(zero->pin(0), tmp->pin(0));
for (unsigned idx = lsig->pin_count() ; idx < lwidth ; idx += 1)
@@ -957,7 +994,9 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, NetScope*scope,
connect(rsig->pin(idx), gate->pin_Distance(idx));
if (op_ == 'r') {
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol());
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
NetNet::IMPLICIT, 1);
tmp->local_flag(true);
NetConst*dir = new NetConst(scope, scope->local_hsymbol(),
verinum::V1);
connect(dir->pin(0), gate->pin_Direction());
@@ -1164,7 +1203,7 @@ NetNet* PEConcat::elaborate_net(Design*des, NetScope*scope,
}
/*
* This provate method handles the special case that we have a
* This private method handles the special case that we have a
* non-constant bit-select of an identifier. We already know that the
* signal that is represented is "sig".
*/
@@ -1179,12 +1218,25 @@ NetNet* PEIdent::elaborate_net_bitmux_(Design*des, NetScope*scope,
/* Elaborate the selector. */
NetNet*sel = msb_->elaborate_net(des, scope, 0, 0, 0, 0);
unsigned sig_width = sig->pin_count();
NetMux*mux = new NetMux(scope, scope->local_hsymbol(), 1,
sig->pin_count(),
sel->pin_count());
sig_width, sel->pin_count());
for (unsigned idx = 0 ; idx < sig->pin_count() ; idx += 1)
connect(mux->pin_Data(0, idx), sig->pin(idx));
/* Connect the signal bits to the mux. Account for the
direction of the numbering (lsb to msb vs. msb to lsb) by
swapping the connection order. */
if (sig->msb() > sig->lsb()) {
sel = add_to_net(des, sel, -sig->lsb());
for (unsigned idx = 0 ; idx < sig_width ; idx += 1)
connect(mux->pin_Data(0, idx), sig->pin(idx));
} else {
sel = add_to_net(des, sel, -sig->msb());
for (unsigned idx = 0 ; idx < sig_width ; idx += 1)
connect(mux->pin_Data(0, idx), sig->pin(sig_width-idx-1));
}
for (unsigned idx = 0 ; idx < sel->pin_count() ; idx += 1)
connect(mux->pin_Sel(idx), sel->pin(idx));
@@ -1298,15 +1350,13 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
lidx = tmp;
}
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
sig->type(), midx-lidx+1);
tmp->local_flag(true);
unsigned part_count = midx-lidx+1;
/* Check that the bit or part select of the signal is
within the range of the part. The lidx is the
normalized index of the LSB, so that plus the desired
width must be <= the width of the references signal. */
if ((lidx + tmp->pin_count()) > sig->pin_count()) {
if ((lidx + part_count) > sig->pin_count()) {
cerr << get_line() << ": error: bit/part select ["
<< mval->as_long() << ":" << lval->as_long()
<< "] out of range for " << sig->name() << endl;
@@ -1314,8 +1364,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
return sig;
}
for (unsigned idx = lidx ; idx <= midx ; idx += 1)
connect(tmp->pin(idx-lidx), sig->pin(idx));
NetSubnet*tmp = new NetSubnet(sig, lidx, part_count);
sig = tmp;
@@ -1336,14 +1385,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
idx = 0;
}
/* This is a bit select, create a compatible NetNet with
a single bit that links to the selected bit of the
expression. */
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
sig->type(), 1);
tmp->local_flag(true);
connect(tmp->pin(0), sig->pin(idx));
NetSubnet*tmp = new NetSubnet(sig, idx, 1);
sig = tmp;
}
@@ -1373,15 +1415,19 @@ NetNet* PEIdent::elaborate_net_ram_(Design*des, NetScope*scope,
if (adr == 0)
return 0;
// Memory names are only the base names. Since NetObj names
// are still fullnames, and we are deriving such names from
// the memory name, make a fullname here.
string hname = scope->name() + "." + mem->name();
NetRamDq*ram = new NetRamDq(scope, des->local_symbol(mem->name()),
NetRamDq*ram = new NetRamDq(scope, des->local_symbol(hname),
mem, adr->pin_count());
des->add_node(ram);
for (unsigned idx = 0 ; idx < adr->pin_count() ; idx += 1)
connect(ram->pin_Address(idx), adr->pin(idx));
NetNet*osig = new NetNet(scope, des->local_symbol(mem->name()),
NetNet*osig = new NetNet(scope, des->local_symbol(hname),
NetNet::IMPLICIT, ram->width());
osig->local_flag(true);
@@ -1447,24 +1493,21 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope) const
unsigned lidx = sig->sb_to_idx(lval->as_long());
if (midx >= lidx) {
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
midx-lidx+1);
if (tmp->pin_count() > sig->pin_count()) {
unsigned subnet_wid = midx-lidx+1;
if (subnet_wid > sig->pin_count()) {
cerr << get_line() << ": bit select out of "
<< "range for " << sig->name() << endl;
return sig;
}
for (unsigned idx = lidx ; idx <= midx ; idx += 1)
connect(tmp->pin(idx-lidx), sig->pin(idx));
NetSubnet*tmp = new NetSubnet(sig, lidx, subnet_wid);
sig = tmp;
} else {
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
lidx-midx+1);
unsigned subnet_wid = midx-lidx+1;
if (tmp->pin_count() > sig->pin_count()) {
if (subnet_wid > sig->pin_count()) {
cerr << get_line() << ": error: "
<< "part select out of range for "
<< sig->name() << "." << endl;
@@ -1472,9 +1515,7 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope) const
return sig;
}
assert(tmp->pin_count() <= sig->pin_count());
for (unsigned idx = lidx ; idx >= midx ; idx -= 1)
connect(tmp->pin(idx-midx), sig->pin(idx));
NetSubnet*tmp = new NetSubnet(sig, lidx, subnet_wid);
sig = tmp;
}
@@ -1496,8 +1537,8 @@ NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope) const
des->errors += 1;
idx = 0;
}
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(), 1);
connect(tmp->pin(0), sig->pin(idx));
NetSubnet*tmp = new NetSubnet(sig, idx, 1);
sig = tmp;
}
@@ -1562,24 +1603,26 @@ NetNet* PEIdent::elaborate_port(Design*des, NetScope*scope) const
unsigned lidx = sig->sb_to_idx(lval->as_long());
if (midx >= lidx) {
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
midx-lidx+1);
if (tmp->pin_count() > sig->pin_count()) {
unsigned part_count = midx-lidx+1;
if (part_count > sig->pin_count()) {
cerr << get_line() << ": bit select out of "
<< "range for " << sig->name() << endl;
return sig;
}
NetSubnet*tmp = new NetSubnet(sig, lidx, part_count);
for (unsigned idx = lidx ; idx <= midx ; idx += 1)
connect(tmp->pin(idx-lidx), sig->pin(idx));
sig = tmp;
} else {
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(),
lidx-midx+1);
assert(tmp->pin_count() <= sig->pin_count());
for (unsigned idx = lidx ; idx >= midx ; idx -= 1)
/* XXXX Signals reversed?? */
unsigned part_count = lidx-midx+1;
assert(part_count <= sig->pin_count());
NetSubnet*tmp = new NetSubnet(sig, midx, part_count);
for (unsigned idx = midx ; idx >= lidx ; idx -= 1)
connect(tmp->pin(idx-midx), sig->pin(idx));
sig = tmp;
@@ -1602,7 +1645,7 @@ NetNet* PEIdent::elaborate_port(Design*des, NetScope*scope) const
des->errors += 1;
idx = 0;
}
NetTmp*tmp = new NetTmp(scope, scope->local_hsymbol(), 1);
NetSubnet*tmp = new NetSubnet(sig, idx, 1);
connect(tmp->pin(0), sig->pin(idx));
sig = tmp;
}
@@ -1817,7 +1860,8 @@ NetNet* PETernary::elaborate_net(Design*des, NetScope*scope,
for (unsigned idx = 0; idx < expr_sig->pin_count(); idx += 1)
connect(log->pin(idx+1), expr_sig->pin(idx));
NetNet*tmp = new NetTmp(scope, scope->local_hsymbol());
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
NetNet::IMPLICIT, 1);
tmp->local_flag(true);
connect(tmp->pin(0), log->pin(0));
des->add_node(log);
@@ -1858,12 +1902,39 @@ NetNet* PETernary::elaborate_net(Design*des, NetScope*scope,
NetMux*mux = new NetMux(scope, scope->local_hsymbol(), dwidth, 2, 1);
connect(mux->pin_Sel(0), expr_sig->pin(0));
/* Connect the data inputs. */
for (unsigned idx = 0 ; idx < dwidth ; idx += 1) {
connect(mux->pin_Result(idx), sig->pin(idx));
connect(mux->pin_Data(idx,0), fal_sig->pin(idx));
connect(mux->pin_Data(idx,1), tru_sig->pin(idx));
}
/* If there are non-zero output delays, then create bufz
devices to carry the propagation delays. Otherwise, just
connect the result to the output. */
if (rise || fall || decay) {
NetNet*tmp = new NetNet(scope, scope->local_hsymbol(),
NetNet::WIRE, dwidth);
for (unsigned idx = 0 ; idx < dwidth ; idx += 1) {
NetBUFZ*tmpz = new NetBUFZ(scope, scope->local_hsymbol());
tmpz->rise_time(rise);
tmpz->fall_time(fall);
tmpz->decay_time(decay);
tmpz->pin(0).drive0(drive0);
tmpz->pin(0).drive1(drive1);
connect(mux->pin_Result(idx), tmp->pin(idx));
connect(tmp->pin(idx), tmpz->pin(1));
connect(sig->pin(idx), tmpz->pin(0));
des->add_node(tmpz);
}
} else {
for (unsigned idx = 0 ; idx < dwidth ; idx += 1) {
connect(mux->pin_Result(idx), sig->pin(idx));
}
}
/* If the MUX device result is too narrow to fill out the
desired result, pad with zeros by creating a NetConst device. */
@@ -1911,11 +1982,19 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
if (val == 0)
break;
if (width == 0)
width = val->len();
assert(width > 0);
sig = new NetNet(scope, scope->local_hsymbol(),
NetNet::WIRE, width);
sig->local_flag(true);
verinum tmp(v_not(*val) + verinum(1UL, width), width);
/* Take the 2s complement by taking the 1s complement
and adding 1. */
verinum tmp (v_not(*val));
verinum one (1UL, width);
tmp = tmp + one;
NetConst*con = new NetConst(scope, scope->local_hsymbol(), tmp);
for (unsigned idx = 0 ; idx < width ; idx += 1)
connect(sig->pin(idx), con->pin(idx));
@@ -2042,9 +2121,12 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
case '-': // Unary 2's complement.
sig = new NetNet(scope, scope->local_hsymbol(),
NetNet::WIRE, sub_sig->pin_count());
NetNet::WIRE, owidth);
sig->local_flag(true);
if (sub_sig->pin_count() < owidth)
sub_sig = pad_to_width(des, sub_sig, owidth);
switch (sub_sig->pin_count()) {
case 0:
assert(0);
@@ -2083,10 +2165,33 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
break;
default:
cerr << get_line() << ": internal error: Wide unary "
<< "minus not supported here." << endl;
des->errors += 1;
sig = 0;
NetAddSub*sub = new NetAddSub(scope, scope->local_hsymbol(),
sig->pin_count());
sub->attribute("LPM_Direction", verinum("SUB"));
des->add_node(sub);
for (unsigned idx = 0 ; idx < sig->pin_count(); idx += 1)
connect(sig->pin(idx), sub->pin_Result(idx));
for (unsigned idx = 0; idx < sub_sig->pin_count(); idx += 1)
connect(sub_sig->pin(idx), sub->pin_DataB(idx));
verinum tmp_num (verinum::V0, sub->width(), true);
NetConst*tmp_con = new NetConst(scope,
scope->local_hsymbol(),
tmp_num);
des->add_node(tmp_con);
NetNet*tmp_sig = new NetNet(scope, scope->local_hsymbol(),
NetNet::WIRE,
sub_sig->pin_count());
tmp_sig->local_flag(true);
for (unsigned idx = 0; idx < sig->pin_count(); idx += 1) {
connect(tmp_sig->pin(idx), sub->pin_DataA(idx));
connect(tmp_sig->pin(idx), tmp_con->pin(idx));
}
break;
}
break;
@@ -2102,6 +2207,47 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
* Revision 1.101 2002/09/18 04:29:55 steve
* Add support for binary NOR operator.
*
* Revision 1.100 2002/09/12 15:49:43 steve
* Add support for binary nand operator.
*
* Revision 1.99 2002/09/08 01:37:13 steve
* Fix padding of operand of unary minus.
*
* Revision 1.98 2002/08/31 03:48:50 steve
* Fix reverse bit ordered bit select in continuous assignment.
*
* Revision 1.97 2002/08/21 02:28:03 steve
* Carry mux output delays.
*
* Revision 1.96 2002/08/14 03:57:27 steve
* Constants can self-size themselves in unsized contexts.
*
* Revision 1.95 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.94 2002/08/05 04:18:45 steve
* Store only the base name of memories.
*
* Revision 1.93 2002/07/05 21:26:17 steve
* Avoid emitting to vvp local net symbols.
*
* Revision 1.92 2002/06/22 04:22:40 steve
* Wide unary minus in continuous assignments.
*
* Revision 1.91 2002/06/19 04:20:03 steve
* Remove NetTmp and add NetSubnet class.
*
* Revision 1.90 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.89 2002/04/23 03:53:59 steve
* Add support for non-constant bit select.
*
@@ -2119,38 +2265,5 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
*
* Revision 1.84 2001/12/31 04:23:59 steve
* Elaborate multiply nets with constant operands ad NetConst.
*
* Revision 1.83 2001/12/30 21:32:03 steve
* Support elaborate_net for PEString objects.
*
* Revision 1.82 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
*
* Revision 1.81 2001/11/10 02:08:49 steve
* Coerse input to inout when assigned to.
*
* Revision 1.80 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.79 2001/11/07 04:26:46 steve
* elaborate_lnet uses scope instead of string path.
*
* Revision 1.78 2001/11/07 04:01:59 steve
* eval_const uses scope instead of a string path.
*
* Revision 1.77 2001/10/28 01:14:53 steve
* NetObj constructor finally requires a scope.
*
* Revision 1.76 2001/10/16 02:19:26 steve
* Support IVL_LPM_DIVIDE for structural divide.
*
* Revision 1.75 2001/09/14 04:20:49 steve
* dead code.
*
* Revision 1.74 2001/09/14 04:16:52 steve
* Elaborate == to NetCompare instead of XNOR and AND
* gates. This allows code generators to generate
* better code in certain cases.
*/
+27 -16
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_pexpr.cc,v 1.13 2002/01/28 00:52:41 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_pexpr.cc,v 1.16 2002/08/12 01:34:59 steve Exp $"
#endif
# include "config.h"
@@ -66,28 +66,21 @@ NetExpr*PEBinary::elaborate_pexpr (Design*des, NetScope*scope) const
*/
NetEConcat* PEConcat::elaborate_pexpr(Design*des, NetScope*scope) const
{
unsigned repeat = 1;
NetExpr* repeat = 0;
/* If there is a repeat expression, then evaluate the constant
value and set the repeat count.
XXXX Potential bug XXX In principle, the repeat expression
can have a parameter name in it. Since where are in the
working of parameters now, we will not be able to
accurately evaluate such expressions. So eventually, I will
need to be able to defer the evaluation of the expression. */
value and set the repeat count. */
if (repeat_) {
verinum*vrep = repeat_->eval_const(des, scope);
if (vrep == 0) {
repeat = repeat_->elaborate_pexpr(des, scope);
if (repeat == 0) {
cerr << get_line() << ": error: "
"concatenation repeat expression cannot be evaluated."
<< endl;
des->errors += 1;
return 0;
}
repeat = vrep->as_ulong();
delete vrep;
/* continue on even if the repeat expression doesn't
work, as we can find more errors. */
}
/* Make the empty concat expression. */
@@ -104,7 +97,12 @@ NetEConcat* PEConcat::elaborate_pexpr(Design*des, NetScope*scope) const
ex->set_line(*parms_[idx]);
if (! ex->has_width()) {
if (dynamic_cast<NetEParam*>(ex)) {
/* If this parameter is a NetEParam, then put off
the width check for later. */
} else if (! ex->has_width()) {
cerr << ex->get_line() << ": error: operand of "
<< "concatenation has indefinite width: "
<< *ex << endl;
@@ -224,6 +222,19 @@ NetExpr*PEUnary::elaborate_pexpr (Design*des, NetScope*scope) const
/*
* $Log: elab_pexpr.cc,v $
* Revision 1.16 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.15 2002/05/06 02:30:27 steve
* Allow parameters in concatenation of widths are defined.
*
* Revision 1.14 2002/05/05 21:11:50 steve
* Put off evaluation of concatenation repeat expresions
* until after parameters are defined. This allows parms
* to be used in repeat expresions.
*
* Add the builtin $signed system function.
*
* Revision 1.13 2002/01/28 00:52:41 steve
* Add support for bit select of parameters.
* This leads to a NetESelect node and the
+54 -12
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_scope.cc,v 1.13 2001/12/30 04:47:57 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_scope.cc,v 1.17 2002/10/19 22:59:49 steve Exp $"
#endif
# include "config.h"
@@ -54,7 +54,7 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
// the pform and just place a NetEParam placeholder in the
// place of the elaborated expression.
typedef map<string,PExpr*>::const_iterator mparm_it_t;
typedef map<string,param_expr_t>::const_iterator mparm_it_t;
typedef map<hname_t,PExpr*>::const_iterator hparm_it_t;
@@ -64,13 +64,21 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
for (mparm_it_t cur = parameters.begin()
; cur != parameters.end() ; cur ++) {
scope->set_parameter((*cur).first, new NetEParam);
NetEParam*tmp = new NetEParam;
if ((*cur).second.msb)
tmp->cast_signed( (*cur).second.signed_flag );
scope->set_parameter((*cur).first, tmp, 0, 0, false);
}
for (mparm_it_t cur = localparams.begin()
; cur != localparams.end() ; cur ++) {
scope->set_parameter((*cur).first, new NetEParam);
NetEParam*tmp = new NetEParam;
if ((*cur).second.msb)
tmp->cast_signed( (*cur).second.signed_flag );
scope->set_parameter((*cur).first, tmp, 0, 0, false);
}
@@ -82,11 +90,29 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
for (mparm_it_t cur = parameters.begin()
; cur != parameters.end() ; cur ++) {
PExpr*ex = (*cur).second;
PExpr*ex = (*cur).second.expr;
assert(ex);
NetExpr*val = ex->elaborate_pexpr(des, scope);
val = scope->set_parameter((*cur).first, val);
NetExpr*msb = 0;
NetExpr*lsb = 0;
bool signed_flag = false;
/* If the parameter declaration includes msb and lsb,
then use them to calculate a width for the
result. Then make sure the constant expression of the
parameter value is coerced to have the correct
and defined width. */
if ((*cur).second.msb) {
msb = (*cur).second.msb ->elaborate_pexpr(des, scope);
assert(msb);
lsb = (*cur).second.lsb ->elaborate_pexpr(des, scope);
signed_flag = (*cur).second.signed_flag;
}
val->cast_signed(signed_flag);
val = scope->set_parameter((*cur).first, val,
msb, lsb, signed_flag);
assert(val);
delete val;
}
@@ -94,11 +120,11 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
for (mparm_it_t cur = localparams.begin()
; cur != localparams.end() ; cur ++) {
PExpr*ex = (*cur).second;
PExpr*ex = (*cur).second.expr;
assert(ex);
NetExpr*val = ex->elaborate_pexpr(des, scope);
val = scope->set_parameter((*cur).first, val);
val = scope->set_parameter((*cur).first, val, 0, 0, false);
assert(val);
delete val;
}
@@ -306,9 +332,12 @@ void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const
PExpr*tmp = (*cur).second;
NetExpr*val = tmp->elaborate_pexpr(des, sc);
val = my_scope->set_parameter((*cur).first, val);
assert(val);
delete val;
bool flag = my_scope->replace_parameter((*cur).first, val);
if (! flag) {
cerr << val->get_line() << ": warning: parameter "
<< (*cur).first << " not found in "
<< sc->name() << "." << endl;
}
}
}
@@ -467,6 +496,19 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const
/*
* $Log: elab_scope.cc,v $
* Revision 1.17 2002/10/19 22:59:49 steve
* Redo the parameter vector support to allow
* parameter names in range expressions.
*
* Revision 1.16 2002/09/01 03:01:48 steve
* Properly cast signedness of parameters with ranges.
*
* Revision 1.15 2002/08/19 02:39:16 steve
* Support parameters with defined ranges.
*
* Revision 1.14 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.13 2001/12/30 04:47:57 steve
* Properly handle empty target in positionla parameter override.
*
+34 -8
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_sig.cc,v 1.20 2002/01/26 05:28:28 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_sig.cc,v 1.25 2002/08/12 01:34:59 steve Exp $"
#endif
# include "config.h"
@@ -71,8 +71,8 @@ bool Module::elaborate_sig(Design*des, NetScope*scope) const
// Scan all the ports of the module, and make sure that each
// is connected to wires that have port declarations.
for (unsigned idx = 0 ; idx < ports_.count() ; idx += 1) {
Module::port_t*pp = ports_[idx];
for (unsigned idx = 0 ; idx < ports.count() ; idx += 1) {
Module::port_t*pp = ports[idx];
if (pp == 0)
continue;
@@ -122,7 +122,7 @@ bool Module::elaborate_sig(Design*des, NetScope*scope) const
hname_t name = (*wt).first;
if (! signal_is_in_port(ports_, name)) {
if (! signal_is_in_port(ports, name)) {
cerr << cur->get_line() << ": error: Signal "
<< name << " has a declared direction "
@@ -475,6 +475,10 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
}
unsigned nattrib = 0;
attrib_list_t*attrib_list = evaluate_attributes(attributes, nattrib,
des, scope);
if (lidx_ || ridx_) {
assert(lidx_ && ridx_);
@@ -494,8 +498,7 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
assert(lval);
assert(rval);
string name = scope->name();
name = name + "." + hname_.peek_tail_name();
string name = hname_.peek_tail_name();
long lnum = lval->as_long();
long rnum = rval->as_long();
@@ -513,12 +516,35 @@ void PWire::elaborate_sig(Design*des, NetScope*scope) const
sig->set_line(*this);
sig->port_type(port_type_);
sig->set_signed(get_signed());
sig->set_attributes(attributes);
sig->set_isint(get_isint());
for (unsigned idx = 0 ; idx < nattrib ; idx += 1)
sig->attribute(attrib_list[idx].key, attrib_list[idx].val);
}
}
/*
* $Log: elab_sig.cc,v $
* Revision 1.25 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.24 2002/08/05 04:18:45 steve
* Store only the base name of memories.
*
* Revision 1.23 2002/06/21 04:59:35 steve
* Carry integerness throughout the compilation.
*
* Revision 1.22 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.21 2002/05/19 23:37:28 steve
* Parse port_declaration_lists from the 2001 Standard.
*
* Revision 1.20 2002/01/26 05:28:28 steve
* Detect scalar/vector declarion mismatch.
*
+185 -225
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elaborate.cc,v 1.246 2002/04/24 17:40:48 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: elaborate.cc,v 1.263 2002/08/28 18:54:36 steve Exp $"
#endif
# include "config.h"
@@ -40,6 +40,7 @@
# include "parse_api.h"
# include "compiler.h"
static Link::strength_t drive_type(PGate::strength_t drv)
{
switch (drv) {
@@ -121,7 +122,44 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
if (rid->pin_count() < cnt)
cnt = rid->pin_count();
if ((rid->type() == lval->type()) && (rise_time == 0)) {
bool need_driver_flag = false;
/* If the device is linked to itself, a driver is
needed. Should I print a warning here? */
for (unsigned idx = 0 ; idx < cnt ; idx += 1) {
if (lval->pin(idx) .is_linked (rid->pin(idx))) {
need_driver_flag = true;
break;
}
}
/* If the nets are different type (i.e. reg vs tri) then
a driver is needed. */
if (rid->type() != lval->type())
need_driver_flag = true;
/* If there is a delay, then I need a driver to carry
it. */
if (rise_time || fall_time || decay_time)
need_driver_flag = true;
/* If there is a strength to be carried, then I need a
driver to carry that strength. */
for (unsigned idx = 0 ; idx < cnt ; idx += 1) {
if (rid->pin(idx).drive0() != drive0) {
need_driver_flag = true;
break;
}
if (rid->pin(idx).drive1() != drive1) {
need_driver_flag = true;
break;
}
}
if (! need_driver_flag) {
/* Don't need a driver, presumably because the
r-value already has the needed drivers. Just
hook things up. */
unsigned idx;
for (idx = 0 ; idx < cnt; idx += 1)
connect(lval->pin(idx), rid->pin(idx));
@@ -137,6 +175,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
}
} else {
/* Do need a driver. Use BUFZ objects to carry the
strength and delays. */
unsigned idx;
for (idx = 0 ; idx < cnt ; idx += 1) {
NetBUFZ*dev = new NetBUFZ(scope,
@@ -265,6 +305,11 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
unsigned long rise_time, fall_time, decay_time;
eval_delays(des, scope, rise_time, fall_time, decay_time);
struct attrib_list_t*attrib_list = 0;
unsigned attrib_list_n = 0;
attrib_list = evaluate_attributes(attributes, attrib_list_n,
des, scope);
/* Now make as many gates as the bit count dictates. Give each
a unique name, and set the delay times. */
@@ -359,7 +404,10 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
return;
}
cur[idx]->set_attributes(attributes);
for (unsigned adx = 0 ; adx < attrib_list_n ; adx += 1)
cur[idx]->attribute(attrib_list[adx].key,
attrib_list[adx].val);
cur[idx]->rise_time(rise_time);
cur[idx]->fall_time(fall_time);
cur[idx]->decay_time(decay_time);
@@ -370,6 +418,9 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
des->add_node(cur[idx]);
}
delete[]attrib_list;
/* The gates have all been allocated, this loop runs through
the parameters and attaches the ports of the objects. */
@@ -397,7 +448,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
des->errors += 1;
}
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(sig))
delete tmp;
}
}
@@ -593,9 +644,10 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
// not, they are different widths. Note that idx is 0
// based, but users count parameter positions from 1.
if (prts_pin_count != sig->pin_count()) {
cerr << get_line() << ": warning: Port " << (idx+1) << " of "
cerr << get_line() << ": warning: Port " << (idx+1)
<< " (" << rmod->ports[idx]->name << ") of "
<< type_ << " expects " << prts_pin_count <<
" pins, got " << sig->pin_count() << "." << endl;
" bits, got " << sig->pin_count() << "." << endl;
if (prts_pin_count > sig->pin_count()) {
cerr << get_line() << ": : Leaving "
@@ -605,7 +657,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
} else {
cerr << get_line() << ": : Leaving "
<< (sig->pin_count()-prts_pin_count)
<< " high bits of the parameter dangling."
<< " high bits of the expression dangling."
<< endl;
}
}
@@ -644,7 +696,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
}
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(sig))
delete tmp;
}
}
@@ -676,11 +728,20 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
NetUDP*net = new NetUDP(scope, my_name, udp->ports.count(), udp);
net->set_attributes(udp->attributes);
net->rise_time(rise_time);
net->fall_time(fall_time);
net->decay_time(decay_time);
struct attrib_list_t*attrib_list = 0;
unsigned attrib_list_n = 0;
attrib_list = evaluate_attributes(attributes, attrib_list_n,
des, scope);
for (unsigned adx = 0 ; adx < attrib_list_n ; adx += 1)
net->attribute(attrib_list[adx].key, attrib_list[adx].val);
delete[]attrib_list;
/* Run through the pins, making netlists for the pin
expressions and connecting them to the pin in question. All
of this is independent of the nature of the UDP. */
@@ -698,7 +759,7 @@ void PGModule::elaborate_udp_(Design*des, PUdp*udp, NetScope*scope) const
connect(sig->pin(0), net->pin(idx));
// Delete excess holding signal.
if (NetTmp*tmp = dynamic_cast<NetTmp*>(sig))
if (NetSubnet*tmp = dynamic_cast<NetSubnet*>(sig))
delete tmp;
}
@@ -842,37 +903,10 @@ NetProc* Statement::elaborate(Design*des, NetScope*) const
return cur;
}
NetProc* PAssign::assign_to_memory_(NetMemory*mem, PExpr*ix,
Design*des, NetScope*scope) const
{
assert(scope);
NetExpr*rv = rval()->elaborate_expr(des, scope);
if (rv == 0)
return 0;
assert(rv);
rv->set_width(mem->width());
if (ix == 0) {
cerr << get_line() << ": internal error: No index in lval "
<< "of assignment to memory?" << endl;
return 0;
}
assert(ix);
NetExpr*idx = ix->elaborate_expr(des, scope);
assert(idx);
if (rv->expr_width() < mem->width())
rv = pad_to_width(rv, mem->width());
NetAssignMem*am = new NetAssignMem(mem, idx, rv);
am->set_line(*this);
return am;
}
NetAssign_* PAssign_::elaborate_lval(Design*des, NetScope*scope) const
{
assert(lval_);
return lval_->elaborate_lval(des, scope);
}
@@ -931,22 +965,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
{
assert(scope);
/* Catch the case where the lvalue is a reference to a memory
item. These are handled differently. */
do {
const PEIdent*id = dynamic_cast<const PEIdent*>(lval());
if (id == 0) break;
NetNet*net = des->find_signal(scope, id->path());
if (net && (net->scope() == scope))
break;
if (NetMemory*mem = des->find_memory(scope, id->path()))
return assign_to_memory_(mem, id->msb_, des, scope);
} while(0);
/* elaborate the lval. This detects any part selects and mux
expressions that might exist. */
NetAssign_*lv = elaborate_lval(des, scope);
@@ -1053,7 +1071,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
}
/* And build up the complex statement. */
NetBlock*bl = new NetBlock(NetBlock::SEQU);
NetBlock*bl = new NetBlock(NetBlock::SEQU, 0);
bl->append(a1);
bl->append(st);
@@ -1072,36 +1090,6 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
return cur;
}
/*
* I do not really know how to elaborate mem[x] <= expr, so this
* method pretends it is a blocking assign and elaborates
* that. However, I report an error so that the design isn't actually
* executed by anyone.
*/
NetProc* PAssignNB::assign_to_memory_(NetMemory*mem, PExpr*ix,
Design*des, NetScope*scope) const
{
assert(scope);
/* Elaborate the r-value expression, ... */
NetExpr*rv = rval()->elaborate_expr(des, scope);
if (rv == 0)
return 0;
assert(rv);
rv->set_width(mem->width());
/* Elaborate the expression to calculate the index, ... */
NetExpr*idx = ix->elaborate_expr(des, scope);
assert(idx);
/* And connect them together in an assignment NetProc. */
NetAssignMemNB*am = new NetAssignMemNB(mem, idx, rv);
am->set_line(*this);
return am;
}
/*
* The l-value of a procedural assignment is a very much constrained
* expression. To wit, only identifiers, bit selects and part selects
@@ -1114,28 +1102,27 @@ NetProc* PAssignNB::elaborate(Design*des, NetScope*scope) const
{
assert(scope);
/* Catch the case where the lvalue is a reference to a memory
item. These are handled differently. */
do {
const PEIdent*id = dynamic_cast<const PEIdent*>(lval());
if (id == 0) break;
if (NetMemory*mem = des->find_memory(scope, id->path()))
return assign_to_memory_(mem, id->msb_, des, scope);
} while(0);
NetAssign_*lv = elaborate_lval(des, scope);
if (lv == 0) return 0;
assert(rval());
/* Elaborate the r-value expression. This generates a
procedural expression that I attach to the assignment. */
NetExpr*rv = rval()->elaborate_expr(des, scope);
if (rv == 0)
NetExpr*rv;
/* Evaluate the rval expression if possible, otherwise just
elaborate it. */
if (verinum*val = rval()->eval_const(des, scope)) {
rv = new NetEConst(*val);
delete val;
} else if (rv = rval()->elaborate_expr(des, scope)) {
/* OK, go on. */
} else {
/* Unable to elaborate expression. Retreat. */
return 0;
}
assert(rv);
@@ -1169,10 +1156,8 @@ NetProc* PBlock::elaborate(Design*des, NetScope*scope) const
NetBlock::Type type = (bl_type_==PBlock::BL_PAR)
? NetBlock::PARA
: NetBlock::SEQU;
NetBlock*cur = new NetBlock(type);
bool fail_flag = false;
NetScope*nscope;
NetScope*nscope = 0;
if (name_.length()) {
nscope = scope->child(name_);
if (nscope == 0) {
@@ -1180,19 +1165,24 @@ NetProc* PBlock::elaborate(Design*des, NetScope*scope) const
"unable to find block scope " << scope->name()
<< "<" << name_ << ">" << endl;
des->errors += 1;
delete cur;
return 0;
}
assert(nscope);
} else {
nscope = scope;
}
NetBlock*cur = new NetBlock(type, nscope);
bool fail_flag = false;
if (nscope == 0)
nscope = scope;
// Handle the special case that the block contains only one
// statement. There is no need to keep the block node.
if (list_.count() == 1) {
// statement. There is no need to keep the block node. Also,
// don't elide named blocks, because they might be referenced
// elsewhere.
if ((list_.count() == 1) && (name_.length() == 0)) {
assert(list_[0]);
NetProc*tmp = list_[0]->elaborate(des, nscope);
return tmp;
@@ -1345,7 +1335,7 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const
else if (else_)
return else_->elaborate(des, scope);
else
return new NetBlock(NetBlock::SEQU);
return new NetBlock(NetBlock::SEQU, 0);
}
// If the condition expression is more then 1 bits, then
@@ -1389,20 +1379,27 @@ NetProc* PCallTask::elaborate(Design*des, NetScope*scope) const
* A call to a system task involves elaborating all the parameters,
* then passing the list to the NetSTask object.
*XXXX
* There is a single special in the call to a system task. Normally,
* an expression cannot take an unindexed memory. However, it is
* possible to take a system task parameter a memory if the expression
* is trivial.
* There is a single special case in the call to a system
* task. Normally, an expression cannot take an unindexed
* memory. However, it is possible to take a system task parameter a
* memory if the expression is trivial.
*/
NetProc* PCallTask::elaborate_sys(Design*des, NetScope*scope) const
{
assert(scope);
svector<NetExpr*>eparms (nparms());
unsigned parm_count = nparms();
for (unsigned idx = 0 ; idx < nparms() ; idx += 1) {
/* Catch the special case that the system task has no
parameters. The "()" string will be parsed as a single
empty parameter, when we really mean no parameters at all. */
if ((nparms() == 1) && (parm(0) == 0))
parm_count = 0;
svector<NetExpr*>eparms (parm_count);
for (unsigned idx = 0 ; idx < parm_count ; idx += 1) {
PExpr*ex = parm(idx);
eparms[idx] = ex? ex->elaborate_expr(des, scope, true) : 0;
}
@@ -1478,7 +1475,7 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
return cur;
}
NetBlock*block = new NetBlock(NetBlock::SEQU);
NetBlock*block = new NetBlock(NetBlock::SEQU, 0);
/* Detect the case where the definition of the task is known
@@ -1533,22 +1530,6 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
if (port->port_type() == NetNet::PINPUT)
continue;
/* Handle the special case that the output parameter is
a memory word. Generate a NetAssignMem instead of a
NetAssign. */
NetMemory*mem;
const PEIdent*id = dynamic_cast<const PEIdent*>(parms_[idx]);
if (id && (mem = des->find_memory(scope, id->path()))) {
NetExpr*ix = id->msb_->elaborate_expr(des, scope);
assert(ix);
NetExpr*rx = new NetESignal(port);
NetAssignMem*am = new NetAssignMem(mem, ix, rx);
block->append(am);
continue;
}
/* Elaborate an l-value version of the port expression
for output and inout ports. If the expression does
@@ -1858,8 +1839,10 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
des->add_node(po);
/* We want to wait only if the expression is something
other then 1 (0,x,z) . */
NetESignal*ce = new NetESignal(ex);
NetCondit*co = new NetCondit(new NetEUnary('!', ce), we, 0);
NetCondit*co = new NetCondit(ce, 0, we);
ev->set_line(*this);
we->set_line(*this);
@@ -1872,7 +1855,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
block to join the wait and the statement. */
if (enet) {
NetBlock*bl = new NetBlock(NetBlock::SEQU);
NetBlock*bl = new NetBlock(NetBlock::SEQU, 0);
bl->set_line(*this);
bl->append(co);
bl->append(enet);
@@ -1890,7 +1873,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
assert(expr_[0]->expr());
PEIdent*id = dynamic_cast<PEIdent*>(expr_[0]->expr());
NetEvent*ev;
if (id && (ev = scope->find_event(id->path()))) {
if (id && (ev = des->find_event(scope, id->path()))) {
NetEvWait*pr = new NetEvWait(enet);
pr->add_event(ev);
pr->set_line(*this);
@@ -1950,7 +1933,7 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
skip the rest of the expression handling. */
if (PEIdent*id = dynamic_cast<PEIdent*>(expr_[idx]->expr())) {
NetEvent*tmp = scope->find_event(id->path());
NetEvent*tmp = des->find_event(scope, id->path());
if (tmp) {
wa->add_event(tmp);
continue;
@@ -2009,15 +1992,13 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
expression (and not a named event) then add this
event. Otherwise, we didn't use it so delete it. */
if (expr_count > 0) {
if (NetEvent*match = ev->find_similar_event()) {
delete ev;
wa->add_event(match);
} else {
scope->add_event(ev);
wa->add_event(ev);
}
scope->add_event(ev);
wa->add_event(ev);
/* NOTE: This event that I am adding to the wait may be
a duplicate of another event somewhere else. However,
I don't know that until all the modules are hooked
up, so it is best to leave find_similar_event to
after elaboration. */
} else {
delete ev;
}
@@ -2099,7 +2080,7 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const
const PEIdent*id2 = dynamic_cast<const PEIdent*>(name2_);
assert(id2);
NetBlock*top = new NetBlock(NetBlock::SEQU);
NetBlock*top = new NetBlock(NetBlock::SEQU, 0);
/* make the expression, and later the initial assignment to
the condition variable. The statement in the for loop is
@@ -2123,7 +2104,7 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const
top->append(init);
NetBlock*body = new NetBlock(NetBlock::SEQU);
NetBlock*body = new NetBlock(NetBlock::SEQU, 0);
/* Elaborate the statement that is contained in the for
loop. If there is an error, this will return 0 and I should
@@ -2253,7 +2234,7 @@ NetProc* PRepeat::elaborate(Design*des, NetScope*scope) const
case 0:
delete expr;
delete stat;
return new NetBlock(NetBlock::SEQU);
return new NetBlock(NetBlock::SEQU, 0);
case 1:
delete expr;
return stat;
@@ -2304,7 +2285,7 @@ void PTask::elaborate(Design*des, NetScope*task) const
NetProc*st;
if (statement_ == 0) {
cerr << get_line() << ": warning: task has no statement." << endl;
st = new NetBlock(NetBlock::SEQU);
st = new NetBlock(NetBlock::SEQU, 0);
} else {
@@ -2324,7 +2305,7 @@ NetProc* PTrigger::elaborate(Design*des, NetScope*scope) const
{
assert(scope);
NetEvent*ev = scope->find_event(event_);
NetEvent*ev = des->find_event(scope, event_);
if (ev == 0) {
cerr << get_line() << ": error: event <" << event_ << ">"
<< " not found." << endl;
@@ -2390,7 +2371,9 @@ bool Module::elaborate(Design*des, NetScope*scope) const
(*gt)->elaborate(des, scope);
}
// Elaborate the behaviors, making processes out of them.
// Elaborate the behaviors, making processes out of them. This
// involves scanning the PProcess* list, creating a NetProcTop
// for each process.
const list<PProcess*>&sl = get_behaviors();
for (list<PProcess*>::const_iterator st = sl.begin()
@@ -2413,6 +2396,21 @@ bool Module::elaborate(Design*des, NetScope*scope) const
break;
}
// Evaluate the attributes for this process, if there
// are any. These attributes are to be attached to the
// NetProcTop object.
struct attrib_list_t*attrib_list = 0;
unsigned attrib_list_n = 0;
attrib_list = evaluate_attributes((*st)->attributes,
attrib_list_n,
des, scope);
for (unsigned adx = 0 ; adx < attrib_list_n ; adx += 1)
top->attribute(attrib_list[adx].key,
attrib_list[adx].val);
delete[]attrib_list;
top->set_line(*(*st));
des->add_process(top);
}
@@ -2524,87 +2522,49 @@ Design* elaborate(list<const char*>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.246 2002/04/24 17:40:48 steve
* Agressively evalutate case expressions.
* Revision 1.263 2002/08/28 18:54:36 steve
* Evaluate nonblocking assign r-values.
*
* Revision 1.245 2002/04/22 00:53:39 steve
* Do not allow implicit wires in sensitivity lists.
* Revision 1.262 2002/08/15 02:11:54 steve
* Handle special case of empty system task argument list.
*
* Revision 1.244 2002/04/21 22:31:02 steve
* Redo handling of assignment internal delays.
* Leave it possible for them to be calculated
* at run time.
* Revision 1.261 2002/08/13 05:35:00 steve
* Do not elide named blocks.
*
* Revision 1.243 2002/04/21 04:59:07 steve
* Add support for conbinational events by finding
* the inputs to expressions and some statements.
* Get case and assignment statements working.
* Revision 1.260 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.242 2002/04/13 02:33:17 steve
* Detect missing indices to memories (PR#421)
* Revision 1.259 2002/07/31 23:55:38 steve
* Add port name to pin size error message.
*
* Revision 1.241 2002/03/09 04:02:26 steve
* Constant expressions are not l-values for task ports.
* Revision 1.258 2002/07/24 16:22:59 steve
* Save event matching for nodangle.
*
* Revision 1.240 2002/01/23 05:56:22 steve
* elaborate deassign lval as done for assign.
* Revision 1.257 2002/07/18 02:06:37 steve
* Need driver for sure in assign feedback and other cases.
*
* Revision 1.239 2002/01/19 20:09:56 steve
* Evaluate case guards, if possible.
* Revision 1.256 2002/07/18 00:24:22 steve
* Careful with assign to self.
*
* Revision 1.238 2001/12/31 00:39:20 steve
* Remove test print
* Revision 1.255 2002/07/03 05:34:59 steve
* Fix scope search for events.
*
* Revision 1.237 2001/12/29 20:19:31 steve
* Do not delete delay expressions of UDP instances.
* Revision 1.254 2002/06/19 04:20:03 steve
* Remove NetTmp and add NetSubnet class.
*
* Revision 1.236 2001/12/06 05:04:49 steve
* Forgot to evaluate UDP delays.
* Revision 1.253 2002/06/05 03:44:25 steve
* Add support for memory words in l-value of
* non-blocking assignments, and remove the special
* NetAssignMem_ and NetAssignMemNB classes.
*
* Revision 1.235 2001/12/06 04:44:11 steve
* Support delays on UDP instances.
* Revision 1.252 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.234 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
*
* Revision 1.233 2001/11/22 06:20:59 steve
* Use NetScope instead of string for scope path.
*
* Revision 1.232 2001/11/08 05:15:50 steve
* Remove string paths from PExpr elaboration.
*
* Revision 1.231 2001/11/07 04:26:46 steve
* elaborate_lnet uses scope instead of string path.
*
* Revision 1.230 2001/11/07 04:01:59 steve
* eval_const uses scope instead of a string path.
*
* Revision 1.229 2001/11/04 23:12:29 steve
* Pad limited r-values in continuous assignments.
*
* Revision 1.228 2001/10/31 03:22:31 steve
* Give up if roots are missing.
*
* Revision 1.227 2001/10/28 01:14:53 steve
* NetObj constructor finally requires a scope.
*
* Revision 1.226 2001/10/22 23:26:37 steve
* Better error message for mising root module.
*
* Revision 1.225 2001/10/22 02:05:20 steve
* Handle activating tasks in another root.
*
* Revision 1.224 2001/10/21 00:42:47 steve
* Module types in pform are char* instead of string.
*
* Revision 1.223 2001/10/20 23:02:40 steve
* Add automatic module libraries.
*
* Revision 1.222 2001/10/20 05:21:51 steve
* Scope/module names are char* instead of string.
*
* Revision 1.221 2001/10/19 21:53:24 steve
* Support multiple root modules (Philip Blundell)
* Revision 1.251 2002/05/27 00:08:45 steve
* Support carrying the scope of named begin-end
* blocks down to the code generator, and have
* the vvp code generator use that to support disable.
*/
+15 -14
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: emit.cc,v 1.66 2002/03/09 02:10:22 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: emit.cc,v 1.69 2002/08/12 01:34:59 steve Exp $"
#endif
# include "config.h"
@@ -161,18 +161,6 @@ bool NetAssignNB::emit_proc(struct target_t*tgt) const
return true;
}
bool NetAssignMem::emit_proc(struct target_t*tgt) const
{
tgt->proc_assign_mem(this);
return true;
}
bool NetAssignMemNB::emit_proc(struct target_t*tgt) const
{
tgt->proc_assign_mem_nb(this);
return true;
}
bool NetBlock::emit_proc(struct target_t*tgt) const
{
return tgt->proc_block(this);
@@ -487,6 +475,19 @@ bool emit(const Design*des, const char*type)
/*
* $Log: emit.cc,v $
* Revision 1.69 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.68 2002/06/05 03:44:25 steve
* Add support for memory words in l-value of
* non-blocking assignments, and remove the special
* NetAssignMem_ and NetAssignMemNB classes.
*
* Revision 1.67 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.66 2002/03/09 02:10:22 steve
* Add the NetUserFunc netlist node.
*
+41 -8
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: eval.cc,v 1.26 2001/12/29 22:10:10 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval.cc,v 1.32 2002/10/19 22:59:49 steve Exp $"
#endif
# include "config.h"
@@ -142,16 +142,20 @@ verinum* PEIdent::eval_const(const Design*des, const NetScope*scope) const
if (expr == 0)
return 0;
assert(msb_ == 0);
if (dynamic_cast<const NetEParam*>(expr)) {
cerr << get_line() << ": sorry: I cannot evaluate ``" <<
path_ << "'' in this scope: " << scope->name() << endl;
const NetEConst*eval = dynamic_cast<const NetEConst*>(expr);
if (eval == 0) {
cerr << get_line() << ": internal error: Unable to evaluate "
<< "constant expression (parameter=" << path_
<< "): " << *expr << endl;
return 0;
}
const NetEConst*eval = dynamic_cast<const NetEConst*>(expr);
assert(eval);
if (msb_ || lsb_)
return 0;
return new verinum(eval->value());
}
@@ -166,6 +170,11 @@ verinum* PENumber::eval_const(const Design*, const NetScope*) const
return new verinum(value());
}
verinum* PEString::eval_const(const Design*, const NetScope*) const
{
return new verinum(string(text_));
}
verinum* PETernary::eval_const(const Design*des, const NetScope*scope) const
{
verinum*test = expr_->eval_const(des, scope);
@@ -217,6 +226,30 @@ verinum* PEUnary::eval_const(const Design*des, const NetScope*scope) const
/*
* $Log: eval.cc,v $
* Revision 1.32 2002/10/19 22:59:49 steve
* Redo the parameter vector support to allow
* parameter names in range expressions.
*
* Revision 1.31 2002/10/13 05:01:07 steve
* More verbose eval_const assert message.
*
* Revision 1.30 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.29 2002/06/07 02:57:54 steve
* Simply give up on constants with indices.
*
* Revision 1.28 2002/06/06 18:57:04 steve
* Better error for identifier index eval.
*
* Revision 1.27 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.26 2001/12/29 22:10:10 steve
* constant eval of arithmetic with x and z.
*
+98
View File
@@ -0,0 +1,98 @@
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_attrib.cc,v 1.5 2002/08/12 01:34:59 steve Exp $"
#endif
# include "config.h"
# include "util.h"
# include "PExpr.h"
# include "netlist.h"
# include <iostream>
# include <assert.h>
/*
* The evaluate_attributes function evaluates the attribute
* expressions from the map, and resturns a table in a form suitable
* for passing to netlist devices.
*/
attrib_list_t* evaluate_attributes(const map<string,PExpr*>&att,
unsigned&natt,
const Design*des,
const NetScope*scope)
{
natt = att.size();
if (natt == 0)
return 0;
attrib_list_t*table = new attrib_list_t [natt];
unsigned idx = 0;
typedef map<string,PExpr*>::const_iterator iter_t;
for (iter_t cur = att.begin() ; cur != att.end() ; cur ++, idx++) {
table[idx].key = (*cur).first;
PExpr*exp = (*cur).second;
/* If the attribute value is given in the source, then
evalulate it as a constant. If the value is not
given, then assume the value is 1. */
verinum*tmp;
if (exp)
tmp = exp->eval_const(des, scope);
else
tmp = new verinum(1);
if (tmp == 0)
cerr << "internal error: no result for " << *exp << endl;
assert(tmp);
table[idx].val = *tmp;
delete tmp;
}
assert(idx == natt);
return table;
}
/*
* $Log: eval_attrib.cc,v $
* Revision 1.5 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.4 2002/08/10 21:59:39 steve
* The default attribute value is 1.
*
* Revision 1.3 2002/06/06 18:57:18 steve
* Use standard name for iostream.
*
* Revision 1.2 2002/06/03 03:55:14 steve
* compile warnings.
*
* Revision 1.1 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
*/
+5 -2
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: eval_rconst.cc,v 1.4 2001/11/07 04:01:59 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_rconst.cc,v 1.5 2002/08/12 01:34:59 steve Exp $"
#endif
# include "config.h"
@@ -81,6 +81,9 @@ verireal* PEIdent::eval_rconst(const Design*des, const NetScope*scope) const
/*
* $Log: eval_rconst.cc,v $
* Revision 1.5 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.4 2001/11/07 04:01:59 steve
* eval_const uses scope instead of a string path.
*
+86 -11
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: eval_tree.cc,v 1.37 2002/04/27 05:03:46 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_tree.cc,v 1.42 2002/10/19 22:59:49 steve Exp $"
#endif
# include "config.h"
@@ -81,8 +81,22 @@ NetEConst* NetEBBits::eval_tree()
eval_sub_tree_();
NetEConst*lc = dynamic_cast<NetEConst*>(left_);
if (lc == 0) return 0;
NetEConst*rc = dynamic_cast<NetEConst*>(right_);
/* Notice the special case where one of the operands is 0 and
this is a bitwise &. If this happens, then the result is
known to be 0. */
if ((op() == '&') && lc && (lc->value() == verinum(0))) {
verinum res (verinum::V0, expr_width());
return new NetEConst(res);
}
if ((op() == '&') && rc && (rc->value() == verinum(0))) {
verinum res (verinum::V0, expr_width());
return new NetEConst(res);
}
if (lc == 0) return 0;
if (rc == 0) return 0;
verinum lval = lc->value();
@@ -705,6 +719,10 @@ NetEConst* NetEBShift::eval_tree()
NetEConst* NetEConcat::eval_tree()
{
unsigned repeat_val = repeat();
unsigned local_errors = 0;
unsigned gap = 0;
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) {
// Parameter not here? This is an error, but presumably
@@ -712,10 +730,13 @@ NetEConst* NetEConcat::eval_tree()
if (parms_[idx] == 0)
continue;
// If this parameter is already a constant, all is well
// so go on.
if (dynamic_cast<NetEConst*>(parms_[idx]))
if (dynamic_cast<NetEConst*>(parms_[idx])) {
gap += parms_[idx]->expr_width();
continue;
}
// Finally, try to evaluate the parameter expression
// that is here. If I succeed, reset the parameter to
@@ -725,23 +746,35 @@ NetEConst* NetEConcat::eval_tree()
if (expr) {
delete parms_[idx];
parms_[idx] = expr;
if (! expr->has_width()) {
cerr << get_line() << ": error: concatenation "
<< "operand has indefinite width: "
<< *parms_[idx] << endl;
local_errors += 1;
}
gap += expr->expr_width();
}
}
if (local_errors > 0)
return 0;
// Handle the special case that the repeat expression is
// zero. In this case, just return a 0 value with the expected
// width.
if (repeat_ == 0) {
if (repeat_val == 0) {
verinum val (verinum::V0, expr_width());
NetEConst*res = new NetEConst(val);
res->set_width(val.len());
return res;
}
// Figure out the width of the repeated expression, and make a
// verinum to hold the result.
unsigned gap = expr_width() / repeat_;
verinum val (verinum::Vx, repeat_ * gap);
// At this point, the "gap" is the width of a single repeat of
// the concatenation. The total width of the result is the gap
// times the repeat count.
verinum val (verinum::Vx, repeat_val * gap);
// build up the result from least significant to most.
@@ -754,7 +787,7 @@ NetEConst* NetEConcat::eval_tree()
verinum tmp = expr->value();
for (unsigned bit = 0; bit < tmp.len(); bit += 1, cur += 1)
for (unsigned rep = 0 ; rep < repeat_ ; rep += 1)
for (unsigned rep = 0 ; rep < repeat_val ; rep += 1)
val.set(rep*gap+cur, tmp[bit]);
is_string_flag = is_string_flag && tmp.is_string();
@@ -851,7 +884,7 @@ NetExpr* NetEParam::eval_tree()
// The result can be saved as the value of the parameter for
// future reference, and return a copy to the caller.
scope_->set_parameter(name_.peek_name(0), res);
scope_->replace_parameter(name_.peek_name(0), res);
return res->dup_expr();
}
@@ -1069,6 +1102,28 @@ NetEConst* NetEUReduce::eval_tree()
break;
}
case '^': {
/* Reduction XOR. */
unsigned ones = 0, unknown = 0;
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
switch (val.get(idx)) {
case verinum::V0:
break;
case verinum::V1:
ones += 1;
break;
default:
unknown += 1;
break;
}
if (unknown)
return new NetEConst(verinum(verinum::Vx,1,true));
if (ones%2)
return new NetEConst(verinum(verinum::V1,1,true));
return new NetEConst(verinum(verinum::V0,1,true));
}
default:
return 0;
}
@@ -1079,6 +1134,26 @@ NetEConst* NetEUReduce::eval_tree()
/*
* $Log: eval_tree.cc,v $
* Revision 1.42 2002/10/19 22:59:49 steve
* Redo the parameter vector support to allow
* parameter names in range expressions.
*
* Revision 1.41 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.40 2002/05/25 16:43:47 steve
* Eval ^ and &0 expressions.
*
* Revision 1.39 2002/05/06 02:30:27 steve
* Allow parameters in concatenation of widths are defined.
*
* Revision 1.38 2002/05/05 21:11:50 steve
* Put off evaluation of concatenation repeat expresions
* until after parameters are defined. This allows parms
* to be used in repeat expresions.
*
* Add the builtin $signed system function.
*
* Revision 1.37 2002/04/27 05:03:46 steve
* Preserve stringiness string part select and concatenation.
*
+9 -1
View File
@@ -16,7 +16,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: hello_vpi.c,v 1.1 2002/04/18 03:25:16 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: hello_vpi.c,v 1.3 2002/08/12 01:35:01 steve Exp $"
#endif
/*
* This file contains an example VPI module to demonstrate the tools
@@ -60,6 +62,12 @@ void (*vlog_startup_routines[])() = {
};
/*
* $Log: hello_vpi.c,v $
* Revision 1.3 2002/08/12 01:35:01 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2002/08/11 23:47:04 steve
* Add missing Log and Ident strings.
*
* Revision 1.1 2002/04/18 03:25:16 steve
* More examples.
*
+50 -5
View File
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: expr_synth.cc,v 1.31 2001/12/30 17:06:52 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: expr_synth.cc,v 1.36 2002/08/12 01:34:59 steve Exp $"
#endif
# include "config.h"
@@ -50,6 +50,7 @@ NetNet* NetEBAdd::synthesize(Design*des)
string path = lsig->scope()->name()+"."+lsig->scope()->local_symbol();
NetNet*osig = new NetNet(lsig->scope(), path, NetNet::IMPLICIT, width);
osig->local_flag(true);
string oname = des->local_symbol(path);
NetAddSub *adder = new NetAddSub(lsig->scope(), oname, width);
@@ -62,10 +63,10 @@ NetNet* NetEBAdd::synthesize(Design*des)
switch (op()) {
case '+':
adder->attribute("LPM_Direction", "ADD");
adder->attribute("LPM_Direction", verinum("ADD"));
break;
case '-':
adder->attribute("LPM_Direction", "SUB");
adder->attribute("LPM_Direction", verinum("SUB"));
break;
}
@@ -107,6 +108,26 @@ NetNet* NetEBBits::synthesize(Design*des)
string oname = des->local_symbol(path);
NetLogic*gate;
/* If the rsig bit is constant, then look for special
cases that I can use to reduce the generated
logic. If I find one, then handle it immediately and
skip the rest of the processing of this bit. */
if (rsig->pin(idx).nexus()->drivers_constant()) {
verinum::V bval = rsig->pin(idx).nexus()->driven_value();
/* (A & 0) is (0) */
if ((op() == '&') && bval == verinum::V0) {
connect(osig->pin(idx), rsig->pin(idx));
continue;
}
/* (A & 1) is A */
if ((op() == '&') && bval == verinum::V1) {
connect(osig->pin(idx), lsig->pin(idx));
continue;
}
}
switch (op()) {
case '&':
gate = new NetLogic(scope, oname, 3, NetLogic::AND);
@@ -378,7 +399,7 @@ NetNet* NetEConcat::synthesize(Design*des)
obit += 1;
}
if (tmp[idx-1]->local_flag() && tmp[idx-1]->get_eref() == 0)
if (tmp[idx-1]->local_flag() && tmp[idx-1]->get_refs() == 0)
delete tmp[idx-1];
}
@@ -587,6 +608,30 @@ NetNet* NetESignal::synthesize(Design*des)
/*
* $Log: expr_synth.cc,v $
* Revision 1.36 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.35 2002/07/07 22:31:39 steve
* Smart synthesis of binary AND expressions.
*
* Revision 1.34 2002/07/05 21:26:17 steve
* Avoid emitting to vvp local net symbols.
*
* Revision 1.33 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.32 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.31 2001/12/30 17:06:52 steve
* Synthesize reduction logic.
*
+43 -117
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -16,8 +16,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: functor.cc,v 1.26 2001/10/19 21:53:24 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: functor.cc,v 1.31 2002/08/16 05:18:27 steve Exp $"
#endif
# include "config.h"
@@ -128,30 +128,31 @@ void Design::functor(functor_t*fun)
// apply to nodes
if (nodes_) {
assert(nodes_functor_cur_ == 0);
assert(nodes_functor_nxt_ == 0);
/* Scan the circular list of nodes, starting with the
front of the list. (nodes_ points to the *end* of the
list.) The bar is the end point. At the end of the
do-while loop, I know that the bar has been
processed or (if bar == 0) no undeleted node has been
processed. */
NetNode*cur = nodes_->node_next_;
NetNode*bar = 0;
front of the list.
This loop interacts with the Design::del_node method
so that the functor is free to delete any nodes it
choose. The destructors of the NetNode objects call
the del_node method, which checks with the
nodes_functor_* members, to keep the iterator
operating safely. */
nodes_functor_cur_ = nodes_;
do {
NetNode*tmp = cur->node_next_;
cur->functor_node(this, fun);
nodes_functor_nxt_ = nodes_functor_cur_->node_next_;
nodes_functor_cur_->functor_node(this, fun);
/* Detect the case that cur has been deleted by
noticing if tmp->node_prev_ no longer points to
cur. If that's the case, clear the bar. */
if (tmp->node_prev_ != cur) {
if (cur == bar)
bar = 0;
} else if (bar == 0) {
bar = cur;
}
cur = tmp;
if (nodes_functor_nxt_ == 0)
break;
nodes_functor_cur_ = nodes_functor_nxt_;
} while (nodes_ && (nodes_functor_cur_ != nodes_));
nodes_functor_cur_ = 0;
nodes_functor_nxt_ = 0;
} while (nodes_ && (cur != bar));
}
}
@@ -234,35 +235,13 @@ int NetAssignNB::match_proc(proc_match_t*that)
return that->assign_nb(this);
}
int proc_match_t::assign_mem(NetAssignMem*)
{
return 0;
}
int NetAssignMem::match_proc(proc_match_t*that)
{
return that->assign_mem(this);
}
int proc_match_t::assign_mem_nb(NetAssignMemNB*)
{
return 0;
}
int NetAssignMemNB::match_proc(proc_match_t*that)
{
return that->assign_mem_nb(this);
}
int proc_match_t::block(NetBlock*)
{
cerr << "default (failing) match for block" << endl;
return 0;
}
int NetBlock::match_proc(proc_match_t*that)
{
cerr << "NetBlock::match_proc" << endl;
return that->block(this);
}
@@ -288,6 +267,25 @@ int proc_match_t::event_wait(NetEvWait*)
/*
* $Log: functor.cc,v $
* Revision 1.31 2002/08/16 05:18:27 steve
* Fix intermix of node functors and node delete.
*
* Revision 1.30 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.29 2002/08/10 22:07:38 steve
* Remove useless error messages.
*
* Revision 1.28 2002/06/05 03:44:25 steve
* Add support for memory words in l-value of
* non-blocking assignments, and remove the special
* NetAssignMem_ and NetAssignMemNB classes.
*
* Revision 1.27 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.26 2001/10/19 21:53:24 steve
* Support multiple root modules (Philip Blundell)
*
@@ -306,77 +304,5 @@ int proc_match_t::event_wait(NetEvWait*)
*
* Revision 1.21 2000/08/01 02:48:41 steve
* Support <= in synthesis of DFF and ram devices.
*
* Revision 1.20 2000/07/16 04:56:07 steve
* Handle some edge cases during node scans.
*
* Revision 1.19 2000/07/15 05:13:43 steve
* Detect muxing Vz as a bufufN.
*
* Revision 1.18 2000/05/02 00:58:12 steve
* Move signal tables to the NetScope class.
*
* Revision 1.17 2000/04/20 00:28:03 steve
* Catch some simple identity compareoptimizations.
*
* Revision 1.16 2000/04/18 04:50:19 steve
* Clean up unneeded NetEvent objects.
*
* Revision 1.15 2000/04/16 23:32:18 steve
* Synthesis of comparator in expressions.
*
* Connect the NetEvent and related classes
* together better.
*
* Revision 1.14 2000/04/12 20:02:53 steve
* Finally remove the NetNEvent and NetPEvent classes,
* Get synthesis working with the NetEvWait class,
* and get started supporting multiple events in a
* wait in vvm.
*
* Revision 1.13 2000/04/01 21:40:22 steve
* Add support for integer division.
*
* Revision 1.12 2000/02/23 02:56:54 steve
* Macintosh compilers do not support ident.
*
* Revision 1.11 2000/02/13 04:35:43 steve
* Include some block matching from Larry.
*
* Revision 1.10 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.9 2000/01/02 17:57:20 steve
* Handle nodes running out during node scan.
*
* Revision 1.8 1999/12/30 04:19:12 steve
* Propogate constant 0 in low bits of adders.
*
* Revision 1.7 1999/12/17 06:18:16 steve
* Rewrite the cprop functor to use the functor_t interface.
*
* Revision 1.6 1999/12/05 02:24:08 steve
* Synthesize LPM_RAM_DQ for writes into memories.
*
* Revision 1.5 1999/12/01 06:06:16 steve
* Redo synth to use match_proc_t scanner.
*
* Revision 1.4 1999/11/18 03:52:19 steve
* Turn NetTmp objects into normal local NetNet objects,
* and add the nodangle functor to clean up the local
* symbols generated by elaboration and other steps.
*
* Revision 1.3 1999/11/01 02:07:40 steve
* Add the synth functor to do generic synthesis
* and add the LPM_FF device to handle rows of
* flip-flops.
*
* Revision 1.2 1999/07/18 05:52:46 steve
* xnfsyn generates DFF objects for XNF output, and
* properly rewrites the Design netlist in the process.
*
* Revision 1.1 1999/07/17 22:01:13 steve
* Add the functor interface for functor transforms.
*
*/
+15 -31
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: functor.h,v 1.17 2000/09/17 21:26:15 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: functor.h,v 1.20 2002/08/12 01:34:59 steve Exp $"
#endif
/*
@@ -83,9 +83,7 @@ struct proc_match_t {
virtual ~proc_match_t();
virtual int assign(class NetAssign*);
virtual int assign_mem(class NetAssignMem*);
virtual int assign_nb(class NetAssignNB*);
virtual int assign_mem_nb(class NetAssignMemNB*);
virtual int condit(class NetCondit*);
virtual int event_wait(class NetEvWait*);
virtual int block(class NetBlock*);
@@ -94,6 +92,19 @@ struct proc_match_t {
/*
* $Log: functor.h,v $
* Revision 1.20 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.19 2002/06/05 03:44:25 steve
* Add support for memory words in l-value of
* non-blocking assignments, and remove the special
* NetAssignMem_ and NetAssignMemNB classes.
*
* Revision 1.18 2002/06/04 05:38:44 steve
* Add support for memory words in l-value of
* blocking assignments, and remove the special
* NetAssignMem class.
*
* Revision 1.17 2000/09/17 21:26:15 steve
* Add support for modulus (Eric Aardoom)
*
@@ -108,32 +119,5 @@ struct proc_match_t {
*
* Revision 1.13 2000/04/20 00:28:03 steve
* Catch some simple identity compareoptimizations.
*
* Revision 1.12 2000/04/18 04:50:19 steve
* Clean up unneeded NetEvent objects.
*
* Revision 1.11 2000/04/12 20:02:53 steve
* Finally remove the NetNEvent and NetPEvent classes,
* Get synthesis working with the NetEvWait class,
* and get started supporting multiple events in a
* wait in vvm.
*
* Revision 1.10 2000/04/01 21:40:22 steve
* Add support for integer division.
*
* Revision 1.9 2000/02/23 02:56:54 steve
* Macintosh compilers do not support ident.
*
* Revision 1.8 2000/02/13 04:35:43 steve
* Include some block matching from Larry.
*
* Revision 1.7 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.6 1999/12/30 04:19:12 steve
* Propogate constant 0 in low bits of adders.
*
* Revision 1.5 1999/12/17 06:18:16 steve
* Rewrite the cprop functor to use the functor_t interface.
*/
#endif
+16 -6
View File
@@ -86,7 +86,7 @@ tool so it is not clear that the standard really is at fault. It is
clear, however, that somebody goofed somewhere.
My personal opinion is that there is no logical need to require that
all module_item_declarations preceed any other module items. I
all module_item_declarations precede any other module items. I
personally would oppose such a restriction. It may make sense to
require that declarations of variables within a module be preceded by
their use, although even that is not necessary for the implementation
@@ -97,7 +97,7 @@ sample2 can have implications that affect any declaration order
rules. When reaching into a module with a hierarchical name, the
module being referenced is already completely declared (or not
declared at all, as in sample2) so module_item order is completely
irrelevent. But a "declare before use" rule would infect module
irrelevant. But a "declare before use" rule would infect module
ordering, by requiring that modules that are used be first defined.
@@ -141,7 +141,7 @@ ports.
With the above in mind, I have decided to *allow* function and task
ports to be declared with types, as long as the types are variable
types, such ag reg or integer. Without this, there would be no
types, such as reg or integer. Without this, there would be no
portable way to pass integers into functions/tasks. The standard does
not say it is allowed, but it doesn't *disallow* it, and other
commercial tools seem to work similarly.
@@ -172,7 +172,7 @@ take it that x is allowed, as that is what Verilog-XL does.
There seems to be ambiguity in how code like this should be parsed:
repeat (5) @(posedge clk) <statment>;
repeat (5) @(posedge clk) <statement>;
There are two valid interpretations of this code, from the
IEEE1364-1995 standard. One looks like this:
@@ -386,7 +386,7 @@ changes in inputs until the thread that changed the inputs yields
execution.
* BIT AND PART SELECTS OF PARAMTERS
* BIT AND PART SELECTS OF PARAMETERS
Bit and part selects are supposed to only be supported on vector nets
and variables (wires, regs, etc.) However, it is common for Verilog
@@ -399,9 +399,19 @@ value with a defined size. The parameter value is considered be a
constant vector of bits foo[X:0]. That is, zero based. The bit and
part selects operate from that assumption.
Verilog 2001 adds syntax to allow the user to explicitly declare the
parameter range (i.e. parameter [5:0] foo = 9;) so Icarus Verilog will
(or should) use the explicitly declared vector dimensions to interpret
bit and part selects.
$Id: ieee1364-notes.txt,v 1.11 2002/04/27 02:38:04 steve Exp $
$Id: ieee1364-notes.txt,v 1.13 2002/08/20 04:11:53 steve Exp $
$Log: ieee1364-notes.txt,v $
Revision 1.13 2002/08/20 04:11:53 steve
Support parameters with defined ranges.
Revision 1.12 2002/06/11 03:34:33 steve
Spelling patch (Larry Doolittle)
Revision 1.11 2002/04/27 02:38:04 steve
Support selecting bits from parameters.
+48
View File
@@ -0,0 +1,48 @@
.TH iverilog-vpi 1 "$Date: 2002/07/05 17:17:20 $" Version "$Date: 2002/07/05 17:17:20 $"
.SH NAME
iverilog-vpi - Compile front end for VPI modules
.SH SYNOPSIS
.B iverilog-vpi
[--name=\fIname\fP]
\fIsourcefile\fP...
.SH DESCRIPTION
.PP
\fIiverilog-vpi\fP is a tool to simplify the compilation of VPI
modules for use with Icarus Verilog. It takes on the command line a
list of C or C++ source files, and generates as output a linked VPI
module. See the \fBvvp\fP(1) man page for a description of how the
linked module is loaded by a simulation.
The output is named after the first source file. For example, if the
first source file is named \fIfoo.c\fP, the output becomes
\fIfoo.vpi\fP.
.SH OPTIONS
.l
\fIiverilog-vpi\fP accepts the following options:
.TP 8
.B -l\fIlibrary\fP
Include the named library in the link of the VPI module. This allows
VPI modules to further reference external libraries.
.TP 8
.B --name=\fIname\fP
Normally, the output VPI module will be named after the first source
file passed to the command. This flag sets the name (without the .vpi
suffix) of the output vpi module.
.SH "AUTHOR"
.nf
Steve Williams ([email protected])
.SH SEE ALSO
iverilog(1), vvp(1),
.BR "<http://www.icarus.com/eda/verilog/>"
.SH COPYRIGHT
.nf
Copyright \(co 2002 Stephen Williams
This document can be freely redistributed according to the terms of the
GNU General Public License version 2.0
+39 -10
View File
@@ -17,18 +17,20 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: iverilog-vpi.sh,v 1.1 2002/04/07 00:47:10 steve Exp $"
#ident "$Id: iverilog-vpi.sh,v 1.9 2002/10/19 23:18:52 steve Exp $"
# These are the variables used for compiling files
CC=gcc
CFLAGS="@PIC@ -O"
CXX=gcc
CFLAGS="@PIC@ -O -I@INCLUDEDIR@"
# These are used for linking...
LD=gcc
LDFLAGS="@SHARED@"
LDLIBS=-lvpi
LDLIBS="-L@LIBDIR@ -lveriuser -lvpi"
SRC=
CCSRC=
CXSRC=
OBJ=
LIB=
OUT=
@@ -42,18 +44,28 @@ do
case $parm
in
*.c) SRC="$SRC $parm"
*.c) CCSRC="$CCSRC $parm"
if [ x$OUT = x ]; then
OUT=`basename $parm .c`
fi
;;
*.cc) CXSRC="$CXSRC $parm"
if [ x$OUT = x ]; then
OUT=`basename $parm .cc`
fi
;;
*.o) OBJ="$OBJ $parm"
if [ x$OUT = x ]; then
OUT=`basename $parm .o`
fi
;;
--name=*)
OUT=`echo $parm | cut -b8-`
;;
-l*) LIB="$LIB $parm"
;;
@@ -62,24 +74,41 @@ do
done
if [ x$OUT = x ]; then
echo "Usage: vpi-tool [src and obj files]..."
echo "Usage: $0 [src and obj files]..."
exit 0
fi
# Put the .vpi on the result file.
OUT=$OUT".vpi"
compile_errors=0
# Compile all the source files into object files
for src
in $SRC
for src in $CCSRC
do
base=`basename $src .c`
obj=$base".o"
echo "Compiling $src..."
$CC -c -o $obj $src
$CC -c -o $obj $CFLAGS $src || compile_errors=`expr $compile_errors + 1`
OBJ="$OBJ $obj"
done
for src in $CXSRC
do
base=`basename $src .cc`
obj=$base".o"
echo "Compiling $src..."
$CXX -c -o $obj $CFLAGS $src || compile_errors=`expr $compile_errors + 1`
OBJ="$OBJ $obj"
done
if test $compile_errors -gt 0
then
echo "Some ($compile_errors) files failed to compile."
exit $compile_errors
fi
echo "Making $OUT from $OBJ..."
$LD -o $OUT $LDFLAGS $OBJ $LDLIBS
exec $LD -o $OUT $LDFLAGS $OBJ $LIB $LDLIBS
+11 -20
View File
@@ -28,8 +28,12 @@
#
# %B Substitute the base libdir, -B flag of iverilog.
#
# %C Substitute the path to the temporary config file.
#
# %f Substitute the -f flags from the command line.
#
# %g Substitule the -g flag
#
# %s Substitute the start module (-s flag) from the user.
#
# %M Substitute the value of the -M<depfile> flag.
@@ -45,9 +49,6 @@
#
# %W Substitute the ivl warning flags.
#
# %y Substitute all the -y flags here.
# %Y Substitute all the -Y flags here.
#
# %[<c><text>]
# This substitution pattern is magical, and is the only
# multicharacter pattern. This tests the code <c>, and
@@ -61,42 +62,32 @@
# be useful and interesting if the -N flag is included.
[-tnull -S]
<ivl>%B/ivl %[v-v] %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -Fsynth -Fsyn-rules -- -
<ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -Fsynth -Fsyn-rules -- -
[-tnull]
<ivl>%B/ivl %[v-v] %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
<ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
# --
# The vvp target generates code that the vvp simulation engine can execute.
# These rules support synthesized and non-synthesized variants.
[-tvvp -S]
<ivl>%B/ivl %[v-v] %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- -
<ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth2 -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- -
[-tvvp]
<ivl>%B/ivl %[v-v] %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- -
# --
# The vvm target uses the <ivl> string to take the preprocessed code from
# standard input, compile it with the vvm code generator and write the
# result to %o.cc. The driver assumes this when invoking the C++ compiler
# on the result.
[-tvvm]
<ivl>%B/ivl %[v-v] %y %Y %W %s %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- -
<ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- -
# This is the XNF code generator.
[-txnf]
<ivl>%B/ivl %y %Y %[v-v] %s %[M-M%M] %[N-N%N] %[T-T%T] -txnf -Fsynth -Fsyn-rules -Fxnfio -Fcprop -Fnodangle -o%o -- -
<ivl>%B/ivl -C%C %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] -txnf -Fsynth2 -Fsynth -Fsyn-rules -Fxnfio -Fcprop -Fnodangle -o%o -- -
# And this is another XNF code generator, under development.
[-tfpga]
<ivl>%B/ivl %y %Y %[v-v] %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/fpga.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
<ivl>%B/ivl -C%C %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/fpga.tgt -Fsynth2 -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
# --
# This is the pal code generator. The target module requires the -fpart=<type>
# flag to specify the part type.
[-tpal]
<ivl>%B/ivl %y %Y %[v-v] %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
<ivl>%B/ivl -C%C %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
+13 -1
View File
@@ -43,6 +43,8 @@ ivl_expr_uvalue
ivl_expr_width
ivl_logic_attr
ivl_logic_attr_cnt
ivl_logic_attr_val
ivl_logic_delay
ivl_logic_name
ivl_logic_basename
@@ -52,6 +54,9 @@ ivl_logic_pin
ivl_logic_pins
ivl_logic_udp
ivl_lpm_aset_value
ivl_lpm_async_clr
ivl_lpm_async_set
ivl_lpm_basename
ivl_lpm_clk
ivl_lpm_data
@@ -79,8 +84,8 @@ ivl_lval_pins
ivl_lval_sig
ivl_memory_basename
ivl_memory_name
ivl_memory_root
ivl_memory_scope
ivl_memory_size
ivl_memory_width
@@ -119,6 +124,10 @@ ivl_scope_type
ivl_scope_tname
ivl_signal_attr
ivl_signal_attr_cnt
ivl_signal_attr_val
ivl_signal_integer
ivl_signal_local
ivl_signal_pin
ivl_signal_pins
ivl_signal_port
@@ -127,6 +136,8 @@ ivl_signal_type
ivl_signal_name
ivl_signal_basename
ivl_process_attr_cnt
ivl_process_attr_val
ivl_process_scope
ivl_process_stmt
ivl_process_type
@@ -134,6 +145,7 @@ ivl_process_type
ivl_statement_type
ivl_stmt_block_count
ivl_stmt_block_scope
ivl_stmt_block_stmt
ivl_stmt_call
ivl_stmt_case_count
+162 -20
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: ivl_target.h,v 1.94 2002/03/17 19:30:20 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: ivl_target.h,v 1.108 2002/10/23 01:47:17 steve Exp $"
#endif
#ifdef __cplusplus
@@ -98,7 +98,7 @@ _BEGIN_DECL
* ivl_process_t
* A Verilog process is represented by one of these. A process may
* be an "initial" or an "always" process. These come from initial
* or always statements from the verilog source.
* or always statements from the Verilog source.
*
* ivl_scope_t
* Elaborated scopes within a design are represented by this
@@ -300,6 +300,24 @@ typedef int (*ivl_process_f)(ivl_process_t net, void*cd);
the user passes to the scanner. */
typedef int (ivl_scope_f)(ivl_scope_t net, void*cd);
/* Attributes, which can be attached to various object types, have
this form. */
typedef enum ivl_attribute_type_e {
IVL_ATT_VOID = 0,
IVL_ATT_STR,
IVL_ATT_NUM
} ivl_attribute_type_t;
struct ivl_attribute_s {
const char*key;
ivl_attribute_type_t type;
union val_ {
const char*str;
long num;
} val;
};
typedef const struct ivl_attribute_s*ivl_attribute_t;
/* DESIGN
* When handed a design (ivl_design_t) there are a few things that you
@@ -319,7 +337,7 @@ typedef int (ivl_scope_f)(ivl_scope_t net, void*cd);
*
* ivl_design_process
* This function scans the processes (threads) in the design. It
* calls the user suplied function on each of the processes until
* calls the user supplied function on each of the processes until
* one of the functors returns non-0 or all the processes are
* scanned. This function will return 0, or the non-zero value that
* was returned from the last scanned process.
@@ -400,7 +418,15 @@ extern ivl_nexus_t ivl_event_pos(ivl_event_t net, unsigned idx);
*
* ivl_expr_width
* This method returns the bit width of the expression at this
* node. It can be applied to any expression node.
* node. It can be applied to any expression node, and returns the
* *output* width of the expression node.
*
* ivl_expr_opcode
* IVL_EX_BINARY and IVL_EX_UNARY expression nodes include an
* upcode from this table:
* & -- AND
* A -- NAND (~&)
* X -- XNOR (~^)
*/
extern ivl_expr_type_t ivl_expr_type(ivl_expr_t net);
@@ -411,7 +437,7 @@ extern const char* ivl_expr_bits(ivl_expr_t net);
extern ivl_scope_t ivl_expr_def(ivl_expr_t net);
/* IVL_EX_SIGNAL */
extern unsigned ivl_expr_lsi(ivl_expr_t net);
/* IVL_EX_SIGNAL, IVL_EX_SFUNC, IVL_EX_MEMORY */
/* IVL_EX_SIGNAL, IVL_EX_SFUNC */
extern const char* ivl_expr_name(ivl_expr_t net);
/* IVL_EX_BINARY IVL_EX_UNARY */
extern char ivl_expr_opcode(ivl_expr_t net);
@@ -443,13 +469,28 @@ extern unsigned ivl_expr_width(ivl_expr_t net);
/*
* Memory.
*
* ivl_memory_name (DEPRECATED)
*
* ivl_memory_basename
* This returns the base name of the memory object. The base name
* does not include the name of the scopes that contains the object.
*
* ivl_memory_size
* ivl_memory_width
* These functions return the dimensions of the memory. The size is
* the number of words in the memory, and the width is the number
* of bits in each word.
*
* ivl_memory_scope
* This returns the scope that contains the memory.
*/
extern const char*ivl_memory_name(ivl_memory_t net);
extern const char*ivl_memory_basename(ivl_memory_t net);
extern int ivl_memory_root(ivl_memory_t net);
extern ivl_scope_t ivl_memory_scope(ivl_memory_t net);
extern unsigned ivl_memory_size(ivl_memory_t net);
extern unsigned ivl_memory_width(ivl_memory_t net);
extern ivl_memory_t ivl_expr_memory(ivl_expr_t net);
/* LOGIC
@@ -480,6 +521,12 @@ extern ivl_memory_t ivl_expr_memory(ivl_expr_t net);
* ivl_logic_attr
* Return the value of a specific attribute, given the key name as
* a string. If the key is not defined, then return 0 (null).
*
* ivl_logic_attr_cnt
* ivl_logic_attr_val
* These support iterating over logic attributes. The _cnt method
* returns the number of attributes attached to the gate, and the
* ivl_logic_attr_val returns the value of the attribute.
*/
extern const char* ivl_logic_name(ivl_net_logic_t net);
@@ -491,8 +538,12 @@ extern unsigned ivl_logic_pins(ivl_net_logic_t net);
extern ivl_udp_t ivl_logic_udp(ivl_net_logic_t net);
extern unsigned ivl_logic_delay(ivl_net_logic_t net, unsigned transition);
/* DEPRECATED */
extern const char* ivl_logic_attr(ivl_net_logic_t net, const char*key);
extern unsigned ivl_logic_attr_cnt(ivl_net_logic_t net);
extern ivl_attribute_t ivl_logic_attr_val(ivl_net_logic_t net, unsigned idx);
/* UDP
*
*/
@@ -522,7 +573,7 @@ extern const char* ivl_udp_name(ivl_udp_t net);
* this device.
*
* ivl_lpm_type
* Return the ivl_lpm_type_t of the secific LPM device.
* Return the ivl_lpm_type_t of the specific LPM device.
*
* ivl_lpm_width
* Return the width of the LPM device. What this means depends on
@@ -539,7 +590,7 @@ extern const char* ivl_udp_name(ivl_udp_t net);
* vector for devices that have more inputs.
*
* ivl_lpm_datab
* Return the input data nexis for device types that have a second
* Return the input data nexus for device types that have a second
* input vector. For example, arithmetic devices are like this.
*
* ivl_lpm_q
@@ -552,7 +603,7 @@ extern const char* ivl_udp_name(ivl_udp_t net);
*
* ivl_lpm_size
* In addition to a width, some devices have a size. The size is
* often the number of inputs per out, i.e. the number of inputs
* often the number of inputs per out, i.e., the number of inputs
* per bit for a MUX.
*/
extern const char* ivl_lpm_name(ivl_lpm_t net);
@@ -561,6 +612,10 @@ extern ivl_scope_t ivl_lpm_scope(ivl_lpm_t net);
extern ivl_lpm_type_t ivl_lpm_type(ivl_lpm_t net);
extern unsigned ivl_lpm_width(ivl_lpm_t net);
/* IVL_LPM_FF */
extern ivl_nexus_t ivl_lpm_async_clr(ivl_lpm_t net);
extern ivl_nexus_t ivl_lpm_async_set(ivl_lpm_t net);
extern ivl_expr_t ivl_lpm_aset_value(ivl_lpm_t net);
/* IVL_LPM_FF IVL_LPM_RAM */
extern ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net);
/* IVL_LPM_UFUNC */
@@ -677,7 +732,7 @@ extern ivl_signal_t ivl_lval_sig(ivl_lval_t net);
* connected to the nexus.
*
* If the target is an LPM device, then this value is zero, and it
* is up to the application to find the pin that referse to this
* is up to the application to find the pin that refers to this
* nexus. The problem is that LPM devices do not have a pinout per
* se, the pins all have specific names.
*
@@ -777,7 +832,7 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
*
* ivl_scope_lpm
* ivl_scope_lpms
* Scopes have 0 or more LPM devices in them. These functions acess
* Scopes have 0 or more LPM devices in them. These functions access
* those devices.
*
* ivl_scope_name
@@ -840,7 +895,7 @@ extern const char* ivl_scope_tname(ivl_scope_t net);
/* SIGNALS
* Signals are named things in the Verilog source, like wires and
* regs, and also named things that are preated as temporaries during
* regs, and also named things that are created as temporaries during
* certain elaboration or optimization steps. A signal may also be a
* port of a module or task.
*
@@ -850,7 +905,7 @@ extern const char* ivl_scope_tname(ivl_scope_t net);
* ivl_signal_pins
* ivl_signal_pin
* The ivl_signal_pin function returns the nexus connected to the
* signal. If the signal is a vectory, the idx can be a non-zero
* signal. If the signal is a vector, the idx can be a non-zero
* value, and the result is the nexus for the specified bit.
*
* ivl_signal_port
@@ -863,16 +918,28 @@ extern const char* ivl_scope_tname(ivl_scope_t net);
* net or variable may be signed. This function returns true if the
* signal is signed.
*
* ivl_signal_type
* Return the type of the signal, i.e. reg, wire, tri0, et al.
* ivl_signal_local
* A signal that was generated by the compiler as a place holder is
* marked as local.
*
* ivl_signal_name
* ivl_signal_type
* Return the type of the signal, i.e., reg, wire, tri0, etc.
*
* ivl_signal_name (DEPRECATED)
* This function returns the fully scoped hierarchical name for the
* signal. The name refers to the entire vector that is the signal.
*
* NOTE: This function is deprecated. The heirarchical name is too
* vague a construct when escaped names can have . characters in
* them. Do no use this function in new code, it will disappear.
*
* ivl_signal_basename
* This function returns the name of the signal, without the scope
* information. This is the tail of the signal name.
* information. This is the tail of the signal name. Since Verilog
* has an escape syntax, this name can contain any ASCII
* characters, except NULL or white space. The leading \ and
* trailing ' ' of escaped names in Verilog source are not part of
* the name, so not included here.
*
* ivl_signal_attr
* Icarus Verilog supports attaching attributes to signals, with
@@ -885,11 +952,16 @@ extern ivl_nexus_t ivl_signal_pin(ivl_signal_t net, unsigned idx);
extern unsigned ivl_signal_pins(ivl_signal_t net);
extern ivl_signal_port_t ivl_signal_port(ivl_signal_t net);
extern int ivl_signal_signed(ivl_signal_t net);
extern int ivl_signal_integer(ivl_signal_t net);
extern int ivl_signal_local(ivl_signal_t net);
extern ivl_signal_type_t ivl_signal_type(ivl_signal_t net);
extern const char* ivl_signal_name(ivl_signal_t net);
extern const char* ivl_signal_basename(ivl_signal_t net);
extern const char* ivl_signal_attr(ivl_signal_t net, const char*key);
extern unsigned ivl_signal_attr_cnt(ivl_signal_t net);
extern ivl_attribute_t ivl_signal_attr_val(ivl_signal_t net, unsigned idx);
/*
* These functions get information about a process. A process is
@@ -898,7 +970,7 @@ extern const char* ivl_signal_attr(ivl_signal_t net, const char*key);
* may be a compound statement.)
*
* The ivl_process_type function gets the type of the process,
* an "inital" or "always" statement.
* an "initial" or "always" statement.
*
* A process is placed in a scope. The statement within the process
* operates within the scope of the process unless there are calls
@@ -907,6 +979,9 @@ extern const char* ivl_signal_attr(ivl_signal_t net, const char*key);
* The ivl_process_stmt function gets the statement that forms the
* process. See the statement related functions for how to manipulate
* statements.
*
* Processes can have attributes attached to them. the attr_cnt and
* attr_val methods return those attributes.
*/
extern ivl_process_type_t ivl_process_type(ivl_process_t net);
@@ -914,6 +989,9 @@ extern ivl_scope_t ivl_process_scope(ivl_process_t net);
extern ivl_statement_t ivl_process_stmt(ivl_process_t net);
extern unsigned ivl_process_attr_cnt(ivl_process_t net);
extern ivl_attribute_t ivl_process_attr_val(ivl_process_t net, unsigned idx);
/*
* These functions manage statements of various type. This includes
* all the different kinds of statements (as enumerated in
@@ -921,7 +999,7 @@ extern ivl_statement_t ivl_process_stmt(ivl_process_t net);
*
* The ivl_statement_type() function returns the type code for the
* statement. This is the major type, and implies which of the later
* functions are applicable to the statemnt.
* functions are applicable to the statement.
*/
extern ivl_statement_type_t ivl_statement_type(ivl_statement_t net);
@@ -931,11 +1009,18 @@ extern ivl_statement_type_t ivl_statement_type(ivl_statement_t net);
* make up the statement. Many of these functions apply to more then
* one type of statement, so the comment in front of them tells which
* statement types can be passed to the function.
*
* ivl_stmt_block_scope
* If the block is named, then there is a scope associated with
* this. The code generator may need to know this in order to
* handle disable statements.
*/
/* IVL_ST_BLOCK, IVL_ST_FORK */
extern unsigned ivl_stmt_block_count(ivl_statement_t net);
/* IVL_ST_BLOCK, IVL_ST_FORK */
extern ivl_scope_t ivl_stmt_block_scope(ivl_statement_t net);
/* IVL_ST_BLOCK, IVL_ST_FORK */
extern ivl_statement_t ivl_stmt_block_stmt(ivl_statement_t net, unsigned i);
/* IVL_ST_UTASK IVL_ST_DISABLE */
extern ivl_scope_t ivl_stmt_call(ivl_statement_t net);
@@ -1006,6 +1091,63 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.108 2002/10/23 01:47:17 steve
* Fix synth2 handling of aset/aclr signals where
* flip-flops are split by begin-end blocks.
*
* Revision 1.107 2002/09/26 03:18:04 steve
* Generate vvp code for asynch set/reset of NetFF.
*
* Revision 1.106 2002/09/12 15:49:43 steve
* Add support for binary nand operator.
*
* Revision 1.105 2002/08/24 05:03:40 steve
* Missing declaration of ivl_memory_scope.
*
* Revision 1.104 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.103 2002/08/05 04:18:45 steve
* Store only the base name of memories.
*
* Revision 1.102 2002/08/04 18:28:14 steve
* Do not use hierarchical names of memories to
* generate vvp labels. -tdll target does not
* used hierarchical name string to look up the
* memory objects in the design.
*
* Revision 1.101 2002/07/05 21:26:17 steve
* Avoid emitting to vvp local net symbols.
*
* Revision 1.100 2002/06/21 04:59:35 steve
* Carry integerness throughout the compilation.
*
* Revision 1.99 2002/06/11 03:34:33 steve
* Spelling patch (Larry Doolittle)
*
* Revision 1.98 2002/05/27 00:08:45 steve
* Support carrying the scope of named begin-end
* blocks down to the code generator, and have
* the vvp code generator use that to support disable.
*
* Revision 1.97 2002/05/26 01:39:02 steve
* Carry Verilog 2001 attributes with processes,
* all the way through to the ivl_target API.
*
* Divide signal reference counts between rval
* and lval references.
*
* Revision 1.96 2002/05/24 04:36:23 steve
* Verilog 2001 attriubtes on nets/wires.
*
* Revision 1.95 2002/05/23 03:08:51 steve
* Add language support for Verilog-2001 attribute
* syntax. Hook this support into existing $attribute
* handling, and add number and void value types.
*
* Add to the ivl_target API new functions for access
* of complex attributes attached to gates.
*
* Revision 1.94 2002/03/17 19:30:20 steve
* Add API to support user defined function.
*
+5 -2
View File
@@ -2,7 +2,7 @@
Icarus Verilog LOADABLE TARGET API (ivl_target)
Copyright 2002 Stephen Williams <[email protected]>
$Id: ivl_target.txt,v 1.2 2002/03/17 19:31:17 steve Exp $
$Id: ivl_target.txt,v 1.3 2002/06/11 03:34:33 steve Exp $
The ivl_target API is the interface available to modules that the
@@ -12,7 +12,7 @@ for code generators that are intended to write netlist files or
executable programs.
The functions and types of the API are summarized in the ivl_target.h
header file. This ducument describes how the functions and types of
header file. This document describes how the functions and types of
the API are used to access and interpret the netlist of the design.
@@ -40,6 +40,9 @@ There are ivl_lpm_size() input ports, each with the width
ivl_lpm_data2_width(). The actual nexus is indexed by ivl_lpm_data2().
$Log: ivl_target.txt,v $
Revision 1.3 2002/06/11 03:34:33 steve
Spelling patch (Larry Doolittle)
Revision 1.2 2002/03/17 19:31:17 steve
Add API to support user defined function.
+5 -2
View File
@@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: globals.h,v 1.6 2002/04/04 05:26:13 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: globals.h,v 1.7 2002/08/12 01:35:02 steve Exp $"
#endif
# include <stdio.h>
@@ -44,6 +44,9 @@ extern int yyparse();
/*
* $Log: globals.h,v $
* Revision 1.7 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.6 2002/04/04 05:26:13 steve
* Add dependency generation.
*
+12 -12
View File
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: lexor.lex,v 1.32 2002/04/04 05:26:13 steve Exp $"
#ident "$Id: lexor.lex,v 1.35 2002/09/25 02:23:08 steve Exp $"
#endif
# include "config.h"
@@ -170,7 +170,7 @@ W [ \t\b\f]+
directive and the name, go into PPDEFINE mode and prepare to
collect the defined value. */
`define{W}[a-zA-Z_][a-zA-Z0-9_]*{W}? { yy_push_state(PPDEFINE); def_start(); }
`define{W}[a-zA-Z_][a-zA-Z0-9_$]*{W}? { yy_push_state(PPDEFINE); def_start(); }
<PPDEFINE>.* {
do_define();
@@ -194,7 +194,7 @@ W [ \t\b\f]+
yy_pop_state();
}
`undef{W}[a-zA-Z_][a-zA-Z0-9_]*{W}?.* { def_undefine(); }
`undef{W}[a-zA-Z_][a-zA-Z0-9_$]*{W}?.* { def_undefine(); }
/* Detect conditional compilation directives, and parse them. If I
@@ -206,7 +206,7 @@ W [ \t\b\f]+
condition that stacks on top of the IFDEF_FALSE so that output is
not accidentally turned on within nested ifdefs. */
^{W}?`ifdef{W}[a-zA-Z_][a-zA-Z0-9_]* {
`ifdef{W}[a-zA-Z_][a-zA-Z0-9_$]* {
char*name = strchr(yytext, '`');
assert(name);
name += 6;
@@ -219,7 +219,7 @@ W [ \t\b\f]+
}
}
^{W}?`ifndef{W}[a-zA-Z_][a-zA-Z0-9_]* {
`ifndef{W}[a-zA-Z_][a-zA-Z0-9_$]* {
char*name = strchr(yytext, '`');
assert(name);
name += 7;
@@ -232,22 +232,22 @@ W [ \t\b\f]+
}
}
<IFDEF_FALSE,IFDEF_SUPR>^{W}?`ifdef{W}.* { yy_push_state(IFDEF_SUPR); }
<IFDEF_FALSE,IFDEF_SUPR>^{W}?`ifndef{W}.* { yy_push_state(IFDEF_SUPR); }
<IFDEF_FALSE,IFDEF_SUPR>`ifdef{W} { yy_push_state(IFDEF_SUPR); }
<IFDEF_FALSE,IFDEF_SUPR>`ifndef{W} { yy_push_state(IFDEF_SUPR); }
<IFDEF_TRUE>{W}?`else { BEGIN(IFDEF_FALSE); }
<IFDEF_FALSE>{W}?`else { BEGIN(IFDEF_TRUE); }
<IFDEF_SUPR>{W}?`else { }
<IFDEF_TRUE>`else { BEGIN(IFDEF_FALSE); }
<IFDEF_FALSE>`else { BEGIN(IFDEF_TRUE); }
<IFDEF_SUPR>`else { }
<IFDEF_FALSE,IFDEF_SUPR>. { }
<IFDEF_FALSE,IFDEF_SUPR>\n { istack->lineno += 1; fputc('\n', yyout); }
<IFDEF_FALSE,IFDEF_TRUE,IFDEF_SUPR>^{W}?`endif {
<IFDEF_FALSE,IFDEF_TRUE,IFDEF_SUPR>`endif {
yy_pop_state();
}
/* This pattern notices macros and arranges for them to be replaced. */
`[a-zA-Z][a-zA-Z0-9_]* { def_match(); }
`[a-zA-Z][a-zA-Z0-9_$]* { def_match(); }
/* Any text that is not a directive just gets passed through to the
output. Very easy. */
+5 -2
View File
@@ -16,8 +16,8 @@ const char COPYRIGHT[] =
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: main.c,v 1.15 2002/04/04 05:26:13 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: main.c,v 1.16 2002/08/12 01:35:02 steve Exp $"
#endif
# include "config.h"
@@ -288,6 +288,9 @@ int main(int argc, char*argv[])
/*
* $Log: main.c,v $
* Revision 1.16 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.15 2002/04/04 05:26:13 steve
* Add dependency generation.
*
+4 -9
View File
@@ -19,14 +19,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: lexor.lex,v 1.71 2002/04/15 00:04:22 steve Exp $"
#ident "$Id: lexor.lex,v 1.73 2002/06/06 18:57:18 steve Exp $"
#endif
# include "config.h"
//# define YYSTYPE lexval
# include <iostream.h>
# include <iostream>
# include "compiler.h"
# include "parse_misc.h"
# include "parse_api.h"
@@ -128,14 +128,9 @@ W [ \t\b\f\r]+
<CCOMMENT>\n { yylloc.first_line += 1; yymore(); }
<CCOMMENT>"*/" { BEGIN(comment_enter); }
/* Pragma comments are very similar to C-style comments, except that
they are allowed to carry tool-specific pragma strings. */
"(*" { comment_enter = YY_START; BEGIN(PCOMMENT); }
<PCOMMENT>. { yymore(); }
<PCOMMENT>\n { yylloc.first_line += 1; yymore(); }
<PCOMMENT>"*)" { BEGIN(comment_enter); }
"(*" { return K_PSTAR; }
"*)" { return K_STARP; }
"<<" { return K_LS; }
">>" { return K_RS; }
"<=" { return K_LE; }
+1 -1
View File
@@ -82,7 +82,7 @@ rpmos, K_rpmos
rtran, K_rtran
rtranif0, K_rtranif0
rtranif1, K_rtranif1
scalered, K_scalered
scalared, K_scalared
signed, K_signed
small, K_small
specify, K_specify
+5 -2
View File
@@ -18,14 +18,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: lexor_keyword.h,v 1.1 2000/03/12 17:09:41 steve Exp $"
#ifdef HAVE_CVS_IDENT
#ident "$Id: lexor_keyword.h,v 1.2 2002/08/12 01:34:59 steve Exp $"
#endif
extern int lexor_keyword_code (const char*str, unsigned len);
/*
* $Log: lexor_keyword.h,v $
* Revision 1.2 2002/08/12 01:34:59 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2000/03/12 17:09:41 steve
* Support localparam.
*
+4
View File
@@ -0,0 +1,4 @@
Makefile
configure
config.*
dep
+89
View File
@@ -0,0 +1,89 @@
#
# This source code is free software; you can redistribute it
# and/or modify it in source code form under the terms of the GNU
# Library General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# 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 Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc.,
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.14 2002/06/11 15:19:12 steve Exp $"
#
#
SHELL = /bin/sh
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
VPATH = $(srcdir)
bindir = @bindir@
libdir = @libdir@
includedir = $(prefix)/include
CC = @CC@ -I$(srcdir) -I$(srcdir)/..
CXX = @CXX@ -I$(srcdir) -I$(srcdir)/..
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
CPPFLAGS = @CPPFLAGS@ @DEFS@
CXXFLAGS = @CXXFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
STRIP = @STRIP@
A = a_close.o a_fetch_argc.o a_fetch_argv.o a_fetch_fullname.o \
a_fetch_tfarg.o a_handle_tfarg.o \
a_initialize.o a_next_topmod.o a_object_of_type.o a_product_version.o \
a_set_value.o a_version.o
O = asynch.o finish.o getcstringp.o getinstance.o getlongp.o \
getp.o getsimtime.o io_print.o mc_scan_plusargs.o nump.o putlongp.o \
putp.o veriusertfs.o $A
all: libveriuser.a
check: all
Makefile: Makefile.in config.status
./config.status
libveriuser.a: $O
rm -f $@
ar cvq $@ $O
%.o: %.c
@[ -d dep ] || mkdir dep
$(CC) -Wall $(CPPFLAGS) $(CFLAGS) -MD -c $< -o $*.o
mv $*.d dep
clean:
rm -f *.o dep/*.d libveriuser.a
distclean: clean
rm -f Makefile config.status config.log config.cache
install:: all installdirs $(libdir)/libveriuser.a
$(libdir)/libveriuser.a: ./libveriuser.a
$(INSTALL_DATA) ./libveriuser.a $(libdir)/libveriuser.a
installdirs: mkinstalldirs
$(srcdir)/mkinstalldirs $(includedir) $(libdir)
uninstall::
rm -f $(libdir)/libveriuser.a
-include $(patsubst %.o, dep/%.d, $O)
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_close.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <acc_user.h>
void acc_close(void) { }
/*
* $Log: a_close.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/05/23 03:46:42 steve
* Add the acc_user.h header file.
*
*/
+49
View File
@@ -0,0 +1,49 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_argc.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <vpi_user.h>
# include <veriuser.h>
/*
* acc_fetch_argc implemented using VPI interface
*/
int acc_fetch_argc(void)
{
s_vpi_vlog_info vpi_vlog_info;
/* get command line info */
if (! vpi_get_vlog_info(&vpi_vlog_info))
return 0;
/* return argc */
return vpi_vlog_info.argc;
}
/*
* $Log: a_fetch_argc.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/11 15:19:12 steve
* Add acc_fetch_argc/argv/version (mruff)
*
*/
+49
View File
@@ -0,0 +1,49 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_argv.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <vpi_user.h>
# include <veriuser.h>
/*
* acc_fetch_argv implemented using VPI interface
*/
char **acc_fetch_argv(void)
{
s_vpi_vlog_info vpi_vlog_info;
/* get command line info */
if (! vpi_get_vlog_info(&vpi_vlog_info))
return (char **)0;
/* return argc */
return vpi_vlog_info.argv;
}
/*
* $Log: a_fetch_argv.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/11 15:19:12 steve
* Add acc_fetch_argc/argv/version (mruff)
*
*/
+42
View File
@@ -0,0 +1,42 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_fullname.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <vpi_user.h>
#include <acc_user.h>
/*
* acc_fetch_fullname implemented using VPI interface
*/
char *acc_fetch_fullname(handle object)
{
return vpi_get_str(vpiFullName, object);
}
/*
* $Log: a_fetch_fullname.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/07 02:58:58 steve
* Add a bunch of acc/tf functions. (mruff)
*
*/
+83
View File
@@ -0,0 +1,83 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_tfarg.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <vpi_user.h>
#include <acc_user.h>
/*
* acc_fetch_tfarg routines implemented using VPI interface
*/
int acc_fetch_tfarg_int(int n)
{
vpiHandle sys_h, sys_i, arg_h = 0;
s_vpi_value value;
int rtn;
sys_h = vpi_handle(vpiSysTfCall, 0);
sys_i = vpi_iterate(vpiArgument, sys_h);
/* scan to nth argument */
while (n > 0 && (arg_h = vpi_scan(sys_i))) n--;
if (arg_h) {
value.format=vpiIntVal;
vpi_get_value(arg_h, &value);
rtn = value.value.integer;
} else {
rtn = 0;
}
return rtn;
}
char *acc_fetch_tfarg_str(int n)
{
vpiHandle sys_h, sys_i, arg_h = 0;
s_vpi_value value;
char *rtn;
sys_h = vpi_handle(vpiSysTfCall, 0);
sys_i = vpi_iterate(vpiArgument, sys_h);
/* scan to nth argument */
while (n > 0 && (arg_h = vpi_scan(sys_i))) n--;
if (arg_h) {
value.format=vpiStringVal;
vpi_get_value(arg_h, &value);
rtn = value.value.str;
} else {
rtn = (char *) 0;
}
return rtn;
}
/*
* $Log: a_fetch_tfarg.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/07 02:58:58 steve
* Add a bunch of acc/tf functions. (mruff)
*
*/
+57
View File
@@ -0,0 +1,57 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_handle_tfarg.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <acc_user.h>
#include <vpi_user.h>
/*
* acc_handle_tfarg implemented using VPI interface
*/
handle acc_handle_tfarg(int n)
{
vpiHandle sys_h, sys_i, rtn_h;
if (n > 0) {
sys_h = vpi_handle(vpiSysTfCall, 0 /* NULL */);
sys_i = vpi_iterate(vpiArgument, sys_h);
/* find nth arg */
while (n > 0) {
rtn_h = vpi_scan(sys_i);
n--;
}
} else {
rtn_h = (vpiHandle) 0;
}
return rtn_h;
}
/*
* $Log: a_handle_tfarg.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/02 19:03:58 steve
* Add acc_handle_tfarg and acc_next_topmode
*
*/
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_initialize.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <acc_user.h>
int acc_error_flag;
int acc_initialize()
{
acc_error_flag = 0;
return 1;
}
/*
* $Log: a_initialize.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/05/23 03:46:42 steve
* Add the acc_user.h header file.
*
*/
+58
View File
@@ -0,0 +1,58 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_next_topmod.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <assert.h>
#include <vpi_user.h>
#include <acc_user.h>
#undef NULL
#define NULL 0
/*
* acc_next_topmod implemented using VPI interface
*/
handle acc_next_topmod(handle prev_topmod)
{
static vpiHandle last = NULL;
static vpiHandle mod_i = NULL;
if (!prev_topmod) {
/* start over */
mod_i = vpi_iterate(vpiModule, NULL);
} else {
/* subsequent time through */
assert(prev_topmod == last);
}
last = vpi_scan(mod_i);
return last;
}
/*
* $Log: a_next_topmod.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/02 19:03:58 steve
* Add acc_handle_tfarg and acc_next_topmode
*
*/
+68
View File
@@ -0,0 +1,68 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_object_of_type.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <assert.h>
#include <vpi_user.h>
#include <acc_user.h>
/*
* acc_object_of_type implemented using VPI interface
*/
int acc_object_of_type(handle object, int type)
{
int vtype;
int rtn = 0; /* false */
/* get VPI type of object */
vtype = vpi_get(vpiType, object);
switch (type) {
case accScope:
if (vtype == vpiModule || vtype == vpiNamedBegin ||
vtype == vpiNamedFork || vtype == vpiTask ||
vtype == vpiFunction) rtn = 1;
break;
case accScalar:
if (vtype == vpiReg || vtype == vpiNet)
rtn = vpi_get(vpiSize, object) == 1;
break;
case accVector:
if (vtype == vpiReg || vtype == vpiNet)
rtn = vpi_get(vpiSize, object) > 1;
break;
default:
vpi_printf("acc_object_of_type: Unknown type %d\n", type);
assert(0);
}
return rtn;
}
/*
* $Log: a_object_of_type.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/07 02:58:58 steve
* Add a bunch of acc/tf functions. (mruff)
*
*/
+43
View File
@@ -0,0 +1,43 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_product_version.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <vpi_user.h>
# include <acc_user.h>
char *acc_product_version(void)
{
s_vpi_vlog_info info;
if (! vpi_get_vlog_info(&info)) return (char *)0;
return info.version;
}
/*
* $Log: a_product_version.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/05/30 02:06:05 steve
* Implement acc_product_version.
*
*/
+121
View File
@@ -0,0 +1,121 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_set_value.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <assert.h>
#include <acc_user.h>
#include <vpi_user.h>
/*
* acc_set_value implemented using VPI interface
*/
int acc_set_value(handle object, p_setval_value value, p_setval_delay delay)
{
s_vpi_time when, *whenp;
s_vpi_value val;
int flags;
assert(delay);
assert(value);
assert(object);
/* map setval_delay.model to flags */
switch (delay->model) {
case accNoDelay: flags = vpiNoDelay; break;
case accInertialDelay: flags = vpiInertialDelay; break;
case accTransportDelay: flags = vpiTransportDelay; break;
case accPureTransportDelay: flags = vpiPureTransportDelay; break;
case accForceFlag: flags = vpiForceFlag; break;
case accReleaseFlag: flags = vpiReleaseFlag; break;
default: assert(0); break;
}
/* map acc_time to vpi_time */
if (delay->model != accNoDelay) {
switch (delay->time.type) {
case accSimTime: when.type = vpiSimTime; break;
case accRealTime: when.type = vpiScaledRealTime; break;
default: assert(0); break;
}
when.high = delay->time.high;
when.low = delay->time.low;
when.real = delay->time.real;
whenp = &when;
} else
whenp = 0;
/* map setval_value to vpi_value and flags */
switch (value->format) {
case accBinStrVal:
val.format = vpiBinStrVal;
val.value.str = value->value.str;
break;
case accOctStrVal:
val.format = vpiOctStrVal;
val.value.str = value->value.str;
break;
case accDecStrVal:
val.format = vpiDecStrVal;
val.value.str = value->value.str;
break;
case accHexStrVal:
val.format = vpiHexStrVal;
val.value.str = value->value.str;
break;
case accScalarVal:
val.format = vpiScalarVal;
val.value.scalar = value->value.scalar;
break;
case accIntVal:
val.format = vpiIntVal;
val.value.integer = value->value.integer;
break;
case accRealVal:
val.format = vpiRealVal;
val.value.real = value->value.real;
break;
case accStringVal:
val.format = vpiStringVal;
val.value.str = value->value.str;
break;
case accVectorVal:
val.format = vpiVectorVal;
val.value.vector = (p_vpi_vecval)value->value.vector;
break;
default: assert(0); break;
}
/* put value */
vpi_put_value(object, &val, whenp, flags);
return 1;
}
/*
* $Log: a_set_value.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/07 02:58:59 steve
* Add a bunch of acc/tf functions. (mruff)
*
*/
+43
View File
@@ -0,0 +1,43 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_version.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <vpi_user.h>
# include <acc_user.h>
char *acc_version(void)
{
s_vpi_vlog_info info;
if (! vpi_get_vlog_info(&info)) return (char *)0;
return info.version;
}
/*
* $Log: a_version.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/11 15:19:12 steve
* Add acc_fetch_argc/argv/version (mruff)
*
*/
+51
View File
@@ -0,0 +1,51 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: asynch.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <veriuser.h>
/* Enables async misctf callbacks */
int async_misctf_enable;
/*
* Implement misctf async enable
*/
int tf_asynchon(void)
{
async_misctf_enable = 1;
return 0;
}
int tf_asynchoff(void)
{
async_misctf_enable = 0;
return 0;
}
/*
* $Log: asynch.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/04 01:40:03 steve
* Add asynchon and asynchoff
*
*/
+20
View File
@@ -0,0 +1,20 @@
AC_INIT(Makefile.in)
AC_PROG_CC
AC_PROG_INSTALL
AC_CYGWIN
AC_EXEEXT
# Darwin requires -no-cpp-precomp
case "${host}" in
*-*-darwin*)
CPPFLAGS="-no-cpp-precomp"
CFLAGS="-no-cpp-precomp"
;;
esac
AC_SUBST(EXEEXT)
AC_SUBST(EXTRALIBS)
AC_OUTPUT(Makefile)
+51
View File
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: finish.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
# include <vpi_user.h>
# include <veriuser.h>
/*
* Implement tf_dofinish and tf_dostop using vpi functions.
*/
int tf_dofinish(void)
{
vpi_sim_control(vpiFinish, 0);
return 0;
}
int tf_dostop(void)
{
vpi_sim_control(vpiStop, 0);
return 0;
}
/*
* $Log: finish.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/05/19 05:21:00 steve
* Start the libveriuser library.
*
*/
+42
View File
@@ -0,0 +1,42 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: getcstringp.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <veriuser.h>
#include <acc_user.h>
/*
* tf_getinstance implemented using equvalent acc_ routing
*/
char *tf_getcstringp(int n)
{
return acc_fetch_tfarg_str(n);
}
/*
* $Log: getcstringp.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/07 02:58:59 steve
* Add a bunch of acc/tf functions. (mruff)
*
*/
+45
View File
@@ -0,0 +1,45 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: getinstance.c,v 1.3 2002/08/12 01:35:02 steve Exp $"
#endif
#include <veriuser.h>
#include <vpi_user.h>
/*
* tf_getinstance implemented using VPI interface
*/
char *tf_getinstance(void)
{
return (char *)vpi_handle(vpiSysTfCall, 0 /* NULL */);
}
/*
* $Log: getinstance.c,v $
* Revision 1.3 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.2 2002/06/03 21:52:59 steve
* Fix return type of tf_getinstance.
*
* Revision 1.1 2002/06/02 18:54:59 steve
* Add tf_getinstance function.
*
*/
+81
View File
@@ -0,0 +1,81 @@
/* vi:sw=6
* Copyright (c) 2002 Michael Ruff (mruff at chiaro.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: getlongp.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#endif
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <veriuser.h>
#include <vpi_user.h>
/*
* tf_getlongp implemented using VPI interface
*/
int tf_getlongp(int *highvalue, int n)
{
vpiHandle sys_h, sys_i, arg_h = 0;
s_vpi_value value;
int len, rtn;
char *str, **end = 0;
assert(highvalue);
assert(n > 0);
/* get task/func handle */
sys_h = vpi_handle(vpiSysTfCall, 0);
sys_i = vpi_iterate(vpiArgument, sys_h);
/* find nth arg */
while (n > 0) {
if (!(arg_h = vpi_scan(sys_i))) assert(0);
n--;
}
/* get the value */
value.format = vpiHexStrVal;
vpi_get_value(arg_h, &value);
/* convert string to int(s) */
len = strlen(value.value.str);
if (len > 8) {
/* low word */
str = value.value.str + (len - 8);
rtn = (int) strtoul(str, end, 16);
/* high word */
*str = '\0';
*highvalue = (int) strtoul(value.value.str, end, 16);
} else {
*highvalue = 0;
rtn = (int) strtoul(value.value.str, end, 16);
}
return rtn;
}
/*
* $Log: getlongp.c,v $
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*
* Revision 1.1 2002/06/07 02:58:59 steve
* Add a bunch of acc/tf functions. (mruff)
*
*/

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