Lưu đồ thiết kế VHDL

Một phần của tài liệu Xử lí tín hiệu số sử dụng kĩ thuật EPGA : Đề tài NCKH. QT.08.07 (Trang 26)

3. Thiết kế bộ lọc số rađa với kỹ thuật VHD L

3.2 Lưu đồ thiết kế VHDL

Như đã trình bày ở trên, một trong những ứng dụng chính của VHDL là mơ tả các mạch điện tử số. Từ các mơ tả này sẽ được biên dịch và đặt vào, đi dây trong các linh kiện PLD. Các bước thực hiện cùa quy trình này được chỉ ra trong hình 3.2.

VHDL entry (RTL level) Synthesis I ICompilation Netlist (Gate level) Optimization Optimized Netlist

(Gate level) Simulation

Physical Devices

Place & Route

Simulation

Khởi đầu của việc thiết kế là viết mã VHDL (VHDL entry), các file được ghi lại dưới dạng.vM

Đước 1 là biên dịch (icompilation), là quá trình biến đổi ngơn ngữ bậc cao VHDL dạng mức chuyển giao thanh ghi {Register Transfer Level - RTL) sang dạng netỉist của các cổng logic.

Bưởc 2 là tối ưu hĩa (optimization) netlist theo yếu tổ tốc độ hay diện tích sừ đụng. Với cơng đoạn này, thiết kế được đưa vào mơ phịng (simulation) để qua sát sự tối ưu.

Cuối cùng là nạp đoạn mã biên dịch này vào trong mạch vật lí của bo mạch FPGA

{place and route).

3.3 Thiết kế bộ lọc dùng FDAtool và chutmg trình mơ phỏng ModelSim

Theo quy trình trên ta thấy, việc thiết kế được bắt đầu với viết code VHDL. Với cấu trúc mạch phức tạp, code này sẽ rất dài vả phức tạp. Nếu ta bắt tay vào nghiên cứu cấu trúc thuật tốn rồi diễn giải thành các câu lệnh thì cĩ một ưu điểm là thấu hiểu rất rõ cẩu trúc đoạn mã. Nhưng nhược điểm lớn hơn là rất tốn thời gian và khơng hiệu quả. Một cơng cụ của Matlab quen thuộc là FDATool cho phép ta thiết kế các bộ lọc rất trực quan và dễ dàng. Các bộ lọc hình thành quan ừọng là phát ra được luơn mã VHDL. Cũng như việc viết website, hiện nay xu thế là sử dụng các cơng cụ cĩ sẵn rồi biên dịch ra các tệp .html. ít ai thực hiện theo kiểu viết từng câu lệnh html.

Bộ lọc thơng thấp được thiết kế cĩ thơng số sau:

o Tần số lấy mẫu, Sampling Frequency Fs = 48 kHz,

o Tần sổ kết thúc của dải thơng, End of Pass-band Fpass = 9.6 kHz, o Tần số bắt đầu của dải chặn, Begin of Stop-band Fs = 12 kHz; o Độ nhấp nhơ của dải thơng, Pass-band ripple Apass = 1 dB, o Độ suy giảm của dải chặn, Stop-band attenuation Astop=80 dB.

Đặc tuyến tần số này được chỉ ra trên hình 3.3. Chú ý ở đây là ưu điểm cùa thiết kế bộ lọc dùng FDAtool cho phép ta dễ dàng thay đổi thơng số và cấu trúc cùa bộ lọc.

Sau khi lượng từ hĩa các hệ số, lối vào/lối ra và các cấu trúc nội của bộ lọc, chúng ta phát ra mã VHDL và sử dụng các chương trình Test Bench để chạy mơ phỏng hoạt động theo quy trình đã đưa ra ở trên. Models im là một cơng cụ tốt để thực hiện nhiệm vụ này.

*Mag. íđB) » Apass A Stop I I F F . P s/2 f {H z) pass stop Magnitude Response (dB) Ỉ I ■ I I t 1 Frequency (Kl-te)

Hình 3.3 Cấu trúc và đặc tuyển tần sổ của bộ lọc số

Thiết kế này tạo ra một mơ hình bộ lọc cĩ 4 lối vào: elk, clkjenable, reset, data in và một lối ra data out. Chú ý đường datajn_gen phát ra dữ liệu dùng cho việc chạy thừ test bench, các đường delayjpipeUnedata injgen cho địng data_indata_out.

