pulse rate test causes compiler panic #301

Closed
opened 2022-06-07 00:03:42 +08:00 by sb10q · 1 comment
Owner
@nac3
class PulseRate(EnvExperiment):
    core: KernelInvariant[Core]
    ttl_out: KernelInvariant[TTLOut]

    def build(self):
        self.setattr_device("core")
        self.setattr_device("ttl_out")

    @rpc
    def set_pulse_rate(self, pulse_rate: float):
        self.set_dataset("pulse_rate", pulse_rate)

    @kernel
    def run(self):
        self.core.reset()
        dt = self.core.seconds_to_mu(300.*ns)
        while True:
            for i in range(10000):
                try:
                    self.ttl_out.pulse_mu(dt)
                    delay_mu(dt)
                except RTIOUnderflow:
                    dt += int64(1)
                    self.core.break_realtime()
                    break
            else:
                self.set_pulse_rate(self.core.mu_to_seconds(dt))
                return
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /build/source/nac3core/src/codegen/stmt.rs:1029:68
``` @nac3 class PulseRate(EnvExperiment): core: KernelInvariant[Core] ttl_out: KernelInvariant[TTLOut] def build(self): self.setattr_device("core") self.setattr_device("ttl_out") @rpc def set_pulse_rate(self, pulse_rate: float): self.set_dataset("pulse_rate", pulse_rate) @kernel def run(self): self.core.reset() dt = self.core.seconds_to_mu(300.*ns) while True: for i in range(10000): try: self.ttl_out.pulse_mu(dt) delay_mu(dt) except RTIOUnderflow: dt += int64(1) self.core.break_realtime() break else: self.set_pulse_rate(self.core.mu_to_seconds(dt)) return ``` ``` thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /build/source/nac3core/src/codegen/stmt.rs:1029:68 ```
sb10q added the
high-priority
label 2022-06-07 00:03:42 +08:00
Author
Owner

Seems to be related to the "break" statement.

Seems to be related to the "break" statement.
sb10q added this to the Alpha milestone 2022-07-04 18:12:28 +08:00
sb10q closed this issue 2023-09-29 06:51:52 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#301
No description provided.