【问题标题】:Changing freq of triangle waveform verilog改变三角波verilog的频率
【发布时间】:2014-02-20 17:32:17
【问题描述】:

所以我已经得到了我的三角波形,现在我想改变它的频率,但我得到了错误,我不知道实际的问题是什么。

module sxoc(clk,res,out1,freq,count);
input  clk,res;
input [0:7]freq;
output [0:7]count;
output [0:7]out1;
reg [0:7]out1;
always @(posedge clk)
begin
    if (res)
    begin
        out1=8'b00000000;
        count=8'b00000000;
    end
    else
        count =count + 1;
        if (count == freq)
            if(out1<=256)
            begin
                out1=out1 + 1;
                count = 0;
            end
end
endmodule
module atam_test;
reg clk,res;
reg [0:7]freq;
wire [0:7]count;
wire [0:7]out1;
sxoc sxoc1(clk,res,out1,freq,count);
always #2 clk=~clk;
initial 
begin
clk=0;res=1;freq=8'b00000011;
#5 res=0;
end
initial #5000 $finish;
endmodule

【问题讨论】:

  • 如果它起作用了,你做了什么改变来改变频率?时钟频率或增量 2 以使其加速。

标签: verilog waveform


【解决方案1】:

程序分配(在always 块中)只能对reg 进行。变化:

output [0:7]count;

到:

output reg [0:7]count;

【讨论】:

    猜你喜欢
    • 2014-03-05
    • 2015-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-04
    • 2021-10-26
    • 2019-12-12
    相关资源
    最近更新 更多