Ir* 862 data n gen

0000030000000050 outM repiB " ' 'jdM oụt 0000000000000000 OOGODOỌOOQOOOŨỌP _ ỌOOOỌOOOQQQOQÍXIỌ ocooọooooooooopo data cut ' đaa dOOOOũOCC-OOOOOOũO

clk nen CIK 00000 • 1.. ... ..•o' Mopõọoqo 1

output register process

c lK

resel

oulputjypeconveit elk enable

o u t p u t r e g i s t e r 0000000000000000

delay pipeline, process

•/I • 0 L . 00000000000Q00Q0 elk M, e l k e n a b le £ i c h l a j n 3 ______

KÉT LUẬN

So sánh với mục tiêu đề ra của để tài, kểt quả thu được của chúng tơi đã hồn thành được mục tiêu đề ra,

Các kết quả gồm cĩ:

■ 01 bài báo VNU, báo cáo tại Tiểu ban Vật lí, 2008:

Radar Digital Filters Design with VHDL and FPGA

■ Tìm hiểu FPGA, đưa ra quy trình tối ưu cho việc thiết kể FPGA ■ Tìm hiểu và sử dụng thành thạo cơng cụ VHDL

■ Đưa ra chương trình mơ phỏng thiết kế các bộ lọc sổ dùng cho rađa ■ 01 khĩa luận tốt nghiệp sinh viên khĩa K49, 2008

Tuy nhiên, việc thiết kế vẫn cần được tiểp tục ưiển khai trên các bo mạch FPGA mà đang được nhà trường trang bị.

Ý nghĩa thực tiễn của đề tài là một chuẩn bị tổt cho việc triển khai phịng thí nghiệm linh kiện lập trình PLD. Đấy là một loại phịng thí nghiệm đã được ừiển khai tại rất nhiều trường đại học ừong nước.

TÀI LIỆU THAM KHẢO

[1]. Steven w . Smith, The Scientist and Engineer's Guide lo Digital Signal

Processing, California Technical Publishing, ISBN 0-9660176-3-3, 1997.

[2]. Douglas L. Perry, VHDL Programming by Example, Fourth Edition, McGraw- Hill, 2002.

[3]. Volnei A. Pedroni, Circuit Design with VHDL, MIT Press, Massachusetts

Institute o f Technology, 2004

[4]. H. Bochnick, w . Anheider, FIR Filter Design using Verilog and VHDL,

Proceedings of the NATO Advanced Study Institute on Fundamentals and Standards in Hardware Description Languages II, Ciocco, Barga, Italy, 1993 [5]. Bob Zeidman, Introduction to CPLD and FPGA Design, The Chalkboard

PHỤ LỤ C 1. Bài báo Tạp chí VNU

Do Trung Kien1, Nguyen Due Thang', Bach Gia Duong2, Radar Digital Filters Design with VHDL and FPGA, VNU 2008

(Hiện dang trong quá trình in ấn)

2. Photocopy bìa luận văn Đại học được thực hiện theo hướng đề tài Khĩa luận Đại học:

• Nguyễn Trọng Anh, K49 Vật lý, Tổng quan về các linh kiện logic khả trình, 2008.

Radar Digital Filters Design with VHDL and FPGA

Do Trung K ien”, Nguyen Due Thang1, Bach Gia D uong2

} Faculty o f Physics, College o f Science

2 Research Center fo r Electronics and Telecommunication, College o f Technology Vietnam National University

Abstract. A set of FIR digital filters with different specifications is created by the FDATool of the Matlab environment. VHDL codes are then generated and verified with a test bench. Another method of filter design is to write VHDL codes in the Model Sim simulation environment. Advantage of the way is code writing depend on acknowledgment of filter structure. VHDL codes then can be compiled, placed and routed into FPGA devices. The results of this paper are necessary for process of design and fabrication of radio frequency navigation digital filters using Field Programmable Gale Arrays.

Keywords: Radar digital filter, FIR, HR, VHDL, FPGA.

1. Introduction

