Главная » Просмотр файлов » QuartusII-Testbench-Tutorial

QuartusII-Testbench-Tutorial (1162597)

Файл №1162597 QuartusII-Testbench-Tutorial (Семинары)QuartusII-Testbench-Tutorial (1162597)2019-09-20СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла

Quartus II Testbench TutorialThis tutorial will walk you through the steps of creating Verilog modules in Quartus II andsimulating them using Altera-Modelsim.1) Create a new Quartus Project & configure it for Altera-ModelsimTo configure Quartus to use Altera-Modelsim as the simulator, first create a new project (oropen an existing one) and go to Assignments > Settings > EDA Tool Settings > Simulation.Make sure “Modelsim-Altera” is selected as the tool as shown below (make sure to clickApply then OK if you made any changes).Next go to Tools > Options > General > EDA Tools sure that the path next to ModelsimAltera is configured correctly.

If you installed Quartus II with Altera-Modelsim the pathshould be similar to the one shown in the figure below (i.e. on Windows:“C:\altera\13.0sp1\mode-sim_ase\win32aloem”), otherwise you will need to browse towhere you installed Altera Modelsim and point it to the win32aloem directory.2) Create your Top-Level ModuleIn Quartus, the top level module must have the same name as your project name and mustbe in a file with the same name and a “.v” extension. To create the top level module goback to the main Quartus window and select File > New… > Design Files > Verilog HDL Fileand click OK. An example template of a top-level module can be seen below.

Notice howthe project is called “testbench_example” which is the same name as the top level module,“testbench_example” which exists in the file “testbench_example.v”.3) Create your Unit Under Test & TestbenchNext we will write the Verilog code that we want to test. This code can go in the same fileas the top-level, but it is good practice for separate modules to have their own files, so wewill do that in this example.For this tutorial the code that we want to test will be a simple 2 to 1 multiplexor circuit.Create a new file by going File > New… etc. and save it as “mux.v”. Next write the code thatwe want to test as shown below (Note: the example code can all be found in the appendix)Next we will write the testbench for our multiplexor circuit.

While it is not necessary, it isgood practice to keep the testbench for a module in the same file as the module itself, soagain that is what we will do here. Below is a simple testbench for testing this circuit (again,the code can be found in the appendix).Note: The testbench module does not contain any inputs or outputs, and it instantiates aninstance of our mux module that we want to test calling it “DUT”.Once you have finished writing everything, including your testbench, and everythingcompiles correctly you can move on to part 4. (Note: you might need to put some dummyinputs and outputs in your top-level module to get Quartus to stop complaining, but don’tworry these can be changed later).4) Open Altera-ModelsimTo open altera-modelsim go to Tools > Simulation Tool > RTL Simulation.

This should openup Altera-Modelsim.Modelsim creates a WORK library and puts your compiled Verilog modules from Quartus init. It also sets the working directory to be the modelsim directory of your project (this canbe changed in the settings in step one, but is not recommended).5) Compile the UUT & TestbenchTo compile your Testbench go to Compile > Compile..

and select the file that contains yourVerilog code that you want to test and its testbench. If you left the default settings formodelsim’s working directory you will probably have to browse up a few folders to find thefile you want (in this case mux.v). Once you have selected the file click Compile, then afterit has finished compiling click Done.Notice two new modules have been added to your WORK library.

This process can also bedone by declaring an instance of your UUT module in your top-level module in Quartus.However, if you have a module that you do not plan to use directly in your top-level moduleyou can still use the above instructions to compile it in Modelsim. (Note: You can in factopen Modelsim on its own, browse to the where the file that contains the code you want totest and its testbench lives, and compile it there.

In some cases this may make a bit moresense than going through Quartus.)6) SimulateTo run the simulation right click on the testbench module that you want to simulate, in thiscase “mux_testbench”, i.e. right click mux_testbench > simulate, or simply double click onit. (Note: you can have multiple testbenches compiled at the same time under your WORKlibrary and you can then select which one you want to simulate).Next, add the waves by selecting the signals you want and right click > add wave (or simplyuse the hot key CTRL + W).

