在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 3061|回复: 1

[求助] 菜鸟求教,第一次用verilog hdl编程,出了点问题

[复制链接]
发表于 2015-1-11 13:50:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
Info: *******************************************************************
Info: Running Quartus II 64-Bit Analysis & Synthesis

Info: Version 11.0 Build 157 04/27/2011 SJ Full Version

Info: Processing started: Sun Jan 11 10:56:12 2015
Info: Command: quartus_map --read_settings_files=on --write_settings_files=off phrase -c phrase
Info: Parallel compilation is enabled and will use 2 of the 2 processors detected
Error (10839): verilog hdl error at phrase.v(3): declaring global objects is a SystemVerilog feature
Error (10170): Verilog HDL syntax error at phrase.v(8) near text "input";  expecting ";"
Info: Found 0 design units, including 0 entities, in source file c:/users/1169294388/desktop/phrase.v
Error: Quartus II 64-Bit Analysis & Synthesis was unsuccessful. 2 errors, 0 warnings

Error: Peak virtual memory: 373 megabytes

Error: Processing ended: Sun Jan 11 10:56:17 2015

Error: Elapsed time: 00:00:05

Error: Total cpu time (on all processors): 00:00:01
Error: Quartus II Full Compilation was unsuccessful. 4 errors, 0 warnings


程序如下

//stan 基准数字信号,tob待测数字信号,clk时钟信号,outs输出相位

parameter N=9,M=20;//2^8<360,2^9>360;20bit

module phrase(stan,tob,clk,outs)

//变量


input stan,tob,clk;

output [N:1] outs;

reg [N:1] outs;

wire c0,c1,c2,c3;//c0是基准数字信号与待测数字信号异或的结果,c1是c0与时钟信号与的结果,c2是基准信号二分频的结果,c3是c2与clk与的结果,用来测基准信号相对于clk的时间周期

reg [20:1] count1,count2,cont1,cont2;//count1是测基准信号时间的,count2是测c0的高电平时间的



count1=0;

count2=0;



//实现异或

assign c0=((!stan)&&tob)||(stan&&(!tob));

//

assign c1=c0&&clk;

//

always@(posedge stan)

begin

assign c2=!c2;

end

assign c3=c2&&clk;



//测c0高电平时间
和测c3高电平时间

always@(posedge c1 or posedge c3)

begin

if(c1)

{

count2=count2+1;

}

if(c3)

{

count1=count1+1;

}


end

always@(negedge c0 or negedge c2)

begin

#2 if(!c0)

{

cont2=count2;

count2=0;

}

#2 if(!c2)

{

cont1=count1;

count1=0;

outs=cont2/cont1;

display("现在的相位是=%0d度",outs);

}

end
endmodule
发表于 2015-1-11 14:44:18 | 显示全部楼层
改一下,再試看看:
//stan 基准数字信号,tob待测数字信号,clk时钟信号,outs输出相位


module phrase(stan,tob,clk,outs);

parameter N=9,M=20;//2^8<360,2^9>360;20bit

//变量
祝好運!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-28 15:53 , Processed in 0.019627 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表