Null slice? Synthesis in XST?

B

Brandon

I'm using the following as a reference:

http://groups.google.com/group/comp...=what+is+a+null+slice&rnum=1#906fd9fdca98a35a

I have to perform sign extension and/or zero padding on some
fixed-point numbers. I want to avoid writing conditions for simplicity
so...

This probably doesn't make much sense, but here is the code:
<SNIP>
-- Zero pad
y(csum_frwidth_g-2*(dwidth_g-1)-1 downto 0) <= (others => '0');
-- Sign extend
y(csum_whwidth_g+csum_frwidth_g downto csum_frwidth_g+2) <= (others =>
x(x'high) );
</SNIP>

Here are two possible conditions:


-- Elaboration Condition #1 (no pad, no sign extend):
dwidth_g := 4;
csum_frwidth_g := 4;
cscum_whwidth_g := 1;

y(-3 downto 0) <= (others => '0'); -- no zero pad -> null slice?
y(5 downto 6) <= (others => x(x'high) ); -- no sign ext -> null slice?


-- Elaboration Condition #2 (pad, sign extend):
dwidth_g := 4;
csum_frwidth_g := 8;
cscum_whwidth_g := 5;

y(1 downto 0) <= (others => '0'); -- zero pad
y(13 downto 10) <= (others => x(x'high) ); -- sign extend


This compiles, but is it okay to write this way for synthesis tools,
especially XST?

Thanks,
-Brandon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top