BCD码转化余三码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

.ModuleBCD_to_Excess_3(data_ou,tdata_in,clk,reset)..outputdata_ou;t..inputdata_in,clk,rese;t..parameterS0=3b`000,S1=3b`001,S2=3b`101,S3=3b`111,S4=3b`011,S5=3b`110,S6=3b`010,..dont_care_case=3b`x,dont_care_out=1b`x;..reg[2:0]state,next_state;..regdata_ou;t..always@(posedgeclkornegedgereset)..if(reset==0)state=s0;..elsestate=next_state;..always@(stateordata_in)..begin..data_out=0;..case(state)..S0:if(data_in==0)..beginnext_state=s1;data_out=1;end..elseif(data_in==1)..beginnext_state=S2;end..S1:if(data_in==0)..beginnext_state=S3;data_out=1;end..elseif(data_in==1)..beginnext_state=S4;end..S2:beginnext_state=S4;data_out=data_in;end..S3:beginnext_state=S5;data_out=data_in;end..S4:if(data_in==0)..beginnext_state=S5;data_out=1;end..elseif(data_in==1)..beginnext_state=S6;end..S5:beginnext_state=S0;data_out=data_in;end..S6:beginnext_state=S0;data_out=data_in;end..defaul:t..beginnext_state=dont_care_case;..data_out=dont_care_ou;tend..endcase..end..endmodule

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功