Commit Graph

8419 Commits

Author SHA1 Message Date
Gwenhael Goavec-Merou d061e9b9cf build/xxx/platform: adding methods to return toolchains list by device, and args by toolchain 2022-11-06 11:22:32 +01:00
Florent Kermarrec 38ee44a85a axi/axi_full: size/lock width are different on AXI3 and AXI4. 2022-11-04 12:35:09 +01:00
Florent Kermarrec 8f459a27dd integration/common/get_mem_data: Remove dead code (thanks @Rongronggg9).
See: https://github.com/enjoy-digital/litex/pull/1488#pullrequestreview-1168106543
2022-11-04 10:21:12 +01:00
Florent Kermarrec adea7879d7 gen/fhdl/verilog: Add Verilog Timescale generation. 2022-11-04 08:15:36 +01:00
enjoy-digital 2ae445018a
Merge pull request #1489 from shenki/crc-pie-fix
Do not build software as PIE
2022-11-04 07:52:45 +01:00
enjoy-digital 3a5a2b5c7d
Merge pull request #1488 from Icenowy/wide-soc
Misc changes for a wider SoC
2022-11-04 07:49:27 +01:00
enjoy-digital a253d7addc
Merge pull request #1487 from Icenowy/c906-ethmac-map
cpu/openc906: add ethmac to memory map and misc changes
2022-11-04 07:42:56 +01:00
Joel Stanley dd0918e9cc Do not build software as PIE
Some builds may default to creating position independent executables
with a .dynamic section containing symbols that must be relocated at
runtime. This section appears after .data section and is included in
the output .bin, causing it to be included in the build time CRC
calculation. The runtime CRC calculation stops after .data, so there
was always a mismatch.

The litex bios has no support for relocating the dynamic symbols, so
disable pie on all platforms. This will improve compatibility with
distro toolchains.

Tested with:

 marocchino / or1k-elf-gcc (GCC 12.1.0-2 Debian 1.0.3) 12.1.0

 vexriscv / riscv64-linux-gnu-gcc (Debian 12.2.0-3) 12.2.0

 microwatt / powerpc64le-linux-gnu-gcc (Debian 12.2.0-3) 12.2.0

Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-11-04 16:29:42 +10:30
Icenowy Zheng 879f1b38bc integration/soc/add_sdram: connect to main bus with its data width
Currently we create a 32-bit Wishbone bus, connect LiteDRAM to it and
then connect it to the main SoC bus. This prevents us from getting
optimized performance from a wider main bus.

Make the intermediate bus to have the same width with the main bus.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-11-04 12:49:56 +08:00
Icenowy Zheng 5ff23066b7 integration/common/get_mem_data: add support for wider data widths
Currently the code only supports 32/64 bit SoC data width.

Add support for any possible data width that is multiply of 32-bit.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-11-04 12:49:56 +08:00
Icenowy Zheng dd6e4868f2 cpu/openc906: add ethmac to memory map and misc changes
The default ethmac section address conflicts with main_ram defined for
openC906.

Add a custom position of ethmac to the memory map, which directly
follows the internal APB.

Also fix the start address of checked IO region from 0xa0000000 to
the full Region 1 in sysmap.h, and add plic and clint sections like
other RISC-V CPU cores (although they're internal to the CPU and won't
be usable by LiteX).

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-11-04 12:47:20 +08:00
enjoy-digital eb2e9a371d
Merge pull request #1485 from Icenowy/64bit-systembus-csr-fix
soc/interconnect/csr: Fix CSR on 64-bit SoC bus width
2022-11-03 21:27:19 +01:00
enjoy-digital b8e007540c
Merge pull request #1486 from alanvgreen/terms
litex/soc: update API to avoid unfortunate terms
2022-11-03 21:25:48 +01:00
Alan Green 61be01ebd4 litex/soc: update API to avoid unfortunate terms
Provides an alternate API to some functions of the SoCBusHandler and bus
Arbiter classes to allow users of the API to avoid the terms 'master'
and 'slave' in certain situations.

Signed-off-by: Alan Green <alan.green@gmail.com>
2022-11-04 06:03:34 +11:00
Florent Kermarrec 21e46b6b6c tools/litex_sim: Avoid use of SoCCore.add_memory_region/add_wb_slave. 2022-11-03 19:22:26 +01:00
Florent Kermarrec 964c82e4e8 soc_core: Move methods that are no longer recommended to compat_soc_core and add compat_notice to them.
These methods were already a compatibility layer for SoC/LiteXSoC and are not recommended
in new designs.
2022-11-03 19:10:31 +01:00
Florent Kermarrec f64dc2b799 gen/fhdl/hierachy: Improve and give names to unnamed modules. 2022-11-03 16:20:07 +01:00
Florent Kermarrec 9321380f48 litex/gen/fhdl: Add initial LiteXHierarchyExplorer and use it to display hierarchy when building SoC. 2022-11-03 10:57:40 +01:00
Florent Kermarrec 507ffb72b5 colorer: Avoid duplication and move it to litex/gen. 2022-11-03 09:49:51 +01:00
enjoy-digital 3986a5b27e
Merge pull request #1484 from cklarhorst/i2c_addr
soc/software: Support non 8bit i2c memory addresses
2022-11-03 09:25:41 +01:00
Icenowy Zheng 0c705537af soc/interconnect/csr: Fix CSR on 64-bit SoC bus width
Currently the code uses the SoC bus width to calculate the alignment of
CSR banks.

