设为首页收藏本站淘宝杂货铺

从F到0 - From F to 0

 找回密码
 注册已关闭
搜索
查看: 158|回复: 0
收起左侧

Quartus Verilog HDL/FPGA 实现 CD4070/74HC4070/74LS4070 四组二输入一输出端异或门

[复制链接]
发表于 2023-6-28 17:31:16 | 显示全部楼层 |阅读模式
main.png
  1. module cd4070(                //四组二输入一输出端异或门 VCC:Pin14 GND:Pin7
  2.         input A1,                //异或输入 Pin1
  3.         input B1,                //异或输入 Pin2
  4.         output Y1,                //异或输出 Pin3

  5.         input A2,                //Pin5
  6.         input B2,                //Pin6
  7.         output Y2,                //Pin4
  8.        
  9.         input A3,                //Pin8
  10.         input B3,                //Pin9
  11.         output Y3,                //Pin10
  12.        
  13.         input A4,                //Pin12
  14.         input B4,                //Pin13
  15.         output Y4                //Pin11
  16. );
  17. assign {Y1,Y2,Y3,Y4} = {A1,A2,A3,A4} ^ {B1,B2,B3,B4};
  18. endmodule

  19. module main(
  20.         input clk,                        //时钟输入
  21.         output reg led                //低电平(计算正确)点亮
  22. );
  23. reg [3:0] A;
  24. reg [3:0] B;
  25. wire [3:0] Y;

  26. cd4070 U1(
  27.         .A1(A[0]),
  28.         .B1(B[0]),
  29.         .Y1(Y[0]),
  30.         .A2(A[1]),
  31.         .B2(B[1]),
  32.         .Y2(Y[1]),
  33.         .A3(A[2]),
  34.         .B3(B[2]),
  35.         .Y3(Y[2]),
  36.         .A4(A[3]),
  37.         .B4(B[3]),
  38.         .Y4(Y[3])
  39. );

  40. always @(posedge clk) begin
  41.         {A,B} <= {A,B} + 4'd1;
  42.         if(A^B == Y) begin
  43.                 led <= 1'b0;
  44.         end else begin
  45.                 led <= 1'b1;
  46.         end
  47. end

  48. endmodule
复制代码

相关帖子

您需要登录后才可以回帖 登录 | 注册已关闭

本版积分规则

QQ|手机版|Archiver|从F到0 ( 蒙ICP备17002595号-1 )
蒙公网安备15010402000325号

腾讯云安全认证

GMT+8, 2024-4-28 00:43 , Processed in 1.705097 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

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