EmbDev.net

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


von mk_vhdl m. (Company: mk_vhdl) (mk_vhdl)


Rate this post
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;

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
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?

von mk_vhdl m. (Company: mk_vhdl) (mk_vhdl)


Rate this post
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

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.