• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
        • Svex-stvs
        • Svex-decomposition-methodology
        • Sv-versus-esim
        • Svex-decomp
        • Svex-compose-dfs
        • Svex-compilation
        • Moddb
        • Svmods
        • Svstmt
        • Sv-tutorial
        • Expressions
        • Symbolic-test-vector
        • Vl-to-svex
          • Vl-to-sv
          • Vl-design->sv-design
            • Vl-simpconfig
            • Vl-hierarchy-sv-translation
            • Vl-expr-svex-translation
              • Sv::vl-expr.lisp
                • Vl-scopecontext-to-addr
                • Vl-binaryop-to-svex
                • Vl-expr-to-svex-maybe-typed
                • Vl-datatype-syscall-to-svex
                • Vl-operandinfo-to-svex-preproc
                • Vl-structmemberlist->types
                • Vl-seltrace-to-svex-select
                • Vl-portdecllist->types
                • Vl-operandinfo-to-svex-select
                • Vl-plusminus-partselect->svex
                • Vl-arrayrange->rel-lsb-and-width
                • Vl-unaryop-to-svex
                • Vl-funcall-args-to-ordered
                • Vl-expr-to-svex-lhs
                • Vl-operandinfo-to-svex
                • Vl-array-assignpat-keyval-resolve
                • Vl-err->vfatal
                • Vl-datatypelist-usertype-resolve
                • Vl-upscope-to-svex-upscope
                  • Vl-err->fatal
                  • Vl-streaming-concat-trunc/extend
                  • Vl-operandinfo-base-svar
                  • Vl-index-shift-amount
                  • Vttree->constraints
                  • Vl-slicesize-resolve
                  • Vl-function-map-find-matching-aux
                  • Vl-funname-lookup
                  • Vl-datatype-size-warn
                  • Svex-repeat-aux
                  • Vl-$test$plusargs-to-svex
                  • Svex-extend
                  • Vl-structmemberlist-shift-bits
                  • Vl-datatype-slot-width/range
                  • Vl-datatype-index-shift-amount
                  • Vl-datatype-field-shift-amount
                  • 4vec-extend
                  • Vl-function-pair-inputs-with-actuals
                  • Vl-expr-to-svex-untyped
                  • Vl-function-map-check-matching
                  • Vl-datatype-syscall-remove-dims
                  • Svex-concat-list-aux
                  • Vttree-add-constraints
                  • Vttree-add-warnings
                  • Vl-check-struct-assignpat-keys
                  • Vl-check-array-assignpat-keys
                  • Sv::constraintlist-subst-memo
                  • Vl-svex-keyval-index-lookup
                  • Vl-function-map-find-matching
                  • Vl-convert-dollarsign-to-expr
                  • Vttree->constraints-acc
                  • Vl-seltrace-type
                  • Vl-seltrace-to-path
                  • Vl-keyval-member-lookup
                  • Svex-repeat
                  • Vttree->warnings-acc
                  • Vl-trunc/extend-type-err
                  • Constraintlist-add-ctx
                  • Vl-hidtrace-add-to-path
                  • Svex-multiconcat
                  • Vttree-join
                  • Vl-value-to-string-aux
                  • Vl-seltrace-add-to-path
                  • Vl-value-to-4vec
                  • Vl-expr-to-svex-selfdet
                  • Vl-svex-keyval-default-lookup
                  • Vl-$test$plusargs-p
                  • Vl-value-to-svex
                  • Vl-value-in-range
                  • Vl-keyval-default-lookup
                  • Sv::svexlist-args-extract-constants
                  • Vl-string->bits
                  • Vl-size-to-unsigned-logic
                  • Vl-hidtrace-to-path
                  • Svex-concat-list
                  • Vttree->warnings
                  • Vl-seltrace-unres-count
                  • Vl-datatype-index-is-bitselect
                  • Vl-bitlist->4vec
                  • Vl-svex-keyvallist-vars
                  • Vl-hidstep->svex-index
                  • Vl-selstep->svex-name
                  • Vl-datatypelist-resolved-p
                  • Vl-datatype-$unpacked_dimensions
                  • Vl-datatype-$dimensions
                  • Vl-bitlist->offset
                  • Vl-bitlist->onset
                  • Vl-streamexprlist-has-with
                  • Vl-hidstep-resolved-p
                  • Vl-expr-needs-type-context
                  • Vl-streamexprlist->exprs
                  • Vl-integer-to-string
                  • Vl-hidtrace-resolved-p
                  • Vl-selstep-resolved-p
                  • Vl-select-resolved-p
                  • Vl-svex-keyvallist
                  • Vl-datatypelist
                  • Svex-x
                • Vttree
              • Vl-design->svex-modalist
              • Vl-svstmt
            • Vl-to-sv-main
            • Vl-simplify-sv
            • Vl-user-paramsettings->unparam-names
            • Vl-user-paramsettings->modnames
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Sv::vl-expr.lisp

    Vl-upscope-to-svex-upscope

    Signature
    (vl-upscope-to-svex-upscope vl-levels ss &key (strictp 't)) 
      → 
    (mv err svex-levels)
    Arguments
    vl-levels — number of levels up we're going.
        Guard (natp vl-levels).
    ss — scopestack we're traversing.
        Guard (vl-scopestack-p ss).
    strictp — Guard (booleanp strictp).
    Returns
    err — Type (implies err (vl-msg-p err)).
    svex-levels — Type (implies (not err) (natp svex-levels)).

    Definitions and Theorems

    Function: vl-upscope-to-svex-upscope-fn

    (defun vl-upscope-to-svex-upscope-fn (vl-levels ss strictp)
     (declare (xargs :guard (and (natp vl-levels)
                                 (vl-scopestack-p ss)
                                 (booleanp strictp))))
     (let ((__function__ 'vl-upscope-to-svex-upscope))
      (declare (ignorable __function__))
      (b* (((when (zp vl-levels)) (mv nil 0)))
       (vl-scopestack-case
        ss :null
        (mv (vmsg "Tried to go ~x0 level~s1 up from the empty scope"
                  vl-levels (if (eql vl-levels 1) "" "s"))
            nil)
        :global
        (mv (vmsg "Tried to go ~x0 level~s1 up from the global scope"
                  vl-levels (if (eql vl-levels 1) "" "s"))
            nil)
        :local
        (b*
         ((type (vl-scope->scopetype ss.top))
          ((mv err incr)
           (case
            type (:vl-genblock (mv nil 1))
            (:vl-genarrayblock (mv nil 1))
            (:vl-genarray (mv nil 1))
            (:vl-blockstmt (mv nil 0))
            (:vl-forstmt (mv nil 0))
            (:vl-foreachstmt (mv nil 0))
            (:vl-fundecl (mv nil 0))
            (otherwise
             (if strictp
              (mv
               (vmsg
                "Tried to go ~x0 level~s1 up through a scope of type ~x2"
                vl-levels (if (eql vl-levels 1) "" "s")
                type)
               nil)
              (mv nil 0)))))
          ((when err) (mv err nil))
          ((mv err rest)
           (vl-upscope-to-svex-upscope (1- vl-levels)
                                       ss.super))
          ((when err) (mv err nil)))
         (mv nil (+ incr rest)))))))

    Theorem: return-type-of-vl-upscope-to-svex-upscope.err

    (defthm return-type-of-vl-upscope-to-svex-upscope.err
      (b* (((mv ?err ?svex-levels)
            (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)))
        (implies err (vl-msg-p err)))
      :rule-classes :rewrite)

    Theorem: return-type-of-vl-upscope-to-svex-upscope.svex-levels

    (defthm return-type-of-vl-upscope-to-svex-upscope.svex-levels
      (b* (((mv ?err ?svex-levels)
            (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)))
        (implies (not err) (natp svex-levels)))
      :rule-classes :type-prescription)

    Theorem: vl-upscope-to-svex-upscope-fn-of-nfix-vl-levels

    (defthm vl-upscope-to-svex-upscope-fn-of-nfix-vl-levels
      (equal (vl-upscope-to-svex-upscope-fn (nfix vl-levels)
                                            ss strictp)
             (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)))

    Theorem: vl-upscope-to-svex-upscope-fn-nat-equiv-congruence-on-vl-levels

    (defthm
        vl-upscope-to-svex-upscope-fn-nat-equiv-congruence-on-vl-levels
     (implies
       (acl2::nat-equiv vl-levels vl-levels-equiv)
       (equal
            (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)
            (vl-upscope-to-svex-upscope-fn vl-levels-equiv ss strictp)))
     :rule-classes :congruence)

    Theorem: vl-upscope-to-svex-upscope-fn-of-vl-scopestack-fix-ss

    (defthm vl-upscope-to-svex-upscope-fn-of-vl-scopestack-fix-ss
     (equal
         (vl-upscope-to-svex-upscope-fn vl-levels (vl-scopestack-fix ss)
                                        strictp)
         (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)))

    Theorem: vl-upscope-to-svex-upscope-fn-vl-scopestack-equiv-congruence-on-ss

    (defthm
     vl-upscope-to-svex-upscope-fn-vl-scopestack-equiv-congruence-on-ss
     (implies
       (vl-scopestack-equiv ss ss-equiv)
       (equal
            (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)
            (vl-upscope-to-svex-upscope-fn vl-levels ss-equiv strictp)))
     :rule-classes :congruence)

    Theorem: vl-upscope-to-svex-upscope-fn-of-bool-fix-strictp

    (defthm vl-upscope-to-svex-upscope-fn-of-bool-fix-strictp
      (equal (vl-upscope-to-svex-upscope-fn
                  vl-levels ss (acl2::bool-fix strictp))
             (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)))

    Theorem: vl-upscope-to-svex-upscope-fn-iff-congruence-on-strictp

    (defthm vl-upscope-to-svex-upscope-fn-iff-congruence-on-strictp
     (implies
       (iff strictp strictp-equiv)
       (equal
            (vl-upscope-to-svex-upscope-fn vl-levels ss strictp)
            (vl-upscope-to-svex-upscope-fn vl-levels ss strictp-equiv)))
     :rule-classes :congruence)