Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ jobs:
run: go install github.com/onsi/ginkgo/v2/ginkgo

- name: Unit Test
run: ginkgo -r
run: ginkgo -r

- name: Go Test
run: go test ./...
3 changes: 2 additions & 1 deletion core/emu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
65 changes: 65 additions & 0 deletions test/testbench/branch_for/branch_for_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
5 changes: 1 addition & 4 deletions test/testbench/histogram/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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):")
Expand Down
Loading