git.s-ol.nu subv / 98b4472
rename CSR instruction part /csr12 → /csr s-ol 16 days ago
3 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1111
1212 == code 0x80400000
1313 # load mhartid CSR into t0, trap all but first Hart
14 # 73/system 5/rd/t0 2/funct3/csrrs 0/rs/x0 f14/csr12/mhartid
14 # 73/system 5/rd/t0 2/funct3/csrrs 0/rs/x0 f14/csr/mhartid
1515 # 63/branch 1/subop/!= 5/rs/t0 0/rs/x0 0/off13
1616
1717 main:
00 == code 0x80400000
11 # load mhartid CSR into t0, trap all but first Hart
2 # 73/system 5/rd/t0 2/funct3/csrrs 0/rs/x0 f14/csr12/mhartid
2 # 73/system 5/rd/t0 2/funct3/csrrs 0/rs/x0 f14/csr/mhartid
33 # 63/branch 1/subop/!= 5/rs/t0 0/rs/x0 0/off13
44
55 main:
435435 """
436436 validate system operations.
437437
438 >>> validate_system(subv.parse('73/system 0/dest/x0 1/subop/csrrw 5/rs/t0 afe/csr12')['instr'])
438 >>> validate_system(subv.parse('73/system 0/dest/x0 1/subop/csrrw 5/rs/t0 afe/csr')['instr'])
439439 [(115, 'i'), (0, 'rd'), (1, 'funct3'), (5, 'rs'), (2814, 'imm12')]
440 >>> validate_system(subv.parse('73/system 0/dest/x0 5/subop/csrrwi 7/imm5 afe/csr12')['instr'])
440 >>> validate_system(subv.parse('73/system 0/dest/x0 5/subop/csrrwi 7/imm5 afe/csr')['instr'])
441441 [(115, 'i'), (0, 'rd'), (5, 'funct3'), (7, 'imm5'), (2814, 'imm12')]
442442
443443 >>> validate_system(subv.parse('73/system 0/subop/priv 0/funct12/ecall')['instr'])
445445 >>> validate_system(subv.parse('73/system 0/subop/priv 1/funct12/ebreak')['instr'])
446446 [(115, 'i'), (0, 'rd'), (0, 'funct3'), (0, 'rs'), (1, 'imm12')]
447447
448 >>> validate_system(subv.parse('73/system 0/dest/x0 1/subop/csrrw 7/imm5 afe/csr12')['instr'])
448 >>> validate_system(subv.parse('73/system 0/dest/x0 1/subop/csrrw 7/imm5 afe/csr')['instr'])
449449 Traceback (most recent call last):
450450 ...
451451 ValueError: Expected a register with label rs/rs1/src
452 >>> validate_system(subv.parse('73/system 0/dest/x0 5/subop/csrrwi 5/rs/t0 afe/csr12')['instr'])
452 >>> validate_system(subv.parse('73/system 0/dest/x0 5/subop/csrrwi 5/rs/t0 afe/csr')['instr'])
453453 Traceback (most recent call last):
454454 ...
455455 ValueError: Expected an immediate with size 5
474474 src = try_pop_zeroes(inputs, ["rs", "rs1", "src"])
475475 else:
476476 dest = validate_reg(inputs, ["rd", "dest"])
477 imm = pop_immediate(inputs, 12, ["imm", "csr"])
477 imm = pop_part(inputs, ["imm12", "csr"], "CSR-specifier")
478478
479479 if funct[2][-1] == "i":
480480 src = pop_immediate(inputs, 5)