刚刚自学完顶层木偶开例化那块,有点小迷糊,求指点
时间:10-02
整理:3721RD
点击:
废话不说,直接上代码
这是我写的顶层模块
module water_led_design
(
input clk_sys,
input rst,
output [3:0] led_data
);
fre_div u1fre
(
.clk_sys (clk_sys),
.rst (rst),
.clk_out (clk_led)
);
led u2led
(
.clk_led (clk_out),
.rst (rst),
.led_data_r (led_data)
);
endmodule
//下面是两个子模块的声明
module fre_div
(
input clk_sys,
input rst,
output clk_out
);
。
module led
(
input clk_led,
input rst,
output reg [3:0] led_data_r
);
编译完了之后总是有这个警告:
Warning (10236): Verilog HDL Implicit Net warning at water_led_design.v(13): created implicit net for "clk_led"
Warning (10236): Verilog HDL Implicit Net warning at water_led_design.v(18): created implicit net for "clk_out"
哪位指点哈这是怎么回事呗
还有还有,我写的是流水灯的代码,哪位好心的大神可不可以个看看哪里有什么不妥吗(仿真神马的正在学~~~~~~)下面是完整代码,先谢过了
module water_led_design
(
input clk_sys,
input rst,
output [3:0] led_data
);
fre_div u1fre
(
.clk_sys (clk_sys),
.rst (rst),
.clk_out (clk_led)
);
led u2led
(
.clk_led (clk_out),
.rst (rst),
.led_data_r (led_data)
);
endmodule
module fre_div
(
input clk_sys,
input rst,
output clk_out
);
reg [25:0] counter;
parameter res_counter = 23'd4_999_999;
always @ (negedge clk_sys or negedge rst)
begin
if (!rst)
counter<=23'd0;
else if (counter < res_counter)
counter = counter + 1'b1;
else
counter = 23'd0;
end
assign clk_out = (counter < res_counter/2) ? 1'b1 : 1'b0;
endmodule
module led
(
input clk_led,
input rst,
output reg [3:0] led_data_r
);
always @ (negedge clk_led or negedge rst)
begin
if (!rst)
led_data_r<=4'b0;
else if (led_data_r < 4'b1111)
led_data_r<=led_data_r + 4'b1;
else led_data_r<=4'b0;
end
endmodule
这是我写的顶层模块
module water_led_design
(
input clk_sys,
input rst,
output [3:0] led_data
);
fre_div u1fre
(
.clk_sys (clk_sys),
.rst (rst),
.clk_out (clk_led)
);
led u2led
(
.clk_led (clk_out),
.rst (rst),
.led_data_r (led_data)
);
endmodule
//下面是两个子模块的声明
module fre_div
(
input clk_sys,
input rst,
output clk_out
);
。
module led
(
input clk_led,
input rst,
output reg [3:0] led_data_r
);
编译完了之后总是有这个警告:
Warning (10236): Verilog HDL Implicit Net warning at water_led_design.v(13): created implicit net for "clk_led"
Warning (10236): Verilog HDL Implicit Net warning at water_led_design.v(18): created implicit net for "clk_out"
哪位指点哈这是怎么回事呗
还有还有,我写的是流水灯的代码,哪位好心的大神可不可以个看看哪里有什么不妥吗(仿真神马的正在学~~~~~~)下面是完整代码,先谢过了
module water_led_design
(
input clk_sys,
input rst,
output [3:0] led_data
);
fre_div u1fre
(
.clk_sys (clk_sys),
.rst (rst),
.clk_out (clk_led)
);
led u2led
(
.clk_led (clk_out),
.rst (rst),
.led_data_r (led_data)
);
endmodule
module fre_div
(
input clk_sys,
input rst,
output clk_out
);
reg [25:0] counter;
parameter res_counter = 23'd4_999_999;
always @ (negedge clk_sys or negedge rst)
begin
if (!rst)
counter<=23'd0;
else if (counter < res_counter)
counter = counter + 1'b1;
else
counter = 23'd0;
end
assign clk_out = (counter < res_counter/2) ? 1'b1 : 1'b0;
endmodule
module led
(
input clk_led,
input rst,
output reg [3:0] led_data_r
);
always @ (negedge clk_led or negedge rst)
begin
if (!rst)
led_data_r<=4'b0;
else if (led_data_r < 4'b1111)
led_data_r<=led_data_r + 4'b1;
else led_data_r<=4'b0;
end
endmodule
标题秀逗了,是顶层模块,大家见谅见谅