標(biāo)題: 計數(shù)器的編程設(shè)計里面有有兩位十進制和4位10進制源程序及仿真圖,實驗報告 [打印本頁]

作者: wcl1994520    時間: 2018-5-17 19:12
標(biāo)題: 計數(shù)器的編程設(shè)計里面有有兩位十進制和4位10進制源程序及仿真圖,實驗報告

2位10進制程序
module wcl(q,a,cout,en,clk,clr,sel);
input en,clk,clr,sel;
output reg [3:0] q;
output reg [3:0] a;
output reg cout;
always @(posedge clk or posedge clr)
begin
        if (clr) begin q=0;a=0; end
                else if(en)
                        begin
                                if(sel)
                                        begin
                                                q=q+1;
                                                        if(q==10)
                                                                begin
                                                                        cout=1;
                                                                        q=0;
                                                                        a=a+1;
                                                                        if(a==10) a=0;
                                                                        end
                                                        else         cout=0;
                                        end
                                else
                                        begin q=q-1;
                                                if(q==15)  
                                                begin
                                                        q=9;
                                                        cout=1;
                                                        a=a-1;       
                                                end
                                                else cout=0;
                                                if(a==15) a=9;
                                        end
                        end
        end
endmodule
4位10進制

module wei4(clr,clk,q,cout,en);
input clr,clk,en;
output reg [15:0] q;
output reg cout;
always @(posedge clk or negedge clr)
begin
        if(~clr) q=0;
        else if(en)
        begin
                        if(q=='h9999) q=0;
                        else q=q+1;
                        if(q[3:0]=='ha)
                        begin
                        q[3:0]=0;
                        q[7:4]=q[7:4]+1;
                        end
                        if(q[7:4]=='ha)
                        begin
                        q[7:4]=0;
                        q[11:8]=q[11:8]+1;
                        end
                        if(q[11:8]=='ha)
                        begin
                        q[11:8]=0;
                        q[15:12]=q[15:12]+1;
                        end
                        if(q=='h9999) cout=1;
                        else cout=0;end
                        end
endmodule       


3(SL@A3ANY}AR3V]}@OBK(Y.png (28.32 KB, 下載次數(shù): 76)

文件材料

文件材料

E5Y3TBR]DONJRZO6}K90NFO.png (136.58 KB, 下載次數(shù): 73)

4位10進制

4位10進制

Z`6X}1B%CPI83W[N@QX7WD0.png (46.35 KB, 下載次數(shù): 62)

設(shè)置要求

設(shè)置要求

EDA2位10進制和4位10進制.rar

7.72 MB, 下載次數(shù): 20, 下載積分: 黑幣 -5

全部文件






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1