VHDLPrimeri Poglavlje3.doc. end process seq; Slika 3.1: Anatomija osnovne definicije test bench-a

Similar documents
VHDLPrimeri Poglavlje5.doc

Tutorial on Simulation using Aldec Active-HDL Ver 1.0

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

VHDL Simulation. Testbench Design

Test Benches - Module 8

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

Test Bench. Top Level Model Test Bench MUT

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

VHDL- VHDL-3. Vsys. maxplus2. Vsys. d:\uoo. vsystem.ini work

VHDL/Verilog Simulation. Testbench Design

Lecture 6. Advanced Testbenches. George Mason University

cla library ieee; use ieee.std_logic_1164.all;

ECE 545 Lecture 7. Advanced Testbenches. Required reading. Simple Testbench. Advanced Testbench. Possible Sources of Expected Outputs

ECE 545 Lecture 7. Advanced Testbenches. George Mason University

Design a 4 bit-adder. Then design a 4-7 decoder to show the outputs. Output Sum(4 bits) Adder. Output carry(1 bit)

Sintaksa VHDL jezika - podsjetnik -

Basic Language Concepts

LECTURE 4: The VHDL N-bit Adder

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

Digitaalsüsteemide disain

Functions, Procedures, and Testbenches

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Getting Started with VHDL

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 9

Introduction to VHDL #1

Constructing VHDL Models with CSA

Simulation with ModelSim Altera from Quartus II


VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

Experiment 0 OR3 Gate ECE 332 Section 000 Dr. Ron Hayne June 8, 2003

EE261: Intro to Digital Design

Designing with VHDL and FPGA

Document Version: 0.6 Document Date: 15 April 2011 Prepared by: Y. Ermoline for ATLAS Level-1Calorimeter Trigger

Quartus Counter Example. Last updated 9/6/18

File: /home/young/mywork/5.cordic_vhdl/a.beh/print.cordic_beh Page 1 of 10

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

TKT-1212 Digitaalijärjestelmien toteutus. Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008

BOUNDARY-SCAN TEST. Elektronski fakultet u Ni u. Smer: R. Predmet: Projektovanje ugra enih ra unarskih sistema. Studenti:

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

Chapter 8 VHDL Code Examples

In our case Dr. Johnson is setting the best practices

LECTURE Simulator 2: Textio, Wait, Clocks, and Test Benches

VHDL 200X: The Future of VHDL

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Lecture 14 Test Bench Design

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

Declarations of Components and Entities are similar Components are virtual design entities entity OR_3 is

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

Lecture 4. VHDL Fundamentals. George Mason University

Inthis lecture we will cover the following material:

Simulation with ModelSim Altera from Quartus II

Tri-State Bus Implementation

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

Very High Speed Integrated Circuit Har dware Description Language

Concurrent Signal Assignment Statements (CSAs)

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

VHDL 200X: The Future of VHDL

Entity, Architecture, Ports

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

UNIVERZITET U BEOGRADU ELEKTROTEHNIČKI FAKULTET

Solutions - Homework 2 (Due date: October 9:30 am) Presentation and clarity are very important!

Generatore di parità. LIBRARY ieee; USE ieee.std_logic_1164.all ; ENTITY xor2 IS PORT( A, B : in std_logic ; Y : out std_logic ) ; END xor2 ;

File: /home/young/mywork/c.arithmetic/bshfit/print.bshift Page 1 of 13

Lecture 5: Aldec Active-HDL Simulator

Introduction to VHDL. Main language concepts

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

Lecture 3 Introduction to VHDL

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 8

Symbolically the RS-Latch that is being simulated is the one shown below, it s truth table is also given:

Assignment 01 Computer Architecture Lab ECSE

Hardware Synthesis. Midia Reshadi. CE Department Science and research branch of Islamic Azad University

