Brad, Matt & Nikhil - Question for the three of you below. Other comments included. At 08:44 AM 2/27/2006, Jonathan Bromley wrote: > > Is there some way to unpack the struct (almost like aggregate > > de-assignment) so that the display command could be written > > something like: > > > > $display("dst=%h src=%h data=%h crc=%h", pkt1); > >I personally don't think this is a very good idea. > >If the struct were packed, as is likely for synthesis, then >you couldn't reasonably do this (because the packed struct >also has a perfectly good integer value when taken as a whole). >This could lead to all sorts of hideous ambiguity; how about >this... (p2 is of the same type as pkt1): > >$display( > "pkt1=%h, p2.dst=%h p2.src=%h p2.data=%h p2.crc=%h", > pkt1, p2); > >How could $display work out which %h is associated with what? I was hoping there was some undiscovered piece of magic, perhaps using one of the streaming operators, that would take each field of the struct and parse them out in struct-order to the respective %h format specifiers. I did not really think it existed but sometimes I ask these questions and people share very clever and concise solutions. Oh well, no big deal! >For simulation only, you could use a class instead, and then >the class could provide its own to-string method - psdisplay() >in VMM-speak. And indeed, since we now have a full-fledged >string data type, it's easy to provide a to-string function >for any data type. > >I sometimes wonder whether there is any utility at all in >unpacked structs. They make little sense for synthesis, and >for simulation it's surely better to use a class; the class can >then have a pack method that converts the appropriate parts of >its content into a packed struct suitable for injection into >an RTL model. Interesting questions. Perhaps we could get the following three committee members to respond: Matt Maidment from Intel, who has been using SV for synthesis for 3-4 years now. Brad Pierce (and Karen if she has time) on Synopsys' take on unpacked structs for synthesis. Nikhil Rishiyur from the Bluespec synthesis perspective. Regards - Cliff >-- >Jonathan Bromley, Consultant > >DOULOS - Developing Design Know-how >VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services > >Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK >Tel: +44 (0)1425 471223 Email: jonathan.bromley@doulos.com >Fax: +44 (0)1425 471573 Web: http://www.doulos.com > >This e-mail and any attachments are confidential and Doulos Ltd. reserves >all rights of privilege in respect thereof. It is intended for the use of >the addressee only. If you are not the intended recipient please delete it >from your system, any use, disclosure, or copying of this document is >unauthorised. The contents of this message may contain personal views which >are not the views of Doulos Ltd., unless specifically stated. ---------------------------------------------------- Cliff Cummings - Sunburst Design, Inc. 14314 SW Allen Blvd., PMB 501, Beaverton, OR 97005 Phone: 503-641-8446 / FAX: 503-641-8486 cliffc@sunburst-design.com / www.sunburst-design.com Expert Verilog, SystemVerilog, Synthesis and Verification TrainingReceived on Mon Feb 27 09:55:23 2006
This archive was generated by hypermail 2.1.8 : Mon Feb 27 2006 - 09:56:57 PST