Commit Graph

114 Commits

Author SHA1 Message Date
enjoy-digital 8303e462ec
Merge pull request #1224 from fjullien/fix_add_sources
platform: fix add_sources
2022-02-24 22:29:18 +01:00
Franck Jullien 289c7fbf54 platform: fix add_sources
If the Builder class is not used to build the projet, platform sources
is still a list of tupples with 4 elements.

For now, we don't handle file copy when Builder is not used but at least
it won't crash.
2022-02-24 21:24:05 +01:00
enjoy-digital 9d68a9479c
Merge pull request #1153 from fjullien/allow_module_in_project_dir
sim: allow custom modules to be in custom path
2022-02-18 17:16:25 +01:00
Florent Kermarrec 419d605e38 build/toolchains: Specify passed toolchain when unknown. 2022-01-26 11:56:22 +01:00
Florent Kermarrec 3683c5b866 build/sim/platform: Add loose support to request. 2022-01-19 16:39:32 +01:00
Florent Kermarrec 3d8ffa1897 build/sim/verilator: Add verilator_build_args/argdict to reduce duplication in sim targets. 2022-01-18 18:47:12 +01:00
Franck Jullien 438bb0b570 sim: allow custom modules to be in custom path
If a project needs a custom verilator module, it can now
specifies the path where the module's directory is.

SimPlatform can now look for extra modules:

    builder.build(
        extra_mods = ["mymodule1", "mymodule2"],
        extra_mods_path = os.path.abspath(os.getcwd()) + "/modules",
        sim_config=sim_config
    )

Modules must be subdirectories of extra_mods_path:

.
├── modules
│   ├── mymodule1
│   ├── mymodule2
│   ├── ...
2022-01-09 21:15:11 +01:00
Leon Schuermann c18635ad19 litex_sim/xgmii: remove IFG SUFFICIENT debug message
Removes a leftover debug message for validating correct XGMII IFG DIC
behavior. Useful for development, but gets annoying quickly while
running the simulation.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-11-30 14:19:12 +01:00
Leon Schuermann de6085c5b3 sim/xgmii_ethernet: support RX IFG deficit idle count mechanism
Because XGMII only allows start of frame characters to be placed on lane
0 (first octet in a 32-bit XGMII bus word), when a packet's length % 4 !=
0, we can't transmit exactly 12 XGMII idle characters inter-frame gap
(the XGMII end of frame character counts towards the inter-frame gap,
while start of frame does not). Given we are required to transmit a
minimum of 12 bytes IFG, it's allowed to send packet length % 4 bytes
additional IFG bytes. However this would waste precious bandwidth
transmitting these characters.

Thus, 10Gbit/s Ethernet and above allow using the deficit idle count
mechanism. It allows to delete some idle characters, as long as an
average count of >= 12 bytes IFG is maintained. This is to be
implemented as a two bit counter as specified in IEEE802.3-2018,
section four, 46.3.1.4 Start control character alignment.

This commit optionally implements the deficit idle count algorithm as
described by Eric Lynskey of the UNH InterOperability Lab[1]. It may
not have much or any impact in the XGMII simulation when using a TAP
interface, however when connecting this simulation to another the DIC
mechanism is a valuable implementation for both saturating proper
10Gbit/s linerate and validating the LiteEth PHY (XGMII to stream)
converter implementation.

[1]: https://www.iol.unh.edu/sites/default/files/knowledgebase/10gec/10GbE_DIC.pdf

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-11-17 13:47:02 +01:00
Leon Schuermann 228c8699b5 sim/xgmii_ethernet: add RX IFG insertion
The previous state of the xgmii_ethernet module did not insert an
inter-frame gap at all. The IFG is mandated as part of the IEEE802.3
specification for Ethernet and as such the module was incorrect.

