SOC实验报告研究生.doc

上传人:土8路 文档编号:10061172 上传时间:2021-04-15 格式:DOC 页数:25 大小:383.50KB
返回 下载 相关 举报
SOC实验报告研究生.doc_第1页
第1页 / 共25页
SOC实验报告研究生.doc_第2页
第2页 / 共25页
SOC实验报告研究生.doc_第3页
第3页 / 共25页
SOC实验报告研究生.doc_第4页
第4页 / 共25页
SOC实验报告研究生.doc_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《SOC实验报告研究生.doc》由会员分享,可在线阅读,更多相关《SOC实验报告研究生.doc(25页珍藏版)》请在三一文库上搜索。

1、SOC 设计方法与实现实验报告马 亮201111857刘家明2011118561 实验时间:2011年11月19日2011年12月15日2 实验目的完成一个数字系统的Verilog HDL描述和利用EDA工具的Verilog HDL仿真综合环境对这一描述进行仿真并综合,完整地从事一个数字VLSI系统的设计过程,理解和掌握现代集成电路的设计流程、硬件描述语言综合理论等高层次设计方法以及它和物理实现之间的关系,巩固在理论课阶段学习的相关知识 。3 实验平台 代码输入工具: QuartusII功能仿真: ModelSim SE 6.2b 综合工具:DC,Synplify Pro 8.6.24 实验内

2、容设计一个数字信号处理器系统,其功能为:在8位微控制器 Intel8051的控制下对输入信号进行数字滤波处理并根据输入数据的大小产生一组控制液晶板的显示。系统框图如下: Intel8051 是微处理器; TH99CHLS 是要实现的系统。Display是一个液晶显示板。它包括三个显示区:一个时间显示区,一个数字显示区和一个由16个小方块组成的信号幅度显示区。显示面板为共阴极驱动,接高电平时对应的面板显示,接低时面板消失。其结构见下图所示。5:系统简介和对应的模块划分5.1:系统的整体工作过程:(1) 在外部信号PEbar的控制下,芯片从端口in读入一个八位数据。(2) 在(1)中输入的数据与微

3、处理器给出的另一个八位数据进行按位“与”操作。(3) 在(2)中处理过的数据经数字滤波后从端口out输出。(4) TH99CHLS 内部产生一组时间信号,包括时和分,其格式为:(hh:mm)。这组时间信号的初值由微处理器给出,微处理器可以随时对时间信号进行修改。(5) 送往液晶显示板的信号有三组:a. (4)中产生的时间信号,经七段译码后从端口hour和minute送出;b. (3)中经数字滤波的信号,在转换成十进制并做七段译码后,百位经端口d00,十位经端口d10,个位经端口d01送出; c. (3)中经数字滤波的信号,在经过压缩后通过端口ap送出。 5.2: 数字滤波器数字滤波器的转移函数

4、为: 滤波器的系数B0,B1,.,B6均由微处理器给出。微处理器可以根据需要修改这些系数。 5.2:系统模块说明和代码说明:根据功能分析,将整个系统分为8个模块。各个模块对应的源文件和功能描述如下表所示。模块名称对应源文件功能说明decoderdecoder.v将四位二进制译码为LED显示。输入4bit,输出为7bit直接驱动显示装置,为组合逻辑。H2DH2D.v进行16进制到十进制的转换。输入为8bit无符号数,输出为百,十,个位数字(其中每个数字4bit位宽),同样为组合逻辑decoder_4X16decoder_4X164-16译码器,主要是将经过y=sqrt(x)压缩后的数据送至显示设

5、备。输入4bit,输出16bit,组合逻辑。sqrt_lutsqrt_lut.v主要实现y=sqrt(x)的运算。主要是通过比较和查找表方式实现。输入8bit,输出4bit。时序逻辑,一个时钟周期。mul8b_shiftadd_fsmmul8b_shiftadd_fsm.v乘法器设计。通过移位加的方式实现。内部通过状态机实现。完成一次乘法需要8个时钟周期timer_clktimer_clk.v时间时钟模块,主要是根据系统时钟计算秒。通过计数器级联的方式实现。filterfilter.v这是整个系统比较核心的部分。主要实现滤波器的设计和与微处理器的接口时序设计。接口需要三态控制,并且要注意读写信

