Skip to content

Commit

Permalink
Merge pull request #56 from PedroAntunes178/master
Browse files Browse the repository at this point in the history
*: SoC runs Linux in Simulation.
  • Loading branch information
jjts authored Oct 20, 2023
2 parents 6e2eb69 + c4eb13c commit 16de727
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 187 deletions.
188 changes: 15 additions & 173 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,240 +23,82 @@ on:
workflow_dispatch:

jobs:
# Disable pc-emul because PLIC and CLINT do not have pc-emul drivers (yet)
#pc-emul:
# runs-on: self-hosted
# timeout-minutes: 5

# steps:
# - uses: actions/checkout@v3
# with:
# submodules: 'recursive'
# - name: clean
# run: make clean
# - name: setup
# run: nix-shell --run "make setup"
# - name: pc-emul test
# run: make -C ../iob_soc_o* pc-emul-test

verilator-baremetal:
iverilog-baremetal:
runs-on: self-hosted
timeout-minutes: 30
# run even if previous job failed
if: ${{ !cancelled() }}
# run after indicated job
#needs: [ pc-emul ]


steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# IOb-SoC-Opencryptolinux only supports USE_EXTMEM=1
## Init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup init_mem
# run: nix-shell --run "make setup RUN_LINUX=0"
#- name: verilator test
# run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
## No init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup
# run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0"
#- name: verilator test
# run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
# Init mem and Ext mem
- name: clean
run: nix-shell --run "make clean"
- name: setup init_mem ext_mem
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=1 USE_EXTMEM=1"
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=1"
- name: verilator test
run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
# Test without init mem takes too long
# No init mem and Ext mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup ext_mem
# run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0 USE_EXTMEM=1"
#- name: verilator test
# run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
run: nix-shell --run "make -C ../iob_soc_o* sim-run"

verilator-linux:
verilator-baremetal:
runs-on: self-hosted
timeout-minutes: 30
# run even if previous job failed
if: ${{ !cancelled() }}
# run after indicated job
#needs: [ pc-emul ]


steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# IOb-SoC-Opencryptolinux only supports USE_EXTMEM=1
## Init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup init_mem
# run: nix-shell --run "make setup"
#- name: verilator test
# run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
## No init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup
# run: nix-shell --run "make setup INIT_MEM=0"
#- name: verilator test
# run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
# Init mem and Ext mem
- name: clean
run: nix-shell --run "make clean"
- name: setup init_mem ext_mem
run: nix-shell --run "make setup INIT_MEM=1 USE_EXTMEM=1"
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0"
- name: verilator test
run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
# Test without init mem takes too long
# No init mem and Ext mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup ext_mem
# run: nix-shell --run "make setup INIT_MEM=0 USE_EXTMEM=1"
#- name: verilator test
# run: nix-shell --run "make -C ../iob_soc_o* sim-test SIMULATOR=verilator"
run: nix-shell --run "make -C ../iob_soc_o* sim-run SIMULATOR=verilator"


cyclonev-baremetal:
runs-on: self-hosted
timeout-minutes: 60
# run even if previous job failed
if: ${{ !cancelled() }}
# run after indicated job
needs: [ verilator-baremetal ]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# IOb-SoC-Opencryptolinux only supports USE_EXTMEM=1
## Init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup init_mem
# run: nix-shell --run "make setup RUN_LINUX=0"
#- name: cyclonev test
# run: make -C ../iob_soc_o* fpga-test BOARD=CYCLONEV-GT-DK
## No init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup
# run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0"
#- name: cyclonev test
# run: make -C ../iob_soc_o* fpga-test BOARD=CYCLONEV-GT-DK
# No init mem and Ext mem
- name: clean
run: nix-shell --run "make clean"
- name: setup ext_mem
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0 USE_EXTMEM=1"
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0"
- name: cyclonev test
run: make -C ../iob_soc_o* fpga-test BOARD=CYCLONEV-GT-DK

aes-ku040-baremetal:
runs-on: self-hosted
timeout-minutes: 90
# run even if previous job failed
if: ${{ !cancelled() }}
# run after indicated job
needs: [ verilator-baremetal ]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# IOb-SoC-Opencryptolinux only supports USE_EXTMEM=1
## Init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup init_mem
# run: nix-shell --run "make setup RUN_LINUX=0"
#- name: ku040 test
# run: make -C ../iob_soc_o* fpga-test BOARD=AES-KU040-DB-G
## No init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup
# run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0"
#- name: ku040 test
# run: make -C ../iob_soc_o* fpga-test BOARD=AES-KU040-DB-G
# No init mem and Ext mem
- name: clean
run: nix-shell --run "make clean"
- name: setup ext_mem
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0 USE_EXTMEM=1"
run: nix-shell --run "make setup RUN_LINUX=0 INIT_MEM=0"
- name: ku040 test
run: make -C ../iob_soc_o* fpga-test BOARD=AES-KU040-DB-G

