1-verilog的串行滤波器FIR实现

news2024/9/25 9:41:18

verilog的串行滤波器FIR实现

      • 1,RTL代码
      • 2,RTL原理框图
      • 3,测试代码
      • 4,输出FIR滤波器的波形

参考文献:
1,基于FPGA的串行FIR滤波器设计与实现
2,FPGA实现FIR滤波器

1,RTL代码

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2023/11/21 22:55:41
// Design Name: 
// Module Name: fir_tops
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//

module	fir_tops(
input	i_clk,
input	i_rst,
input	signed	[1:0]	i_din,	//	 signed是默认的,
						//	表示这个变量是有符号的,
						//	可以用来存储整数和负数
output	signed	[15:0]	o_dout
);
// 滤波器系数
parameter	b0 	= 14'd82;
parameter	b1	= 14'd317;
parameter	b2	= 14'd788;
parameter	b3	= 14'd1023;
parameter	b4	= 14'd788;
parameter	b5	= 14'd317;
parameter	b6	= 14'd82;

reg		signed	[1:0]	x0;
reg		signed	[1:0]	x1;
reg		signed	[1:0]	x2;
reg		signed	[1:0]	x3;
reg		signed	[1:0]	x4;
reg		signed	[1:0]	x5;
reg		signed	[1:0]	x6;

//	延迟
always@(posedge i_clk or posedge i_rst)	begin
	if(i_rst)	begin
		x0	<= 2'd0;
		x1	<= 2'd0;
		x2	<= 2'd0;
		x3	<= 2'd0;
		x4	<= 2'd0;
		x5	<= 2'd0;
		x6	<= 2'd0;
		end
	else	begin     // 移位
		x0	<= i_din;
		x1	<= x0;
		x2	<= x1;
		x3	<= x2;
		x4	<= x3;
		x5	<= x4;
		x6	<= x5;
		end
end

//	使用乘法器ip核计算乘法
wire	signed	[15:0]	r0;
multer	u0_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x0),		// input  wire [1:0]  A
.B			(b0),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r0)		// output wire [15:0] P
);

wire	signed	[15:0]	r1;
multer	u1_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x1),		// input  wire [1:0]  A
.B			(b1),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r1)		// output wire [15:0] P
);

wire	signed	[15:0]	r2;
multer	u2_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x2),		// input  wire [1:0]  A
.B			(b2),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r2)		// output wire [15:0] P
);

wire	signed	[15:0]	r3;
multer	u3_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x3),		// input  wire [1:0]  A
.B			(b3),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r3)		// output wire [15:0] P
);

wire	signed	[15:0]	r4;
multer	u4_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x4),		// input  wire [1:0]  A
.B			(b4),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r4)		// output wire [15:0] P
);

wire	signed	[15:0]	r5;
multer	u5_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x5),		// input  wire [1:0]  A
.B			(b5),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r5)		// output wire [15:0] P
);

wire	signed	[15:0]	r6;
multer	u6_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x6),		// input  wire [1:0]  A
.B			(b6),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r6)		// output wire [15:0] P
);

assign	o_dout	= r0 + r1 + r2 + r3 + r4 + r5 + r6;

endmodule

2,RTL原理框图

在这里插入图片描述

3,测试代码

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2023/11/21 22:55:41
// Design Name: 
// Module Name: fir_tops
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//

module	fir_tops(
input	i_clk,
input	i_rst,
input	signed	[1:0]	i_din,	//	 signed是默认的,
						//	表示这个变量是有符号的,
						//	可以用来存储整数和负数
output	signed	[15:0]	o_dout
);
// 滤波器系数
parameter	b0 	= 14'd82;
parameter	b1	= 14'd317;
parameter	b2	= 14'd788;
parameter	b3	= 14'd1023;
parameter	b4	= 14'd788;
parameter	b5	= 14'd317;
parameter	b6	= 14'd82;

reg		signed	[1:0]	x0;
reg		signed	[1:0]	x1;
reg		signed	[1:0]	x2;
reg		signed	[1:0]	x3;
reg		signed	[1:0]	x4;
reg		signed	[1:0]	x5;
reg		signed	[1:0]	x6;

//	延迟
always@(posedge i_clk or posedge i_rst)	begin
	if(i_rst)	begin
		x0	<= 2'd0;
		x1	<= 2'd0;
		x2	<= 2'd0;
		x3	<= 2'd0;
		x4	<= 2'd0;
		x5	<= 2'd0;
		x6	<= 2'd0;
		end
	else	begin     // 移位
		x0	<= i_din;
		x1	<= x0;
		x2	<= x1;
		x3	<= x2;
		x4	<= x3;
		x5	<= x4;
		x6	<= x5;
		end
end

