Find the modelsim.ini file in the install path, and Change "VoptFlow" parameter to false in the file.
[vsim]
; vopt flow
; Set to turn on automatic optimization of a design.
; Default is on
VoptFlow = 0
save('./dat/bpnn_00.mat', 'bpnn'); % | file name | nn obj | // it`s easy.
newData1 = load('-mat', './dat/bpnn_00.mat'); % transfer variable format vars = fieldnames(newData1); for i = 1:length(vars) assignin('base', vars{i}, newData1.(vars{i})); end
nnResult = sim(bpnn, nnInput); % nnResult is error value
nnWB = getx(bpnn); % <-- why? nnResult = sim(bpnn, nnInput); % nnResult is correct value
void init_timer(void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); TIM_TimeBaseStructure.TIM_Period = 0xA; // Counter 12 = 1Mhz = 1us TIM_TimeBaseStructure.TIM_Prescaler = 0x5; // 72Mhz/6 = 12Mhz TIM_TimeBaseStructure.TIM_ClockDivision = 0x0; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_RepetitionCounter = 0x0000; TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); TIM_ClearFlag(TIM2, TIM_FLAG_Update); TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); TIM_Cmd(TIM2, ENABLE); }
void TIM2_IRQHandler(void) { // Timer2 Interrupt Handler }
Altera CycloneIII & Taiwan`s $10 coin |
The front of the development board |
The back of the development board |
void TD_Init( void ) { CPUCS = 0x12; // cpu freq. = 24Mhz SYNCDELAY; IFCONFIG = 0xA3; // ifclk freq. = 30Mhz SYNCDELAY; PINFLAGSAB = 0x88; // FLAGA - EP2 EF SYNCDELAY; PINFLAGSCD = 0xEE; // FLAGD - EP6 FF SYNCDELAY; PORTACFG |= 0x80; SYNCDELAY; FIFOPINPOLAR = 0x3F; // setting all interface to high active SYNCDELAY; EP4CFG = 0x02; // Clear Valid SYNCDELAY; EP8CFG = 0x02; // Clear Valid SYNCDELAY; EP2CFG = 0xA0;// OUT 512 4x SYNCDELAY; EP6CFG = 0xE0;// IN 512 4x SYNCDELAY; // Clear FIFO FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions SYNCDELAY; FIFORESET = 0x02; // reset, FIFO 2 SYNCDELAY; // FIFORESET = 0x04; // reset, FIFO 4 SYNCDELAY; // FIFORESET = 0x06; // reset, FIFO 6 SYNCDELAY; // FIFORESET = 0x08; // reset, FIFO 8 SYNCDELAY; // FIFORESET = 0x00; // deactivate NAK-ALL SYNCDELAY; // OUT EP2 EP2FIFOCFG = 0x01; // AUTOOUT = 0 SYNCDELAY; OUTPKTEND = 0x82; // 1x SYNCDELAY; OUTPKTEND = 0x82; // 2x SYNCDELAY; OUTPKTEND = 0x82; // 3x SYNCDELAY; OUTPKTEND = 0x82; // 4x SYNCDELAY; EP2FIFOCFG = 0x11; SYNCDELAY; // IN EP6 EP6FIFOCFG = 0x0D; SYNCDELAY; }