Skip to content

Commit c37f101

Browse files
Merge pull request #581 from ahlyssa/ahlyssa2
Align Coverpoint Hole for I instructions
2 parents b910630 + a0b795f commit c37f101

File tree

10 files changed

+185
-0
lines changed

10 files changed

+185
-0
lines changed

bin/testgen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,8 @@ def write_tests(coverpoints, test, xlen):
18401840
pass # Zalrsc coverpoints handled custom
18411841
elif (coverpoint == "cp_custom_aqrl"):
18421842
make_custom(test, xlen)
1843+
elif (coverpoint == "cp_align_byte", "cp_align_word", "cp_align_hword"):
1844+
make_custom(test, xlen)
18431845
else:
18441846
print("Warning: " + coverpoint + " not implemented yet for " + test)
18451847

templates/testgen/lb.S

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# cp_align_byte
2+
# test all 8 byte alignments
3+
la t0, scratch
4+
li t1, 0x9ABCDEF0
5+
li t2, 0x12345678
6+
sw t1, 0(t0) // Initialize memory
7+
sw t2, 4(t0)
8+
9+
# cp_align_byte: imm[2:0]=000
10+
lb t1, 0(t0)
11+
12+
# cp_align_byte: imm[2:0]=001
13+
lb t1, 1(t0)
14+
15+
# cp_align_byte: imm[2:0]=010
16+
lb t1, 2(t0)
17+
18+
# cp_align_byte: imm[2:0]=011
19+
lb t1, 3(t0)
20+
21+
# cp_align_byte: imm[2:0]=100
22+
lb t1, 4(t0)
23+
24+
# cp_align_byte: imm[2:0]=101
25+
lb t1, 5(t0)
26+
27+
# cp_align_byte: imm[2:0]=110
28+
lb t1, 6(t0)
29+
30+
# cp_align_byte: imm[2:0]=111
31+
lb t1, 7(t0)

templates/testgen/lbu.S

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# cp_align_byte
2+
# test all 8 byte alignments
3+
la t0, scratch
4+
li t1, 0x9ABCDEF0
5+
li t2, 0x12345678
6+
sw t1, 0(t0) // Initialize memory
7+
sw t2, 4(t0)
8+
9+
# cp_align_byte: imm[2:0]=000
10+
lbu t3, 0(t0)
11+
12+
# cp_align_byte: imm[2:0]=001
13+
lbu t3, 1(t0)
14+
15+
# cp_align_byte: imm[2:0]=010
16+
lbu t3, 2(t0)
17+
18+
# cp_align_byte: imm[2:0]=011
19+
lbu t3, 3(t0)
20+
21+
# cp_align_byte: imm[2:0]=100
22+
lbu t3, 4(t0)
23+
24+
# cp_align_byte: imm[2:0]=101
25+
lbu t3, 5(t0)
26+
27+
# cp_align_byte: imm[2:0]=110
28+
lbu t3, 6(t0)
29+
30+
# cp_align_byte: imm[2:0]=111
31+
lbu t3, 7(t0)

templates/testgen/lh.S

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# cp_align_hword
2+
# test all halfword-aligned operations
3+
la t0, scratch
4+
li t1, 0x9ABCDEF0
5+
li t2, 0x12345678
6+
sw t1, 0(t0) // Initialize memory
7+
sw t2, 4(t0)
8+
9+
#cp_align_hword: imm[2:1]=00
10+
lh t1, 0(t0)
11+
12+
#cp_align_hword: imm[2:1]=01
13+
lh t1, 2(t0)
14+
15+
#cp_align_hword: imm[2:1]=10
16+
lh t1, 4(t0)
17+
18+
#cp_align_hword: imm[2:1]=11
19+
lh t1, 6(t0)

templates/testgen/lhu.S

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# cp_align_hword
2+
# test all halfword-aligned operations
3+
la t0, scratch
4+
li t1, 0x9ABCDEF0
5+
li t2, 0x12345678
6+
sw t1, 0(t0) // Initialize memory
7+
sw t2, 4(t0)
8+
9+
#cp_align_hword: imm[2:1]=00
10+
lhu t3, 0(t0)
11+
12+
#cp_align_hword: imm[2:1]=01
13+
lhu t3, 2(t0)
14+
15+
#cp_align_hword: imm[2:1]=10
16+
lhu t3, 4(t0)
17+
18+
#cp_align_hword: imm[2:1]=11
19+
lhu t3, 6(t0)

templates/testgen/lw.S

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# align_word.S
2+
# Test word-aligned lw operations
3+
la t0, scratch
4+
li t2, 0x12345678
5+
sw t2, 0(t0)
6+
li t2, 0x9ABCDEF0
7+
sw t2, 4(t0)
8+
9+
# cp_align_word: imm[2]=0 (aligned load)
10+
lw t1, 0(t0)
11+
12+
# cp_align_word: imm[2]=1 (next word)
13+
lw t1, 4(t0)

templates/testgen/lwu.S

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# cp_align_word
2+
# Test all word-aligned operations for RV64 only
3+
la t0, scratch
4+
li t2, 0x123456789ABCDEF0
5+
sd t2, 0(t0)
6+
7+
# cp_align_word: imm[2]=0
8+
lwu t3, 0(t0)
9+
10+
# cp_align_word: imm[2]=1
11+
lwu t3, 4(t0)

templates/testgen/sb.S

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# cp_align_byte
2+
# test all 8 byte alignments
3+
la t0, scratch
4+
li t1, 0x9ABCDEF0
5+
li t2, 0x12345678
6+
sw t1, 0(t0) // Initialize memory
7+
sw t2, 4(t0)
8+
9+
# cp_align_byte: imm[2:0]=000
10+
sb t2, 0(t0)
11+
12+
# cp_align_byte: imm[2:0]=001
13+
sb t2, 1(t0)
14+
15+
# cp_align_byte: imm[2:0]=010
16+
sb t2, 2(t0)
17+
18+
# cp_align_byte: imm[2:0]=011
19+
sb t2, 3(t0)
20+
21+
# cp_align_byte: imm[2:0]=100
22+
sb t2, 4(t0)
23+
24+
# cp_align_byte: imm[2:0]=101
25+
sb t2, 5(t0)
26+
27+
# cp_align_byte: imm[2:0]=110
28+
sb t2, 6(t0)
29+
30+
# cp_align_byte: imm[2:0]=111
31+
sb t2, 7(t0)

templates/testgen/sh.S

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# cp_align_hword
2+
# test all halfword-aligned operations
3+
la t0, scratch
4+
li t1, 0x9ABCDEF0
5+
li t2, 0x12345678
6+
sw t1, 0(t0) // Initialize memory
7+
sw t2, 4(t0)
8+
9+
#cp_align_hword: imm[2:1]=00
10+
sh t2, 0(t0)
11+
12+
#cp_align_hword: imm[2:1]=01
13+
sh t2, 2(t0)
14+
15+
#cp_align_hword: imm[2:1]=10
16+
sh t2, 4(t0)
17+
18+
#cp_align_hword: imm[2:1]=11
19+
sh t2, 6(t0)

templates/testgen/sw.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# align_word.S
2+
# Test word-aligned sw operations
3+
la t0, scratch
4+
li t2, 0x12345678
5+
li t3, 0x9ABCDEF0
6+
7+
# cp_align_word: imm[2]=0 (aligned store)
8+
sw t2, 0(t0)
9+
sw t3, 4(t0)

0 commit comments

Comments
 (0)