Altera_Forum
Honored Contributor
15 years agovhdl testbench issue in modelsim
I am having a problem in modelsim-altera with a vhdl testbench I have set up to generate a serial data stream. I created a procedure to generate the serial stream as such:
-- create procedure to generate one symbol long DL rx signal procedure dl_rx_gen ( signal clk : in std_logic; signal encoded_symbol : in std_logic_vector(13 downto 0); signal dl_serial_out : out std_logic ) is begin -- loop for each half bit of encoded symbol for i in encoded_symbol'range loop dl_serial_out <= encoded_symbol(i); wait for dl_bit_period/2; -- two values per bit period for manchester encoding end loop; end procedure; I call this procedure repeatedly as follows: -- process to generate DL serial data process begin -- wait until after configuration is done wait for 525 ns; -- good packet dl_test_symbol <= "11111111111111"; -- idle dl_rx_gen( clk, dl_test_symbol, RX_DL_TTL(0) ); dl_test_symbol <= "10011001100110"; -- sync dl_rx_gen( clk, dl_test_symbol, RX_DL_TTL(0) ); dl_test_symbol <= "01010110100110"; -- start of frame dl_rx_gen( clk, dl_test_symbol, RX_DL_TTL(0) ); dl_test_symbol <= "01010101010101"; -- 0 dl_rx_gen( clk, dl_test_symbol, RX_DL_TTL(0) ); ... What I am seeing though is that the first bit in the test symbol sometimes gets inverted. It happens with both ones and zeros, although it does seem to be more likely to happen when the first bit has the opposite polarity of the last bit of the previous symbol - but I have seen it even when the previous bit is the same value. Does anyone know why this could happen? Thanks for the help.