Giter Club home page Giter Club logo

fpga_test_soc's Introduction

FPGA Test SoC

Github: https://github.com/ultraembedded/fpga_test_soc

A small test SoC for various soft-CPUs (Cortex-M0, RISC-V).

Cloning

This repo contains submodules.
Make sure to clone them with the following command;

git clone --recursive https://github.com/ultraembedded/fpga_test_soc.git

Features

  • Support for RISC-V or ARM Cortex-M0 CPU
  • Load SW via UART/USB serial.
  • Multi-channel timer peripheral.
  • UART peripheral.
  • SPI (master mode) peripheral with 8 chip selects.
  • 32 I/O GPIO controller.
  • Interrupt controller (combines peripheral IRQs into single IRQ).

Memory Map

Range Description
0x0000_0000 - 0x0000_ffff 64-KB Memory (RISC-V)
0x0000_0000 - 0x0000_7fff 32-KB Instruction Memory (Cortex-M0)
0x2000_0000 - 0x2000_7fff 32-KB Data Memory (Cortex-M0)
0x9000_0000 - 0x90ff_ffff Peripheral - IRQ controller
0x9100_0000 - 0x91ff_ffff Peripheral - Timer
0x9200_0000 - 0x92ff_ffff Peripheral - UART
0x9300_0000 - 0x93ff_ffff Peripheral - SPI
0x9400_0000 - 0x94ff_ffff Peripheral - GPIO

Project Files

This project is constructed from various sub-projects;

├── cpu
│   ├── cortex_m0
│   │   └── src_v
│   │       ├── ahb_dport.v
│   │       ├── cortexm0ds_logic.v       [NOT SUPPLIED]
│   │       ├── CORTEXM0INTEGRATION.v    [NOT SUPPLIED]
│   │       ├── cortex_m0.v
│   │       ├── cortex_m0_wrapper.v
│   │       ├── dport_axi.v
│   │       ├── dport_mem_pmem.v
│   │       ├── dport_mem_ram13.v
│   │       ├── dport_mem.v
│   │       └── dport_mux.v
│   └── riscv
│       ├── core
│       │   ├── rv32i
│       │   │   ├── riscv_alu.v
│       │   │   ├── riscv_core.v
│       │   │   ├── riscv_csr.v
│       │   │   ├── riscv_decode.v
│       │   │   ├── riscv_defs.v
│       │   │   ├── riscv_exec.v
│       │   │   ├── riscv_fetch.v
│       │   │   ├── riscv_lsu.v
│       │   │   └── riscv_regfile.v
│       │   ├── rv32im
│       │   │   ├── riscv_alu.v
│       │   │   ├── riscv_core.v
│       │   │   ├── riscv_csr.v
│       │   │   ├── riscv_decode.v
│       │   │   ├── riscv_defs.v
│       │   │   ├── riscv_exec.v
│       │   │   ├── riscv_fetch.v
│       │   │   ├── riscv_lsu.v
│       │   │   ├── riscv_muldiv.v
│       │   │   └── riscv_regfile.v
│       │   ├── rv32imsu
│       │   │   ├── riscv_alu.v
│       │   │   ├── riscv_core.v
│       │   │   ├── riscv_csr.v
│       │   │   ├── riscv_decode.v
│       │   │   ├── riscv_defs.v
│       │   │   ├── riscv_exec.v
│       │   │   ├── riscv_fetch.v
│       │   │   ├── riscv_lsu.v
│       │   │   ├── riscv_mmu_arb.v
│       │   │   ├── riscv_mmu.v
│       │   │   ├── riscv_muldiv.v
│       │   │   └── riscv_regfile.v
│       │   └── rv32i_spartan6
│       │       ├── riscv_alu.v
│       │       ├── riscv_core.v
│       │       ├── riscv_csr.v
│       │       ├── riscv_decode.v
│       │       ├── riscv_defs.v
│       │       ├── riscv_exec.v
│       │       ├── riscv_fetch.v
│       │       ├── riscv_lsu.v
│       │       └── riscv_regfile.v
│       └── top_tcm_wrapper
│           ├── dport_axi.v
│           ├── dport_mux.v
│           ├── riscv_tcm_wrapper.v
│           ├── tcm_mem_pmem.v
│           ├── tcm_mem_ram.v
│           └── tcm_mem.v
├── fpga
│   ├── arty_a7
│   │   ├── artix7_pll.v
│   │   ├── arty_revb.xdc
│   │   ├── makefile
│   │   └── top.v
│   ├── common
│   │   ├── axi4_axi4lite_conv.v
│   │   ├── fpga_top.v
│   │   ├── makefile.fpga_ise
│   │   ├── makefile.fpga_vivado
│   │   └── reset_gen.v
│   ├── minispartan6
│   │   ├── fpga.ucf
│   │   ├── makefile
│   │   └── top.v
│   └── qmtech_a7
│       ├── makefile
│       ├── top.v
│       └── xc7m.xdc
└── soc
    ├── core_soc
    │   └── src_v
    │       ├── axi4lite_dist.v
    │       ├── core_soc.v
    │       ├── gpio_defs.v
    │       ├── gpio.v
    │       ├── irq_ctrl_defs.v
    │       ├── irq_ctrl.v
    │       ├── spi_lite_defs.v
    │       ├── spi_lite.v
    │       ├── timer_defs.v
    │       ├── timer.v
    │       ├── uart_lite_defs.v
    │       └── uart_lite.v
    └── dbg_bridge
        └── src_v
            ├── dbg_bridge_fifo.v
            ├── dbg_bridge_uart.v
            └── dbg_bridge.v

