Helper function for creating lists of primitive port declarations.
(vl-primitive-mkports prefix i n &key dir (loc '*vl-fakeloc*)) → (mv exprs ports portdecls vardecls)
Function:
(defun vl-primitive-mkports-fn (prefix i n dir loc) (declare (xargs :guard (and (stringp prefix) (natp i) (natp n) (vl-direction-p dir) (vl-location-p loc)))) (declare (xargs :guard (<= i n))) (let ((__function__ 'vl-primitive-mkports)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (lnfix n) (lnfix i))) :exec (eql i n))) (mv nil nil nil nil)) (name1 (hons-copy (cat prefix (natstr i)))) ((mv expr1 port1 portdecl1 vardecl1) (vl-primitive-mkport name1 dir)) ((mv exprs2 ports2 portdecls2 vardecls2) (vl-primitive-mkports prefix (+ 1 (lnfix i)) n :dir dir :loc loc))) (mv (cons expr1 exprs2) (cons port1 ports2) (cons portdecl1 portdecls2) (cons vardecl1 vardecls2)))))
Theorem:
(defthm vl-exprlist-p-of-vl-primitive-mkports.exprs (implies (and (force (stringp prefix)) (force (natp i)) (force (natp n)) (force (vl-direction-p dir)) (force (vl-location-p loc)) (force (not (< n i)))) (b* (((mv ?exprs ?ports ?portdecls ?vardecls) (vl-primitive-mkports-fn prefix i n dir loc))) (vl-exprlist-p exprs))) :rule-classes :rewrite)
Theorem:
(defthm vl-portlist-p-of-vl-primitive-mkports.ports (implies (and (force (stringp prefix)) (force (natp i)) (force (natp n)) (force (vl-direction-p dir)) (force (vl-location-p loc)) (force (not (< n i)))) (b* (((mv ?exprs ?ports ?portdecls ?vardecls) (vl-primitive-mkports-fn prefix i n dir loc))) (vl-portlist-p ports))) :rule-classes :rewrite)
Theorem:
(defthm vl-portdecllist-p-of-vl-primitive-mkports.portdecls (implies (and (force (stringp prefix)) (force (natp i)) (force (natp n)) (force (vl-direction-p dir)) (force (vl-location-p loc)) (force (not (< n i)))) (b* (((mv ?exprs ?ports ?portdecls ?vardecls) (vl-primitive-mkports-fn prefix i n dir loc))) (vl-portdecllist-p portdecls))) :rule-classes :rewrite)
Theorem:
(defthm vl-vardecllist-p-of-vl-primitive-mkports.vardecls (implies (and (force (stringp prefix)) (force (natp i)) (force (natp n)) (force (vl-direction-p dir)) (force (vl-location-p loc)) (force (not (< n i)))) (b* (((mv ?exprs ?ports ?portdecls ?vardecls) (vl-primitive-mkports-fn prefix i n dir loc))) (vl-vardecllist-p vardecls))) :rule-classes :rewrite)
Theorem:
(defthm vl-primitive-mkports-fn-mvtypes-0 (true-listp (mv-nth 0 (vl-primitive-mkports-fn prefix i n dir loc))) :rule-classes :type-prescription)
Theorem:
(defthm vl-primitive-mkports-fn-mvtypes-1 (true-listp (mv-nth 1 (vl-primitive-mkports-fn prefix i n dir loc))) :rule-classes :type-prescription)
Theorem:
(defthm vl-primitive-mkports-fn-mvtypes-2 (true-listp (mv-nth 2 (vl-primitive-mkports-fn prefix i n dir loc))) :rule-classes :type-prescription)
Theorem:
(defthm vl-primitive-mkports-fn-mvtypes-3 (true-listp (mv-nth 3 (vl-primitive-mkports-fn prefix i n dir loc))) :rule-classes :type-prescription)
Theorem:
(defthm len-of-vl-primitive-mkports (b* (((mv exprs ports portdecls vardecls) (vl-primitive-mkports prefix i n :dir dir :loc loc)) (len (nfix (- (nfix n) (nfix i))))) (and (equal (len exprs) len) (equal (len ports) len) (equal (len portdecls) len) (equal (len vardecls) len))))
Theorem:
(defthm vl-primitive-mkports-under-iff (b* (((mv exprs ports portdecls vardecls) (vl-primitive-mkports prefix i n :dir dir :loc loc)) (len (- (nfix n) (nfix i)))) (and (iff exprs (posp len)) (iff ports (posp len)) (iff portdecls (posp len)) (iff vardecls (posp len)))))