Convert a UDP into a module.
(vl-udp-to-module x) → mod
We always produce a new module. If the UDP is not something we can support, the resulting module will have fatal warnings.
Function:
(defun vl-udp-to-module (x) (declare (xargs :guard (vl-udp-p x))) (let ((__function__ 'vl-udp-to-module)) (declare (ignorable __function__)) (b* (((vl-udp x)) (portdecls (cons x.output x.inputs)) (ports (vl-ports-from-portdecls portdecls)) (vardecls (vl-udp-vardecls-from-portdecls portdecls)) (atts (list* (list "VL_CONVERTED_UDP") (if x.sequentialp (list "VL_SEQUENTIAL_UDP") (list "VL_COMBINATIONAL_UDP")) x.atts)) (warnings x.warnings) (warnings (if x.sequentialp (fatal :type :vl-sequential-udp :msg "Sequential UDPs are not yet supported." :args nil) warnings)) ((mv ?okp warnings assigns) (if x.sequentialp (mv nil warnings nil) (vl-combinational-udptable-synth x.output x.inputs x.maxloc x.table warnings)))) (make-vl-module :name x.name :origname x.name :minloc x.minloc :maxloc x.maxloc :comments x.comments :ports ports :portdecls portdecls :vardecls vardecls :warnings warnings :assigns assigns :atts atts))))
Theorem:
(defthm vl-module-p-of-vl-udp-to-module (b* ((mod (vl-udp-to-module x))) (vl-module-p mod)) :rule-classes :rewrite)