This fixes the inter-frame gap insertion by keeping track of the IFG
using a counter.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-11-17 13:47:02 +01:00
Leon Schuermann 05dda4cbdc sim/xgmii_ethernet: switch internal bus representation to 32 bits
The xgmii_ethernet module used to represent internal XGMII interface
signals using 64-bit signals. While this is not incorrect per se, it
makes a standards-compliant implementation of the XGMII significantly
harder in the long run. This is because XGMII fundamentally is defined
as a 32-bit bus, and thus has constraints in relation to that bus
width. For example, it is specified that packets may only ever start
on the XGMII lane 0, that is the first octet of a 32-bit XGMII bus
word. Hence, to properly handle a XGMII start of frame control
character using a 64-bit bus representation, the first and fifth octet
would need to be respected, along with shifting data depending on the
start octet.

Hence this change causes the internal XGMII interface to be
represented as a 32-bit bus. Because it is common for FPGAs to
implement the XGMII as a 64-bit bus given the fact that a DDR bus
cannot be represented in an FPGA and 32 bits without DDR would require
a clock frequency of 312.5MHz, it still permits 64-bit operation. This
is implemented by always transmitting two 32-bit bus words back to
back.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-11-17 13:47:02 +01:00
Florent Kermarrec 2740dd34e7 sim/verilator: Revert regular_comb change and just pass it to get_verilog as before. 2021-11-05 16:27:38 +01:00
Matt Johnston 1716e37809 litex_sim: Allow regular_comb=False argument
This was removed in
3b78fd928d fhdl/verilog: Remove blocking_assign (not used with LiteX).

However that breaks litedram gen.py which passes regular_comb=False
to all toolchain builders
2021-11-02 18:16:28 +08:00
Leon Schuermann f2a622975a litex_sim/xgmii_ethernet: fix RX frame check sequence generation
The rewritten XGMII Ethernet module generates proper frame check
sequences (FCS) on Ethernet frames received by the simulation, such
that the unmodified MAC pipeline including CRC checking can be
used. However, the byte order of the generated frame check sequence
has been inverted. This becomes apparent when one specifies that the
CRC should be calculated in the LiteX BIOS.

This fixes the byte order to be correct. The similar GMII Ethernet
module did not contain this mistake.

Fixes: 7b533a032d ("litex_sim: rewrite XGMII verilator...")
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-10-25 08:57:36 +02:00
Florent Kermarrec 3b78fd928d fhdl/verilog: Remove blocking_assign (not used with LiteX). 2021-10-15 15:20:01 +02:00
Florent Kermarrec 8c3508e7f5 fhdl/verilog: Remove dummy_signal (no longer used). 2021-10-15 15:09:41 +02:00
Florent Kermarrec de738e153d tools/litex_sim: Avoid double build iteration with pre_run_callback function. 2021-09-28 09:58:43 +02:00
enjoy-digital 87f7f3bc45
Merge branch 'master' into dev/litex-sim-gmii-xgmii 2021-09-27 17:47:26 +02:00
wuhanstudio 5d9880888c fix: missing colon syntax error 2021-09-07 11:21:41 +01:00
Florent Kermarrec a6f9ac58bb build/sim/common: Review/Cleanup #1021 for consistency with other backends. 2021-09-07 09:44:43 +02:00
Leon Schuermann 08a14e8cf1 litex_sim: add GMII verilator module and add support in litex_sim
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-09-01 20:44:50 +02:00
Leon Schuermann 7b533a032d litex_sim: rewrite XGMII verilator module and add support in litex_sim
Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-09-01 20:44:45 +02:00
Leon Schuermann 92ceb8f73d litex_sim: rename clk_edge to clk_edge_state, add clk_edge enum
This renames the `clk_edge_t` struct to `clk_edge_state_t`, given it
only tracks the previous clock edge state.