Digital signal processing (DSP) finds innumerable applications in the fields of audio, video, and communications. Digital filters, one o f DSP cores, are a important part of radar signal processing such as matched filters, IF filters. There are two types o f digital filters called Finite Impulse Response {FIR)

and Infinite Impulse Response ỤIR) using techniques of convolution and recursion, respectively [1]. VHDL is a hardware description language that stands for VHSIC Hardware Description Language (VHSIC - Very High Speed Integrated Circuits). It describes the behavior o f an electronic circuit or system, from which the physical circuit can be implemented. The main application of VHDL is in the field o f Field Programmable Gate Array (FPGA) [2-5].

Our work concentrates on the analysis of the FIR structures and using the FDAtool of Matlab environment and then VHDL code to design and create the FIR filters. These resultant codes are ready for the place and routine on FPGA devices.

2. Theories o f niters and VHDL design flow (1,3,4) Concepts o f the FIR

For a large variety o f applications, digital filters are usually based on the following relationships between the filter input sequence x(n) and the filter output sequence y(n) [3-4]:

y ( n ) = £ Ot Xị n - k) - ]T b - j ) ( 0

*=0 I-1

Equation (1) is referred to as a linear constant coefficient difference equation. Two classes of filters are FIR and HR that mentioned in tile introduction. A discrete signal x(n) can be expressed as:

t( n ) = £ r( m)<*>'( n - m )

m ■ f

Where S(n-m) is impulse sequence ỗ(n) delayed by m. The signals and systems that we deal with are linear and time invariant, where both superposition and shifi-invariance apply. If the input is a unii

impulse Sịn) the resulting output response is h(n), h(n) is designated as the impulse response. Then

x(m)S(n-m) x(m)h(n-m) by the shift-invariance property. Using (2), the response becomes:

y(n)= Yi x ( m) h{ n- m) m--ac

Letting k = n-m yields: y{n) = ỵ h { k ) x ( n - k)

k= »

This convolution equation is very useful for design of FIR filter since we can approximate it with a finite number o f terms, or: y{n) = £ h(k)x{n - k) (3)

ề=u

(1) reduces to (3) with ak = h(k) and bj = 0. To understand the FIR filter, we can consider an example o f a low changed signal plus with a random rapid noise. When using an 8-tap FIR filter, we can create a low pass filter (Figure ])

Signal = 0.125*Reading(n) +0.125*Reading(n-]) + 0.125*Reading(n-2) + 0.125*Reading(n-3) + 0.125*Reading(n-4) + 0.l25*Reading(n-5) + 0. i 25*Reading{n-6) + 0. J 25*Reading(n-7)

h[n] = [Ị/8, Ỉ/8, Ỉ/8, 1/8, 1/8, ỉ/8, Ỉ/8, i/8]

Fig.l * Example of 8-tap FIR filter The number of taps and the values o f the coefficients determine the filter’s operation. Designing the filter is just a case o f deciding how many taps and choosing the coefficients.

VHDL Design Flow Ị23]

As mentioned above, one of the major utilities of VHDL is that it allows the synthesis of a circuit in the FPGA. The steps followed during such a project are summarized in Figure 2. We start the design by writing the VHDL code, which is saved in a file with the extension vhd. The first step in the synthesis process is compilation. That is the conversion of the high-level VHDL language, which describes the circuit at the Register Transfer Level (RTL), into a netlist at the gate level. The second step is optimization, which is performed on the gate-level netlist for speed or for area. At this stage, the design can be simulated. Finally, a place-and-route (filter) software will generate the physical layout for a FPGA chip.

S y n th e s is I

Fig-2 - V H D L design flow

3. Filter design with FDAtool and ModelSim

Using FDA tool o f Matlab language, we setup the specification for a lowpass filter as follow: ° Sampling Frequency Fs = 48 kHz,

0 End o f Pass-band Fpass = 9,6 kHz, 0 Begin of Stop-band / 5 = 1 2 kHz; 0 Pass-band ripple Apass = 1 dB, ° Stop-band attenuation Astop=80 dB.

The frequency characteristic of this filter is show in Figure 3. We note that the remarkable advantage o f FDAtool filter design is in which we can easily change structure and parameters of filter.

