2014-02-20 5 views
0

저는 이미 삼각형 파형을 얻었습니다. 이제 주파수를 변경하고 싶지만 오류가 발생하고 실제 문제는 무엇인지 모르겠습니다. (AN always 블록)삼각형 파형 Verilog의 주파수 변경하기

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 

Compilation errors

+0

당신은 당신의 이전 질문에서 조언을 따르지 않았다가 ('<=') NBA를 사용합니다. – toolic

+0

차이가 있습니까? – PYPL

+0

예. http://stackoverflow.com/questions/4653284/how-to-interpret-blocking-vs-non-blocking-assignments-in-verilog – toolic

답변

1

절차 할당 reg 만 이루어질 수있다. 변경 :

output [0:7]count; 

에 :

output reg [0:7]count;