From b3dbe43365641974349528a5daa271facbb5afcf Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 10 Jan 2026 13:32:36 +0100 Subject: [PATCH] adds 2x eth controller --- .github/workflows/cmake-single-platform.yml | 2 +- src/vp/system.cpp | 18 ++++++++++-------- src/vp/system.h | 3 +++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 51a247d..af84b8a 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -42,5 +42,5 @@ jobs: - name: Smoke Test working-directory: ${{github.workspace}} - run: ${{github.workspace}}/build/${{env.BUILD_TYPE}}/src/riscv-vp -f fw/hello-world/hello.elf + run: ${{github.workspace}}/build/${{env.BUILD_TYPE}}/src/riscv-vp -f ${{github.workspace}}/fw/hello-world/hello.elf diff --git a/src/vp/system.cpp b/src/vp/system.cpp index 8d1ed42..1ec4e78 100644 --- a/src/vp/system.cpp +++ b/src/vp/system.cpp @@ -16,20 +16,18 @@ using namespace vpvper::minres; system::system(sc_core::sc_module_name nm) : sc_core::sc_module(nm) -, NAMED(ahb_router, 3, 2) +, NAMED(ahb_router, 5, 2) , NAMED(apbBridge, PipelinedMemoryBusToApbBridge_map.size(), 1) { mtime_clk = (1.0 / 32768) * 1_sec; core_complex.ibus(ahb_router.target[0]); core_complex.dbus(ahb_router.target[1]); - ahb_router.initiator.at(0)(qspi.xip_sck); - ahb_router.set_target_range(0, 0x20000000, 16_MB); - ahb_router.initiator.at(1)(mem_ram.target); - ahb_router.set_target_range(1, 0x00000000, 128_kB); - ahb_router.initiator.at(2)(apbBridge.target[0]); - ahb_router.set_target_range(2, 0x10000000, 256_MB); - + ahb_router.bind_target(mem_ram.target, 1, 0x00000000, 128_kB); + ahb_router.bind_target(apbBridge.target[0], 2, 0x10000000, 128_MB); + ahb_router.bind_target(eth0.socket, 3, 0x18000000, 4_KiB); + ahb_router.bind_target(eth1.socket, 4, 0x18001000, 4_KiB); + ahb_router.bind_target(qspi.xip_sck, 0, 0x20000000, 16_MB); size_t i = 0; for(const auto& e : PipelinedMemoryBusToApbBridge_map) { apbBridge.initiator.at(i)(e.target); @@ -45,6 +43,8 @@ system::system(sc_core::sc_module_name nm) qspi.clk_i(clk_i); core_complex.clk_i(clk_i); // mem_ram.clk_i(clk_i); + eth0.clk_i(clk_i); + eth1.clk_i(clk_i); gpio0.rst_i(rst_s); uart0.rst_i(rst_s); @@ -53,6 +53,8 @@ system::system(sc_core::sc_module_name nm) irq_ctrl.rst_i(rst_s); qspi.rst_i(rst_s); core_complex.rst_i(rst_s); + eth0.rst_i(rst_s); + eth1.rst_i(rst_s); aclint.mtime_clk_i(mtime_clk); aclint.mtime_o(mtime_s); diff --git a/src/vp/system.h b/src/vp/system.h index 29a8136..1d03222 100644 --- a/src/vp/system.h +++ b/src/vp/system.h @@ -10,6 +10,7 @@ #include "tlm/scc/quantum_keeper.h" #include #include +#include #include #include #include @@ -58,6 +59,8 @@ private: vpvper::minres::aclint_tl aclint{"aclint"}; vpvper::minres::irq_tl irq_ctrl{"irq_ctrl"}; vpvper::minres::qspi_tl qspi{"qspi"}; + vpvper::minres::ethmac eth0{"eth0"}; + vpvper::minres::ethmac eth1{"eth1"}; scc::memory<128_kB, scc::LT> mem_ram{"mem_ram"}; scc::memory<8_kB, scc::LT> boot_rom{"boot_rom"};