6、号的控制,滤波器采用并行设计,用面积换取速度。TH99CHLSTH99CHLS.v顶层元件例化。主要是将上述各个模块进行组合。 整个功能框图如下:6:代码功能测试下面是测试用的模块介绍,模拟TH99CHLS外围的单片机、控制信号和数据输入等:模块名称对应的源文件功能说明osc_rstosc_rst.v产生时钟频率和复位信号fir_tbfir_tb.v滤波器数据的输入wr_rdwr_rd.v单片机WR,RD信号的模拟mcumcu.v主要是模拟单片机对TH99CHLS芯片的控制,包括寄存器的读入与读出等一系列操作top_testtop_test.v顶层测试文件,主要是进行元件例化ModelSimS

7、E功能仿真结果波形图如下:第一张图为前0-7us,第二张图为7us-15us.详细图形见source中的1.bmp和2.bmp.也可以查看其下的vsim.wlf(需要安装modelsim)。此图为对TH99CHLS芯片内部b0-b6(滤波器系数)寄存器的操作和对mini,hour寄存器初始化的操作仿真结果。7:综合结果及分析Synplify综合结果如下:DC综合结果如下:8:所占用的资源和数据通道分析该系统所占用的资源如下:在滤波器设计中,并没有采用乘法器的复用,而是采用了多个乘法器的复制,牺牲面积来换取速读的提高。综合后的频率能够达到50MHz。滤波器的数据通道如下:(用多个乘法器)9:Ve

8、rilog HDL代码/timescale 1ns/10psmodule top_test(); wire clk,rst_n; wire 7:0 abus; wire ale,rbar_n,wbar_n,cs_n; wire pebar_n; wire 7:0 fir_in; wire 7:0 dbus_xio; wire 13:0 hour,mini; wire 20:0 fir_out; wire 15:0 fir_out_sqrt; wire send_data_en; fir_tb Ufir_tb(send_data_en,pebar_n,fir_in); osc_rst Uost_

9、rst(clk,rst_n); TH99CHLS UTH99( dbus_xio, abus, rbar_n, wbar_n, ale, pebar_n, fir_in, cs_n, rst_n, clk, /output ports fir_out, fir_out_sqrt, hour, mini ); mcu Umcu( .dbus_xio(dbus_xio), .abus(abus), .rbar_n(rbar_n), .wbar_n(wbar_n), .ale(ale), .cs_n(cs_n), .send_data_en(send_data_en) );endmodule/mod

10、ule decoder( /input hex, /output led ); input 3:0 hex; output reg 6:0 led; always (hex) begin case(hex) 4b0000:led=7b011_1111; /0 4b0001:led=7b001_1000; /1 4b0010:led=7b111_0110; /2 4b0011:led=7b111_1100; /3 4b0100:led=7b101_1001; /4 4b0101:led=7b110_1101; /5 4b0110:led=7b110_1111; /6 4b0111:led=7b0

11、11_1000; /7 4b1000:led=7b111_1111; /8 4b1001:led=7b111_1101; /9 default :led=7b000_0000; /null endcase endendmodule/module TH99CHLS( /input dbus_xio, abus, rbar_n, wbar_n, ale, pebar_n, fir_in, cs_n, rst_n, clk, /output ports fir_out, fir_out_sqrt, hour, mini ); input clk,rst_n; input 7:0 abus; inpu

