FIFO设计16*8,verilog,数据显示在数码管
名称:FIFO设计16*8,数据显示在数码管(代码在文末付费下载)
软件:Quartus
语言:Verilog
代码功能:
使用verilog语言设计一个16*8的FIFO,深度16,宽度为8。可对FIFO进行写和读,并将FIFO读出的数据显示到数码管。
演示视频:
FPGA代码资源下载网:hdlcode.com
部分代码展示
//fifo 16×8fifo
module fifo_top
(
input clk,
input rst,
input [7:0] din,//fifo写数据
input wr_en,//写使能
input rd_en,//读使能
output empty,//空信号
output full,//满信号
output [7:0] bit_select,//数码管位选,高电平选通
output [7:0] seg_select//数码管段选,低电平点亮
);
wire [7:0] dout;//读数据
//fifo模块
a_fifo i_a_fifo
(
. clk(clk),
. rst(rst),
. din(din),//fifo写数据
. wr_en(wr_en),//写使能
. rd_en(rd_en),//读使能
. dout(dout),//读数据
. empty(empty),//空信号
. full(full)//满信号
);
//数码管显示模块
display i_display(
. clk(clk),
. din(din),//fifo写数据
. dout(dout),//读数据
. bit_select(bit_select),//数码管位选,高电平选中
. seg_select(seg_select)//数码管段选
);
endmodule
//fifo 16×8fifo
module a_fifo
(
input clk,
input rst,
input [7:0] din,//fifo写数据
input wr_en,//写使能
input rd_en,//读使能
output reg [7:0] dout,//读数据
output empty,//空信号
output full//满信号
);
reg [7:0] ram [15:0];//RAM。深度16,宽度8
reg [6:0] count=7'd0;
reg [6:0] rp=7'd0;
reg [6:0] wp=7'd0;
integer i;
always@(posedge clk)
if(rst)begin//复位
wp<=7'd0;
rp<=7'd0;
dout<=8'd0;
count<=7'd0;
for(i=0;i<16;i=i+1)
ram[i]<=8'b00000000;//清零
end
else
case({rd_en,wr_en})
2'b00:count<=count;
2'b01://单写FIFO
if(~full)begin//未满
ram[wp]<=din;//存入fifo
if(wp>=7'd15)
wp<=7'd0;//写地址循环累加
else
wp<=wp+7'd1;
count<=count+7'd1;
rp<=rp;
end
2'b10://单读FIFO
if(~empty)begin//未空
dout<=ram[rp];//读fifo设计文档:
1. 工程文件

2. 程序文件

3. 程序编译

4. RTL图

5. Testbench

6. 仿真图
整体仿真图






Fifo模块仿真图


数码管显示模块仿真图



代码文件(付费下载):
![]()
1、代码文件需要付费后才可见。
2、支付问题请联系微信公众号客服。
3、优质Verilog/VHDL代码资源,所见即所得。
Verilog/VHDL资源下载 » FIFO设计16*8,verilog,数据显示在数码管
2、支付问题请联系微信公众号客服。
3、优质Verilog/VHDL代码资源,所见即所得。
Verilog/VHDL资源下载 » FIFO设计16*8,verilog,数据显示在数码管
发表评论
模板文件不存在: ./template/plugins/comment/pc/index.htm