Re: enhancement/409: lists in part-selects

From: Michael McNamara (mac@verisity.com)
Date: Mon Aug 18 2003 - 09:50:02 PDT

  • Next message: Steven Sharp: "Re: 12.2.1: question on defparams in array of instances"

    Precedence: bulk

    The following reply was made to PR enhancement/409; it has been noted by GNATS.

    From: Michael McNamara <mac@verisity.com>
    To: Shalom.Bresticker@motorola.com
    Cc: etf-bugs@boyd.com
    Subject: Re: enhancement/409: lists in part-selects
    Date: Wed, 20 Aug 2003 11:38:55 -0700

     Shalom.Bresticker@motorola.com writes:
    > Precedence: bulk
    >
    > Why does this work:
    >
    > wire [1:0] foo,bar;
    >
    > assign {foo,bar}=4'b1000;
    >
    > at setting foo to 2'b10 and bar to 2'b00, but this gives a syntax error:
    >
    > wire [1:0] foo,bar;
    >
    > assign {foo,bar}=4'b0000;
    > assign {foo,bar}[3]=1'b1;
    >
    > but this also works:
    >
    > wire [3:0] foobar;
    >
    > assign foobar=4'b0000;
    > assign foobar[3]=1'b1;
    >
    > Please note that I'm not trying to argue over the finer points of style,
    > the above is simply a trivial and overly simplistic example of something
    > I tried that I thought "should" work, but of course it didn't.
    >
    > =========================================================================
    >
    > Shalom
     
      In a language like perl assign {foo.bar}[3] = 1'b1; would work; and I
      believe it is a useful RFE for 1364 verilog. Again, one would
      discourage folks from typing the above directly; but it may be very
      useful to do:
     
      `define CPU_REG {mode,exception_mask,interrupt_mask,cpu_id}
     
     
      ...
     
      if ( `CPU_REG[5:0] == 6'b0 ) begin
        // we are the boot cpu; load the OS
        ...
      end
     
      which would expand to the same thing.
     
      -mac



    This archive was generated by hypermail 2.1.4 : Mon Aug 18 2003 - 09:51:24 PDT and
    sponsored by Boyd Technology, Inc.