Skip to content

Commit da98687

Browse files
authored
Fix svsim DPI function template (#4317)
1 parent 8923c56 commit da98687

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

svsim/src/main/scala/Workspace.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ final class Workspace(
113113
}
114114
l(");")
115115
l()
116-
l(" import \"DPI-C\" context function void initTestBenchScope;")
116+
l(" import \"DPI-C\" context function void initTestBenchScope();")
117117
l(" initial")
118118
l(" initTestBenchScope();")
119119
for ((port, index) <- ports) {
@@ -243,9 +243,14 @@ final class Workspace(
243243
l()
244244
l("extern \"C\" {")
245245
l(" svScope setScopeToTestBench();")
246-
for ((port, index) <- ports.filter(_._1.isGettable)) {
247-
l(CreateFunctionForPort.createGetBits(port.name))
246+
for ((port, index) <- ports) {
248247
l(CreateFunctionForPort.createGetBitWidth(port.name))
248+
if (port.isGettable) {
249+
l(CreateFunctionForPort.createGetBits(port.name))
250+
}
251+
if (port.isSettable) {
252+
l(CreateFunctionForPort.createSetBits(port.name))
253+
}
249254
}
250255
l()
251256
l("int port_getter(int id, int *bitWidth, void (**getter)(uint8_t*)) {")
@@ -261,10 +266,6 @@ final class Workspace(
261266
l(" }")
262267
l("}")
263268
l()
264-
for ((port, index) <- ports.filter(_._1.isSettable)) {
265-
l(CreateFunctionForPort.createSetBits(port.name))
266-
}
267-
l()
268269
l("int port_setter(int id, int *bitWidth, void (**setter)(const uint8_t*)) {")
269270
l(" switch (id) {")
270271
for ((port, index) <- ports.filter(_._1.isSettable)) {

0 commit comments

Comments
 (0)