'M m (dB) * A __ "%L FL F8/2~ ,h” Magntude Reiponse (dB) ' Í F*«qu«ncy (M>

Fig.3 - Frequency characteristic of designed lowpass filter

After quantize parameters o f coefficients, input / output and filter internals, we generate VHDL code and Test Bench file for the filter. Follow the instruction in Figure 2, before place and route to physical devices, we need to check the VHDL code by some tools o f simulation. ModelSim is referred as very powerful software for compilation and simulation o f VHDL.

This process creates a model o f a filter that has four inputs: elk, clk enable, reset, data in and one output: data out (Figure 4). Note that the da(a_in_gen generates the data for the test bench process, delay_pipeline and output register are processes for data in and data out flows.

The waveforms o f inputs and output of the filter are shown in Figure 5. The pane 1 has five waves o f four inputs and output but the waves of data in and data out illustrated in digital form. However, digital forms are not easily readable forms. Therefore, the data in and data out are changed to analog form in Pane 2 and Pane 3. Due to analog shapes of two curves, we can realize the effect o f lowpass filter is removes the components of high frequencies. The curve o f data in is very fluctuating but that o f data out is more smoothing. That means the filter removed the high frequencies from 9.6 kHz. Moreover, the amplitude o f curve o f data_out is in range o f -574 to +575 while that of d a ta jn is in range o f -32768 to +32767. This is also due to rejection o f components of high frequencies.

rvxyxxirooooorooo u \_nge ou10000>:0000XK».l0 OOQOrK*: fJOOOOOirf>0 ajOOOMHUHIWOGP OX)OCOQOO<>.XyHlOO<>m .*4 w«i n.v*"s V) .,rK>*V>*Y> .irfW<Kr'*

ouftxrtjreQisltfi _ptomss. • u feobooooooc 1e* P i,* fc r«iJ<4v anpooooooncoomn n*_pi oc * ■ »c'frit* OOOOPOQOOOOIXXXX/ f i 1 . ^ f c* & • I i

Fig.5 - The waves o f the filter run by Test Bench o f ModelSim

4. Conclusion

With the co-work o f both the FDAtoo! o f Matỉab and the ModelSim, we can easily create any filter with different structures, different specifications. VHDL code o f filters generated by FDAtool are then compiled and simulated for optimization by ModelSim. These tools are very useful for learning and writing VHDL code and in-ready for place-and-route in FPGA devices.

Acknowledgments. This work is implemented with the help of the “QT-08-07” project that is support by the College o f Science, Vietnam National University. I would like to thank for the help.

References

[1] Steven w. Smith. The Scientist and Engineer's Guide to Digital Signal Processing. California Technical Publishing,

ISBN 0-9660176-3-3, 1997.

[2] Douglas L. Perry, VHDL Programming by Example, Fourth Hdition, McGraw-Hiii, 2002.

[3] Volnei A. Pedroni, Circuit Design with VHDL, MIT Press, Massachusetts Institute o f Technology, 2004

[4] H. Bochnick, w . Anheider, FIR Filter Design using Verilog and VHDL, Proceedings o f the SATO Advanced Study

Institute on Fundamentals and Standards in Hardware Description Languages //, Ciocco. Barga, Italy, 1993

ĐẠI HỌC QUỐC GIA HÀ NỘI

TRƯỜNG ĐẠI HỌC KHOA HỌC T ự NHIÊN KHOA VẬT Ú

NGUYỄN TRỌNG ANH

TỎNG QUAN VỀ CÁC LINH KIỆN LOGIC KHẢ TRÌNH

KHĨA LUẬN TĨT NGHIỆP

CHUYÊN NGÀNH: VẬT LÝ VƠ TUYẾN

Giáo viên hướng dẫn: Đỗ Trung Kiên

TĨM TẮT CÁC CƠNG TRÌNH NGHIÊN c ứ u CỦA CÁ NHÂN

Ngành Vật lý

Chuyên ngành Vật lý Vơ tuyến

Radar Digital Filters Design with VHDL and FPGA (Thiết kế các bộ lọc số rađa dùng VHDL và FPGA)

Do Trung Kien1, Nguyen Due Thang', Bach Gia Duong2

fa c u lty of Physics, College o f Science

2Research Center fo r Electronics and Telecommunication, College o f Technology Vietnam National University

Tĩm tắt

Một hệ thống các bộ lọc so FIR với các thơng sổ thay đổi được tạo ra bời cơng cụ FDAtool của Matlab. Mã VHDL ngay sau đĩ được phát ra và kiểm tra, chạy thử với các cơng cụ Test Bench. Mode IS im là một cơng cụ giúp cho việc viết cũng như chạy mơ phịng các đoạn chương trình VHDL cỏ sẵn. Ưu điểm cùa phương pháp là việc tạo ra mã VHDL dễ dàng. Mã VHDL sau khi được chỉnh sửa sẽ được biên dịch và nạp vào trong các bo mạch FPGA để hinh thành ra các mạch lọc số. Kết quả của bài báo này rất cần thiết cho quá trình thiết kể và chế tạo các mạch số nĩi chung, mạch lọc sổ dành cho các hệ thống rađa nĩi riêng dùng kĩ thuật FPGA.

A set o f FIR digital filters with different specifications is created by the FDATool of the Matlab environment. VHDL codes are then generated and verified with a test bench. Another method o f filter design is to write VHDL codes in the ModelSim simulation environment. Advantage of the way is code writing depend on acknowledgment o f filter structure. VHDL codes then can be compiled, placed and routed into FPGA devices. The results of this paper are necessary for process of design and fabrication o f radio frequency navigation digital filters using Field Programmable Gate Arrays.

SCIENTIFIC PROJECT

BRANCH : PHYSICS

PROJECT CATEGORY : NATIONAL LEVEL

1. Title

Digital Signal Processes using FPGA Technique

2. Code

QT-08-07

3. Managing Institution

Hanoi University of Science

4. Implementing Institution

Faculty o f Physics, Hanoi University o f Science 5. Collaborating Institutions 6. Coordinator MS. Do Trung Kien MS. Le Quang Thao 7. Key implementors MS. Dang Hung 8. Duration: From 02/2008 to 12/2008 9. Budget

20.000.000VND from Hanoi University of Science 10. Main results:

■ 01 paper o f VNU 2008

Radar Digital Filters Design with VHDL and FPGA ■ Research and Development of PLD and VHDL ■ 01 thesises of undergraduated student K49, 2008 11. Evaluation grade

PHIẾƯ ĐẢNG KỈ KÉT QUẢ NGHỈÊN c ứ u KHOA HỌC

Tên đề tài (hoặc dự án):

X Ử LÍ TÍN H IỆU SĨ SỬ DỤNG KĨ THUẬT FPGA (Digital Signal Processes using FPGA Technique)

Mã số: QT-08-07

Cơ quan chủ trì đề tài (hoặc dự án):

TRƯỜNG ĐẠI HỌC KHOA HỌC T ự NHIÊN

Địa chỉ: 334 Nguyễn Trãi, Thanh Xuân, Hà nội

Tel:

Cơ quan quản lý đề tài (hoặc dự án):

ĐẠI HỌC QUỐC GIA HÀ NỘI

Địa chi: 144 đường Xuân Thủy, cầu Giấy, Hà Nội Tel:

Tổng kỉnh phí thực chỉ: 20.000.000 đồng

Trong đĩ: -T ừ ngân sách Nhà nước: 20.000.000 đồng - Kinh phí của trường:

- Vay tín dụng: - Vốn tự cĩ: - Thu hồi:

Thời gian nghiên cứu: 2008

Thời gian bắt đầu: Thịi gian kết thúc:

Tên các cán bộ phái hợp nghiên cứu:

1. ThS. Đỗ Trung Kiên Bộ mơn Vật lý Vơ tuyến, Khoa Vật lý, ĐHKHTN 2. ThS. Lê Quang Thào Bộ mơn Vật lv Vơ tưvến, Khoa Vật lý. ĐHKHTN

tài kết quả nghiên cứu: a. Phổ biến rộng rãi: X

b. Phổ biển hạn chế: c. Bảo mật:

Ngày:

Tĩm tắt kết quả nghiên cứu:

❖ Tim hiểu được kĩ thuật PLD ❖ Tìm hiểu được ngơn ngữ VHDL

Một phần của tài liệu Xử lí tín hiệu số sử dụng kĩ thuật EPGA : Đề tài NCKH. QT.08.07 (Trang 26)

Tải bản đầy đủ (PDF)

(40 trang)