This can also be done by selecting the signals you want andclicking the icon of a green circle with a + in it at the top.To run the simulation click the click the icon that looks like a white page with a down-arrowdirectly to the right of the box that says 100 ps.To adjust the simulation time simply edit the time in this box (for this multiplexor example100 ps is more than enough time, but for more complex circuits you may need to simulatelonger). This can also be achieved by typing: run 100 ps in the command prompt at thebottom.Observe your simulation waveforms (you may have to adjust the window zoom/scrolllocation to see your waveforms)*Note if you make a change to either your Unit Under Test or your testbench, you must firstrecompile whatever you changed before re-running the simulation.

Also make sure thatyou click the Restart button directly to the right of the simulation time window (or simplytype “restart” in the command prompt at the bottom) otherwise you will not see yourchanges.Appendix: Source Code/**************************************************** File: testbench_example.v* Author: Benjamin Morgan* Class: EE 271* Module: testbench_example* Description: The top level module for the*testbench tutorial*****************************************************/module testbench_example(LEDR, SW);output [0:0] LEDR;input [2:0] SW;//mux my_mux(.f(LEDR[0]), .in0(SW[0]), .in1(SW[1]), .sel(SW[2]));endmodule/**************************************************** File: mux.v* Author: Benjamin Morgan* Class: EE 271* Module: mux* Description: A simple 2 to 1 multiplexor circuit****************************************************/module mux(f, in0, in1, sel);output f;input in0, in1, sel;assign f = (in0 & ~sel) | (in1 & sel);endmodule/**************************************************** File: mux.v* Author: Benjamin Morgan* Class: EE 271* Module: mux_testbench* Description: A simple 2 to 1 multiplexor circuit****************************************************/module mux_testbench;reg in0, in1, sel;wire f;parameter stimDelay = 10;mux DUT(f, in0, in1, sel);initialbeginin0 = 0; in1 = 0; sel=0;#(stimDelay) in0 = 1;#(stimDelay) in0 = 0; in1 = 1;#(stimDelay) in0 = 1;#(stimDelay) in0 = 0; in1 = 0; sel = 1;#(stimDelay) in0 = 1;#(stimDelay) in0 = 0; in1 = 1;#(stimDelay) in0 = 1;#(stimDelay) sel = 0;#100; //Let simulation finishendendmodule.

Характеристики

Тип файла
PDF-файл
Размер
811,55 Kb
Материал
Тип материала
Высшее учебное заведение

Тип файла PDF

PDF-формат наиболее широко используется для просмотра любого типа файлов на любом устройстве. В него можно сохранить документ, таблицы, презентацию, текст, чертежи, вычисления, графики и всё остальное, что можно показать на экране любого устройства. Именно его лучше всего использовать для печати.

Например, если Вам нужно распечатать чертёж из автокада, Вы сохраните чертёж на флешку, но будет ли автокад в пункте печати? А если будет, то нужная версия с нужными библиотеками? Именно для этого и нужен формат PDF - в нём точно будет показано верно вне зависимости от того, в какой программе создали PDF-файл и есть ли нужная программа для его просмотра.

Список файлов семинаров

Семинары
Part 1
Seminar 1
DE0_CV
DE0_CV.qsf
Datasheet
Clock
CDCLVC1104PWR.pdf
EPCQ
EPCQ64.pdf
FPGA
cyclone5_handbook.pdf
cyclone_5_datasheet.pdf
IR Receiver and Emitter
IR12_21C_TR8.pdf
IRM_V538_TR1.pdf
Power
BZX84C5V1.pdf
Optimizing_TPS62130_Output_Filter.pdf
TPS62130EVM.pdf
tps62085.pdf
tps62130.pdf
tps73701.pdf
SDRAM
IS42S16320D.pdf
UART TO USB
DS_FT232R.pdf
VIDEO-DAC
ADV7123.pdf
DE0_Nano
DE0_Nano.qsf
DE0_Nano_Datasheets
ADC.pdf
DE0_Nano_Schematic.pdf
Digital_Accelerometer.pdf
Flash_Memory.pdf
I2C_2K_EEPROM.pdf
Linear_Regulator.pdf
SDRAM.pdf
Seminar 3
modules
adder.v
fsm.v
fsm.v.bak
register.v
Seminar 4
simulation_lab
funcitonal
db
serial.db_info
serial.sld_design_entry.sci
serial.qpf
serial.qsf
serial.qws
serial.v
serial_assignment_defaults.qdf
Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
7021
Авторов
на СтудИзбе
260
Средний доход
с одного платного файла
Обучение Подробнее