def visit_Task(self, node): # to avoid to call self.add_object() for the current Module self.push_read_only_module() name = node.name _task = task.Task(name) statement = [self.visit(s) for s in node.statement] body = [] for s in statement: if isinstance(s, (tuple, list)): # from the visitor result of decl for d in s: if isinstance(d, vtypes.Input): t = _task.Input(d.name, d.width, d.length, d.signed, d.value) if d.width_msb is not None and d.width_lsb is not None: t._set_raw_width(d.width_msb, d.width_lsb) elif isinstance(d, vtypes.Reg): t = _task.Reg(d.name, d.width, d.length, d.signed, d.value) if d.width_msb is not None and d.width_lsb is not None: t._set_raw_width(d.width_msb, d.width_lsb) elif isinstance(d, vtypes.Integer): t = _task.Integer(d.name, d.width, d.length, d.signed, d.value) if d.width_msb is not None and d.width_lsb is not None: t._set_raw_width(d.width_msb, d.width_lsb) else: body.append(s) else: body.append(s) _task.Body(*body) # to restore the current Module self.pop_module() self.add_object(_task) return _task
def Task(self, name): t = task.Task(name) self.check_existing_identifier(name) self.task[name] = t self.items.append(t) return t