def simulate(self): return (MemBuild() .set_origin(0x100) .add_i32(0x12345678) .add_i32(0xF0E0B0C0) .set_origin(0x200) .lb(1, 0, 0x100) .lb(2, 0, 0x104) .lb(3, 0, 0x101) .nop() ).dict
def simulate(self): return (MemBuild(0x200) .j(0x100) .set_origin(0x300) .jal(imm=-16, rd=1) #300 .nop() #304 .set_origin(0x2F0) .addi(rs1=1,rd=2,imm=0) #x2=304 .nop() ).dict
def simulate(self): return (MemBuild(0x200).lui(1, 0xFFFFF000).lui(2, 0x00001000).lui( 3, 0x12345000).dict)
def simulate(self): return (MemBuild(0x200).auipc(1, 0x1000) # R1 = 1200 .auipc(2, 0x1000) # R1 = 1204 .auipc(3, 0x1000) # R1 = 1208 .auipc(4, 0x1000) # R1 = 120B .nop().nop().nop().nop().dict)
def simulate(): return (MemBuild(0x200).addi(rd=1, rs1=0, imm=11) #x1=11 .addi(rd=0, rs1=0, imm=15) #x0=0 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.SHIFT_LEFT, rd=2, rs1=1, imm=2)) #x2=2c=B<<2 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.SHIFT_RIGHT, rd=3, rs1=2, imm=2)) #x3=2c>>2=b .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.SLT, rd=4, rs1=2, imm=1000)) #r4=x1 < 1000 = 1 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.SLT, rd=4, rs1=2, imm=0)) #x4=x1 < 0 = 0 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.XOR, rd=5, rs1=1, imm=-1)) #x5=~x1=FFFF FFF4 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.ADD, rd=6, imm=6)) #x6=6=b110 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.AND, rd=7, rs1=6, imm=3)) #x7=2 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.ADD, rd=8, imm=3)) #x8=3 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.OR, rd=9, rs1=8, imm=8)) #x8=b=3+8=11 .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.SHIFT_RIGHT, rd=10, rs1=5, imm=1)) #7FFFFFFA .add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.SHIFT_RIGHT, rd=10, rs1=5, imm=1 | (1 << 10))) #FFFFFFFA .addi(rd=10, rs1=0, imm=0x10) #0+10 .addi(rd=10, rs1=10, imm=0x20) #10+20 .addi(rd=10, rs1=10, imm=-0x20) #30-20 .dict)
def simulate(): membuild = MemBuild(0x200) return (membuild.add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.ADD)).add_i32( IType.build_i32(opcode=Opcode.OpImm, funct3=OpImm.ADD)).dict)
def simulate(self): return (MemBuild(0x200).addi(10, 0, 2).addi(11, 0, 2).bne( 11, 10, 0x100).bne(11, 0, 0x100).set_origin(0x30c).nop()).dict
def simulate(self): return (MemBuild(0x200).nop()).dict
def simulate(self): return (MemBuild(0x200).addi(1, 0, 0x80).jalr( 2, 1, 0x200).set_origin(0x280).nop().nop().nop()).dict