S
SnakeyJakey
Guest
i am struggling to assign values to different bits of the same signal
concurrently eg
signal a : std_logic_vector(31 downto 0) :=
"10101010101010101010101010101010";
signal b : std_logic_vector(31 downto 0) :=
"11111111111111110000000000000000";
signal c : std_logic_vector(31 downto 0);
begin
c(4 downto 0) <= b(4 downto 0);
c(31 downto 5) <= a(31 downto 5);
end;
works find whereas
signal integer1 : integer := 5;
c(integer1-1 downto 0) <= b(integer1-1 downto 0);
c(31 downto integer1) <= a(31 downto integer1);
produces all U when simulated. i cant see why this wouldnt work since
i am assigning to different bit of c. the below does work though
x(integer1-1 downto 0) <= b(integer1-1 downto 0);
y(31 downto integer1) <= a(31 downto integer1);
c <= y(31 downto integer1) & x(integer1-1 downto 0);
which shows that the assignments individually are correct but just seem
not to work concurrently.
eventually i will be using conv_integer instead of defining a seperate
integer signal.
c(conv_integer(t1)-1 downto 0) <= b(conv_integer(t1)-1 downto 0);
c(31 downto conv_integer(t1)) <= a(31 downto conv_integer(t1));
which always seems to add extra errors due to conv_integer not
happening instantly.
i hope my (semi)psuedo vhdl is understandable to everyone. i have
tried with the auth, signed and unsigned librarys but none seem to
work. i am using modelsim to both compile and simulate if that makes a
difference.
hope someone can cope me in the rigth direction.
concurrently eg
signal a : std_logic_vector(31 downto 0) :=
"10101010101010101010101010101010";
signal b : std_logic_vector(31 downto 0) :=
"11111111111111110000000000000000";
signal c : std_logic_vector(31 downto 0);
begin
c(4 downto 0) <= b(4 downto 0);
c(31 downto 5) <= a(31 downto 5);
end;
works find whereas
signal integer1 : integer := 5;
c(integer1-1 downto 0) <= b(integer1-1 downto 0);
c(31 downto integer1) <= a(31 downto integer1);
produces all U when simulated. i cant see why this wouldnt work since
i am assigning to different bit of c. the below does work though
x(integer1-1 downto 0) <= b(integer1-1 downto 0);
y(31 downto integer1) <= a(31 downto integer1);
c <= y(31 downto integer1) & x(integer1-1 downto 0);
which shows that the assignments individually are correct but just seem
not to work concurrently.
eventually i will be using conv_integer instead of defining a seperate
integer signal.
c(conv_integer(t1)-1 downto 0) <= b(conv_integer(t1)-1 downto 0);
c(31 downto conv_integer(t1)) <= a(31 downto conv_integer(t1));
which always seems to add extra errors due to conv_integer not
happening instantly.
i hope my (semi)psuedo vhdl is understandable to everyone. i have
tried with the auth, signed and unsigned librarys but none seem to
work. i am using modelsim to both compile and simulate if that makes a
difference.
hope someone can cope me in the rigth direction.