//	使用乘法器ip核计算乘法
wire	signed	[15:0]	r0;
multer	u0_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x0),		// input  wire [1:0]  A
.B			(b0),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r0)		// output wire [15:0] P
);

wire	signed	[15:0]	r1;
multer	u1_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x1),		// input  wire [1:0]  A
.B			(b1),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r1)		// output wire [15:0] P
);

wire	signed	[15:0]	r2;
multer	u2_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x2),		// input  wire [1:0]  A
.B			(b2),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r2)		// output wire [15:0] P
);

wire	signed	[15:0]	r3;
multer	u3_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x3),		// input  wire [1:0]  A
.B			(b3),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r3)		// output wire [15:0] P
);

wire	signed	[15:0]	r4;
multer	u4_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x4),		// input  wire [1:0]  A
.B			(b4),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r4)		// output wire [15:0] P
);

wire	signed	[15:0]	r5;
multer	u5_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x5),		// input  wire [1:0]  A
.B			(b5),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r5)		// output wire [15:0] P
);

wire	signed	[15:0]	r6;
multer	u6_multer(
.CLK		(i_clk),	// input  wire CLK
.A			(x6),		// input  wire [1:0]  A
.B			(b6),		// input  wire [13:0] B
.SCLR		(i_rst),	// input  wire SCLR
.P			(r6)		// output wire [15:0] P
);

assign	o_dout	= r0 + r1 + r2 + r3 + r4 + r5 + r6;

endmodule

4,输出FIR滤波器的波形

在这里插入图片描述

注意:
1,输出波形有误差,需要修改;
2,vivado对IP catalog进行了调用;这里要注重调用的方法。
3,测试代码结合起来理解输出波形。

使用zynq-7000的IP核:

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1236667.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

子虔与罗克韦尔自动化合作 进博会签约自动化净零智造联创中心

11月6日进博会现场&#xff0c;漕河泾罗克韦尔自动化净零智造联创中心合作协议签约暨合作伙伴&#xff08;第一批&#xff09;授牌仪式举办&#xff0c;子虔科技作为联创中心合作伙伴签约&#xff0c;携手共建智能制造&#xff0c;引领行业可持续发展。 图示&#xff1a;子虔科…

从0开始学习JavaScript--深入理解JavaScript的async/await

JavaScript的异步编程在过去经历了回调地狱、Promise的引入&#xff0c;而今&#xff0c;通过async/await&#xff0c;让我们获得了更加优雅、可读性更高的异步编程方式。本文将深入探讨async/await的概念、用法&#xff0c;并通过丰富的示例代码展示其在实际应用中的威力。 理…

SPDK NVMe-oF target多路功能介绍

基本概念 SPDK NVMe-oF target multi-path是基于NVMe协议的multi-path IO和namespace sharing功能。 NVMe multi-path IO指的是两个或多个完全独立的PCI Express路径存在于一个主机和一个命名空间。 而namespace 共享是两个或多个主机使用不同的NVMe控制器访问一个shared na…

2023.11.22使用flask做一个简单的图片浏览器

2023.11.22使用flask做一个简单的图片浏览器 功能&#xff1a; 实现图片浏览&#xff08;翻页&#xff09;功能 程序页面&#xff1a; 程序架构&#xff1a; 注意&#xff1a;在flask中常会使用src“{{ url_for(‘static’, filename‘images/’ image) }}”&#xff0c…

利用ros实现单片机通讯(转载)

我觉得如果使用这个人的micro_ros通信协议&#xff0c;就不用再去Ubuntu或者Windows上面自己写驱动程序了&#xff0c; 利用micro_ros实现esp32与ros2的通讯 Tianci ​ 天津大学 工学博士 参考&#xff1a;https://github.com/micro-ROS/micro_ros_arduino https://blog.cs…

【开源】基于Vue和SpringBoot的服装店库存管理系统

项目编号&#xff1a; S 052 &#xff0c;文末获取源码。 \color{red}{项目编号&#xff1a;S052&#xff0c;文末获取源码。} 项目编号&#xff1a;S052&#xff0c;文末获取源码。 目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 数据中心模块2.2 角色管理模块2.3 服…

森林之子/Sons Of The Forest V42457 资源分享

游戏介绍&#xff1a; 视频介绍&#xff1a; 森林之子 资源分享 这里是引用 你被派到了一座孤岛上&#xff0c;寻找一位失踪的亿万富翁&#xff0c;结果却发现自己深陷被食人生物占领的炼狱之地。你需要制作工具和武器、建造房屋&#xff0c;倾尽全力生存下去&#xff0c;无论…

MySQL之BETWEEN AND包含范围查询总结

一、时间范围 查询参数格式与数据库类型相对应时&#xff0c;between and包含头尾&#xff0c;否则依情况 当数据库字段中存储的是yyyy-MM-dd格式&#xff0c;即date类型&#xff1a; 用between and查询&#xff0c; 参数yyyy-MM-dd格式时&#xff0c;包含头尾&#xff0c;相当…

