Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] different vector size assighning?

Status
Not open for further replies.

romikot

Newbie level 6
Joined
Jun 16, 2012
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,383
mispar : in STD_LOGIC_VECTOR (4 downto 0); --defining 5 bit input
signal misparregi : std_logic_vector (8 downto 0) ; --defining 9 bit signal
i want to assighn the input "mispar" to the lowest bits in the signal "misparregi"
the compiler gives me an error telling me that they are diffrent sizes.
is there a way around it?
 

Dear romikot,

from the above snippet, I guess you are using VHDL. In VHDL, you can accomplish slicing using simple syntax:

Code:
misparregi(4 downto 0) <= mispar;

Just remember to keep the direction of the slice in the target vector (misparregi in the example) consistent with its definition.

Hope this helps
Best regards
 
Dear romikot,

from the above snippet, I guess you are using VHDL. In VHDL, you can accomplish slicing using simple syntax:

Code:
misparregi(4 downto 0) <= mispar;

Just remember to keep the direction of the slice in the target vector (misparregi in the example) consistent with its definition.

Hope this helps
Best regards

Its not working !:sad: ill post the full code maybe itll be easier to understand my problem.
entity bindiv is
Port ( mispar : in STD_LOGIC_VECTOR (4 downto 0);
mehalek : in STD_LOGIC_VECTOR (4 downto 0);
moza : out STD_LOGIC_VECTOR (4 downto 0);
reset: in std_logic;
clk : in STD_LOGIC);
end bindiv;

architecture Behavioral of bindiv is
signal hishuvim : std_logic_vector (8 downto 0);
hishuvim(4 downto 0)<=mispar;
signal mikum : integer range 4 downto 0 :=4;
begin
process(clk)
begin
if clk'event and clk='1' then
if reset='1' then

mikum<=4;
else

end if;
end if;
end process;
end Behavioral;
im trying to assighn "mispar" to the lowest bits of "hishuvim"
i need "hishuvim" to be (8 downto 0) for later proccessing.
 

At first, I suggest you to use the 'code' tags when posting code, otherwise it is difficult to read ;-)

Concerning your code, it simply won't compile since the following assignment
Code:
hishuvim(4 downto 0) <= mispar;
should go after the 'begin' keyword related to the 'architecture' section; just leave declarations in the architecture preamble!

Cheers
 

At first, I suggest you to use the 'code' tags when posting code, otherwise it is difficult to read ;-)


Cheers

sorry didnt know that there is that option.
yep i noticed that my code was before the begin.( thanks)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top