Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache/
build/
125 changes: 125 additions & 0 deletions include/ArchitectureSpec/architecture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"architecture": {
"name": "NeuraCGRA",
"version": "1.0",
"width": 4,
"height": 4
},
"tile_defaults": {
"num_registers": 64,
"default_ports": [
"N",
"S",
"W",
"E"
],
"operations": [
"add",
"mul",
"sub"
]
},
"link_defaults": {
"latency": 1,
"bandwidth": 32
},
"connectivity": "mesh",
"links": [
{
"id": 0,
"x": 0,
"y": 0,
"src_tile": 0,
"dst_tile": 1,
"src_port": "E",
"dst_port": "W",
"latency": 1,
"bandwidth": 32
},
{
"id": 1,
"x": 1,
"y": 0,
"src_tile": 0,
"dst_tile": 4,
"src_port": "S",
"dst_port": "N"
}
],
"tile_overrides": [
{
"id": 0,
"x": 0,
"y": 0,
"operations": [
"load"
],
"num_registers": 32,
"ports": [
"S",
"E"
]
},
{
"id": 3,
"x": 3,
"y": 0,
"operations": [
"store"
],
"num_registers": 32,
"ports": [
"W"
]
},
{
"id": 5,
"x": 1,
"y": 1,
"operations": [
"add",
"mul"
],
"num_registers": 32,
"memory": {
"capacity": 2048
},
"ports": [
"N",
"S",
"E",
"W"
]
},
{
"id": 6,
"x": 2,
"y": 1,
"operations": [],
"num_registers": 32,
"ports": [
"E",
"W"
]
}
],
"extensions": {
"crossbar": false
},
"simulator": {
"execution_model": "serial",
"logging": {
"enabled": true,
"file": "output.log"
},
"driver": {
"name": "Driver",
"frequency": "1GHz"
},
"device": {
"name": "Device",
"frequency": "1GHz",
"bind_to_architecture": true
}
}
}
85 changes: 85 additions & 0 deletions include/ArchitectureSpec/architecture.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
architecture:
name: "NeuraCGRA"
version: "1.0"
width: 4
height: 4

tile_defaults:
num_registers: 64
default_ports: ["N", "S", "W", "E"]
operations: ["add", "mul", "sub"] # default ALU instructions

link_defaults:
latency: 1
bandwidth: 32

connectivity: "mesh"

links:
- id: 0
x: 0
y: 0
src_tile: 0
dst_tile: 1
src_port: "E"
dst_port: "W"
latency: 1
bandwidth: 32

- id: 1
x: 1
y: 0
src_tile: 0
dst_tile: 4
src_port: "S"
dst_port: "N"

tile_overrides:
- id: 0
x: 0
y: 0
operations: ["load"]
num_registers: 32
ports: ["S", "E"]

- id: 3
x: 3
y: 0
operations: ["store"]
num_registers: 32
ports: ["W"]

- id: 5
x: 1
y: 1
operations: ["add", "mul"]
num_registers: 32
memory:
capacity: 2048
ports: ["N", "S", "E", "W"] # optional: matches defaults

- id: 6
x: 2
y: 1
operations: []
num_registers: 32
ports: ["E", "W"]

extensions:
crossbar: false

simulator:
execution_model: "serial"

logging:
enabled: true
file: "output.log"

driver:
name: "Driver"
frequency: "1GHz"

device:
name: "Device"
frequency: "1GHz"
bind_to_architecture: true
33 changes: 33 additions & 0 deletions include/ArchitectureSpec/yaml2json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import yaml
import json
import sys
import os

def convert_yaml_to_json(yaml_path, json_path=None):
if not os.path.isfile(yaml_path):
print(f"Error: File '{yaml_path}' not found.")
return

with open(yaml_path, 'r') as f:
try:
data = yaml.safe_load(f)
except yaml.YAMLError as e:
print(f"YAML parse error: {e}")
return

if json_path is None:
json_path = os.path.splitext(yaml_path)[0] + ".json"

with open(json_path, 'w') as f:
json.dump(data, f, indent=2)

print(f"✅ Converted '{yaml_path}' to '{json_path}'")

if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python yaml2json.py <input.yaml> [output.json]")
sys.exit(1)

yaml_file = sys.argv[1]
json_file = sys.argv[2] if len(sys.argv) > 2 else None
convert_yaml_to_json(yaml_file, json_file)
18 changes: 18 additions & 0 deletions test/lit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
import lit.formats

config.name = 'Neura Dialect Tests'
config.test_format = lit.formats.ShTest(True)
config.suffixes = ['.mlir']
config.test_source_root = os.path.dirname(__file__)
config.test_exec_root = os.path.dirname(__file__)
config.excludes = ['samples']

# Tool substitutions from CMake
config.substitutions.append(('mlir-neura-opt', '/home/yshi16/Desktop/dataflow/build/tools/mlir-neura-opt/mlir-neura-opt'))
config.substitutions.append(('neura-interpreter', '/home/yshi16/Desktop/dataflow/build/tools/neura-interpreter/neura-interpreter'))
config.substitutions.append(('neura-compiler', '/home/yshi16/Desktop/dataflow/build/tools/neura-compiler/neura-compiler'))
config.substitutions.append(('FileCheck', '/home/yshi16/.local/opt/llvm/bin/FileCheck'))
config.substitutions.append(('mlir-opt', '/home/yshi16/.local/opt/llvm/bin/mlir-opt'))
config.substitutions.append(('mlir-translate', '/home/yshi16/.local/opt/llvm/bin/mlir-translate'))
config.substitutions.append(('llc', '/home/yshi16/.local/opt/llvm/bin/llc'))