Helper function for creating lists of net declarations.
(vl-occform-mkwires prefix i n &key width (loc '*vl-fakeloc*)) → (mv exprs decls)
We generate a list of net declarations,
wire [width-1:0] prefix_i; ... wire [width-1:0] prefix_{n-1};
And return these declarations, along with the corresponding expressions with sizes pre-computed.
Function:
(defun vl-occform-mkwires-fn (prefix i n width loc) (declare (xargs :guard (and (stringp prefix) (natp i) (natp n) (posp width) (vl-location-p loc)))) (declare (xargs :guard (<= i n))) (let ((__function__ 'vl-occform-mkwires)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (lnfix n) (lnfix i))) :exec (eql i n))) (mv nil nil)) (width (lposfix width)) (name (hons-copy (cat prefix (natstr i)))) (expr (vl-idexpr name width :vl-unsigned)) (type (make-vl-coretype :name :vl-logic :pdims (list (vl-make-n-bit-range width)))) (decl (make-vl-vardecl :name name :type type :nettype :vl-wire :loc loc)) ((mv rest-exprs rest-decls) (vl-occform-mkwires prefix (+ 1 (lnfix i)) n :width width :loc loc))) (mv (cons expr rest-exprs) (cons decl rest-decls)))))
Theorem:
(defthm vl-exprlist-p-of-vl-occform-mkwires.exprs (b* (((mv ?exprs ?decls) (vl-occform-mkwires-fn prefix i n width loc))) (vl-exprlist-p exprs)) :rule-classes :rewrite)
Theorem:
(defthm vl-vardecllist-p-of-vl-occform-mkwires.decls (b* (((mv ?exprs ?decls) (vl-occform-mkwires-fn prefix i n width loc))) (vl-vardecllist-p decls)) :rule-classes :rewrite)
Theorem:
(defthm vl-occform-mkwires-fn-mvtypes-0 (true-listp (mv-nth 0 (vl-occform-mkwires-fn prefix i n width loc))) :rule-classes :type-prescription)
Theorem:
(defthm vl-occform-mkwires-fn-mvtypes-1 (true-listp (mv-nth 1 (vl-occform-mkwires-fn prefix i n width loc))) :rule-classes :type-prescription)
Theorem:
(defthm len-of-vl-occform-mkwires (b* (((mv exprs decls) (vl-occform-mkwires prefix i n :width width :loc loc))) (and (equal (len exprs) (nfix (- (nfix n) (nfix i)))) (equal (len decls) (nfix (- (nfix n) (nfix i)))))))
Theorem:
(defthm vl-occform-mkwires-under-iff (b* (((mv exprs decls) (vl-occform-mkwires prefix i n :width width :loc loc))) (and (iff exprs (posp (- (nfix n) (nfix i)))) (iff decls (posp (- (nfix n) (nfix i)))))))
Theorem:
(defthm vl-occform-mkwires-fn-of-str-fix-prefix (equal (vl-occform-mkwires-fn (str-fix prefix) i n width loc) (vl-occform-mkwires-fn prefix i n width loc)))
Theorem:
(defthm vl-occform-mkwires-fn-streqv-congruence-on-prefix (implies (streqv prefix prefix-equiv) (equal (vl-occform-mkwires-fn prefix i n width loc) (vl-occform-mkwires-fn prefix-equiv i n width loc))) :rule-classes :congruence)
Theorem:
(defthm vl-occform-mkwires-fn-of-nfix-i (equal (vl-occform-mkwires-fn prefix (nfix i) n width loc) (vl-occform-mkwires-fn prefix i n width loc)))
Theorem:
(defthm vl-occform-mkwires-fn-nat-equiv-congruence-on-i (implies (acl2::nat-equiv i i-equiv) (equal (vl-occform-mkwires-fn prefix i n width loc) (vl-occform-mkwires-fn prefix i-equiv n width loc))) :rule-classes :congruence)
Theorem:
(defthm vl-occform-mkwires-fn-of-nfix-n (equal (vl-occform-mkwires-fn prefix i (nfix n) width loc) (vl-occform-mkwires-fn prefix i n width loc)))
Theorem:
(defthm vl-occform-mkwires-fn-nat-equiv-congruence-on-n (implies (acl2::nat-equiv n n-equiv) (equal (vl-occform-mkwires-fn prefix i n width loc) (vl-occform-mkwires-fn prefix i n-equiv width loc))) :rule-classes :congruence)
Theorem:
(defthm vl-occform-mkwires-fn-of-pos-fix-width (equal (vl-occform-mkwires-fn prefix i n (pos-fix width) loc) (vl-occform-mkwires-fn prefix i n width loc)))
Theorem:
(defthm vl-occform-mkwires-fn-pos-equiv-congruence-on-width (implies (acl2::pos-equiv width width-equiv) (equal (vl-occform-mkwires-fn prefix i n width loc) (vl-occform-mkwires-fn prefix i n width-equiv loc))) :rule-classes :congruence)
Theorem:
(defthm vl-occform-mkwires-fn-of-vl-location-fix-loc (equal (vl-occform-mkwires-fn prefix i n width (vl-location-fix loc)) (vl-occform-mkwires-fn prefix i n width loc)))
Theorem:
(defthm vl-occform-mkwires-fn-vl-location-equiv-congruence-on-loc (implies (vl-location-equiv loc loc-equiv) (equal (vl-occform-mkwires-fn prefix i n width loc) (vl-occform-mkwires-fn prefix i n width loc-equiv))) :rule-classes :congruence)