Convert a wire address into a wire index, given the scope from which the address is relative.
(moddb-address->wireidx addr scope moddb) → idx
Function:
(defun moddb-address->wireidx (addr scope moddb) (declare (xargs :stobjs (moddb))) (declare (xargs :guard (and (address-p addr) (modscope-p scope) (moddb-ok moddb)))) (declare (xargs :guard (modscope-okp scope moddb))) (let ((__function__ 'moddb-address->wireidx)) (declare (ignorable __function__)) (b* (((address addr)) ((modscope scope1) (if (eq addr.scope :root) (modscope->top scope) (modscope->nth addr.scope scope))) (local-idx (moddb-path->wireidx addr.path scope1.modidx moddb))) (and local-idx (+ local-idx scope1.wireoffset)))))
Theorem:
(defthm return-type-of-moddb-address->wireidx (b* ((idx (moddb-address->wireidx addr scope moddb))) (iff (natp idx) idx)) :rule-classes :rewrite)
Theorem:
(defthm moddb-address->wireidx-bound (let ((res (moddb-address->wireidx addr scope moddb))) (implies (and (moddb-ok moddb) (modscope-okp scope moddb) res) (< res (moddb-mod-totalwires (modscope->modidx (modscope->top scope)) moddb)))) :rule-classes :linear)
Theorem:
(defthm moddb-address->wireidx-of-address-fix-addr (equal (moddb-address->wireidx (address-fix addr) scope moddb) (moddb-address->wireidx addr scope moddb)))
Theorem:
(defthm moddb-address->wireidx-address-equiv-congruence-on-addr (implies (address-equiv addr addr-equiv) (equal (moddb-address->wireidx addr scope moddb) (moddb-address->wireidx addr-equiv scope moddb))) :rule-classes :congruence)
Theorem:
(defthm moddb-address->wireidx-of-modscope-fix-scope (equal (moddb-address->wireidx addr (modscope-fix scope) moddb) (moddb-address->wireidx addr scope moddb)))
Theorem:
(defthm moddb-address->wireidx-modscope-equiv-congruence-on-scope (implies (modscope-equiv scope scope-equiv) (equal (moddb-address->wireidx addr scope moddb) (moddb-address->wireidx addr scope-equiv moddb))) :rule-classes :congruence)
Theorem:
(defthm moddb-address->wireidx-of-moddb-fix-moddb (equal (moddb-address->wireidx addr scope (moddb-fix moddb)) (moddb-address->wireidx addr scope moddb)))
Theorem:
(defthm moddb-address->wireidx-moddb-equiv-congruence-on-moddb (implies (moddb-equiv moddb moddb-equiv) (equal (moddb-address->wireidx addr scope moddb) (moddb-address->wireidx addr scope moddb-equiv))) :rule-classes :congruence)