NM500 Lib
NM500.h@9:06ef3c5d6737, 2018-12-17 (annotated)
- Committer:
- Nasungil
- Date:
- Mon Dec 17 09:31:12 2018 +0000
- Revision:
- 9:06ef3c5d6737
- Parent:
- 7:a8ebb0cab33d
NM500 Test Lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nasungil | 0:fadd3703a42c | 1 | //sd card define |
Nasungil | 0:fadd3703a42c | 2 | #define CM1K 0x01 |
Nasungil | 0:fadd3703a42c | 3 | |
Nasungil | 1:5cdfdb2e5691 | 4 | #define MAX_SIZE 100 |
Nasungil | 1:5cdfdb2e5691 | 5 | |
Nasungil | 0:fadd3703a42c | 6 | |
Nasungil | 7:a8ebb0cab33d | 7 | |
Nasungil | 0:fadd3703a42c | 8 | |
Nasungil | 0:fadd3703a42c | 9 | |
Nasungil | 0:fadd3703a42c | 10 | |
Nasungil | 0:fadd3703a42c | 11 | //register address |
Nasungil | 0:fadd3703a42c | 12 | #define NM_NCR 0x00 // Neuron Context Register |
Nasungil | 0:fadd3703a42c | 13 | #define NM_COMP 0x01 // Component |
Nasungil | 0:fadd3703a42c | 14 | #define NM_LCOMP 0x02 // Last Component |
Nasungil | 0:fadd3703a42c | 15 | #define NM_DIST 0x03 // Distance register, between [0, 65535] |
Nasungil | 0:fadd3703a42c | 16 | #define NM_IDX 0x03 // |
Nasungil | 0:fadd3703a42c | 17 | #define NM_CAT 0x04 // Category register |
Nasungil | 0:fadd3703a42c | 18 | #define NM_AIF 0x05 // Active Influence Field |
Nasungil | 0:fadd3703a42c | 19 | #define NM_MINIF 0x06 // Minumum Influence Field |
Nasungil | 0:fadd3703a42c | 20 | #define NM_MAXIF 0x07 // Maximum Influence Field |
Nasungil | 0:fadd3703a42c | 21 | #define NM_TESTCOMP 0x08 // |
Nasungil | 0:fadd3703a42c | 22 | #define NM_TESTCAT 0x09 // |
Nasungil | 0:fadd3703a42c | 23 | #define NM_NID 0x0A // Neuron Identifier or index of the neuron in the chain, Bit[15:0]= 2 lower bytes of a 3-bytes neuron identifier. |
Nasungil | 0:fadd3703a42c | 24 | #define NM_GCR 0x0B // Global Context and also partial identifier of the RTL neuron |
Nasungil | 0:fadd3703a42c | 25 | #define NM_RSTCHAIN 0x0C // |
Nasungil | 0:fadd3703a42c | 26 | #define NM_NSR 0x0D // Network Status Register |
Nasungil | 0:fadd3703a42c | 27 | #define NM_POWER_SAVE 0x0E |
Nasungil | 0:fadd3703a42c | 28 | #define NM_NCOUNT 0x0F // Count of committed neurons, Bit[15:0]= 2 lower bytes of the count |
Nasungil | 0:fadd3703a42c | 29 | #define NM_FORGET 0x0F // Uncommit all neurons by clearing their category register. |
Nasungil | 0:fadd3703a42c | 30 | |
Nasungil | 5:dacd883e994d | 31 | //#define NEURONSIZE 256 //memory capacity of each neuron in byte |
Nasungil | 6:4bc46c554aed | 32 | //#define MAXNEURONS 1024 //(576*2) //number of neurons per chip |
Nasungil | 0:fadd3703a42c | 33 | |
Nasungil | 5:dacd883e994d | 34 | #define NEURONSIZE 256 //memory capacity of each neuron in byte |
Nasungil | 6:4bc46c554aed | 35 | #define MAXNEURONS 576*1 //(576*2) //number of neurons per chip |
Nasungil | 0:fadd3703a42c | 36 | |
Nasungil | 0:fadd3703a42c | 37 | #define LOW 0 |
Nasungil | 0:fadd3703a42c | 38 | #define HIGH 1 |
Nasungil | 0:fadd3703a42c | 39 | |
Nasungil | 0:fadd3703a42c | 40 | #define WRITE 0 |
Nasungil | 0:fadd3703a42c | 41 | #define READ 1 |
Nasungil | 0:fadd3703a42c | 42 | |
Nasungil | 0:fadd3703a42c | 43 | |
Nasungil | 0:fadd3703a42c | 44 | |
Nasungil | 0:fadd3703a42c | 45 | |
Nasungil | 0:fadd3703a42c | 46 | |
Nasungil | 0:fadd3703a42c | 47 | |
Nasungil | 0:fadd3703a42c | 48 | |
Nasungil | 0:fadd3703a42c | 49 | extern int begin(); |
Nasungil | 0:fadd3703a42c | 50 | extern void forget(); |
Nasungil | 0:fadd3703a42c | 51 | extern int clearNeurons(); |
Nasungil | 0:fadd3703a42c | 52 | extern int learn(unsigned char vector[], int length, int category); |
Nasungil | 0:fadd3703a42c | 53 | //extern int classify(unsigned char vector[], int length, int K, int distance[], int category[], int nid[]); |
Nasungil | 0:fadd3703a42c | 54 | extern int classify(unsigned char vector[], int length, int* distance, int* category, int* nid); |
Nasungil | 0:fadd3703a42c | 55 | extern void setContext(int context, int minif, int maxif); |
Nasungil | 0:fadd3703a42c | 56 | extern void getContext(int* context, int* minif, int* maxif); |
Nasungil | 0:fadd3703a42c | 57 | extern void setRBF(); |
Nasungil | 0:fadd3703a42c | 58 | extern void setKNN(); |
Nasungil | 0:fadd3703a42c | 59 | extern int NCOUNT(); |
Nasungil | 7:a8ebb0cab33d | 60 | |
Nasungil | 0:fadd3703a42c | 61 | extern void write(char reg, int data); |
Nasungil | 0:fadd3703a42c | 62 | extern int read(char reg); |
Nasungil | 0:fadd3703a42c | 63 | extern int broadcast(unsigned char vector[], int length); |
Nasungil | 0:fadd3703a42c | 64 | extern void readNeuron(int nid, unsigned char model[], int* context, int* aif, int* category); |
Nasungil | 7:a8ebb0cab33d | 65 | extern void SPI_Init(void); |
Nasungil | 7:a8ebb0cab33d | 66 | extern void RESET_Test(void); |
Nasungil | 0:fadd3703a42c | 67 | |
Nasungil | 0:fadd3703a42c | 68 | |
Nasungil | 0:fadd3703a42c | 69 | |
Nasungil | 7:a8ebb0cab33d | 70 | |
Nasungil | 7:a8ebb0cab33d | 71 | |
Nasungil | 7:a8ebb0cab33d | 72 |