集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 3241|回复: 6

verilog请教程序中的一点小问题

[复制链接]
CCIE 发表于 2010-6-27 23:53:03 | 显示全部楼层 |阅读模式
`timescale 1ns/100ps
module div_freq (
     reset_n,
     clockin,
     datain,
     clockout
      );
input     reset_n;
input     clockin;
input[7:0]  datain;
output    clockout;
reg     clockout;
reg  [7:0]  counter;

always @( posedge clockin or negedge reset_n ) begin
  if ( ~reset_n ) begin
   counter <= 8'h00;
  end
  else if ( ~|counter ) begin
   counter <= datain;
  end
  else begin
   counter <= counter - 8'h01;
  end
end
//
// If we use the carry out as clock out, duty cycle is not 50%.
//
// wire cout;
// assign cout = (counter == 8'hff);
//
//
// If we use the following clockout as clock out, duty cycle is 50%.
// However, we must know the following code has included 2-div
// frequence.
//
always @( posedge clockin or negedge reset_n ) begin
  if ( ~reset_n ) begin
   clockout <= 1'b0;
  end
  else if ( ~|counter ) begin
   clockout <= ~clockout;
  end
end
endmodule
请问粗体字中的~|counter是什么意思
ATA 发表于 2010-6-28 01:38:36 | 显示全部楼层
咋的没人来帮忙呢????????????????????
UFO 发表于 2010-6-28 03:03:12 | 显示全部楼层
是归约运算符或非<br>
&bull; | ( 归约或)<br>
如果存在位值为1,那么结果为1;如果存在位x或z,结果为x;否则结果为0。<br>
&bull; ~| ( 归约或非)<br>
与归约操作符|相反。
encounter 发表于 2010-6-28 04:03:44 | 显示全部楼层
谢谢楼上 小弟刚学几天 呵呵
interige 发表于 2010-6-28 04:22:36 | 显示全部楼层
一起学习,一起进步
interi 发表于 2010-6-28 05:09:04 | 显示全部楼层
共同学习,不过这个还是用的比较少
VVC 发表于 2010-6-28 05:20:33 | 显示全部楼层
恩,不怎么常见,我在考试复习时看过,
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-5-15 12:52 , Processed in 0.069708 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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