Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PYTHONPATH=build_hw:coyote/sim
PYTHONPATH=hardware/build_hw:coyote/sim
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
build_hw/**
build
hardware/build_hw

# Generated unit test files
unit-tests/diff/**
unit-tests/sim_dump.vcd
unit-tests/sim.out
unit-tests/vapor_view.json
hardware/unit-tests/diff/**
hardware/unit-tests/sim_dump.vcd
hardware/unit-tests/sim.out
hardware/unit-tests/vapor_view.json

# Vivado generated files
*.jou
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"python.testing.unittestArgs": [
"-v",
"-s",
"./unit-tests",
"./hardware/unit-tests",
"-p",
"*_test.py"
],
Expand Down
21 changes: 5 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.16)
project(libstf)

set(CYT_DIR ${CMAKE_SOURCE_DIR}/coyote/)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CYT_DIR}/cmake)
# NOTE: This CMakeLists.txt is only here because of VSCode

find_package(CoyoteHW REQUIRED)
# Find dependencies
add_subdirectory(coyote/sw coyote)

set(N_REGIONS 1)
set(EN_STRM 1)
set(N_STRM_AXI 4)
set(FDEV_NAME u55c)

validation_checks_hw()

load_apps (
VFPGA_C0_0 "src"
)

create_hw()
add_subdirectory(software)
52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,64 @@
This library is a collection of common modules used to develop hardware designs. Some modules are
specific to developing vFPGAs for Coyote. The main functionality libstf offers is:

- Interfaces that transport a specific number of elements, adapters to AXI4S interfaces, and other helpers (src/data_interfaces.sv and src/hdl/stream)
- Utilities for configuration registers accessed through an AXI4L interface (src/hdl/config)
- Crossbar (src/hdl/crossbar)
- Dictionary (src/hdl/dict)
- Stream normalization (src/hdl/normalization)
- vFPGA-specific stream output writer that generates memory requests and communicates with a memory manager on the CPU side (src/hdl/output)
- Interfaces that transport a specific number of elements (ndata), adapters to AXI4S interfaces, and other helpers (hardware/src/data_interfaces.sv and hardware/src/hdl/stream)
- Utilities for configuration registers accessed through an AXI4L interface (hardware/src/hdl/config)
- Crossbar (hardware/src/hdl/crossbar)
- Dictionary (hardware/src/hdl/dict)
- Stream normalization (hardware/src/hdl/normalization)
- Coyote vFPGA-specific stream output writer that generates memory requests and communicates with a output buffer manager on the CPU side (hardware/src/hdl/output)

This library is *work in progress*.
It also features some of the corresponding software-side components to use the hardware. This
repository is *work in progress* and quite a bit of documentation is missing. Please feel free to
contribute.

## Getting Started
## Getting Started (Hardware)
Clone the repo and download the Coyote submodule:
```bash
git clone --recurse-submodules https://github.com/fpgasystems/libstf
```

The recommended way to get started with libstf is to start exploring the Python unit tests in the
`unit-tests` folder. To execute the unit tests, you have to set up the Coyote simulation project
with:
`hardware/unit-tests` folder. To execute the unit tests, you have to set up the Coyote simulation
project with:

```bash
./sim_setup.sh
```

This creates the `build_hw` folder. Anytime you create or rename files in `src/hdl`, you have to
execute this command again. Afterwards, the unit tests should show up in VSCode.
This creates the `hardware/build_hw` folder. Anytime you create or rename files in `src/hdl`, you
have to execute this command again. Afterwards, the unit tests should show up in VSCode.

## Getting Started (Software)
You have to install jemalloc which is required for the HugePageMemoryPool like this:

```bash
./scripts/install_jemalloc.sh
```

This will install jemalloc in `~/opt/jemalloc`. The you can build the libstf library as follows:

```bash
mkdir build && cd build
cmake -DCMAKE_PREFIX_PATH=$HOME/opt ..
make
```

Notice the `-DCMAKE_PREFIX_PATH=$HOME/opt`: this is so that CMake will look in the path where
jemalloc has been installed with the script and link libstf against it.

## Code Style
For now, we have a couple of code style rules:

- Camel case for class names and snake case for file names and everything else in the code
- _i postfix for interfaces
- _t postfix for types
- _i suffix for interfaces
- _t suffix for types
- n_ prefix for next signals in state logic
- inst_ prefix for module instantiations
- *Width* always refers to width in bits and *size* to width in bytes
- The term *width* always refers to width in bits and *size* to width in bytes

## TODOs
1. Get types and NUM_ELEMENTS from interface instead of parameters
1. Get types and NUM_ELEMENTS from interface instead of parameters (on hold because this crashes Vivado sometimes)
2. Add interface assertions

## License
Expand Down
20 changes: 20 additions & 0 deletions hardware/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.0)
project(libstf)

set(CYT_DIR ${CMAKE_SOURCE_DIR}/../coyote)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CYT_DIR}/cmake)

find_package(CoyoteHW REQUIRED)

set(N_REGIONS 1)
set(EN_STRM 1)
set(N_STRM_AXI 4)
set(FDEV_NAME u55c)

validation_checks_hw()

load_apps (
VFPGA_C0_0 "src"
)

create_hw()
48 changes: 48 additions & 0 deletions hardware/src/hdl/axi/axi_multiplexer.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
`timescale 1ns / 1ps

import libstf::*;

module AXIMultiplexer #(
parameter NUM_STREAMS
) (
input logic clk,
input logic rst_n,

ready_valid_i.s select, // #(logic[$clog2(NUM_STREAMS) - 1:0])

AXI4S.s in[NUM_STREAMS],
AXI4S.m out
);

ndata_i #(data8_t, AXI_DATA_BITS / 8) in_data[NUM_STREAMS]();
ndata_i #(data8_t, AXI_DATA_BITS / 8) out_data();

for (genvar I = 0; I < NUM_STREAMS; I++) begin
assign in_data[I].data = in[I].tdata;
assign in_data[I].keep = in[I].tkeep;
assign in_data[I].last = in[I].tlast;
assign in_data[I].valid = in[I].tvalid;
assign in[I].tready = in_data[I].ready;
end

DataMultiplexer #(
.data_t(data8_t),
.NUM_ELEMENTS(AXI_DATA_BITS / 8),
.NUM_STREAMS(NUM_STREAMS)
) inst_mux (
.clk(clk),
.rst_n(rst_n),

.select(select),

.in(in_data),
.out(out_data)
);

assign out.tdata = out_data.data;
assign out.tkeep = out_data.keep;
assign out.tlast = out_data.last;
assign out.tvalid = out_data.valid;
assign out_data.ready = out.tready;

endmodule
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
`include "config_macros.svh"

module StreamConfig #(
parameter NUM_SELECT,
parameter NUM_STREAMS
) (
input logic clk,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading