作者papa2958 (当当是蓝 你是白)
看板Electronics
标题[问题] 麻烦帮我看一下verilog语言这样写有没有错误?
时间Sun Mar 8 22:03:34 2009
不知道有没有专门在讨论verilog语言的地方
所以就PO在这里了...
题目是a 4-bit mismatch check circuit is implemented. If A[3:0] and B[3:0]
all mismatch, a signal “MISMATCH” will be asserted. We can check this
condition by using four “XOR” gates and connect their four outputs into a
four-input “AND” gate.
以下是我自己写的语言:
module mismatch(MISMATCH,A,B)
wire T0,T1,T2,T3;
output MIASMATCH;
input[3:0] A,B;
xor(T0,A[0],B[0]),
(T1,A[1],B[1]),
(T2,A[2],B[2]),
(T3,A[3],B[3]);
and(MISMATCH,T0,T1,T2,T3);
endmodule
不知道这样有没有哪里需要修正? 我是初学者 劳请大家多多指点
感激不尽!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.19.48
1F:→ M9407120:.......超久没碰了,连怎麽写都忘了 03/08 22:42
2F:→ M9407120:ALTERA 主程式载下来 RUN 一下就知道了 03/08 22:43
3F:推 pupucar:1. input应为wire形式 output应为reg形式 你颠倒了 03/08 23:53
※ 编辑: papa2958 来自: 140.115.19.48 (03/08 23:56)
4F:→ papa2958:这样?还有哪里有缺吗? 03/08 23:56
5F:推 pupucar:说太快 output应为wire或reg形式 这里应用wire 03/09 00:00
※ 编辑: papa2958 来自: 140.115.19.48 (03/09 00:02)
6F:→ pupucar:Tx 都要用wire input宣告本身就是wire形式了 不用再次宣告 03/09 00:01
7F:→ pupucar:多个bit的宣告法 EX:input[3:0] A,B; 03/09 00:03
※ 编辑: papa2958 来自: 140.115.19.48 (03/09 00:13)
※ 编辑: papa2958 来自: 140.115.19.48 (03/09 00:14)