03 2012 档案

static的变量初值问题
摘要:1 #include "iostream.h" 2 3 int i=1; 4 5 void others(void) 6 { 7 static int a; 8 static int b; 9 int c(3);10 int i(2);11 cout<<"i: "<<i<<"a: "<<a<<"b: "<<b<<"c: "<<c<<endl;12 }13 14 void main(void 阅读全文

posted @ 2012-03-31 13:57 Xilinx&Altera 阅读(358) 评论(0) 推荐(0)

verilog中的初值问题
摘要:这是修改后的一段代码,黄色部分是后加的,用modelsim仿真时,若不加这一段,则Cont初始值为“XXX...XXX”即为高阻,而用Quartus II自带的仿真器仿真时,Cont初始值为0。 1 module Count(CLOCK_50, LED, KEY); 2 output [7:0] LED; 3 input CLOCK_50; 4 input KEY ; 5 6 reg [22:0] Cont; 7 reg [7:0] mLED; 8 reg [7:0] number; 9 10 always@(posedge CLOCK_50) 11 begin12 if(!KEY)13 C. 阅读全文

posted @ 2012-03-30 15:51 Xilinx&Altera 阅读(503) 评论(0) 推荐(0)

导航