|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
module fp_verilog248(div2, div4, div8, clk);
output div2,div4,div8;
input clk;
reg div2, div4, div8;
reg [2:0] cnt;
always @(posedge clk)
begin
cnt <= cnt + 1;
div2 <= cnt[0];
div4 <= cnt[1];
div8 <= cnt[2];
end
endmodule
测试文件:
`timescale 1ns/1ns
module fp_verilog248_vlg_tst();
// constants
// general purpose reg
// test vector input registers
reg clk;
// wires
wire div2;
wire div4;
wire div8;
// assign statements (if any)
fp_verilog248 i1 (
// port map - connection between master ports and signals/registers
.clk(clk),
.div2(div2),
.div4(div4),
.div8(div8)
);
initial
begin
clk = 0;
forever #10 clk = ~clk;
end
endmodule
div总是高阻。。 |
|