-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add modelsim DPI support, improve modelsim support and add modelsim e…
…xamples
- Loading branch information
Showing
14 changed files
with
278 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
project(dpi_example NONE) | ||
|
||
include("../../../SoCMakeConfig.cmake") | ||
|
||
add_ip(tb | ||
DESCRIPTION "Simple verilog testbench" | ||
) | ||
|
||
ip_sources(${IP} SYSTEMVERILOG | ||
${PROJECT_SOURCE_DIR}/tb.sv | ||
) | ||
|
||
add_subdirectory(hello) | ||
|
||
ip_link(${IP} hello_dpi) | ||
|
||
modelsim(${IP}) | ||
|
||
help() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
project(hello_dpi CXX) | ||
|
||
add_library(hello_dpi SHARED | ||
./hello.cpp | ||
) | ||
|
||
target_compile_options(hello_dpi PRIVATE -m32) | ||
target_link_options(hello_dpi PRIVATE -m32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <cstdint> | ||
|
||
extern "C" uint32_t hello(uint32_t data); | ||
uint32_t hello(uint32_t data) | ||
{ | ||
return data + 10; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module tb; | ||
|
||
import "DPI-C" function int unsigned hello(input int unsigned data); | ||
|
||
initial begin | ||
$display("From DPI-C 5 + 10 is: %d", hello(5)); | ||
$finish(); | ||
end | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
project(parallel_example NONE) | ||
|
||
include("../../../SoCMakeConfig.cmake") | ||
|
||
add_ip(tb | ||
DESCRIPTION "Simple verilog testbench" | ||
) | ||
|
||
ip_sources(${IP} VERILOG | ||
${PROJECT_SOURCE_DIR}/tb.v | ||
) | ||
|
||
add_subdirectory(printer) | ||
|
||
foreach(cnt RANGE 0 32) | ||
stupid_printer(${cnt}) | ||
ip_link(${IP} vendor::lib_${cnt}::printer_${cnt}::0.0.1) | ||
endforeach() | ||
|
||
modelsim(${IP} TARGET_PER_IP) | ||
|
||
help() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
function(stupid_printer NUM_TO_ADD) | ||
add_ip(vendor::lib_${NUM_TO_ADD}::printer_${NUM_TO_ADD}::0.0.1 | ||
DESCRIPTION "A stupid module that prints ${NUM_TO_ADD}") | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/printer.v.in | ||
${CMAKE_BINARY_DIR}/printer_${NUM_TO_ADD}.v | ||
@ONLY | ||
) | ||
ip_sources(${IP} VERILOG | ||
${CMAKE_BINARY_DIR}/printer_${NUM_TO_ADD}.v | ||
) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module printer_@NUM_TO_ADD@; | ||
initial begin | ||
$display("NUM IS: %d", @NUM_TO_ADD@); | ||
end | ||
endmodule |
Oops, something went wrong.