Verilog程序Word格式.docx

上传人:b****1 文档编号:3958153 上传时间:2023-05-02 格式:DOCX 页数:25 大小:16.87KB
下载 相关 举报
Verilog程序Word格式.docx_第1页
第1页 / 共25页
Verilog程序Word格式.docx_第2页
第2页 / 共25页
Verilog程序Word格式.docx_第3页
第3页 / 共25页
Verilog程序Word格式.docx_第4页
第4页 / 共25页
Verilog程序Word格式.docx_第5页
第5页 / 共25页
Verilog程序Word格式.docx_第6页
第6页 / 共25页
Verilog程序Word格式.docx_第7页
第7页 / 共25页
Verilog程序Word格式.docx_第8页
第8页 / 共25页
Verilog程序Word格式.docx_第9页
第9页 / 共25页
Verilog程序Word格式.docx_第10页
第10页 / 共25页
Verilog程序Word格式.docx_第11页
第11页 / 共25页
Verilog程序Word格式.docx_第12页
第12页 / 共25页
Verilog程序Word格式.docx_第13页
第13页 / 共25页
Verilog程序Word格式.docx_第14页
第14页 / 共25页
Verilog程序Word格式.docx_第15页
第15页 / 共25页
Verilog程序Word格式.docx_第16页
第16页 / 共25页
Verilog程序Word格式.docx_第17页
第17页 / 共25页
Verilog程序Word格式.docx_第18页
第18页 / 共25页
Verilog程序Word格式.docx_第19页
第19页 / 共25页
Verilog程序Word格式.docx_第20页
第20页 / 共25页
亲,该文档总共25页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

Verilog程序Word格式.docx

《Verilog程序Word格式.docx》由会员分享,可在线阅读,更多相关《Verilog程序Word格式.docx(25页珍藏版)》请在冰点文库上搜索。

Verilog程序Word格式.docx

(g2a==0)&

(g2b==0))//门控信号满足条件时,输出有效

case({c,b,a})

3'

b000:

y<

=8'

b11111110;

b001:

b11111101;

b010:

b11111011;

b011:

b11110111;

b100:

b11101111;

b101:

b11011111;

b110:

b10111111;

b111:

b01111111;

default:

b11111111;

endcase

elsey<

endmodule

modulefredevider2(clockin,clockout);

inputclockin;

outputclockout;

regclockout;

always@(posedgeclockin)

clockout<

=~clockout;

modulefredevider3(clockin,clockout);

regtemp1,temp2;

reg[1:

always@(posedgeclockin)

if(count==2)

=0;

temp1<

=~temp1;

else

=count+1;

always@(negedgeclockin)

if(count==1)

temp2<

=~temp2;

assignclockout=temp1^temp2;

modulefredevider4(clockin,clockout);

0]count;

parameterN=0;

if(count==N)//每计到2个上升沿(从0开始)时,输出信号翻转一次

=2'

b00;

=count+2'

b01;

modulefredevider6(clockin,clockout);

reg[2:

parameterN=2;

=3'

b000;

end

else

=count+3'

b001;

moduleseg_7(code,discode);

input[3:

0]code;

output[6:

0]discode;

reg[6:

always@(code)//如果输入发生变化,则执行下面块语句

begin

case(code)

4'

b0000:

discode<

=7'

b1111110;

b0001:

b0110000;

b0010:

b1101101;

b0011:

b1111001;

b0100:

b0110011;

b0101:

b1011011;

b0110:

b0011111;

b0111:

b1110000;

b1000:

b1111111;

b1001:

b1110011;

defaultdiscode<

b0000000;

moduleseg_flash(clock,code,discode);

inputclock;

input[3:

output[6:

reg[6:

begin

if(count==128)

if(count<

=64)//计数值小于64,显示输出

elsediscode<

//计数值大于64则不显示

modulekeyboard(key4in,key4out,codeout,clock,reset,count);

input[3:

0]key4in;

inputclock,reset;

output[3:

0]key4out,codeout,count;

reg[3:

0]key4out,codeout;

reg[7:

reg[5:

0]state;

parameter

firststate=6'

b000001,

waitst=6'

b000010,

scan1=6'

b000100,

scan2=6'

b001000,

scan3=6'

b010000,

scan4=6'

b100000;

always@(posedgeclock)

if(reset)

state<

=firststate;

count<

b00000000;

codeout<

=4'

bz;

case(state)

firststate:

begin

key4out<

b1111;

if(|(key4in))

state<

=waitst;

else

waitst:

if(count<

=19)

begin

state<

count<

=count+1'

b1;

end

else

=scan1;

key4out<

b0001;

end

scan1:

if(|(key4in))

begin

case(key4in)

4'

codeout<

h2;

h3;

default:

hz;

endcase

state<

end

else

=scan2;

key4out=4'

b0010;

scan2:

if(|(key4in))

h4;

h5;

h6;

h7;

endcase

=scan3;

b0100;

scan3:

h8;

ha;

hb;

=scan4;

b1000;

scan4:

hc;

hd;

he;

hf;

endcase

end

endmodule

modulefrediv2(clockin,clkout);

outputclkout;

regclkout;

always@(posedgeclockin)

clkout<

=!

clkout;

modulefrediv10(clockin,clkout);

0]counter;

if(counter==4)

counter<

elsecounter<

=counter+1;

modulemmcount(clockmmin,reset,mmouta,mmoutb,clockmout,alarm);

inputclockmmin,reset;

outputclockmout,alarm;

output[3:

0]mmouta,mmoutb;

regclockmout,alarm;

reg[3:

reg[7:

0]countnum;

always@(posedgeclockmmin)

if(reset)

countnum<

=0;

mmouta<

mmoutb<

if(countnum==29)

clockmout<

clockmout;

if(countnum==59)

alarm<

=1;

=countnum+1;

if(mmouta==9)

=mmoutb+1;

=mmouta+1;

end

modulemscount(clockmsin,reset,msouta,msoutb,clocksout);

inputclockmsin,reset;

outputclocksout;

0]msouta,msoutb;

regclocksout;

always@(posedgeclockmsin)

msouta<

msoutb<

if(countnum==49)

clocksout<

clocksout;

if(countnum==99)

if(msouta==9)

=msoutb+1;

=msouta+1;

modulestartcontroller(start,stop,clock,dataout);

inputstart,stop,clock;

outputdataout;

regdataout1;

wiredataout;

always@(posedgestartorposedgestop)

if(stop)dataout1<

elsedataout1<

assigndataout=dataout1&

clock;

modulesuosun(start,clear,clock,dataout);

inputstart,clear,clock;

always@(posedgestartorposedgeclear)

if(clear)dataout1<

moduledisplay1(clock,code,discode);

endmodule

分频10

modulefenpin10(clockin,clkout);

分频100

modulefenpin100(clockin,clkout);

if(counter==49)

[hcounter]:

modulehcounter(clock,dcodea,dcodeb,reset);

inputclock,reset;

output[3:

0]dcodea,dcodeb;

always@(posedgeclock)

dcodea<

dcodeb<

if(countnum==11)

if(dcodea==9)

=dcodeb+1;

=dcodea+1;

[ledlat]:

moduleledlat(clock,clkin,codein,codeout,selout,clkout);

inputclock,clkin;

input[7:

0]codein;

0]codeout,selout;

0]mymemory[7:

0];

reg[4:

0]count1,count2;

always@

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2