Skip to content

Commit

Permalink
Handled multiple learning cores
Browse files Browse the repository at this point in the history
  • Loading branch information
tcstewar committed Sep 26, 2018
1 parent 13c5084 commit c1b46f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion nengo_loihi/snips/nengo_io.c.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void nengo_io(runState *s) {
int32_t spike[2];
int32_t error_info[2];
int32_t error_data[MAX_ERROR_LEN];
int32_t error_index = 0;
int32_t error_index;
int32_t output[N_OUTPUTS];

if (inChannel == -1 || outChannel == -1) {
Expand All @@ -44,6 +44,8 @@ void nengo_io(runState *s) {
}

// Communicate with learning snip
s->userData[0] = N_ERRORS;
error_index = 1;
for (int i=0; i < N_ERRORS; i++) {
readChannel(inChannel, error_info, 2);
readChannel(inChannel, error_data, error_info[1]);
Expand Down
9 changes: 5 additions & 4 deletions nengo_loihi/snips/nengo_learn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
#include <string.h>
#include "nengo_learn.h"

#define N_ERRORS 1

int guard_learn(runState *s) {
return 1;
}

void nengo_learn(runState *s) {
int offset = 0;
for (int error_index=0; error_index < N_ERRORS; error_index++) {
int offset = 1;
int n_errors = s->userData[0];
for (int error_index=0; error_index < n_errors; error_index++) {
int core = s->userData[offset];
int n_vals = s->userData[offset+1];
for (int i=0; i < n_vals; i++) {
Expand Down Expand Up @@ -72,5 +71,7 @@ void nengo_learn(runState *s) {
.StdpProfile = 1
};
}
}
offset += 2 + n_vals;
}
}

0 comments on commit c1b46f0

Please sign in to comment.