Review. LIBRARY list of library names; USE library.package.object; ENTITY entity_name IS generic declarations PORT ( signal_name(s): mode signal_type;

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Lattice VHDL Training

library STD; use STD.textio.all; library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; package cordic_pkg is

search_chr: ASM chart search_chr search_chr search_chr MEM_ENABLE MEM_WE MEM_ADDRESS MEM_DATAIN MEM_DATAOUT MEM_READY ADDRESS CHAR LEN nfound

VHDL Notes for Week 4. VHDL Programming in CprE 381. Entity and Component 9/22/2014. Generic Constant. Test bench

Tutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy

ECE 3401 Lecture 10. More on VHDL

Solutions - Homework 4 (Due date: November 9:30 am) Presentation and clarity are very important!

Review of Digital Design with VHDL

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Digital Systems Design

Lab # 5. Subprograms. Introduction

COE 405 Behavioral Descriptions in VHDL

Experiment 8 Introduction to VHDL

VHDL 3 BASIC OPERATORS AND ARCHITECTURE BODY. Design descriptions & design constructions examples are taken from foundation series examples

Symbolically a D-Latch can be represented as so, it s truth table is also given:

Polusabirač. design.vhd. testbench.vhd. library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis. Register File: An Example. Register File: An Example (cont d) Aleksandar Milenkovic

FINAL PROJECT DESIGN OF HOUGH TRANSFORM ON A CORDIC CONFIGURABLE ALGORITHM

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

File: /home/young/mywork/7.cordic_accuracy/ghdl/print.file Page 1 of 13

Multiplication Simple Gradeschool Algorithm for 16 Bits (32 Bit Result)

Digital Design. Chapter 9: Hardware Description Languages

Transcription:

3. Verifikacija projekta - Test bench entity TestBench is end entity TestBench; architecture TB_Arhitektura of TestBench is component UUT (Arhitektura_UUT) port( end component UUT; prazan entitet -- deklarisanje lokalnih signala i konstanti { { Deklaracija komponente za UUT { Po~etak opisa arhitekture u1: UUT port map ( konkurentno: ); sekvencionalno: seq: process end process seq; end architecture TB_Arhitektura; { { Instanciranje komponente koja se testira Testiranje Kraj opisa arhitekture Slika 3.1: Anatomija osnovne definicije test bench-a Definisanje pobude i željenog odziva Da bi se ispitao odziv Prvog_primera na sve moguće kombinacije ulaznih signala potrebno je da se kolo pobudi sa najviše osam kombinacija prikazanih u Tabeli 3.1. Tabela 3.1 A B C Y 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1

A 0 40 80 120 160 200 240 280 320 B 0 40 80 120 160 200 240 280 320 C 0 40 80 120 160 200 240 280 320 Y 0 40 80 120 160 200 240 280 320 Slika 3.2: Vremenski dijagram pobudnih signala (A, B, C) i očekivanog odziva (Y) Vreme na slici 3.2 dato je u ns. Primer 3.1: library IEEE; use IEEE.std_logic_1164.all; entity TestBench is end entity TestBench; architecture Prvi_projekat_TB of TestBench is component Prvi_projekat port (A, B, C: in std_logic; Y: out std_logic); end component; signal A, B, C, Y: std_logic; -- deklarisanje signala -- instanciranje komponente koja se testira UUT: Prvi_projekat port map ( A => A, B => B, C => C, Y => Y); -- Opis pobude preko konkurentne dodele vrednosti signala -- Definisanje pobude signala C C <= 0, 1 after 40ns, 0 after 80ns, 1 after 120ns, 0 after 160ns, 1 after 200ns, 0 after 240ns, 1 after 280ns, 0 after 320ns; -- Definisanje pobude signala B B <= 0, 1 after 80ns, 0 after 160ns, 1 after 240ns; -- Definisanje pobude signala A A <= 0, 1 after 160ns; end architecture Prvi_projekat_TB;

Primer 3.2: library IEEE; use IEEE.std_logic_1164.all; entity TestBench is end entity TestBench; architecture Prvi_projekat_TB of TestBench is component Prvi_projekat port (A, B, C: in std_logic; Y: out std_logic); end component; signal A, B, C, Y: std_logic; -- deklarisanje signala -- Uveden 3-bitni signal 'ulaz' da bi se olaksao opis pobude -- MSB signala ulaz ulaz(2) odgovara signalu A, -- ulaz(1) odgovara signalu 'B' -- LSB signala ulaz ulaz(0) odgovara signalu C, signal ulaz: std_logic_vector (2 downto 0); -- definisanje konstante constant PropDelay: time := 40 ns; -- UUT: Prvi_projekat port map (A => ulaz(2), B => ulaz(1), C => ulaz(0), Y => Y); -- Opis pobude sekvencijalno u okviru procesa 'seq' seq: process ulaz <= "000"; ulaz <= "001"; ulaz <= "010"; ulaz <= "011"; ulaz <= "100"; ulaz <= "101"; ulaz <= "110"; ulaz <= "111"; end process seq; end architecture Prvi_projekat_TB;

- k-ti član vektora ulaz izdvaja se jednostavno pisanjem ulaz(k); - dodeljivanje vrednosti vektoru zahteva da se umesto jednostrukih, koriste dvostruki navodnici. Napomena: U narednim primerima koristi se Test Banch Wizard pomocu koga je deo VHDL kôda automatski generisan. Taj deo kôda je zasencen.

Primer 3.3: --************************************************************* --* This file is automatically generated test bench template * --* By ACTIVE-VHDL <TBgen v1.10>. Copyright (C) ALDEC Inc. * --* * --* This file was generated on: 7:05 PM, 11/30/01 * --* Tested entity name: Prvi_projekat * --* File name contains tested entity: $DSN\src\prviprojekatstruct.vhd * --************************************************************* library ieee; use ieee.std_logic_1164.all; -- Add your code here... use Nase_primitive.all; entity tb_wizard is end tb_wizard; architecture TB_WIZARD_ARCH of tb_wizard is -- Component declaration of the tested unit component Prvi_projekat port( A : in std_logic; B : in std_logic; C : in std_logic; Y : out std_logic ); end component; -- Stimulus signals - signals mapped to the input and inout ports of tested entity signal A : std_logic; signal B : std_logic; signal C : std_logic; -- Observed signals - signals mapped to the output ports of tested entity signal Y : std_logic; -- Add your code here... signal ulaz: std_logic_vector (2 downto 0); signal izlaz: std_logic; constant PropDelay: time := 40 ns; constant Citaj: time := 10ns; -- Unit Under Test port map UUT : Prvi_projekat port map (A => ulaz(2), B => ulaz(1), C => ulaz(0), Y => Y );

-- Add your stimulus here... seq: process ulaz <= "000"; izlaz <= '1'; wait for Citaj; assert (Y = izlaz) report "Greska za 000" severity warning; ulaz <= "001"; izlaz <= '1';wait for Citaj; assert (Y = izlaz) report "Greska za 001" severity warning; ulaz <= "010"; izlaz <= '0';wait for Citaj; assert (Y = izlaz) report "Greska za 010" severity warning; ulaz <= "011"; izlaz <= '1';wait for Citaj; assert (Y = izlaz) report "Greska za 011" severity warning; ulaz <= "100"; izlaz <= '0'; wait for Citaj; assert (Y = izlaz) report "Greska za 100" severity warning; ulaz <= "101"; izlaz <= '1'; wait for Citaj; assert (Y = izlaz) report "Greska za 101" severity warning; ulaz <= "110"; izlaz <= '0';wait for Citaj; assert (Y = izlaz) report "Greska za 110" severity warning; ulaz <= "111"; izlaz <= '1'; wait for Citaj; assert (Y = izlaz) report "Greska za 111" severity warning; end process seq; end TB_WIZARD_ARCH; configuration TESTBENCH_FOR_Prvi_projekat of tb_wizard is for TB_WIZARD_ARCH for UUT : Prvi_projekat use entity work.prvi_projekat(protok_podataka); end for; end for; end TESTBENCH_FOR_Prvi_projekat;

dat a2 Zapi s dat a1 No MU IN i 1 0 1 1 0 1 0 1 0 0 0 0 1 1 5 0 1 2 0 0 0 1 1 1 1 0 0 1 1 0 0 7 0 1 3 1 0 1 1 1 0 1 1 0 1 0 0 1 2 1 0................................................ n 0 1 0 1 0 1 0 0 0 1 0 0 0 9 1 1 Deklarisanje zapisa Zapi s Type Zapi s i s record dat a1: st d_l ogi c_vect or ( 7 downt o 0) ; dat a2: st d_l ogi c_vect or ( 4 downt o 0) ; No: i nt eger; MU: st d_l ogi c; IN: st d_l ogi c; end record Zapi s; Poziv na pojedine delove Zapi s - a: referenca vrednost Zapi s. dat a1( 2) 0001110 Zapi s. dat a2( 3) 01001 Zapi s. No (1) 5 Zapi s. MU (2) 0 Zapi s. I N (2) 1 Slika 3.3: Grafička predstava, deklaracija i poziv na pojedine vrednosti zapisa

Primer 3.4: --************************************************************* --* This file is automatically generated test bench template * --* By ACTIVE-VHDL <TBgen v1.10>. Copyright (C) ALDEC Inc. * --* * --* This file was generated on: 7:05 PM, 11/30/01 * --* Tested entity name: Prvi_projekat * --* File name contains tested entity: $DSN\src\prviprojekatstruct.vhd * --************************************************************* library ieee; use ieee.std_logic_1164.all; -- Add your code here... use std.textio.all; use Nase_primitive.all; entity tb_wizard is end tb_wizard; architecture TB_WIZARD_ARCH of tb_wizard is -- Component declaration of the tested unit component Prvi_projekat port( A : in std_logic; B : in std_logic; C : in std_logic; Y : out std_logic ); end component; -- Stimulus signals - signals mapped to the input and inout ports of tested entity signal A : std_logic; signal B : std_logic; signal C : std_logic; -- Observed signals - signals mapped to the output ports of tested entity signal Y : std_logic; -- Add your code here... signal ulaz: std_logic_vector (2 downto 0); signal izlaz: std_logic; constant PropDelay: time := 40 ns; constant Citaj: time := 10ns; constant Broj_kombinacija: integer :=8; type Vektor is record Pobuda: std_logic_vector (2 downto 0); Kontrola: std_logic; end record; type Kombinacije is array (0 to Broj_kombinacija -1) of Vektor; constant TabelaVektora: Kombinacije := ((Pobuda => "000", Kontrola => '1'), (Pobuda => "001", Kontrola => '1'), (Pobuda => "010", Kontrola => '0'),

(Pobuda => "011", Kontrola => '1'), (Pobuda => "100", Kontrola => '0'), (Pobuda => "101", Kontrola => '1'), (Pobuda => "110", Kontrola => '0'), (Pobuda => "111", Kontrola => '1')); -- Unit Under Test port map UUT : Prvi_projekat port map (A => ulaz(2), B => ulaz(1), C => ulaz(0), Y => Y ); -- Add your stimulus here... Petlja: process variable Greska: boolean := false; variable Privremeni: Vektor; variable Poruka: line; for i in TabelaVektora'range loop Privremeni := TabelaVektora(i); ulaz <= Privremeni.Pobuda; izlaz <= Privremeni.Kontrola; wait for Citaj; if Y /= izlaz then write (Poruka, string'("greska u ")); write (Poruka, now); writeline (output, Poruka); Greska := true; end if; end loop; assert Greska report " Nema gresaka" severity note; wait; end process Petlja; end TB_WIZARD_ARCH; configuration TESTBENCH_FOR_Prvi_projekat of tb_wizard is for TB_WIZARD_ARCH for UUT : Prvi_projekat use entity work.prvi_projekat(strukturni_opis); end for; end for; end TESTBENCH_FOR_Prvi_projekat;

Citanje test vektora za Prvi_projekat iz fajla Test vektor Prvog projekta i datum: # Test vektor prvog projekta # 08. Dec. 2001 0001 0011 0100 0110 1000 1011 1100 1111 Primer 3.5: --************************************************************* --* This file is automatically generated test bench template * --* By ACTIVE-VHDL <TBgen v1.10>. Copyright (C) ALDEC Inc. * --* * --* This file was generated on: 9:17 PM, 12/2/01 * --* Tested entity name: Prvi_projekat * --* File name contains tested entity: $DSN\src\prviprojekatstruct.vhd * --************************************************************* library ieee; use ieee.std_logic_1164.all; -- Add your library and packages declaration here... use IEEE.STD_LOGIC_TEXTIO.all; use STD.TEXTIO.all; use Nase_primitive.all; entity prvi_projekat_tb is end prvi_projekat_tb; architecture TB_ARCHITECTURE of prvi_projekat_tb is -- Component declaration of the tested unit component Prvi_projekat port( A : in std_logic; B : in std_logic; C : in std_logic; Y : out std_logic ); end component; -- Stimulus signals - signals mapped to the input and inout ports of tested entity signal A : std_logic; signal B : std_logic; signal C : std_logic; -- Observed signals - signals mapped to the output ports of tested entity signal Y : std_logic; -- Add your code here...

signal izlaz: std_logic; constant PropDelay: time := 40 ns; constant Citaj: time := 10ns; -- ovo je pomocni signal signal TacanOdziv: boolean := false; -- Deklarisanje fajla iz koga se cita file UlazniFajl: text is in "ulaznifajl.txt"; type Vektor is record Pobuda: std_logic_vector (2 downto 0); Kontrola: std_logic; end record; -- Unit Under Test port map UUT : Prvi_projekat port map (A => A, B => B, C => C, Y => Y ); --Below VHDL code is an inserted.\src\ulaznifajl.vhs --User can modify it... -- Add your stimulus here... Ucitaj: process -- Ucitava iz fajla -- "UlazniFajl" variable Red: line; variable DobroCita: boolean; variable Privremeni: Vektor; while not endfile (UlazniFajl) loop readline (UlazniFajl, Red); read (Red, Privremeni.Pobuda, good => DobroCita); next when not DobroCita; read (Red, Privremeni.Kontrola); A <= Privremeni.Pobuda(2); B <= Privremeni.Pobuda(1); C <= Privremeni.Pobuda(0); izlaz <= Privremeni.Kontrola; end loop; assert TacanOdziv report "Simulacija izpravno okoncana" severity note; wait; end process Ucitaj;

-- Kontrola izlaza Proveri: process variable Poruka: line; wait for Citaj; if Y /= izlaz then write (Poruka, string'("greska u trenutku ")); write (Poruka, now); writeline (output, Poruka); TacanOdziv <= True; end if; end process Proveri; end TB_ARCHITECTURE; configuration TESTBENCH_FOR_Prvi_projekat of prvi_projekat_tb is for TB_ARCHITECTURE for UUT : Prvi_projekat use entity work.prvi_projekat(strukturni_opis); end for; end for; end TESTBENCH_FOR_Prvi_projekat; end TESTBENCH_FOR_Prvi_projekat;

Kasnjenje VH 0,9 VH 0,1 VH TR TF Slika 3.4: Električna šema NOR2 kola u CMOS tehnologiji i R/F kašnjenje Primer 3.6: InertniA <= A after 10ns; ZakasneliA <= transport A after 10ns; Na slici 3.5 prikazani su efekti koji nastaju kada se na ulazu pojavi signal čija je dužina trajanja veća (a) i manja (b) od definisanog kašnjnja 10ns. 20ns 5ns A InertniA 10ns InertniA 10ns ZakasneliA ZakasneliA a) b) Slika 3.5: Razlika izmedju inercionog i transportnog kašnjenja

Modeli komponenata sa kasnjenjem Primer 3.7: --Model invertora library IEEE; use IEEE.std_logic_1164.all; entity INVT is generic ( thl: time := 2 ns; tlh: time := 1 ns); port ( i: in std_logic; o: out std_logic); end entity INVT; architecture rtlt of INVT is o <= (not i) after tlh when (i = '0') else (not i) after thl; end architecture rtlt; -- ======================================= -- Model AND2 library IEEE; use IEEE.std_logic_1164.all; entity AND2T is generic ( tlh: time := 2ns; thl: time := 4ns); port ( i1: in std_logic; i2: in std_logic; y: out std_logic); end entity AND2T; architecture rtlt of AND2T is y <= '1' after tlh when (i1 = '1' and i2 = '1') else '0' after thl; end architecture rtlt; -- ====================================== -- Model OR2 library IEEE; use IEEE.std_logic_1164.all; entity OR2T is generic ( thl: time := 2 ns; tlh: time := 1 ns); port ( i1: in std_logic; i2: in std_logic; y: out std_logic);

end entity OR2T; architecture rtlt of OR2T is y <= '1' after tlh when (i1 = '1' or i2 = '1') else '0' after thl; end architecture rtlt; -- ====================================== -- Nove modele smesticemo u paket Nase_primitiveT library IEEE; use IEEE.std_logic_1164.all; package Nase_primitiveT is component INVT generic ( thl: time; tlh: time); port ( i: in std_logic; o: out std_logic); end component INVT; component AND2T generic ( thl: time; tlh: time); port ( i1: in std_logic; i2: in std_logic; y: out std_logic); end component AND2T; component OR2T generic ( thl: time; tlh: time); port ( i1: in std_logic; i2: in std_logic; y: out std_logic); end component OR2T; end package Nase_primitiveT; -- ======================================= library IEEE; use IEEE.std_logic_1164.all; entity Prvi_projekat is port ( A: in std_logic; B: in std_logic; C: in std_logic; Y: out std_logic ); end entity Prvi_projekat; use work.nase_primitivet.all; -- koristi sve -- komponente iz -- paketa "Nase_primitiveT"

-- Definisanje strukturnog opisa arhitekture architecture Strukturni_opisT of Prvi_projekat is -- nema deklaracije "component" signal nota, notb, and2_out: std_logic; INV_1: invt generic map (thl => 10ns, tlh => 20ns) port map (i => A, o => nota); INV_2: invt generic map (thl => 10ns, tlh => 20ns) port map (i => B, o => notb); I_kolo: AND2T generic map (thl => 10ns, tlh => 20ns) port map (i1 => nota, i2 => notb, y => and2_out); ILI_kolo: OR2T generic map (thl => 10ns, tlh => 20ns) port map (i1 => and2_out, i2 => C, y => Y); end architecture Strukturni_opisT; -- =========================================================

--************************************************************* --* This file is automatically generated test bench template * --* By ACTIVE-VHDL <TBgen v1.10>. Copyright (C) ALDEC Inc. * --* * --* This file was generated on: 12:54 PM, 12/9/01 * --* Tested entity name: Prvi_projekat * --* File name contains tested entity: $DSN\src\prviprojekatstructT.vhd * --************************************************************* library ieee; use ieee.std_logic_1164.all; -- Add your library and packages declaration here... use IEEE.STD_LOGIC_TEXTIO.all; use STD.TEXTIO.all; use Nase_primitiveT.all; entity prvi_projekat_tb is end prvi_projekat_tb; architecture TB_ARCHITECTURE of prvi_projekat_tb is -- Component declaration of the tested unit component Prvi_projekat port( A : in std_logic; B : in std_logic; C : in std_logic; Y : out std_logic ); end component; -- Stimulus signals - signals mapped to the input and inout ports of tested entity signal A : std_logic; signal B : std_logic; signal C : std_logic; -- Observed signals - signals mapped to the output ports of tested entity signal Y : std_logic; -- Add your code here... signal izlaz: std_logic; constant PropDelay: time := 100 ns; constant Citaj: time := 50ns; -- ovo je pomocni signal signal TacanOdziv: boolean := false; -- Deklarisanje fajla iz koga se cita file UlazniFajl: text is in "ulaznifajl.txt"; type Vektor is record Pobuda: std_logic_vector (2 downto 0); Kontrola: std_logic; end record; -- Unit Under Test port map UUT : Prvi_projekat port map (A => A, B => B,

C => C, Y => Y ); -- Add your stimulus here... Ucitaj: process -- Ucitava iz fajla -- "UlazniFajl" variable Red: line; variable DobroCita: boolean; variable Privremeni: Vektor; while not endfile (UlazniFajl) loop readline (UlazniFajl, Red); read (Red, Privremeni.Pobuda, good => DobroCita); next when not DobroCita; read (Red, Privremeni.Kontrola); A <= Privremeni.Pobuda(2); B <= Privremeni.Pobuda(1); C <= Privremeni.Pobuda(0); izlaz <= Privremeni.Kontrola; end loop; assert TacanOdziv report "Simulacija izpravno okoncana" severity note; wait; end process Ucitaj; -- Kontrola izlaza Proveri: process variable Poruka: line; wait for Citaj; if Y /= izlaz then write (Poruka, string'("greska u trenutku ")); write (Poruka, now); writeline (output, Poruka); TacanOdziv <= True; end if; end process Proveri; end TB_ARCHITECTURE; configuration TESTBENCH_FOR_Prvi_projekat of prvi_projekat_tb is for TB_ARCHITECTURE for UUT : Prvi_projekat use entity work.prvi_projekat(strukturni_opist); end for; end for; end TESTBENCH_FOR_Prvi_projekat; -- =======================================================