Getting Started

Building a FPGA target (RISC-V)

# Choose target board
cd fpga/arty_a7

# Make sure Vivado environmental variables setup
source /opt/Xilinx/Vivado/XXXX.X/settings64.sh

# Build bitstream
make CPU=riscv

# Load bitstream onto target board
make run

Building a FPGA target (Cortex-M0)


# Download ARM Cortex-M0 DesignStart from ARM

# Copy CPU core files into this project
cp CORTEXM0INTEGRATION.v cpu/cortex_m0/src_v/
cp cortexm0ds_logic.v cpu/cortex_m0/src_v/

# Choose target board
cd fpga/arty_a7

# Make sure Vivado environmental variables setup
source /opt/Xilinx/Vivado/XXXX.X/settings64.sh

# Build bitstream
make CPU=armv6m

# Load bitstream onto target board
make run

Running helloworld on the target


# Find correct tty port (replace /dev/ttyUSB1 as appropriate)...

# Run FW on target
./run.py -d /dev/ttyUSB1 -f prebuilt/helloworld_riscv.elf 
ELF: Loading 0x0 - size 15KB
 |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| 100.0% 
helloworld!
helloworld!
helloworld!
helloworld!
helloworld!
helloworld!
helloworld!
helloworld!

fpga_test_soc's People

Contributors

skiphansen avatar ultraembedded avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fpga_test_soc's Issues

Could you provide a biriscv core version

I saw the commit in biriscv that it can run on an Arty board, but I don't know how to do that.
So could you please provide a birisicv core version of fpga_test_soc? thanks.

Please provide source for prebuild helloworld_riscv.elf

I've added support for the second generation Panologic device to this project and it's almost working.

However the output of the prebuilt hello world program isn't as expected. Having source would help me debug the problem.

I tried lowering the baudrate to 115200 thinking that my FTDI serial cable might not be able to keep up at 1megabit but that didn't seem to help.

Here's what I get:
--- snip ---
skip@dell-790:~/pano/working/fpga_test_soc$ ./run.py -d /dev/ttyUSB0 -f prebuilt/helloworld_riscv.elf
/home/skip/pano/working/fpga_test_soc/run/poke.py -t uart -d /dev/ttyUSB0 -b 1000000 -a 0xF0000000 -v 0x0
/home/skip/pano/working/fpga_test_soc/run/load.py -t uart -d /dev/ttyUSB0 -b 1000000 -f prebuilt/helloworld_riscv.elf -p ''
ELF: Loading 0x0 - size 15KB
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| 100.0%
/home/skip/pano/working/fpga_test_soc/run/console-uart.py -t uart -d /dev/ttyUSB0 -b 1000000 -f prebuilt/helloworld_riscv.elf
helloworld!0123456789ABCDEF0123456789abcdefÔàààààààäðààààààààààààààààààààààààààààààààààààààààààààà<ààààààààààààüàààtààðààààtUnhandled IRQ!Unhandled exception: PC 0x%08x Cause %d!
/home/rob/repo/software/arch/riscv/exception.c!"Unhandled exception"ASSERTException: PC=%08x Cause=%x Status=%08x
REG %.2d: %08x
stackstack_size != 0%s: %s (%s:%d)
ÿè28I%IHIxIøÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
--- snip ---

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.