Skip to content
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

Update Neuron.h #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
39 changes: 9 additions & 30 deletions opt/netparser/Neuron.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Created by rodrigo on 5/30/17.
//

//
// Contributed to by Emre Neftci and Andrew Hansen on 02/15/18
//

#ifndef CAER_NEURON_H
#define CAER_NEURON_H

#endif //CAER_NEURON_H

//
// Created by rodrigo on 5/30/17.
//

#include <algorithm> // std::find_if
#include <iostream>
#include <map>
Expand All @@ -22,12 +22,12 @@
#include <set>
#include <fstream>
#include <mxml.h>
//TEST #include <libcaer/devices/dynapse.h>
//TEST #include "modules/ini/dynapse_utils.h"
//TEST #include "base/mainloop.h"
#include <libcaer/devices/dynapse.h>
#include "modules/ini/dynapse_utils.h"
#include "base/mainloop.h"
//
// Following code to use this code in standalone mode
#include "testcaer.h"
//#include "testcaer.h"

using namespace std;

Expand All @@ -45,28 +45,7 @@ struct Synapse {
void Print() const;
};

uint8_t find_next_unused_cam(vector<Synapse *> CAM){
vector<uint8_t> v1 (0);
//64 CAMs per neuron
for( uint8_t i = 0; i <= 64; i++ ) v1.push_back( i );

vector<uint8_t> v2 (0);
for(auto i: CAM) v2.push_back( (*i).camid );

vector<uint8_t> diff;

//DEBUG for (auto i : v1) std::cout << unsigned(i) << ' ';
//DEBUG std::cout << "minus ";
//DEBUG for (auto i : v2) std::cout << unsigned(i) << ' ';
//DEBUG std::cout << "is: ";

set_difference(v1.begin(), v1.end(), v2.begin(), v2.end(),
inserter(diff, diff.begin()));

//DEBUG for (auto i : diff) std::cout << unsigned(i) << ' ';
//DEBUG std::cout << '\n';
return diff.front();
}
uint8_t find_next_unused_cam(vector<Synapse *> CAM);

struct Neuron {
const uint8_t chip;
Expand Down