【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

相关推荐
s090713611 小时前
FPGA中CIC设计注意事项
算法·fpga开发·cic滤波器
Aaron158811 小时前
RFSOC+VU13P在无线信道模拟中的技术应用分析
数据结构·人工智能·算法·fpga开发·硬件架构·硬件工程·射频工程
碎碎思12 小时前
BerkeleyLab Bedrock:为 FPGA 与加速计算打造的开源基石
fpga开发·开源
zidan141212 小时前
xilinx常用文档说明
fpga开发
ShiMetaPi12 小时前
GM-3568JHF丨ARM+FPGA异构开发板系列教程:外设教程 04 WIFI
网络·arm开发·fpga开发·智能路由器·fpga
FPGA_小田老师12 小时前
FPGA基础知识(二十):Xilinx Block Memory IP核(5)--ROM 详解
fpga开发·rom·coe文件格式·导入coe·block memory
FPGA_无线通信13 小时前
压缩解压缩算法 BFP-8bit
fpga开发
红糖果仁沙琪玛14 小时前
AD7616驱动开发-FPGA
驱动开发·fpga开发
坏孩子的诺亚方舟14 小时前
FPGA系统架构设计实践13_FPGA系统功能安全
fpga开发·系统架构·功能安全概念
ALINX技术博客14 小时前
【新品解读】5G/6G 基带系统级验证,AXVU13G 如何缩短高速系统研发周期
5g·fpga开发·fpga