集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1711|回复: 2

哪位高人帮我看看verilog程序

[复制链接]
encounter 发表于 2010-6-27 23:19:30 | 显示全部楼层 |阅读模式
本帖最后由 fpgaw 于 2010-7-7 05:35 编辑

用MAXPLUS编译总是有错误 请高人指点
module yybf
(clk,f_4M,f_4K,f_4,news,qd);
inputclk,f_4M,f_4K,f_4,news;//20MHz
output qd;
wire clk,f_4M,f_4K,f_4,mews;
reg[3:0] high,mid,low;
reg  a=3;
reg[9:0] b=23,c=23;
reg[12:0] d,fbi;
reg qd=0;
[email=always@(posedge]always@(posedge[/email] clk)
  begin
  if(a==7)
   begin
    a<=3;
    f_4M=1;
   end
  else
   begin
    a<=a+1;f_4M<=0;
   end
  end
[email=always@(posedge]always@(posedge[/email] f_4M)
  begin
  if(b==1023)
   begin
    b<=23;f_4K<=1;
   end
  else
   begin
    b<=b+1;f_4K<=0;
   end
  end
[email=always@(posedge]always@(posedge[/email] f_4)
begin
  case({high,mid,low})
  'b000000000011: fbi<=2123;
  'b000000000101: fbi<=3089;
  'b000000000110: fbi<=3646;
  'b000000010000: fbi<=4369;
  'b000000100000: fbi<=4786;
  'b000000110000: fbi<=5157;
  'b000001000000: fbi<=5328;
  'b000001010000: fbi<=5640;
  'b000001100000: fbi<=5918;
  'b000001110000: fbi<=6166;
  'b000100000000: fbi<=6280;
  'b001000000000: fbi<=6488;
  'b001100000000: fbi<=6674;
  'b010000000000: fbi<=6759;
  'b010100000000: fbi<=6915;
  'b000000000000: fbi<=8191;
  default: fbi<=8191;
  endcase
end
assign news=(d==8191);
[email=always@(posedge]always@(posedge[/email] f_4M)
begin
   if(news)d<=fbi;
   else d<=d+1;
end
[email=always@(posedge]always@(posedge[/email] news)
beginqd<=~qd;
  end
endmodule
VVIC 发表于 2010-6-28 00:10:03 | 显示全部楼层
首先,你求助的时候应该说明你想完成什么功能,最好能说明你的代码逻辑。其次,代码的排列一定要规则,不应该出现[email=always@(posedge]always@(posedge[/email] news)。最后,maxplus2的warning应该贴出来。<br>
<br>
说点语法不对的,大致扫了一眼。<br>
1. reg&nbsp; &nbsp;&nbsp; &nbsp;a=3;&nbsp; &nbsp;<br>
reg[9:0] b=23,c=23;&nbsp;&nbsp;赋值显然不可能,又不是c语言,要赋值,用reset<br>
2.always@(posedge&nbsp;&nbsp;f_4M) f_4M就是一个时钟信号。。。这种写法造成了一堆时钟,最后的结果就是被时钟搞死。。。应该是在clk里面电平检测f_4M及类似信号。
HDL 发表于 2010-6-28 01:10:50 | 显示全部楼层

<br>
the guy upstares is right!<br>
form your program style is very important!
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2024-12-24 04:08 , Processed in 0.057709 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表