Na sungil / NM500Lib_Socket
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NM500.h Source File

NM500.h

00001 //sd card define
00002 #define CM1K        0x01
00003 
00004 #define MAX_SIZE    100
00005 
00006 
00007  
00008 
00009 
00010 
00011 //register address
00012 #define NM_NCR          0x00    // Neuron Context Register
00013 #define NM_COMP         0x01    // Component
00014 #define NM_LCOMP        0x02    // Last Component
00015 #define NM_DIST         0x03    // Distance register, between [0, 65535]
00016 #define NM_IDX          0x03    // 
00017 #define NM_CAT          0x04    // Category register
00018 #define NM_AIF          0x05    // Active Influence Field
00019 #define NM_MINIF        0x06    // Minumum Influence Field
00020 #define NM_MAXIF        0x07    // Maximum Influence Field
00021 #define NM_TESTCOMP     0x08    // 
00022 #define NM_TESTCAT      0x09    // 
00023 #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.
00024 #define NM_GCR          0x0B    // Global Context and also partial identifier of the RTL neuron
00025 #define NM_RSTCHAIN     0x0C    // 
00026 #define NM_NSR          0x0D    // Network Status Register
00027 #define NM_POWER_SAVE   0x0E
00028 #define NM_NCOUNT       0x0F    // Count of committed neurons, Bit[15:0]= 2 lower bytes of the count
00029 #define NM_FORGET       0x0F    // Uncommit all neurons by clearing their category register.
00030 
00031 //#define NEURONSIZE  256 //memory capacity of each neuron in byte
00032 //#define MAXNEURONS  1024 //(576*2) //number of neurons per chip
00033 
00034 #define NEURONSIZE  256 //memory capacity of each neuron in byte
00035 #define MAXNEURONS  576*1 //(576*2) //number of neurons per chip
00036 
00037 #define LOW         0
00038 #define HIGH        1
00039 
00040 #define WRITE       0
00041 #define READ        1
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 extern int begin();
00050 extern void forget();
00051 extern int clearNeurons();
00052 extern int learn(unsigned char vector[], int length, int category);
00053 //extern int classify(unsigned char vector[], int length, int K, int distance[], int category[], int nid[]);
00054 extern int classify(unsigned char vector[], int length, int* distance, int* category, int* nid);
00055 extern void setContext(int context, int minif, int maxif);
00056 extern void getContext(int* context, int* minif, int* maxif);
00057 extern void setRBF();
00058 extern void setKNN();
00059 extern int NCOUNT();
00060 
00061 extern void write(char reg, int data);
00062 extern int read(char reg);
00063 extern int broadcast(unsigned char vector[], int length);
00064 extern void readNeuron(int nid, unsigned char model[], int* context, int* aif, int* category);
00065 extern void SPI_Init(void);
00066 extern void RESET_Test(void);
00067 
00068 
00069 
00070 
00071 
00072