|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
`timescale 1 ns/ 1ns
module temp(clk,cout);
input clk;
output [7:0] cout;
reg out;
reg [3:0] a;
reg [2:0] count;
reg [7:0] ct;
always@(posedge clk)
if(a==4'hf)begin
a<=4'h0;
out<=~out;
end
else
a<=a+1'b1;
always@(posedge out)
if(count==3'h7)begin
count<=3'h0;
end
else
count<=count+1'b1;
always@(*)
case(count)
3'h0:ct<=8'h55;
3'h1:ct<=8'haa;
3'h2:ct<=8'hdc;
3'h3:ct<=8'h24;
3'h4:ct<=8'hf0;
3'h5:ct<=8'h0f;
3'h6:ct<=8'h6c;
3'h7:ct<=8'hc4;
default:ct<=8'h0;
endcase
assign cout=ct;
endmodule
`timescale 1 ns/ 1ns
module tb;
reg clk=1'b0;
wire [7:0] cout;
always clk =#5 ~clk;
temp temp(.clk(clk),.cout(cout));
endmodule
为什么只有时钟信号,其他信号看不到啊 |
|