Yes, I disagree with the statement that MyType has to be declared as packed. There are no restrictions in the LRM that state a base type of an open array has to be declared as packed. On the contrary, there is the example to which the VG writer referred (from 35.5.6.1, ballot draft8), and there is also mention of unpacked struct in I.12.3 (The bullet that starts with “Other types”). Note that the type restrictions in 35.5.6 apply to base types of open arrays. That would mean, for example, that you couldn’t pass an actual argument of a type containing an associative array or a queue to a DPI open array formal argument. As I mentioned, the (corrected) example code works fine on at least one simulator. Regards, Doug From: Bresticker, Shalom [mailto:shalom.bresticker@intel.com] Sent: Sunday, March 01, 2009 11:44 PM To: Warmke, Doug; SV-CC Subject: RE: [sv-cc] example code errors in I.12.9 ? Someone in the Verfication Guild claimed, for example, the MyType has to be declared as packed. You disagree? Thanks, Shalom ________________________________ From: Warmke, Doug [mailto:doug_warmke@mentor.com] Sent: Monday, March 02, 2009 8:10 AM To: Bresticker, Shalom; SV-CC Subject: RE: [sv-cc] example code errors in I.12.9 ? Hi Shalom, The example has a couple of problems that make it unable to compile, but not in the code related to DPI. The … in the struct declarations, for example. Another problem is that the import function “foo” is called in the middle of nowhere in $unit, which isn’t allowed. I got the example working fine in the simulator available to me by correcting those MyType declarations and the other minor syntax errors. No LRM-related changes appear necessary. Regards, Doug test.c: #include "svdpi.h" typedef struct { int x; } MyType; void foo(const svOpenArrayHandle hin, const svOpenArrayHandle hout) { int count = svSize(hin, 1); MyType *s = (MyType *)svGetArrayPtr(hin); MyType *d = (MyType *)svGetArrayPtr(hout); if (s && d) { /* both arrays have C layout */ /* an efficient solution using pointer arithmetic */ while (count--) *d++ = *s++; } else { /* less efficient yet implementation independent */ int i = svLow(hin, 1); int j = svLow(hout, 1); while (i <= svHigh(hin, 1)) { *(MyType *)svGetArrElemPtr1(hout, j++) = *(MyType *)svGetArrElemPtr1(hin, i++); } } } test.sv: typedef struct { int x; } MyType; import "DPI-C" function void foo(input MyType i [], output MyType o []); MyType source [11:20]; MyType target [11:20]; module top; initial begin source[11].x = 123; source[20].x = 999; foo(source, target); $display("source[11].x=%0d, source[12].x=%0d, source[20].x=%0d, target[11].x=%0d, target[12].x=%0d, target[20].x=%0d", source[11].x, source[12].x, source[20].x, target[11].x, target[12].x, target[20].x); end endmodule Regards, Doug From: owner-sv-cc@server.eda.org [mailto:owner-sv-cc@server.eda.org] On Behalf Of Bresticker, Shalom Sent: Sunday, March 01, 2009 9:44 PM To: SV-CC Subject: [sv-cc] example code errors in I.12.9 ? Hi, SV-CC. Please see the discussion in http://verificationguild.com/modules.php?name=Forums&file=viewtopic&p=14513 on the example code in I.12.9 and comment on whether changes are needed. Thanks, Shalom Shalom Bresticker Intel Jerusalem LAD DA +972 2 589-6582 +972 54 721-1033 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- This message has been scanned for viruses and dangerous content by MailScanner <http://www.mailscanner.info/> , and is believed to be clean. --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Mar 2 00:07:08 2009
This archive was generated by hypermail 2.1.8 : Mon Mar 02 2009 - 00:07:13 PST