cyclonev-linux:
runs-on: self-hosted
timeout-minutes: 60
if: ${{ !cancelled() }}
needs: [ verilator-linux ]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# IOb-SoC-Opencryptolinux only supports USE_EXTMEM=1
## Init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup init_mem
# run: nix-shell --run "make setup"
#- name: cyclonev test
# run: make -C ../iob_soc_o* fpga-test BOARD=CYCLONEV-GT-DK
## No init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup
# run: nix-shell --run "make setup INIT_MEM=0"
#- name: cyclonev test
# run: make -C ../iob_soc_o* fpga-test BOARD=CYCLONEV-GT-DK
# No init mem and Ext mem
- name: clean
run: nix-shell --run "make clean"
- name: setup ext_mem
run: nix-shell --run "make setup INIT_MEM=0 USE_EXTMEM=1"
- name: cyclonev test
run: make -C ../iob_soc_o* fpga-test BOARD=CYCLONEV-GT-DK

aes-ku040-linux:
runs-on: self-hosted
timeout-minutes: 90
if: ${{ !cancelled() }}
needs: [ verilator-linux ]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# IOb-SoC-Opencryptolinux only supports USE_EXTMEM=1
## Init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup init_mem
# run: nix-shell --run "make setup"
#- name: ku040 test
# run: make -C ../iob_soc_o* fpga-test BOARD=AES-KU040-DB-G
## No init mem
#- name: clean
# run: nix-shell --run "make clean"
#- name: setup
# run: nix-shell --run "make setup INIT_MEM=0"
#- name: ku040 test
# run: make -C ../iob_soc_o* fpga-test BOARD=AES-KU040-DB-G
# No init mem and Ext mem
- name: clean
run: nix-shell --run "make clean"
- name: setup ext_mem
run: nix-shell --run "make setup INIT_MEM=0 USE_EXTMEM=1"
- name: ku040 test
run: make -C ../iob_soc_o* fpga-test BOARD=AES-KU040-DB-G

doc:
runs-on: self-hosted
timeout-minutes: 60
Expand Down
2 changes: 1 addition & 1 deletion hardware/simulation/bsp.vh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//`define BAUD 115200
`define BAUD 2000000
`define BAUD 115200
`define FREQ 100000000
`define DDR_DATA_W 32
`define DDR_ADDR_W 26
Expand Down
9 changes: 2 additions & 7 deletions hardware/src/boot_ctr.v
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ module boot_ctr #(
.data_i(boot_nxt),
.data_o(boot)
);
iob_reg #(
.DATA_W (1),
.RST_VAL(1)
) sync_reset (
iob_reset_sync sync_reset (
.clk_i (clk_i),
.arst_i(arst_i),
.cke_i (cke_i),
.data_i(1'b0),
.data_o(rst_sync)
.arst_o(rst_sync)
);
iob_pulse_gen #(
.START (0),
Expand Down
2 changes: 2 additions & 0 deletions hardware/src/iob_soc_opencryptolinux.v
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ module iob_soc_opencryptolinux #(
assign peripheral_axi_rid = {PERIPHERAL_AXI_ID_W{1'b0}};
assign peripheral_axi_rlast = 1'b1;

assign cpu_trap_o = 1'b0;

//
// CPU
//
Expand Down
2 changes: 2 additions & 0 deletions iob_soc_opencryptolinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from iob_uart import iob_uart
from iob_spi import iob_spi
from axil2iob import axil2iob
from iob_reset_sync import iob_reset_sync


class iob_soc_opencryptolinux(iob_soc):
Expand Down Expand Up @@ -59,6 +60,7 @@ def _create_submodules_list(cls, extra_submodules=[]):
iob_vexriscv,
iob_uart16550,
axil2iob,
iob_reset_sync,
# iob_spi,
(iob_uart, {"purpose": "simulation"}),
]
Expand Down
8 changes: 6 additions & 2 deletions software/src/iob_soc_opencryptolinux_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define PROGNAME "IOb-Bootloader"

#define DC1 17 // Device Control 1 (used to indicate end of bootloader)
#define EXT_MEM 0x00000000
#define EXT_MEM 0x80000000

int main() {

Expand Down Expand Up @@ -42,6 +42,7 @@ int main() {

#ifndef INIT_MEM
#ifdef RUN_LINUX

// receive firmware from host
int file_size = 0;
char opensbi[] = "fw_jump.bin";
Expand All @@ -59,6 +60,9 @@ int main() {
uart16550_puts(PROGNAME);
uart16550_puts(": Loading firmware...\n");
}

uart16550_putc((char)DC1);

#else

// receive firmware from host
Expand All @@ -75,10 +79,10 @@ int main() {
uart16550_puts(PROGNAME);
uart16550_puts(": ERROR loading firmware\n");
}

#endif
#endif

uart16550_putc((char)DC1);
// Clear CPU registers, to not pass arguments to the next
asm volatile("li a0,0");
asm volatile("li a1,0");
Expand Down
Loading

0 comments on commit 16de727

Please sign in to comment.