-
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.
Provided: * simple_verilog - Simple verilog only testbench for all simulators * simple_mixed_language - Verilog and VHDL tb for all capable sims * Remove modelsim and vcs examples
- Loading branch information
Showing
20 changed files
with
143 additions
and
254 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 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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
project(hello_dpi CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
add_library(hello_dpi SHARED | ||
./hello.cpp | ||
) | ||
|
||
if(NOT SIMULATOR STREQUAL "verilator") | ||
if(SIMULATOR STREQUAL "modelsim") | ||
target_compile_options(hello_dpi PRIVATE -m32) | ||
target_link_options(hello_dpi PRIVATE -m32) | ||
endif() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
project(simple_mixed_language NONE) | ||
|
||
include("../../SoCMakeConfig.cmake") | ||
|
||
option_enum(SIMULATOR "Which simulator to use" "questa;modelsim;xcelium;vcs;all" "modelsim") | ||
if(SIMULATOR STREQUAL "all") | ||
set(ALL_SIMS TRUE) | ||
endif() | ||
|
||
add_ip(tb | ||
DESCRIPTION "Simple verilog testbench") | ||
|
||
ip_sources(${IP} VERILOG | ||
tb.v) | ||
|
||
add_subdirectory(adder) | ||
ip_link(${IP} adder) | ||
|
||
if(SIMULATOR STREQUAL "questa" OR SIMULATOR STREQUAL "modelsim" OR ALL_SIMS) | ||
modelsim(${IP}) | ||
endif() | ||
|
||
if(SIMULATOR STREQUAL "xcelium" OR ALL_SIMS) | ||
xcelium(${IP}) | ||
endif() | ||
|
||
if(SIMULATOR STREQUAL "vcs" OR ALL_SIMS) | ||
vcs(${IP}) | ||
endif() | ||
|
||
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
File renamed without changes.
19 changes: 13 additions & 6 deletions
19
examples/modelsim/simple/tb.v → examples/simple_mixed_language/tb.v
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 |
---|---|---|
@@ -1,15 +1,22 @@ | ||
module tb; | ||
initial begin | ||
$display("Hello world, from SoCMake build system\n"); | ||
$finish(); | ||
end | ||
|
||
wire [4:0] a, b, o; | ||
reg [4:0] a, b; | ||
wire [4:0] o; | ||
|
||
adder adder_i ( | ||
.NUM1(a), | ||
.NUM2(b), | ||
.SUM(o) | ||
); | ||
|
||
initial begin | ||
a = 5; | ||
b = 10; | ||
#1; | ||
|
||
$display("Hello world, from SoCMake build system\n"); | ||
$display("%d + %d = %d", a, b, o); | ||
$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,41 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
project(simple_verilog_example NONE) | ||
|
||
include("../../SoCMakeConfig.cmake") | ||
|
||
option_enum(SIMULATOR "Which simulator to use" "iverilog;questa;modelsim;xcelium;vcs;verilator;all" "iverilog") | ||
if(SIMULATOR STREQUAL "all") | ||
set(ALL_SIMS TRUE) | ||
endif() | ||
|
||
add_ip(tb | ||
DESCRIPTION "Simple verilog testbench") | ||
|
||
ip_sources(${IP} VERILOG | ||
tb.v) | ||
|
||
add_subdirectory(adder) | ||
ip_link(${IP} adder) | ||
|
||
|
||
if(SIMULATOR STREQUAL "iverilog" OR ALL_SIMS) | ||
iverilog(${IP}) | ||
endif() | ||
|
||
if(SIMULATOR STREQUAL "questa" OR SIMULATOR STREQUAL "modelsim" OR ALL_SIMS) | ||
modelsim(${IP}) | ||
endif() | ||
|
||
if(SIMULATOR STREQUAL "xcelium" OR ALL_SIMS) | ||
xcelium(${IP}) | ||
endif() | ||
|
||
if(SIMULATOR STREQUAL "verilator" OR ALL_SIMS) | ||
verilator(${IP} MAIN VERILATOR_ARGS --timing) | ||
endif() | ||
|
||
if(SIMULATOR STREQUAL "vcs" OR ALL_SIMS) | ||
vcs(${IP}) | ||
endif() | ||
|
||
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,6 @@ | ||
add_ip(adder | ||
DESCRIPTION "Just a simple adder") | ||
|
||
ip_sources(${IP} VERILOG | ||
adder.v | ||
) |
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,8 @@ | ||
module adder( | ||
input [4:0] NUM1, | ||
input [4:0] NUM2, | ||
output [4:0] SUM | ||
); | ||
|
||
assign SUM = NUM1 + NUM2; | ||
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,22 @@ | ||
module tb; | ||
reg [4:0] a, b; | ||
wire [4:0] o; | ||
|
||
adder adder_i ( | ||
.NUM1(a), | ||
.NUM2(b), | ||
.SUM(o) | ||
); | ||
|
||
initial begin | ||
a = 5; | ||
b = 10; | ||
#1; | ||
|
||
$display("Hello world, from SoCMake build system\n"); | ||
$display("%d + %d = %d", a, b, o); | ||
$finish(); | ||
end | ||
|
||
|
||
endmodule |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.