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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.cache/
build/
test/lit.cfg
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)