Furthermore introduce a new `enum clk_edge` (typedef'd to
`clk_edge_t`) which represents all possible clock edges and add a
function (`clk_edge`) to retrieve the type of current clock edge as a
`clk_edge_t`.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
2021-09-01 20:44:41 +02:00
Pawel Sagan 8aa7c1b9dd litex: adding oddr/iddr/ddrtristate simulation models
Signed-off-by: Pawel Sagan <psagan@antmicro.com>
2021-09-01 10:25:21 +02:00
Jędrzej Boczar 4636a841d3 build/sim/gtkwave: automate handling of Endpoint and other stream primitives 2021-07-22 15:49:20 +02:00
Vadzim Dambrouski 35204225e8 Fix compile error when FST traces are enabled on macOS.
Compile options should be the same for all platforms.
2021-06-27 17:34:43 +03:00
developandplay 7d2e19ac26 Enable non-interactive mode 2021-06-18 12:35:42 +02:00
developandplay 8ef7353fe5
Add interactivity option to simulation 2021-04-14 13:39:47 +02:00
Jędrzej Boczar bea82efc5d gtkwave: fix error when prefix is empty, make treeopen optional 2021-03-23 10:08:06 +01:00
Florent Kermarrec a1e54671be sim/serial2console: Remove \r workaround since no longer required and generating double carrier return in simulation. 2021-03-06 17:36:21 +01:00
Florent Kermarrec d3407c67b1 build/sim/core: Cast main_time to vluint64_t to avoid ambiguity error of the dump function to be used. 2021-03-03 09:25:54 +01:00
Jędrzej Boczar b1fb141d1f Fix gtkwave.py to be compatible with python 3.6 2021-02-02 11:14:16 +01:00
Jędrzej Boczar 01b900f4e0 Add GTKWave savefile generator 2021-02-01 13:22:30 +01:00
Florent Kermarrec db836e8e5d build: add toolchain check before running build script and improve error reporting. 2020-11-04 09:42:18 +01:00
Michael Betz 6e3e979a0b serial2tcp.c json error handling, respect rx.ready 2020-10-04 18:17:28 -07:00
Jędrzej Boczar 7c3fbf1d06 sim: improve tracing reset value and behaviour with sim_debug=False 2020-09-07 15:29:02 +02:00
Jędrzej Boczar 3fd567c4c9 sim: additional simulation tracing and debugging tools 2020-09-07 15:28:26 +02:00
Florent Kermarrec e8f21cd958 build/sim/verilator: cleanup SimVerilatorToolchain, return to initial path after build/run. 2020-09-03 09:21:14 +02:00
Florent Kermarrec 70610b2332 build: add SPDX License identifier and specify file is part of LiteX. 2020-08-23 15:14:45 +02:00
Florent Kermarrec 0ca99b798f build/sim/config: add default_clk/default_clk_freq parameters for retro-compatibility with previous API. 2020-08-04 15:49:53 +02:00
Florent Kermarrec 696ea468b8 build/sim: use json_object_get_int64 instead of json_object_get_uint64.
json_object_get_uint64 does not seem supported with old json-c versions.
2020-08-04 15:49:26 +02:00
Jędrzej Boczar f778ff09dc build/sim: improve timebase calculation (strict checks) and update modules 2020-08-04 14:00:58 +02:00
Jędrzej Boczar c1ae7e596c build/sim: allow for arbitrary clocks generation using clockers 2020-08-03 17:06:38 +02:00
Jędrzej Boczar 38054874ac build/sim: use a real timebase in the simulation 2020-08-03 15:21:24 +02:00
Dolu1990 b455a81678
Improve verilator compilation speed
by asking verilator to split the C++ model into multiple files.
2020-06-30 10:38:26 +02:00
Ilia Sergachev 3610b066c2 build/sim/core/modules: fix compilation warnings 2020-06-16 01:06:11 +02:00
Jędrzej Boczar 1692dfbf61 build/sim/spdeeprom: use hex format when loading from file 2020-05-29 14:56:56 +02:00
Jędrzej Boczar a0ce4ce56b litex/build/sim: add module for simulating SPD EEPROM 2020-05-28 12:10:25 +02:00
Florent Kermarrec 795ff08a20 build/sim/verilator: add regular_comb parameter (that defaults to False) and pass it to get_verilog. 2020-05-27 19:54:52 +02:00
Florent Kermarrec 2eea786436 build/sim: rename dut to sim (for consistency with other builds). 2020-05-21 09:06:29 +02:00