HDLBits(10)2.14

1|03 电路

1|13.1 组合逻辑

1|03.1.1 基础门

  • Wire: assign out = in ;
  • GND: assign out = 1'b0 ;
  • NOR: assign out = ~ (in1 | in2) ;
  • Another Gate: assign out = in1 & (~in2) ;
  • Two Gate: assign out = (in1 ~^ in2) ^ in3 ;

* 异或门:out = a ~^ b = a^~ b = ~ (a ^b)

  • More Gates:
assign out_and = a & b; assign out_or = a | b; assign out_xor = a ^ b; assign out_nand = ~(a & b); assign out_nor = ~(a | b); assign out_xnor = ~(a ^ b); assign out_anotb = a & (~b);
  • 7420: 
assign p1y =  ~(p1a & p1b & p1c & p1d); assign p2y =  ~(p2a & p2b & p2c & p2d);
  •  Truthtable:

assign f = ((~x3) & x2 & (~x1)) | ((~x3) & x2 & x1) | (x3 & (~x2) & x1) | (x3 & x2 & x1);

  • Two bit equality

  创建一个具有两个 2 位输入A[1:0]和B[1:0]的电路,并产生一个输出z。如果A = B ,则z的值应为 1 ,否则z应为 0

  assign z = (A == B) ? 1'b1 : 1'b0 ;

  • Simple circuit A

  创建模块A实现函数 z = (x^y) & x

module top_module (input x, input y, output z); assign z = (x^y) &x; endmodule
  • Simple circuit B

module top_module ( input x, input y, output z ); assign z = ~(x^y); endmodule
  •  Combine circuit A and B
module top_module (input x, input y, output z); assign z = (((x^y)&x)|(x~^y))^(((x^y)&x)&(x~^y)); endmodule

 


__EOF__

本文作者LhTian
本文链接https://www.cnblogs.com/LhTian/p/17119953.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   LhTian21  阅读(30)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
点击右上角即可分享
微信分享提示