Importing waveforms from ASCII files

Mar 22, 2005 2 Replies

Hi all, I'm trying to test a filter I implemented with Xilinx ISE 6.1, so I created a testbench waveform. I'd like to import the input waveform from an ASCII file because the Pattern Generator can create only simple patterns.


And on the 8th Day God said, "Murphy, take over!" |\ | |HomePage : http://nem01.altervista.org | \|emesis |XPN (my nr): http://xpn.altervista.org

Try something like this:

-- Copyright (c) 2003-2005 by Aldec, Inc. All rights reserved.

--

------------------------------------------------------------------------------------

--

-- Created on Wednesday 2005-04-13, 19:37:24

--

------------------------------------------------------------------------------------

-- Details:

-- Type: Clocked file stimulus

-- Data width: 16

-- Radix of values stored in the file is binary

-- Clock input CLK sensitive to rising edge

-- Clock enable input CE active high

-- Output Q

------------------------------------------------------------------------------------

--{{ Section below this comment is automatically maintained

-- and may be overwritten

--{entity {file_stim_clkd} architecture {file_stim_arch}}

library IEEE; use IEEE.std_logic_1164.all;

entity file_stim_clkd is port( CLK : in std_logic; CE : in std_logic; Q : out std_logic_vector(15 downto 0) ); end entity;

--}} End of automatically maintained section

library IEEE; use STD.textio.all; use IEEE.std_logic_textio.all;

architecture file_stim_arch of file_stim_clkd is constant file_name : string(1 to 12) := "stimulus.txt"; file stimulus : text open READ_MODE is file_name; begin reader : process variable line_read : line; variable signal_val : std_logic_vector(15 downto 0); begin processing : while not endfile(stimulus) loop

readline(stimulus, line_read); read(line_read, signal_val);

wait until (CE='1' and rising_edge(CLK));

Q

Mentre io pensavo ad una intro simpatica "Engineering Guy" scriveva:

[cut]

Thanks, finally I found a solution very close to yours.

Five out of four people have trouble with fractions. |\ | |HomePage : http://nem01.altervista.org | \|emesis |XPN (my nr): http://xpn.altervista.org

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required