【Flink】Process Function

目录 1、ProcessFunction解析 1.1 抽象方法.processElement() 1.2 非抽象方法.onTimer() 2、Flink中8个不同的处理函数 2.1 ProcessFunction 2.2 KeyedProcessFunction 2.3 ProcessWindowFunction 2.4 ProcessAllWindowFunction 2.5 CoProcessFunction 2.6 ProcessJo…

C++ 多态和虚函数详解

本文章内容来源于C课堂上的听课笔记 多态基础 多态&#xff08;Polymorphism&#xff09;是面向对象编程中的一个重要概念&#xff0c;它允许使用统一的接口来表示不同的对象和操作。多态性有两种主要形式&#xff1a;静态多态性&#xff08;编译时多态性&#xff09;和动态多…

【设备树添加节点】

节点结束位置都需要加分号 of_iomap 完成映射 of_property_read_u32_array of_property_read_string of_fine_node_by_path

子虔科技出席2023WAIC“智能制造融合创新论坛”

7月7日&#xff0c;2023世界人工智能大会&#xff08;WAIC&#xff09;闵行会场在大零号湾举办。子虔科技联合创始人周洋作为专家嘉宾受邀参与智能制造融合创新论坛大会。会上探讨了工业和制造业数字化转型的机遇、挑战和对策。其中&#xff0c;周洋提到&#xff0c;工业制造业…

【电路笔记】-电源电压

电源电压 文章目录 电源电压1、概述1.1 交流发电机1.2 电池1.3 理想电压源1.4 实际电压源1.5 连接规则 2、相关源2.1 压控电压源 (VCVS)2.2 电流控制电压源 (CCVS) 3、总结 在本文中&#xff0c;我们详细介绍了称为电源电压的重要电子元件的架构、功能和使用。 我们首先提出理想…

leetcode刷题详解——粉刷房子

1. 题目链接&#xff1a;LCR 091. 粉刷房子 2. 题目描述&#xff1a; 假如有一排房子&#xff0c;共 n 个&#xff0c;每个房子可以被粉刷成红色、蓝色或者绿色这三种颜色中的一种&#xff0c;你需要粉刷所有的房子并且使其相邻的两个房子颜色不能相同。 当然&#xff0c;因为…

https和http的区别和优势

大家好&#xff0c;我是咕噜-凯撒&#xff0c;HTTP&#xff08;超文本传输协议&#xff09;和HTTPS&#xff08;安全超文本传输协议&#xff09;是用于在网络上传输数据的协议&#xff0c;HTTPS相比HTTP在数据传输过程中更加安全可靠&#xff0c;适合对数据安全性要求较高的场景…

力扣第463题 岛屿的周长 C++ 深度优先搜索 + 思维判断的边界

题目 463. 岛屿的周长 简单 相关标签 深度优先搜索 广度优先搜索 数组 矩阵 给定一个 row x col 的二维网格地图 grid &#xff0c;其中&#xff1a;grid[i][j] 1 表示陆地&#xff0c; grid[i][j] 0 表示水域。 网格中的格子 水平和垂直 方向相连&#xff08;对角线…

Altium Designer学习笔记6

原理图库的制作&#xff0c;SMA元件的制作&#xff1a; 图形不是很重要&#xff0c;重要的是管脚的功能。 Design Item ID和Designator两个值是要注意的。 进行Place放置&#xff0c;切换到原理图工作区&#xff0c;测试下功能。 AD9851元件库制作&#xff1a; 不需要再新建原…

在银行外包如何自我提升

作者&#xff1a;苍何&#xff0c;前大厂高级 Java 工程师&#xff0c;阿里云专家博主&#xff0c;CSDN 2023 年 实力新星&#xff0c;土木转码&#xff0c;现任部门技术 leader&#xff0c;专注于互联网技术分享&#xff0c;职场经验分享。 &#x1f525;热门文章推荐&#xf…

Linux调度域与调度组

引入调度域的讨论可以参考这篇文章。这篇笔记重点分析了内核调度域相关的数据结构以及内核用于构建调度域的代码实现&#xff0c;以此来加深对调度域的理解。调度域是调度器进行负载均衡的基础。 调度域拓扑层级 整个系统的调度域组成一个层级结构&#xff0c;内核设计了stru…

解决VSCode运行时自动保存问题【图文解析】

用VSCode写前端时老是自动保存&#xff0c;代码还没写完就开始 刷新页面 调用接口 出现报错之类的&#xff0c;很烦人&#xff0c;所以就写一篇修改VSCode自动保存文件的文章&#xff0c;以免自己忘记在哪设置。 同事总是用不自动保存&#xff0c;每次写完都要ctrls一下&#x…