#### chandra1502

##### Newbie

I am currently working on a VHDL design that involves arithmetic operations with certain signals, but I'm facing timing issues that I need assistance with. I've provided a simplified version of the relevant code below.

Code:

```
when scale_calc =>
reg_intermediate_sub <= resize(max_input -min_input,32) ;--cc0
reg_intermediate_div <= to_signed(to_integer(signed(reg_intermediate_sub) / to_signed(255,32)), 32);
if unsigned(scale_cnt) <2 then
scale_cnt <= scale_cnt+1;
else
scale <= std_logic_vector(reg_intermediate_div);
state <= zero_point_calc;
scale_cnt<= "000";
end if;
when zero_point_calc =>
reg_mult_input <= to_signed(to_integer(signed(min_input) / signed(scale)), 32);
if unsigned(scale_cnt) < 2 then
scale_cnt <= scale_cnt + 1;
reg_mult <= not reg_mult_input(15 downto 0);
else
state <= zero_point_done;
scale_cnt <= "000";
q_min <= to_signed(-128, 16);
end if;
when zero_point_done =>
reg := reg_mult;
zero_cnt <= zero_cnt + 1;
if unsigned(zero_cnt) = 2 then
sum <= ('0' & q_min) + ('0' & reg) + "1"; ----timing error shows is i use reg/reg_mult signal here
elsif unsigned(zero_cnt) = 3 then
state <= out_data;
zero_point <= std_logic_vector(sum(7 downto 0));
end if;
when out_data => ...
```

In the above code, I'm performing arithmetic operations involving signals like reg_mult, q_min, and sum. When using specific signals like reg_mult or reg in the sum calculation, I'm encountering timing issues in implementation. Interestingly, if I use random values instead of these signals like to_signed(-27,16), the code works fine without any timing issue.

I've tried pipelining, using registered signals, and analyzing timing reports, but I'm still struggling with timing optimizations.

I'd greatly appreciate any insights, suggestions, or solutions from experienced designers who may have encountered similar situations. If you have any advice on how to tackle such timing issues in VHDL designs or can offer guidance on my specific case, please share your thoughts.

Thank you in advance for your help!