【verilog】四位全加器


文章目录


前言

进行 FPGA 全加器 实验


一、实验原理

go 复制代码
module adder(ain,bin,cin,cout,s);
input ain,bin,cin;
output cout,s;
assign cout=ain&bin | ain&cin | bin&cin;
assign s=ain^bin^cin;
endmodule




`timescale 1ns/1ns
module adder_tst();
reg ain,bin,cin;
wire cout,s;
initial begin
ain=1'b0;bin=1'b0;cin=1'b0;
#20 ain=1'b0;bin=1'b0;cin=1'b1;
#20 ain=1'b0;bin=1'b1;cin=1'b0;
#20 ain=1'b0;bin=1'b1;cin=1'b1;
#20 ain=1'b1;bin=1'b0;cin=1'b0;
#20 ain=1'b1;bin=1'b0;cin=1'b1;
#20 ain=1'b1;bin=1'b1;cin=1'b0;
#20 ain=1'b1;bin=1'b1;cin=1'b1;
end
adder u0(.ain(ain),
      .bin(bin),
      .cin(cin),
      .cout(cout),
      .s(s));
endmodule



module adder4(ain,bin,cin,s,cout);
input[3:0] ain,bin;
input cin;
output[3:0] s;
output cout;
wire cout1,cout2,cout3;
adder u0(.ain(ain[0]),
      .bin(bin[0]),
      .cin(cin),
      .cout(cout1),
      .s(s[0]));
adder u1(.ain(ain[1]),
      .bin(bin[1]),
      .cin(cout1),
      .cout(cout2),
      .s(s[1]));
adder u2(.ain(ain[2]),
      .bin(bin[2]),
      .cin(cout2),
      .cout(cout3),
      .s(s[2]));
adder u3(.ain(ain[3]),
      .bin(bin[3]),
      .cin(cout3),
      .cout(cout),
      .s(s[3]));
endmodule

二、实验过程

三、实验结果


参考文献

1

相关推荐
尤老师FPGA8 小时前
GT系列2:GT基础架构(二)
fpga开发
想你依然心痛10 小时前
电源时序控制:多路电源的上电顺序与监控——复位、看门狗
fpga开发
Eloudy14 小时前
hsb fpga/ 目录分析
fpga开发·量子计算
Hello-FPGA15 小时前
GPU Direct DMA RDMA 与FPGA 通讯在Jetson 平台的测试表现
fpga开发
坏孩子的诺亚方舟17 天前
FPGA系统架构设计实践15_高云Arora V系列时钟体系
fpga开发·系统架构
FPGA小徐18 天前
入门 CNN 结构全解析|从流程图理论到 FPGA Verilog 硬件实现(含习题带讲解)
fpga开发
FPGA小徐18 天前
FPGA 数字信号处理:并行 FIR 与串行滤波器设计原理、对比与完整 Verilog 实现
fpga开发
Saniffer_SH18 天前
【高清视频】Gen6 服务器还没到,Gen6 SSD 怎么测?Emily 现场演示三种测试环境
人工智能·驱动开发·测试工具·缓存·fpga开发·计算机外设·压力测试
zlinear数据采集卡19 天前
双核架构深度解析:ARM+FPGA如何让数据采集卡实现500Ksps高性能?
arm开发·fpga开发·架构
9527华安19 天前
FPGA实现GTH Transceivers Wizard传输2路视频,基于aurora 8b10b编解码架构,提供4套工程源码和技术支持
fpga开发·gth·aurora 8b10b·transceivers