However when we get AXI-Lite interconnect support, the CSR bus is not
directly converted from SoC bus now, instead an intermediate bus with
default parameter (which means 32-bit) is created, CSR bus is converted
from it, and finally this bus is attached to the main interconnect with
auto converter if needed. In this case the intermediate bus is always of
32 bit bus width, eliminating the need of caring the SoC bus width when
handling CSR banks.

Tested on 64-bit SoC bus width now; to make the bus further wider,
other codes need to be changed either.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-11-02 23:37:48 +08:00
Christian Klarhorst fa3b4a1f1f soc/software: Support non 8bit i2c memory addresses
Add another parameter to i2c_read/write to specify the size
(in bytes) of the addresses.
2022-11-02 12:45:14 +01:00
enjoy-digital f71bda1c61
Merge pull request #1482 from Icenowy/openc906-fix
misc openc906 fixes and enhancements
2022-11-02 08:36:33 +01:00
Icenowy Zheng 0f097fd4c7 cpu/openc906: misc fixes/enhancements related to L1$
Currently L1$ flush code does not work well because of lack of
synchorizing.

Switch to use T-Head extended instructions instead of CSRs to flush L1
cache (both D and I), and THEADISAEE is set for this.

In addition, Some other performance-related options are enabled too,
including branch predicting, cache prefetching, etc.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-11-01 16:10:46 +08:00
Florent Kermarrec cd2805b422 soc/SoCBusHandler: Set default _interconnect to None. 2022-10-31 09:40:36 +01:00
enjoy-digital c71db5159b
Merge pull request #1448 from tpwrules/fix-framebuffer-colors
soc/cores/video: fix framebuffer color output
2022-10-30 21:26:10 +01:00
enjoy-digital 9497b0cdf5
Merge pull request #1481 from alanvgreen/with-cxx
soc/software/demo/Makefile: define WITH_CXX
2022-10-30 21:25:37 +01:00
enjoy-digital 3704e36c7e
Merge pull request #1476 from shenki/riscv-toolchain
riscv: Fix compilation with new binutils
2022-10-30 21:25:18 +01:00
enjoy-digital 7142d25e98
Merge pull request #1475 from shenki/vhd2v-ghdl
vhd2v: Use GHDL directly
2022-10-30 21:24:44 +01:00
enjoy-digital 59d10b8672
Merge pull request #1480 from Icenowy/axifull-downconv-fix
interconnect/axi/axi_full: Fix AXIDownConverter compilation.
2022-10-30 21:17:10 +01:00
Alan Green 57a35d7a70 soc/software/demo/Makefile: define WITH_CXX
Defines WITH_CXX to the C compiler when including hello.cpp in the demo.
This fixes a bug wahere the the menu did not include the hellocpp item
even when --with-cpp was passed to demo.py

Signed-off-by: Alan Green <alan.green@gmail.com>
2022-10-31 06:35:09 +11:00
Icenowy Zheng 5240d28817 cpu/openc906: fixes to get it work again
We made the bus width of C906 wrong at first, and when we convert its
external interface from AXI-Lite to AXI, it's id width is wrong too.

In addition, the AXI down converter of LiteX is quite weird, so a AXI2WB
bridge is integrated into the core now, like what is done in CVA6.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-10-30 19:59:24 +08:00
Icenowy Zheng ab4880c97e interconnect/axi/axi_full: Fix AXIDownConverter compilation.
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2022-10-30 17:24:32 +08:00
Joel Stanley 0e2a1b54a4 riscv: Fix compilation with new binutils
The csr opcodes are no longer part of the i instruction set, and must be
enabled separately. This can be done by adding _zicsr to the march
string, eg. -march=rv32i_zicsr. However this is not recognised by older
toolchains, so we can't change over until everyone is using binutils
2.28 or later.

An alternate fix was merged for Vexriscv by patching .S files in
https://github.com/enjoy-digital/litex/pull/1292. This only fixes the
problem for .S files, so the usage of csr instructions in c files was
still broken.

Later it was fixed for all source files for Vexriscv in
https://github.com/enjoy-digital/litex/pull/1321 by telling the compiler
to target the 2.0 ISA, where the csr instructions were still present.

