~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/centaur/vl/mlib/lvalues.lisp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
expressions in lvalue positions.")
43
43
 
44
44
 
 
45
(define vl-index-exprp ((x vl-expr-p))
 
46
  :measure (vl-expr-count x)
 
47
  (if (vl-fast-atom-p x)
 
48
      (vl-hidexpr-p x)
 
49
    (b* (((vl-nonatom x))
 
50
         ((when (member x.op '(:vl-bitselect :vl-index)))
 
51
          (and (vl-index-exprp (first x.args))
 
52
               (vl-expr-resolved-p (second x.args)))))
 
53
      (vl-hidexpr-p x))))
 
54
 
45
55
(defines vl-expr-lvaluep
46
56
  :parents (lvalues vl-expr-p)
47
57
  :short "Determine if an expression looks like a good lvalue."
73
83
         (op   (vl-nonatom->op x))
74
84
         (args (vl-nonatom->args x)))
75
85
      (case op
76
 
        ((:vl-bitselect :vl-partselect-colon :vl-partselect-pluscolon
77
 
          :vl-partselect-minuscolon)
 
86
        ((:vl-bitselect :vl-partselect-colon :vl-partselect-pluscolon :vl-partselect-minuscolon
 
87
          :vl-index :vl-select-colon :vl-select-pluscolon :vl-select-minuscolon)
78
88
         ;; foo[index] or foo[a:b] or foo[a+:b] or foo[a-:b] is an okay
79
89
         ;; lvalue as long as foo is an identifier or hierarchical id.
80
 
         (or (vl-idexpr-p (first args))
81
 
             (vl-hidexpr-p (first args))))
 
90
         (vl-index-exprp (first args)))
82
91
        ((:vl-concat)
83
92
         ;; { foo, bar, baz, ... } is valid if all the components are
84
93
         ;; lvalues.
325
334
  :type vl-modinst
326
335
  :nrev-body
327
336
  (let ((args (vl-modinst->portargs x)))
328
 
    (if (eq (vl-arguments-kind args) :named)
 
337
    (if (eq (vl-arguments-kind args) :vl-arguments-named)
329
338
        (prog2$
330
339
         (cw "; vl-modinst-lvalexprs: skipping unresolved instance ~s0 of ~s1~%"
331
340
             (vl-modinst->instname x)
334
343
      (vl-plainarglist-lvalexprs-nrev (vl-arguments-plain->args args) nrev)))
335
344
  :body
336
345
  (let ((args (vl-modinst->portargs x)))
337
 
    (if (eq (vl-arguments-kind args) :named)
 
346
    (if (eq (vl-arguments-kind args) :vl-arguments-named)
338
347
        nil
339
348
      (vl-plainarglist-lvalexprs (vl-arguments-plain->args args)))))
340
349
 
546
555
        ;; Nothing to check.
547
556
        (ok))
548
557
       ((unless dir)
549
 
        (warn :type :vl-programming-error
550
 
              :msg "~l0: expected arguments of instance ~w1 to be resolved, ~
551
 
                    but no :DIR is present."
552
 
              :args (list loc instname)))
 
558
        ;; (warn :type :vl-programming-error
 
559
        ;;       :msg "~l0: expected arguments of instance ~w1 to be resolved, ~
 
560
        ;;             but no :DIR is present."
 
561
        ;;       :args (list loc instname))
 
562
 
 
563
        ;; NOTE: We used to warn about this, but now if there are interface
 
564
        ;; ports it's correct for argresolve to leave the direction blank.
 
565
        (ok))
553
566
       ((when (eq dir :vl-input))
554
567
        ;; Input to a submodule -- not an lvalue, nothing to check.
555
568
        (ok))
582
595
  :guard (and (vl-location-p loc)
583
596
              (maybe-stringp instname))
584
597
  :body
585
 
  (if (eq (vl-arguments-kind x) :named)
 
598
  (if (eq (vl-arguments-kind x) :vl-arguments-named)
586
599
      (warn :type :vl-programming-error
587
600
            :msg "~l0: expected arguments of instance ~s1 to be resolved, but ~
588
601
                  args are still named."