我是刚学的verilog,写了一个秒表程序,但是一直编译不过去,哪位大侠帮我看看啊!!!
module nixie_light(clk_n,wei,dat_n,cs_n,digit_n);
input clk_n;
input [3:0] dat_n;
input [2:0] wei;
output digit_n,cs_n;
parameter
MSK_0 = 8'h40, // '0'
MSK_1 = 8'h79, // '1'
MSK_2 = 8'h24, // '2'
MSK_3 = 8'h30, // '3'
MSK_4 = 8'h19, // '4'
MSK_5 = 8'h12, // '5'
MSK_6 = 8'h02, // '6'
MSK_7 = 8'h78, // '7'
MSK_8 = 8'h00, // '8'
MSK_9 = 8'h10; // '9'
//=================================================================================================
reg [16:0] cnt2;
reg [3:0] submsk;
reg [7:0] cs_n;
reg [7:0] digit_n;
always @(posedge clk_n)
begin
cnt2 <= cnt2 + 1'b1;
if (cnt2 == 17'd0)
begin
cs_n<=8'hf0;
submsk<=dat_n;
end
end
always @(submsk)
case (submsk)
4'h0: digit_n <= MSK_0;
4'h1: digit_n <= MSK_1;
4'h2: digit_n <= MSK_2;
4'h3: digit_n <= MSK_3;
4'h4: digit_n <= MSK_4;
4'h5: digit_n <= MSK_5;
4'h6: digit_n <= MSK_6;
4'h7: digit_n <= MSK_7;
4'h8: digit_n <= MSK_8;
4'h9: digit_n <= MSK_9;
default: digit_n <= MSK_0;
endcase
always @(wei)
case (wei)
3'd0: cs_n <= 7'hfe;
3'd1: cs_n <= 7'hfd;
3'd2: cs_n <= 7'hfb;
3'd3: cs_n <= 7'hf7;
3'd4: cs_n <= 7'hef;
3'd5: cs_n <= 7'hdf;
3'd6: cs_n <= 7'hbf;
3'd7: cs_n <= 7'h7f;
default: cs_n <= 7'hfe;
endcase
endmodule
module timepiece(clk,cs,digit_o);
input clk;
output [7:0]cs;
output [7:0]digit_o;
reg [27:0]count;
reg time_clk;
reg [5:0]date;
always @(posedge clk)
if(count==28'h17D7840)
begin
count<=1'b0;
time_clk<=~time_clk;
end
else count<=count+1'b1;
reg [2:0]minute_s;
reg [3:0]minute_g;
//reg [1:0]hour_s;
//reg [3:0]hour_g;
always @(posedge time_clk)
begin
if(minute_g==9)
begin
minute_g<=0;
if(minute_s<=5)
minute_s<=0;
else
minute_s<=minute_s+1;
end
else
minute_g<=minute_g+1;
end
reg [3:0] submsk;
reg [7:0] cs;
reg [7:0] digit_o;
nixie_light(clk,1,minute_s,cs,digit_o);
nixie_light(clk,2,minute_g,cs,digit_o);
endmodule
编译后的错误是
Error (10663): Verilog HDL Port Connection error at timepiece.v(96): output or inout port "cs_n" must be connected to a structural net expression
Error (10663): Verilog HDL Port Connection error at timepiece.v(96): output or inout port "digit_n" must be connected to a structural net expression |