what is meant by the following piece of System Verilog code

V

very_log

Guest
struct {
int a, b, c;
} str1 = '{1, 2, 3};
int x1, x2, x3;

x1 = str1 matches '{a:1, b:.n} &&& str1 matches '{b:2, c:.m} ? m*n : 0;
 
On Fri, 30 Nov 2007 07:25:53 -0800 (PST), very_log
<sachin.goyal.new@gmail.com> wrote:

struct {
int a, b, c;
} str1 = '{1, 2, 3};
int x1, x2, x3;

x1 = str1 matches '{a:1, b:.n} &&& str1 matches '{b:2, c:.m} ? m*n : 0;
Which bit of it don't you follow? There are at least
five new SystemVerilog constructs at work here:

- struct
- assignment pattern '{...}
- pattern matching using the "matches" operator
- logical "and" on pattern matches using &&&
- pattern capture using the ".n" syntax

All of them are fully documented in the LRM.

The last time I checked, tool support for "matches" was
very limited.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Welcome to EDABoard.com

Sponsor

Back
Top