-
Notifications
You must be signed in to change notification settings - Fork 6
patmos and s4noc support #288
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
Open
EhsanKhodadad
wants to merge
28
commits into
lf-lang:main
Choose a base branch
from
EhsanKhodadad:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e923ce8
Patmos and S4NoC support: init commit
EhsanKhodadad de6bb6d
Patmos and S4NoC support: 2nd commit
EhsanKhodadad 5450bbb
Patmos and S4NoC: 3rd Commit
EhsanKhodadad 0e3c723
Patmos and s4noc: 4th Commit: s4noc_channel passed the test
EhsanKhodadad c2436f6
Patmos and s4noc support
EhsanKhodadad ad9a2e4
Patmos and s4noc support: 6
EhsanKhodadad 843c316
Patmos and s4noc : 7
EhsanKhodadad a928619
Patmos and S4NoC: 8
EhsanKhodadad 8a2e842
Patmos and S4NoC 9
EhsanKhodadad 87f79d8
Patmos and S4NoC 10: manipulator to the second-to-last reactors is ad…
EhsanKhodadad 00acbd5
Patmos and S4NoC 11: compiled
EhsanKhodadad 60fed35
stuck at receive
EhsanKhodadad d2a9731
Recieves with long delay and lacks cb
EhsanKhodadad 481a419
fpga config and download
EhsanKhodadad 7c460af
failed on fpga solved
EhsanKhodadad e39efaa
global state are set in channel
EhsanKhodadad 68984ba
loop in build.sh
EhsanKhodadad be2d86e
main file generator
EhsanKhodadad 77e8b97
unconnected handling
EhsanKhodadad 7870744
new connectin handling disabled for channel_test
EhsanKhodadad 3a276f8
some modifications
EhsanKhodadad 5fd3942
s4noc_fed
EhsanKhodadad dc04629
fpga config & some renaming
EhsanKhodadad b74cc7d
readme update
EhsanKhodadad abd0456
--recursive in readme
EhsanKhodadad 7f335fd
log lock
EhsanKhodadad 0486db0
cpu_id in log
EhsanKhodadad 737cd87
handle_new_connection as a
EhsanKhodadad 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 |
|---|---|---|
|
|
@@ -11,3 +11,6 @@ cmake-build-release | |
| doc/html | ||
| doc/latex | ||
| doc/markdown/platform | ||
| *.o | ||
| *.bc | ||
| *.elf | ||
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
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
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 |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| set -e | ||
| ${REACTOR_UC_PATH}/lfc/bin/lfc-dev src/Smoke.lf | ||
| cmake -Bbuild | ||
| make -C build | ||
| bin/fp-smoke | ||
| if [ -z "$FP_SDK_PATH" ]; then | ||
| echo "Error: FP_SDK_PATH is not defined. Please set it before running this script." | ||
| else | ||
| ${REACTOR_UC_PATH}/lfc/bin/lfc-dev src/Smoke.lf | ||
| cmake -Bbuild | ||
| make -C build | ||
| bin/fp-smoke | ||
| fi |
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,18 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| if ! command -v pasim &> /dev/null; then | ||
| echo "Error: pasim command not found. Please ensure it is installed and available in your PATH." | ||
| else | ||
| # Iterate over each folder and execute the command | ||
| for dir in ./*; do | ||
| if [ -d $dir ]; then | ||
| echo "Entering $dir" | ||
| pushd $dir | ||
| chmod +x build.sh | ||
| ./build.sh | ||
| popd | ||
| fi | ||
| done | ||
| fi | ||
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,27 @@ | ||
| # Makefile for building a simple Hello World program for the Patmos platform | ||
|
|
||
| # Compiler and tools for PATMOS | ||
| CC = patmos-clang | ||
|
|
||
| # Paths | ||
| SRC_DIR = $(CURDIR) | ||
| BUILD_DIR = $(CURDIR)/build | ||
|
|
||
| # Source files | ||
| SOURCES = $(SRC_DIR)/hello.c | ||
|
|
||
| # Compiler flags | ||
| CFLAGS = -O2 -Wall -Wextra -Werror | ||
|
|
||
| # Output binary | ||
| OUTPUT = $(BUILD_DIR)/hello.elf | ||
| all : $(OUTPUT) | ||
| # Build rule | ||
| $(OUTPUT): $(SOURCES) | ||
| mkdir -p $(BUILD_DIR) | ||
| $(CC) $(CFLAGS) $(SOURCES) -o $(OUTPUT) | ||
|
|
||
| clean: | ||
| rm -rf $(BUILD_DIR) | ||
|
|
||
| .PHONY: all clean |
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,4 @@ | ||
| #!/bin/bash | ||
| rm -rf build | ||
| make all | ||
| pasim ./build/hello.elf |
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,5 @@ | ||
| #include <stdio.h> | ||
| int main () { | ||
| printf("Hello Patmos!\n"); | ||
| return 0; | ||
| } |
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 @@ | ||
| REACTOR_UC_PATH ?= $(CURDIR)/../../../ | ||
| LF_MAIN ?= HelloLF | ||
|
|
||
| # The name of the LF application inside "./src" to build/run/flash etc. | ||
| SRC_GEN_PATH ?= ./src-gen/$(LF_MAIN) | ||
|
|
||
| # Execute the LF compiler if build target is "all" | ||
| ifeq ($(firstword $(MAKECMDGOALS)),all) | ||
| _ := $(shell $(REACTOR_UC_PATH)/lfc/bin/lfc-dev src/$(LF_MAIN).lf) | ||
| endif | ||
|
|
||
| # ---- Patmos specific configuration ---- | ||
| include $(REACTOR_UC_PATH)/make/patmos/patmos-lfc.mk | ||
|
|
||
| CFLAGS += -DEVENT_QUEUE_SIZE=$(EVENT_QUEUE_SIZE) | ||
| CFLAGS += -DREACTION_QUEUE_SIZE=$(REACTION_QUEUE_SIZE) | ||
|
|
||
| # Output directory | ||
| BIN_DIR = $(CURDIR)/bin | ||
| OUTPUT = $(BIN_DIR)/$(LF_MAIN) | ||
|
|
||
| all: $(OUTPUT) | ||
|
|
||
| # Build rule | ||
| $(OUTPUT): $(SOURCES) | ||
| mkdir -p $(BIN_DIR) | ||
| $(CC) $(SOURCES) $(CFLAGS) -o $(OUTPUT) | ||
|
|
||
| clean: | ||
| rm -rf $(BIN_DIR) ./src-gen | ||
|
|
||
| .PHONY: all clean | ||
|
|
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,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| rm -rf bin src-gen | ||
| make all | ||
| pasim ./bin/HelloLF |
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,9 @@ | ||
| target uC { | ||
| platform: Patmos | ||
| } | ||
|
|
||
| main reactor { | ||
| reaction(startup) {= | ||
| printf("Hello LF on PATMOS!\n"); | ||
| =} | ||
| } |
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,20 @@ | ||
| include $(REACTOR_UC_PATH)/make/patmos/patmos.mk | ||
|
|
||
| OUTPUT = s4noc_fed.elf | ||
| BIN_DIR = $(CURDIR)/bin | ||
|
|
||
| SOURCES += $(CURDIR)/main.c | ||
| SOURCES += $(CURDIR)/sender/build/sender.a | ||
| SOURCES += $(CURDIR)/receiver/build/receiver.a | ||
|
|
||
| all: $(OUTPUT) | ||
|
|
||
| $(OUTPUT): $(SOURCES) | ||
| @echo "BUILDING $(notdir $@) from $^" | ||
| mkdir -p $(BIN_DIR) | ||
| $(CC) $(CFLAGS) $(SOURCES) -o $(BIN_DIR)/$(OUTPUT) | ||
|
|
||
| clean: | ||
| rm -rf $(BIN_DIR) | ||
|
|
||
| .PHONY: all clean |
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,31 @@ | ||
| # !/bin/bash | ||
|
|
||
| LF_MAIN=s4noc_fed | ||
| BIN_DIR=bin | ||
| CC=patmos-clang | ||
|
|
||
| make clean -C ./sender | ||
| make clean -C ./receiver | ||
|
|
||
| make all -C ./sender | ||
| make all -C ./receiver | ||
|
|
||
| echo "Linking sender and receiver to create executable" | ||
| make clean | ||
| make all | ||
|
|
||
| read -n 1 -t 10 -p "Choose action: [e]mulate or [f]pga? (default: e) " action | ||
| action=${action:-e} | ||
| if [[ "$action" == "e" ]]; then | ||
| patemu $BIN_DIR/$LF_MAIN.elf | ||
| elif [[ "$action" == "f" ]]; then | ||
| if jtagconfig | grep -q "USB-Blaster"; then | ||
| mv $BIN_DIR/$LF_MAIN.elf ~/t-crest/patmos/tmp/$LF_MAIN.elf | ||
| make -C ~/t-crest/patmos APP=$LF_MAIN config download | ||
| else | ||
| echo "JTAG not connected. Please connect USB-Blaster." | ||
| fi | ||
| else | ||
| echo "Invalid option. Please choose 'e' for emulate or 'f' for fpga." | ||
| fi | ||
|
|
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 @@ | ||
| #include <stdio.h> | ||
| #include <pthread.h> | ||
| #include "sender/sender.h" | ||
| #include "receiver/receiver.h" | ||
|
|
||
| static void* receiver_thread(void* arg) { | ||
| (void)arg; | ||
| // printf("Starting receiver federate on core/thread 1\n"); | ||
| lf_start_receiver(); | ||
| return NULL; | ||
| } | ||
|
|
||
| static void* sender_thread(void* arg) { | ||
| (void)arg; | ||
| printf("Starting sender federate on core/thread 2\n"); | ||
| lf_start_sender(); | ||
| return NULL; | ||
| } | ||
|
|
||
| int main(void) { | ||
| pthread_t threads[2]; | ||
| printf("Starting S4NOC Federated Example\n"); | ||
| pthread_create(&threads[0], NULL, receiver_thread, NULL); | ||
| pthread_create(&threads[1], NULL, sender_thread, NULL); | ||
|
|
||
| printf("Threads created for federates.\n"); | ||
|
|
||
| pthread_join(threads[0], NULL); | ||
| pthread_join(threads[1], NULL); | ||
|
|
||
| printf("All federates finished.\n"); | ||
| return 0; | ||
| } |
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,34 @@ | ||
| include $(REACTOR_UC_PATH)/make/patmos/patmos.mk | ||
|
|
||
| FED = receiver | ||
|
|
||
| # Paths | ||
| SRC_DIR = $(CURDIR) | ||
| BUILD_DIR = $(CURDIR)/build | ||
|
|
||
| # Source files | ||
| SOURCES = $(FED).c | ||
|
|
||
| OBJECTS ?= $(SOURCES:.c=.bc) | ||
|
|
||
| # Output binary | ||
| OUTPUT = $(FED).a | ||
|
|
||
| all: $(OUTPUT) | ||
|
|
||
| # Build rule | ||
| $(OUTPUT): $(OBJECTS) | ||
| @echo "BUILDING $(notdir $@) from $^" | ||
| mkdir -p $(BUILD_DIR) | ||
| llvm-ar rcsv $(BUILD_DIR)/$(OUTPUT) $^; | ||
|
|
||
| %.bc: %.c | ||
| @echo "$(notdir $^) COMPILED TO $(notdir $@)" | ||
| mkdir -p $(BUILD_DIR) | ||
| $(CC) $(CFLAGS) -emit-llvm -c $^ -o $@ | ||
|
|
||
| clean: | ||
| rm -rf $(BUILD_DIR) | ||
| rm -f $(FED).bc | ||
|
|
||
| .PHONY: all clean |
Oops, something went wrong.
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.