Make the same change to all riscv cpus that specify -march=rv32. This
should allow both old and new toolchains to build software.

Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-10-29 22:36:32 +10:30
Joel Stanley deafbf5efe vhd2v: Use GHDL directly
As of April 2022, GHDL can output Verilog directly without the use of
yosys. This simplifies the build environment for flows that simply want
to convert VHDL to Verilog.

Note that this removes some arguments from ghdl that are not required to
synthesise ether Microwatt or neorv32.

Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-10-29 22:27:23 +10:30
enjoy-digital e3c33191b0
Merge pull request #1474 from trabucayre/f4pga_edalize
F4pga edalize
2022-10-29 12:46:17 +02:00
Gwenhael Goavec-Merou 0855612b6d build/lattice/icestorm: use PNR getter to fill edalize dict 2022-10-29 11:16:55 +02:00
Gwenhael Goavec-Merou 50ffd0cd02 build/{nextpnr_wrapper, yosys_nextpnr_toolchain}: adding getter to retrieve pnr configuration 2022-10-29 11:15:52 +02:00
Gwenhael Goavec-Merou 50cf037bef build/xilinx/f4pga: adding edalize backend support 2022-10-29 09:14:49 +02:00
Gwenhael Goavec-Merou 949f262ce9 build/xilinx/f4pga: XDC -> xdc 2022-10-29 09:14:05 +02:00
Gwenhael Goavec-Merou 79cc3698b8 build/generic_toolchain, build/lattice/icestorm: tool_options is now a dict {key, value} (with value can be a dict) => edaflow compat 2022-10-29 09:12:51 +02:00
Gwenhael Goavec-Merou ab6bb331fd build/generic_toolchain: space before = 2022-10-29 09:08:19 +02:00
Florent Kermarrec 2086cced22 soc/interconnect/csr_eventmanager: Also switch to new Reduce. 2022-10-28 19:38:45 +02:00
Florent Kermarrec 2829ca93f7 litex/gen: Move LiteXModule to gen/fhdl/module.py. 2022-10-28 19:38:24 +02:00
Florent Kermarrec e3e99c527c soc/cores/interconnect: Switch most of the cores to new Reduce. 2022-10-28 19:31:33 +02:00
Florent Kermarrec a10b1fd1e6 gen/common/Reduce: Add ADD support. 2022-10-28 19:13:27 +02:00
Florent Kermarrec 5106fd43fc gen/common: Add Reduction function (To avoid using Python's reduction directly which is messy/confusing). 2022-10-28 15:13:17 +02:00
Florent Kermarrec 13448b8260 soc/SoCBusHandler: Integrate interconnect code since avoid duplication and simplify reuse.
Also extends supported data_widths.

A simple custom interconnect can now be created with code like this:

# Create 2 AXI Masters / 2 AXI Slaves.
axi_m_0 = axi.AXIInterface(data_width=32,  address_width=32)
axi_m_1 = axi.AXIInterface(data_width=64,  address_width=32)
axi_s_0 = axi.AXIInterface(data_width=512, address_width=32)
axi_s_1 = axi.AXIInterface(data_width=512, address_width=32)

axi_s_0_region = SoCRegion(origin=0x00000000, size=0x10000000)
axi_s_1_region = SoCRegion(origin=0x10000000, size=0x10000000)

# Create Bus Handler .
self.custom_bus = SoCBusHandler(
    name                  = "SoCCustomBusHandler",
    standard              = "axi",
    data_width            = 512,
    address_width         = 32,
    bursting              = True,
    interconnect          = "crossbar",
    interconnect_register = True,
)

# Add AXI Buses.
self.custom_bus.add_master(master=axi_m_0)
self.custom_bus.add_master(master=axi_m_1)
self.custom_bus.add_slave(slave=axi_s_0, region=axi_s_0_region)
self.custom_bus.add_slave(slave=axi_s_0, region=axi_s_1_region)

# Finalize.
self.custom_bus.finalize()
print(self.custom_bus)
2022-10-28 12:47:38 +02:00
Florent Kermarrec 3603e90ed8 integration/soc/SoC: Add collection of CSRs described in Main Module (ie Top-Level).
CSRs added to the Main Module were silently ignored. These are now collected and automatically
added to a "main" Sub-Module.

This feature is useful to quickly create/add CSRs in the design when debugging, ex:

# Adds a "debug" CSR to a SoC and connect register to pads:
self.debug = CSRStorage()
self.comb += pads.debug.eq(self.debug.storage).
2022-10-28 10:04:12 +02:00
Florent Kermarrec 1f2d4f017a integration/soc: Switch to LiteXModule and from self.submodules/self.clock_domains to self. 2022-10-27 16:04:17 +02:00