-
Notifications
You must be signed in to change notification settings - Fork 15
add architecture_spec.yaml file and yaml2json script #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
abc9225
add architecture_spec.yaml file and yaml2json script
n0thingNoob fd3a494
add ArchitectureSpec dir to include
n0thingNoob 0d098af
remove compiled files
n0thingNoob 48bfa62
add .gitignore to ignore cache files
n0thingNoob b83d06d
ignore lit.cfg
n0thingNoob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .cache/ | ||
| build/ | ||
| test/lit.cfg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.