Skip to content

Commit

Permalink
Fix svsim DPI function template (#4317)
Browse files Browse the repository at this point in the history
  • Loading branch information
uenoku authored Jul 30, 2024
1 parent 8923c56 commit da98687
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions svsim/src/main/scala/Workspace.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ final class Workspace(
}
l(");")
l()
l(" import \"DPI-C\" context function void initTestBenchScope;")
l(" import \"DPI-C\" context function void initTestBenchScope();")
l(" initial")
l(" initTestBenchScope();")
for ((port, index) <- ports) {
Expand Down Expand Up @@ -243,9 +243,14 @@ final class Workspace(
l()
l("extern \"C\" {")
l(" svScope setScopeToTestBench();")
for ((port, index) <- ports.filter(_._1.isGettable)) {
l(CreateFunctionForPort.createGetBits(port.name))
for ((port, index) <- ports) {
l(CreateFunctionForPort.createGetBitWidth(port.name))
if (port.isGettable) {
l(CreateFunctionForPort.createGetBits(port.name))
}
if (port.isSettable) {
l(CreateFunctionForPort.createSetBits(port.name))
}
}
l()
l("int port_getter(int id, int *bitWidth, void (**getter)(uint8_t*)) {")
Expand All @@ -261,10 +266,6 @@ final class Workspace(
l(" }")
l("}")
l()
for ((port, index) <- ports.filter(_._1.isSettable)) {
l(CreateFunctionForPort.createSetBits(port.name))
}
l()
l("int port_setter(int id, int *bitWidth, void (**setter)(const uint8_t*)) {")
l(" switch (id) {")
for ((port, index) <- ports.filter(_._1.isSettable)) {
Expand Down

0 comments on commit da98687

Please sign in to comment.