12、t ale,rbar_n,wbar_n,cs_n; input pebar_n; input 7:0 fir_in; inout 7:0 dbus_xio; output 13:0 hour,mini; output 20:0 fir_out; output 15:0 fir_out_sqrt; wire 15:0 fir_out_Hex; wire 7:0 hour_Hex,mini_Hex; wire 3:0 fir_sqt_Hex; wire 3:0 hud_Hex,ten_Hex,num_Hex; filter Ufilter(.dbus_xio(dbus_xio),.abus(abu

13、s),.rbar_n(rbar_n), .wbar_n(wbar_n),.ale(ale),.pebar_n(pebar_n), .fir_in(fir_in),.cs_n(cs_n),.rst_n(rst_n),.clk(clk), .fir_out(fir_out_Hex),.hour(hour_Hex),.mini(mini_Hex); sqrt_lut Usqt(.result(fir_sqt_Hex),.in(fir_out_Hex7:0),.clk(clk),.rst_n(rst_n); decoder_4X16 Ude4X16(.out(fir_out_sqrt),.in(fir

14、_sqt_Hex); H2D UH2d1(.hex(fir_out_Hex7:0), .hud(hud_Hex),.ten(ten_Hex),.num(num_Hex); decoder Udecoder1(.hex(hud_Hex),.led(fir_out20:14); decoder Udecoder2(.hex(ten_Hex),.led(fir_out13:7); decoder Udecoder3(.hex(num_Hex),.led(fir_out6:0); decoder Udecoder4(.hex(hour_Hex7:4),.led(hour13:7); decoder U

15、decoder5(.hex(hour_Hex3:0),.led(hour6:0); decoder Udecoder6(.hex(mini_Hex7:4),.led(mini13:7); decoder Udecoder7(.hex(mini_Hex3:0),.led(mini6:0);endmodule/timescale 1ns/10psmodule wr_rd( dbus_xio, abus, rbar_n, wbar_n, ale); parameter MCU_CLK=40;/25MHz parameter LL_DELAY=15; output reg 7:0 abus; outp

16、ut reg ale,rbar_n,wbar_n; inout 7:0 dbus_xio; reg ctrl; reg 7:0 abus_low; assign dbus_xio=ctrl?abus_low:8hzz; /if ctrl=1 output then hiz integer i; initial begin rbar_n=1b1; wbar_n=1b1; end task write_register; input 7:0 write_addr; input 7:0 write_data; /write movx begin ale=1b0;/config b0 #MCU_CLK

17、; ale=1b1; ctrl=1b1; #LL_DELAY; abus_low=write_addr; abus=8h0; #LL_DELAY; ale=0; ctrl=1b0; /float #MCU_CLK; #MCU_CLK; ctrl=1b1; abus_low=write_data; #1; wbar_n=1b0; for(i=0;i8;i=i+1) #MCU_CLK; wbar_n=1b1; end endtask /end movx task read_register; input 7:0 read_addr; output 7:0 read_data; /read movx

18、 begin ale=1b0;/config b0 #MCU_CLK; ale=1b1; ctrl=1b1; #LL_DELAY; abus_low=read_addr; abus=8h0; #LL_DELAY; ale=0; ctrl=1b0; /float #MCU_CLK; #MCU_CLK; ctrl=1b0; rbar_n=1b0; #MCU_CLK; read_data=dbus_xio; for(i=0;i7;i=i+1) #MCU_CLK; rbar_n=1b1; end endtask endmodule/module decoder_4X16( / output out,

19、/16 bit width high voltag effect /input in /four bit width ); input 3:0 in; output 15:0 out; assign out15= in3 & in2 & in1 & in0; /1111 15 assign out14= in3 & in2 & in1 &(in0); /1110 14 assign out13= in3 & in2 &(in1)& in0; /1101 13 assign out12= in3 & in2 &(in1)&(in0); /1100 12 assign out11= in3 &(i

20、n2)& in1 & in0; /1011 11 assign out10= in3 &(in2)& in1 &(in0); /1010 10 assign out9 = in3 &(in2)&(in1)& in0; /1001 9 assign out8 = in3 &(in2)&(in1)&(in0); /1000 8 assign out7=(in3)& in2 & in1 & in0; /0111 7 assign out6=(in3)& in2 & in1 &(in0); /0110 6 assign out5=(in3)& in2 &(in1)& in0; /0101 5 assi

21、gn out4=(in3)& in2 &(in1)&(in0); /0100 4 assign out3=(in3)&(in2)& in1 & in0; /0011 3 assign out2=(in3)&(in2)& in1 & in0; /0010 2 assign out1=(in3)&(in2)&(in1)& in0; /0001 1 assign out0=(in3)&(in2)&(in1)&(in0); /0000 0 endmodule/module filter( / input ports dbus_xio, abus, rbar_n, wbar_n, ale, pebar_

22、n, fir_in, cs_n, rst_n, clk, /output ports fir_out, hour, mini, ); inout wire 7:0 dbus_xio; /data bus connect to p0 complex of data and addr /output reg 7:0 dbus; input 7:0 abus; /addr bus connect to p2 input rbar_n,wbar_n; /rd and wr signal connect to rd,we of mcu input ale,cs_n; input pebar_n; inp

23、ut 7:0 fir_in; input clk,rst_n; output reg 15:0 fir_out; output 7:0 hour,mini; /*/ /about config reg 7:0 B0,B1,B2,B3,B4,B5,B6; reg 7:0 mcu_num; reg 7:0 abus_low; reg 7:0 hour,mini; reg 7:0 dbus; reg timer_clr_n; wire 15:0 abus_inner; / wire 7:0 dbus_in; /*/ /reg about fir reg 7:0 fir_in_reg6:0; wire

24、 15:0 mul_out6:0; reg start; wire 6:0 mul_out_en; wire mul_out_en_all; wire 7:0 fir_in_inner; integer i; /*/ assign fir_in_inner=fir_in&mcu_num; assign abus_inner=abus,abus_low; assign dbus_xio=rbar_n?8hzz:dbus; / /*/ /* always (posedge clk or rst_n) begin /latch the address like 373 if(!rst_n) begi

25、n abus_low=8b0; end else begin if(ale&(!cs_n) /cs_n=0 and ale=1 latch the address of P0 abus_low=dbus_in; end end*/ /latch not flip_flop always (ale or dbus_xio or cs_n) begin if(ale=1b1)&(!cs_n) abus_low=dbus_xio; end /*/ always (posedge clk or negedge rst_n) begin /config the register if(!rst_n) b

26、egin B0=8b0;B1=8b0;B2=8b0; B3=8b0;B4=8b0;B5=8b0;B6=8b0; end else begin if(!(cs_n|wbar_n) begin /cs_n=0 and wbar_n=0 write case(abus_inner3:0) 4b0000:B0=dbus_xio; 4b0001:B1=dbus_xio; 4b0010:B2=dbus_xio; 4b0011:B3=dbus_xio; 4b0100:B4=dbus_xio; 4b0101:B5=dbus_xio; 4b0110:B6=dbus_xio; 4b0111:mcu_num=dbu

27、s_xio; / default:version=dbus_xio; endcase end end end /*/ always (posedge clk or negedge rst_n) begin /read the register if(!rst_n)begindbus=8h0;end else if(!(cs_n|rbar_n) begin /cs_n=0 and wbar_n=0 write case(abus_inner3:0) 4b0000:dbus=B0; 4b0001:dbus=B1; 4b0010:dbus=B2; 4b0011:dbus=B3; 4b0100:dbu

28、s=B4; 4b0101:dbus=B5; 4b0110:dbus=B6; 4b0111:dbus=mcu_num; 4b1000:dbus=mini; 4b1001:dbus=hour; default:dbus=8b0;/version endcase end end /*/input the num reg pebar1; wire in_enable; always (posedge clk or negedge rst_n) begin if(!rst_n) begin pebar1=1b0; end else begin pebar1=pebar_n; end end assign

29、 in_enable=pebar1&(pebar_n); always (posedge clk or negedge rst_n) begin if(!rst_n) begin for(i=0;i7;i=i+1) fir_in_regi=8b0; start=1b0; end else if(in_enable) begin fir_in_reg0=fir_in_inner; for(i=0;i6;i=i+1) fir_in_regi+1=fir_in_regi; start=1b1; end else begin start=1b0; end end /*/ mul8b_shiftadd_

30、fsm U0(.mul_out(mul_out0), .mul_out_en(mul_out_en0), .mul_ina(B0), .mul_inb(fir_in_reg0), .clk(clk), .start(start), .rst_n(rst_n) ); mul8b_shiftadd_fsm U1(.mul_out(mul_out1), .mul_out_en(mul_out_en1), .mul_ina(B1), .mul_inb(fir_in_reg1), .clk(clk), .start(start), .rst_n(rst_n) ); mul8b_shiftadd_fsm

31、U2(.mul_out(mul_out2), .mul_out_en(mul_out_en2), .mul_ina(B2), .mul_inb(fir_in_reg2), .start(start), .clk(clk), .rst_n(rst_n) ); mul8b_shiftadd_fsm U3(.mul_out(mul_out3), .mul_out_en(mul_out_en3), .mul_ina(B3), .mul_inb(fir_in_reg3), .start(start), .clk(clk), .rst_n(rst_n) ); mul8b_shiftadd_fsm U4(.mul_out(mul_out4), .mul_out_en(mul_out_en4), .mul_ina(B4), .mul_inb(fir_in_reg4), .start(start), .clk(clk), .rst_n(rst_n) ); mul8b_shiftadd_fsm U5(.mul_out(mul_out5),

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1