A Design Example of PicoBlazeTMfor SpartanTM-3E Starter Kit---George WangAbout the Design A design using PicoBlaze. The Design is totally based on the Initial Design for the Spartan-3E Starter Kit Board including basic hardware description, display subroutines for LCD module and UCF etc. What I did is just to modify it.About the Example A Clock to display time, date and week on the LCD module of Starter kit board; The time and date can be set through pressing and turning the encoder on the starter kit board; PicoBlaze automatically calculates what day the date set is;Hardware Description(1) As mentioned above, the basic hardware description is based on Mr. Ken Chapman’s S3ESK_STARTUP. Additional logic is needed: A 400Hz CLK as an additional interrupt source; The 2 interrupt sources share the interrupt request pin of PicoBlazeHardware Description(2) 2 interrupt flags are a must for PicoBlaze to identify the different sources; Some of the IRQ may be missed if only one interrupt flag is used; The IRQ and the 2 interrupt flags should be cleared individually and asynchronously by PicoBlaze.Software Description(1) The display subroutines and related delay modules are all based on Mr. Ken Chapman’s S3ESK_STARTUP. All the clock data (Second, Minute, Hour) are processed by the ISR. So, the accuracy of the 50MHz crystal determines the accuracy of the Clock. The year, month, day and week are processed in the main routine according to the flag set by the ISR to make the ISR shorter.Software Description(2) You may wonder the way in which PicoBlaze calculates the week; I spent almost an afternoon studying the clock of Windows of my computer and worked out the formula: w=(w0+d +k(m) +y+int((y+c(m))/4))) mod 7; w: 0~6(Sun~Sat); m: 1~12; y: 0~99;Software Description(3) W0 =6 k(1), k(10) =3 k(2), k(3), k(11) =6 k(4), k(7) =2 k(5) =4 k(6) =0 k(8) =5 k(9), k(12) =1 c(1),c(2)=99;c(3) ~ c(12)=100;Calculating subroutines Int(y/4) INT: FETCH s0,ySR0 s0SR0 s0STORE s0,yRETURN MOD 7MOD7:FETCH s0,SUMMD7 :ADD s0,F9JUMP NC, M7_ENDJUMP MD7M7_END:ADD s0,07STORE
View Full Document