def ab_c(self): self.a in rangelist(1, 5) with vsc.if_then(self.a == 1): self.b in rangelist(0, 10) with vsc.else_if(self.a == 2): self.b in rangelist(11, 20) with vsc.else_if(self.a == 3): self.b in rangelist(21, 30) with vsc.else_if(self.a == 4): self.b in rangelist(31, 40) with vsc.else_if(self.a == 5): self.b in rangelist(41, 50)
def ab_c(self): self.a == 5 with vsc.if_then(self.a == 1): self.b == 1 with vsc.else_if(self.a == 2): self.b == 2 with vsc.else_if(self.a == 3): self.b == 4 with vsc.else_if(self.a == 4): self.b == 8 with vsc.else_if(self.a == 5): self.b == 16 with vsc.else_then(): self.b == 0
def enum_inter_class(self): # Does not work self.c1[0].a[0].enum_test == level_e.level_2 with vsc.if_then(self.c1[0].a[0].enum_test == level_e.level_0): self.c2[0].x[0].value == 1 with vsc.else_if(self.c1[0].a[0].enum_test == level_e.level_1): self.c2[0].x[0].value == 2 with vsc.else_then: self.c2[0].x[0].value == 3
def enum_inter_class(self): with vsc.foreach(self.c1, idx=True) as i: with vsc.foreach(self.c1[i].a, idx=True) as j: with vsc.if_then( self.c1[i].a[0].enum_test == level_e.level_0): self.c2[i].x[0].value == 0 with vsc.else_if( self.c1[i].a[0].enum_test == level_e.level_1): self.c2[i].x[0].value == 1 with vsc.else_then: self.c2[i].x[0].value == 2
def loop_c(self): vsc.solve_order(self.num_of_nested_loop, self.loop_init_val) vsc.solve_order(self.num_of_nested_loop, self.loop_step_val) vsc.solve_order(self.num_of_nested_loop, self.loop_limit_val) vsc.solve_order(self.loop_limit_val, self.loop_limit_reg) vsc.solve_order(self.branch_type, self.loop_init_val) vsc.solve_order(self.branch_type, self.loop_step_val) vsc.solve_order(self.branch_type, self.loop_limit_val) self.num_of_instr_in_loop.inside(vsc.rangelist((1, 25))) self.num_of_nested_loop.inside(vsc.rangelist(1, 2)) self.loop_init_val.size.inside(vsc.rangelist(1, 2)) self.loop_step_val.size.inside(vsc.rangelist(1, 2)) self.loop_limit_val.size.inside(vsc.rangelist(1, 2)) self.branch_type.size.inside(vsc.rangelist(1, 2)) self.loop_init_val.size == self.num_of_nested_loop self.branch_type.size == self.num_of_nested_loop self.loop_step_val.size == self.num_of_nested_loop self.loop_limit_val.size == self.num_of_nested_loop self.branch_type.size == self.num_of_nested_loop with vsc.foreach(self.branch_type, idx=True) as i: with vsc.if_then(cfg.disable_compressed_instr == 0): self.branch_type[i].inside( vsc.rangelist( riscv_instr_name_t.C_BNEZ, riscv_instr_name_t.C_BEQZ, riscv_instr_name_t.BEQ, riscv_instr_name_t.BNE, riscv_instr_name_t.BLTU, riscv_instr_name_t.BLT, riscv_instr_name_t.BGEU, riscv_instr_name_t.BGE)) with vsc.else_then(): self.branch_type[i].inside( vsc.rangelist(riscv_instr_name_t.BEQ, riscv_instr_name_t.BNE, riscv_instr_name_t.BLTU, riscv_instr_name_t.BLT, riscv_instr_name_t.BGEU, riscv_instr_name_t.BGE)) with vsc.foreach(self.loop_init_val, idx=True) as i: with vsc.if_then(self.branch_type[i].inside( vsc.rangelist(riscv_instr_name_t.C_BNEZ, riscv_instr_name_t.C_BEQZ))): self.loop_limit_val[i] == 0 self.loop_limit_reg[i] == riscv_reg_t.ZERO self.loop_cnt_reg[i].inside(vsc.rangelist(compressed_gpr)) with vsc.else_then: self.loop_limit_val[i].inside(vsc.rangelist((-20, 20))) self.loop_limit_reg[i] != riscv_reg_t.ZERO with vsc.if_then(self.branch_type[i].inside( vsc.rangelist(riscv_instr_name_t.C_BNEZ, riscv_instr_name_t.C_BEQZ, riscv_instr_name_t.BEQ, riscv_instr_name_t.BNE))): self.loop_limit_val[i] != self.loop_init_val[i] ((self.loop_limit_val[i] - self.loop_init_val[i]) % self.loop_step_val[i]) == 0 with vsc.else_if(self.branch_type[i] == riscv_instr_name_t.BGE): self.loop_step_val[i] < 0 with vsc.else_if(self.branch_type[i].inside( vsc.rangelist(riscv_instr_name_t.BGEU))): self.loop_step_val[i] < 0 self.loop_init_val[i] > 0 # Avoid count to negative (self.loop_step_val[i] + self.loop_limit_val[i]) > 0 with vsc.else_if(self.branch_type[i] == riscv_instr_name_t.BLT): self.loop_step_val[i] > 0 with vsc.else_if(self.branch_type[i] == riscv_instr_name_t.BLTU): self.loop_step_val[i] > 0 self.loop_limit_val[i] > 0 self.loop_init_val[i].inside(vsc.rangelist((-10, 10))) self.loop_step_val[i].inside(vsc.rangelist((-10, 10))) with vsc.if_then(self.loop_init_val[i] < self.loop_limit_val[i]): self.loop_step_val[i] > 0 with vsc.else_then: self.loop_step_val[i] < 0
def ab_c(self): with vsc.foreach(self.b, idx = True) as i: with vsc.if_then(self.b[i] == my_e.A): self.a == 0 with vsc.else_if(self.b[i] == my_e.B): self.a == 1