|
module shumaguan(clk,rst_n,LED,LED_com);
input clk;
input rst_n;
output[7:0] LED;
output[3:0] LED_com;
/*
0xc0,0xf9,0xa4,0xb0,
0x99,0x92,0x82,0xf8,
0x80,0x90,0x88,0x83,
0xc6,0xa1,0x86,0x8e
*/
//-------------------------------------
//延时
reg[24:0] cnt;
always@(posedge clk or negedge rst_n)
if(!rst_n) cnt<=25'd0;
else cnt<=cnt+1'b1;
//-------------------------------------
//num++
reg[3:0] num;
always@(posedge clk or negedge rst_n)
if(!rst_n) num<=4'd0;
else if(cnt==25'h1ffffff) num<=num+1'b1;
else if(num==4'd10) num<=4'd0;
//-------------------------------------
//数码管显示
parameter seg0 = 8'hc0,
seg1 = 8'hf9,
seg2 = 8'ha4,
seg3 = 8'hb0,
seg4 = 8'h99,
seg5 = 8'h92,
seg6 = 8'h82,
seg7 = 8'hf8,
seg8 = 8'h80,
seg9 = 8'h90;
reg[7:0] xianshi;
always@(num) //num变化时执行以下语句
case(num)
4'h0: xianshi<=seg0;
4'h1: xianshi<=seg1;
4'h2: xianshi<=seg2;
4'h3: xianshi<=seg3;
4'h4: xianshi<=seg4;
4'h5: xianshi<=seg5;
4'h6: xianshi<=seg6;
4'h7: xianshi<=seg7;
4'h8: xianshi<=seg8;
4'h9: xianshi<=seg9;
default:xianshi<=8'hff ;
endcase
//-------------------------------------
assign LED=xianshi;
assign LED_com=1'b1;
endmodule
(原文件名:未命名.jpg)
为什么会出现6哥警告?这些警告都是什么原因所致啊?谢了啊 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|