Skip to content

Commit 39a060a

Browse files
committed
Add FFT testbench
1 parent 5d91103 commit 39a060a

4 files changed

Lines changed: 478 additions & 1 deletion

File tree

test/testbench/fft/arch_spec.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
architecture:
2+
name: "NeuraMultiCgra"
3+
version: "1.0"
4+
5+
multi_cgra_defaults:
6+
base_topology: "mesh"
7+
rows: 1
8+
columns: 1
9+
10+
cgra_defaults:
11+
rows: 4
12+
columns: 4
13+
ctrl_mem_items: 20
14+
base_topology: "mesh"
15+
16+
tile_defaults:
17+
num_registers: 32
18+
local_memory_words: 2048
19+
fu_types: ["add", "mul", "div", "fadd", "fmul", "fdiv", "logic", "cmp", "sel", "type_conv", "vfmul", "fadd_fadd", "fmul_fadd", "grant", "loop_control", "phi", "constant", "mem", "return", "mem_indexed", "alloca", "shift"]
20+
21+
link_defaults:
22+
latency: 1
23+
bandwidth: 32
24+
25+
extensions:
26+
crossbar: false
27+
28+
simulator:
29+
execution_model: "serial"
30+
execution_policy: "in_order_dataflow"
31+
enable_fifo_model: false
32+
33+
logging:
34+
enabled: true
35+
enableTrace: true
36+
file: "<test>.json.log"
37+
38+
driver:
39+
name: "Driver"
40+
frequency: "1GHz"
41+
port_incoming_buffer_depth: 4
42+
port_outgoing_buffer_depth: 4
43+
44+
device:
45+
name: "Device"
46+
frequency: "1GHz"
47+
bind_to_architecture: true
48+
memory_mode: "shared"
49+
shared_memory_model: "ideal"
50+
port_incoming_buffer_depth: 8
51+
port_outgoing_buffer_depth: 8
52+
memory_share:
53+
- {tile_x: 0, tile_y: 0, group: 0}
54+
- {tile_x: 1, tile_y: 0, group: 0}
55+
- {tile_x: 2, tile_y: 0, group: 0}
56+
- {tile_x: 3, tile_y: 0, group: 0}
57+
- {tile_x: 0, tile_y: 1, group: 0}
58+
- {tile_x: 1, tile_y: 1, group: 0}
59+
- {tile_x: 2, tile_y: 1, group: 0}
60+
- {tile_x: 3, tile_y: 1, group: 0}
61+
- {tile_x: 0, tile_y: 2, group: 0}
62+
- {tile_x: 1, tile_y: 2, group: 0}
63+
- {tile_x: 2, tile_y: 2, group: 0}
64+
- {tile_x: 3, tile_y: 2, group: 0}
65+
- {tile_x: 0, tile_y: 3, group: 0}
66+
- {tile_x: 1, tile_y: 3, group: 0}
67+
- {tile_x: 2, tile_y: 3, group: 0}
68+
- {tile_x: 3, tile_y: 3, group: 0}

test/testbench/fft/fft_test.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package main
2+
3+
import (
4+
"log/slog"
5+
"os"
6+
"path/filepath"
7+
"testing"
8+
9+
"github.com/sarchlab/zeonica/core"
10+
"github.com/sarchlab/zeonica/runtimecfg"
11+
)
12+
13+
func TestFft(t *testing.T) {
14+
logPath := filepath.Join(t.TempDir(), "fft.json.log")
15+
f, err := os.Create(logPath)
16+
if err != nil {
17+
t.Fatalf("create log file: %v", err)
18+
}
19+
defer f.Close()
20+
21+
handler := slog.NewJSONHandler(f, &slog.HandlerOptions{
22+
Level: core.LevelTrace,
23+
})
24+
slog.SetDefault(slog.New(handler))
25+
26+
archSpecPath, err := resolveArchSpecPath()
27+
if err != nil {
28+
t.Fatalf("resolve arch spec: %v", err)
29+
}
30+
rt, err := runtimecfg.LoadRuntime(archSpecPath, "fft")
31+
if err != nil {
32+
t.Fatalf("load runtime: %v", err)
33+
}
34+
35+
mismatch := Fft(rt)
36+
if mismatch != 0 {
37+
t.Fatalf("fft mismatch count: got=%d expected=0", mismatch)
38+
}
39+
}

0 commit comments

Comments
 (0)