Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #69 from Abdulwadoodd/atomics_dev
Browse files Browse the repository at this point in the history
Add support for standard Atomic (A) Extension
  • Loading branch information
neelgala authored Aug 21, 2023
2 parents ef895d6 + 10f0cb9 commit 5cc22db
Show file tree
Hide file tree
Showing 5 changed files with 851 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Only when a release to the main branch is done, the contents of the WIP-DEV are
versioned header while the `WIP-DEV` is left empty

## [WIP-DEV]
- Added support of Standard Atomic (A) Extension (RV32 and RV64), excluding the LR/SC instruction.
- Updating CONTRIBUTING.rst to capture the new git strategy adopted to follow a monthly release
cadence.

Expand Down
360 changes: 360 additions & 0 deletions riscv_ctg/data/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10318,3 +10318,363 @@ czero.nez:
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_RR_OP($inst, $rd, $rs1, $rs2, $correctval, $rs1_val, $rs2_val, $swreg, $offset, $testreg)
amoadd.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoand.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoswap.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoxor.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoor.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amomin.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amominu.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amomax.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amomaxu.w:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [32,64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoadd.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoand.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoswap.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoxor.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amoor.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amomin.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amominu.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amomax.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
amomaxu.d:
sig:
stride: 2
sz: 'XLEN/8'
xlen: [64]
std_op:
isa:
- IA
formattype: 'rformat'
rs1_op_data: *all_regs
rs2_op_data: *all_regs
rd_op_data: *all_regs
rs1_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
rs2_val_data: 'gen_sign_dataset(xlen)+gen_usign_dataset(xlen)'
template: |-
// $comment
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
TEST_AMO_OP($inst, $rd, $rs1, $rs2, $rs1_val, $rs2_val, $swreg, $offset)
7 changes: 6 additions & 1 deletion sample_cgfs/dataset.cgf
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,12 @@ datasets:
'rs2 == rd != rs1': 0
'rs1 == rs2 == rd': 0
'rs1 != rs2 and rs1 != rd and rs2 != rd': 0


ramofmt_op_comb: &ramofmt_op_comb
'rs1 == rd != rs2': 0
'rs2 == rd != rs1': 0
'rs1 != rs2 and rs1 != rd and rs2 != rd': 0

r4fmt_op_comb: &r4fmt_op_comb
'rs1 == rs2 == rs3 == rd': 0
'rs1 == rs2 == rs3 != rd': 0
Expand Down
Loading

0 comments on commit 5cc22db

Please sign in to comment.