From 48e155a93518def7150150a935e50af82aca11e2 Mon Sep 17 00:00:00 2001 From: n0thingNoob Date: Wed, 21 Jan 2026 23:01:26 +0000 Subject: [PATCH 1/3] fix some small issue --- test/testbench/histogram/main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/testbench/histogram/main.go b/test/testbench/histogram/main.go index c9394e2..0510397 100644 --- a/test/testbench/histogram/main.go +++ b/test/testbench/histogram/main.go @@ -7,7 +7,6 @@ import ( "github.com/sarchlab/akita/v4/sim" "github.com/sarchlab/zeonica/api" - // "github.com/sarchlab/zeonica/cgra" "github.com/sarchlab/zeonica/config" "github.com/sarchlab/zeonica/core" ) @@ -92,9 +91,7 @@ func Histogram() { for addr := 0; addr < scanLimit; addr++ { val := driver.ReadMemory(outputTile[0], outputTile[1], uint32(addr)) outputData[addr] = val - if addr < len(inputData) { - fmt.Printf(" addr %d -> %d\n", addr, val) - } + fmt.Printf(" addr %d -> %d\n", addr, val) } fmt.Println("expected histogram (CPU):") From ed9da76e0219b3a0f3387a9e62a41300bcf5165f Mon Sep 17 00:00:00 2001 From: n0thingNoob Date: Wed, 21 Jan 2026 23:05:15 +0000 Subject: [PATCH 2/3] update ICMP_SLT --- core/emu.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/emu.go b/core/emu.go index 403b04c..7295d83 100644 --- a/core/emu.go +++ b/core/emu.go @@ -366,7 +366,8 @@ func (i instEmulator) RunOperation(inst Operation, state *coreState, time float6 "GRANT_ONCE": i.runGrantOnce, // comparisons - "ICMP_EQ": i.runCmpExport, + "ICMP_EQ": i.runCmpExport, + "ICMP_SLT": i.runLTExport, // do not distinguish between data_mov and control mov "DATA_MOV": i.runMov, From 977e75b0a6a47f90580a894a0160f7e36195d10f Mon Sep 17 00:00:00 2001 From: n0thingNoob Date: Wed, 21 Jan 2026 23:11:18 +0000 Subject: [PATCH 3/3] update branch_for test --- .github/workflows/test.yml | 5 +- test/testbench/branch_for/branch_for_test.go | 65 ++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 test/testbench/branch_for/branch_for_test.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94d1181..19404dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,4 +30,7 @@ jobs: run: go install github.com/onsi/ginkgo/v2/ginkgo - name: Unit Test - run: ginkgo -r \ No newline at end of file + run: ginkgo -r + + - name: Go Test + run: go test ./... \ No newline at end of file diff --git a/test/testbench/branch_for/branch_for_test.go b/test/testbench/branch_for/branch_for_test.go new file mode 100644 index 0000000..e288a65 --- /dev/null +++ b/test/testbench/branch_for/branch_for_test.go @@ -0,0 +1,65 @@ +package main + +import ( + "fmt" + "math" + "testing" + + "github.com/sarchlab/akita/v4/sim" + "github.com/sarchlab/zeonica/api" + "github.com/sarchlab/zeonica/config" + "github.com/sarchlab/zeonica/core" +) + +func TestBranchForKernel(t *testing.T) { + width := 4 + height := 4 + + engine := sim.NewSerialEngine() + + driver := api.DriverBuilder{}. + WithEngine(engine). + WithFreq(1 * sim.GHz). + Build("Driver") + + device := config.DeviceBuilder{}. + WithEngine(engine). + WithFreq(1 * sim.GHz). + WithWidth(width). + WithHeight(height). + Build("Device") + + driver.RegisterDevice(device) + + program := core.LoadProgramFileFromYAML("./tmp-generated-instructions.yaml") + if len(program) == 0 { + t.Fatal("Failed to load branch_for program") + } + + for x := 0; x < width; x++ { + for y := 0; y < height; y++ { + coord := fmt.Sprintf("(%d,%d)", x, y) + if prog, exists := program[coord]; exists { + driver.MapProgram(prog, [2]int{x, y}) + } + } + } + + for x := 0; x < width; x++ { + for y := 0; y < height; y++ { + tile := device.GetTile(x, y) + tickingComponent := tile.GetTickingComponent() + engine.Schedule(sim.MakeTickEvent(tickingComponent, 0)) + } + } + + driver.Run() + + retBits := device.GetTile(1, 1).GetRetVal() + retVal := math.Float32frombits(retBits) + expected := cpuBranchFor() + + if retVal != expected { + t.Fatalf("branch_for failed: retVal=%f expected=%f", retVal, expected) + } +}