Continue to Site

Welcome to

Welcome to our site! 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] Problem with fixed point multiplication

Not open for further replies.


Newbie level 1
Apr 22, 2015
Reaction score
Trophy points
Activity points
I am trying to do a fixed point multiplication and I always get the same error in the simulation stage.

I have a histogram values saved in a memory and at some point I want to compute a threshold for that histogram which I will use to classify the bins in two groups. I have these 3 variables, where 'maxim' is the highest value of the histogram, 'thresh_low' is a percentage value to apply, let's say 0.2, and 'thvar' is where I am planning to save the absolute threshold value:

variable maxim : ufixed(18 downto 0);
variable thresh_low : ufixed(0 downto -8);
variable thvar : ufixed(18 downto -8);

At some point I assign values for the variables 'maxim' and 'thresh_low', and proceed to make a multiplication

thvar := maxim*thresh_low;​

My intention later is to discard all the decimal values from 'thvar' and keep the integer part as a threshold.

I am simulating all my code with Modelsim for now, so I compile the code without any errors and proceed to simulate. I have some other code that is executed before this part is, and it is simulated correctly. But, when the simulation arrives to the multiplication code, it stops and generates the following error:

# Fatal error in Process line__289 at pixelclassification_wrapper.vhd line 320
# HDL call sequence:
# Stopped at pixelclassification_wrapper.vhd 320 Process line__289

The line 320 of this code is the line I have the multiplication presented previously. If instead of having a multiplication I assign a value to 'thvar' everything will work correctly, so there is some problem when I am multiplying both ufixed values, but I really don't know what is it. Could anyone have an idea of what is happening?

Thank you in advance.

I'm not sure if this is the problem, but the bit widths don't match.

Code VHDL - [expand]
variable maxim : ufixed(18 downto 0);       -- 19 bits \ 28-bits
variable thresh_low : ufixed(0 downto -8);  --  9 bits /
variable thvar : ufixed(18 downto -8);      -- 27 bits

Maybe the thresh_low should be (-1 downto -8) if it's only a fractional value, otherwise by using (0 downto -8) it could be as large as 1.990234375 (i.e. 1 + 1/2 + ... + 1/256).
Not open for further replies.

Part and Inventory Search

Welcome to