EmbDev.net

Forum: FPGA, VHDL & Verilog simulate sll function with Modelsim - VHDL


Author: mk_vhdl mk_vhdl (Company: mk_vhdl) (mk_vhdl)
Posted on:

Rate this post
0 useful
not useful
Hello to all,

I am writing a VHDL code in ISE 9.2, using Modelsim PE 10 Student 
Edition for simulation. I want to use the sll function in order to 
rotate a std_logic_vector. When I synthesize the following code with ISE 
I do not get any errors. But when I am trying to simulate my program 
using Modelsim, I get only "U" signals. Could somebody tell me what I am 
doing wrong?

Thanks in advance

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--use IEEE.numeric_std.ALL;

entity shifter is

    Port ( Bus_B : in  STD_LOGIC_VECTOR (31 downto 0);
           shamt_in : in  STD_LOGIC_VECTOR (4 downto 0);
           shift_out : out  STD_LOGIC_VECTOR (31 downto 0));
end shifter;

architecture Behavioral of shifter is
        signal B_32 : bit_vector(31 downto 0);
  signal temp : std_logic_vector(31 downto 0);
begin


process ( Bus_B, shamt_in)
begin

  B_32 <= to_bitvector(Bus_B) sll conv_integer(shamt_in);
  temp <= to_stdlogicvector(B_32);

end process;

shift_out <= temp;

end Behavioral;

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
> I want to use the sll function in order to rotate a std_logic_vector.
The sll performs a shift operation, not a rotate operation...

> But when I am trying to simulate my program using Modelsim,
> I get only "U" signals.
How does your testbench look like? Can you post it?

Author: mk_vhdl mk_vhdl (Company: mk_vhdl) (mk_vhdl)
Posted on:

Rate this post
0 useful
not useful
You have right. Thanks a lot for your response. I think that I have 
found my problem. I typed this process in my test bench

  tb : PROCESS
  BEGIN

    -- Wait 100 ns for global reset to finish
    wait for 100 ns;

    shamt_in<="00001";
    Bus_B<=X"111111110";

    wait; -- will wait forever
  END PROCESS;

But I have made mismatch of the amount of bits in the HEX number. I 
should have typed Bus_B<=X"11111110";
The strange thing is that while I was running Modelsim I didn't get any 
warnings or errors. But now that I have restarted Modelsim and rerun my 
project I got the warning message, so I managed to fix the problem. Do 
you know why that happened?

Thanks a lot again for your response

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.