Index into std_logic_vector using signal

I need to modify a certain portion of a register, but the upper and lower bound of the modified part depend on the input. Can the following code:

(1) be synthesised?

(2) if so, what circuit do the tools produce?

reg (to_integer (unsigned(upper1)) downto to_integer (unsigned(lower1)))
<= input (to_integer (unsigned(upper2)) downto to_integer (unsigned(lower2));


(edit: the syntax might be wrong, but I hope I've got the idea across)

• Isn't it exciting to just try it? – Gregory Kornblum Apr 7 '17 at 16:22
• Hint: multiplexers.. – Eugene Sh. Apr 7 '17 at 16:22
• Any time you see that many type conversions, step back and declare things in the right type in the first place. – Brian Drummond Apr 7 '17 at 18:54