cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
407 Views
Registered: ‎01-05-2017

How to solve the "aggregate choice expression" error

Jump to solution

Hello

I would like to construct an SPI communication between an FPGA and arduino but having some problem. FPGA is planned to be a slave module. I found a master and slave design on github in here. Before I synthesize the code, I got an error regarding to below line,

bit_counter <= (conv_integer(NOT cpha) => '1', OTHERS => '0'); -- reset active bit indicator

and telling that

[Synth 8-211] could not evaluate expression: aggregate choice expression.

So I understand that Vivado 2019.2 is not happy with "others =>'0' " part but I even didn' t understand the expression on the right (conv_integer(NOT cpha) => '1', OTHERS => '0')

 

Could anyone clarify this expression for me and help to solve the issue. 

 

Best wishes

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Scholar
Scholar
396 Views
Registered: ‎08-01-2012

Its trying to set a specific bit to '1' , with the rest the 0. Because cpha is a sinlge bit it will be either bit 0 or bit 1. This is using non-standard VHDL library std_logic_arith.

The problem is here is because the width of the bit counter is non-static (because of the use of a generic) it cannot determin at compile time what bits others should apply to.

The other technical problem is you have logic in the async reset path, which is generally not recommended (better to leave resets to static values).

The easily way to fix the syntax error would be:

bit_counter <= (others => '0');
if cpha = '1' then
  bit_counter(0) <= '1';
else
  bit_counter(1) <= '1';
end if;

View solution in original post

Tags (1)
2 Replies
Highlighted
Scholar
Scholar
397 Views
Registered: ‎08-01-2012

Its trying to set a specific bit to '1' , with the rest the 0. Because cpha is a sinlge bit it will be either bit 0 or bit 1. This is using non-standard VHDL library std_logic_arith.

The problem is here is because the width of the bit counter is non-static (because of the use of a generic) it cannot determin at compile time what bits others should apply to.

The other technical problem is you have logic in the async reset path, which is generally not recommended (better to leave resets to static values).

The easily way to fix the syntax error would be:

bit_counter <= (others => '0');
if cpha = '1' then
  bit_counter(0) <= '1';
else
  bit_counter(1) <= '1';
end if;

View solution in original post

Tags (1)
Highlighted
Explorer
Explorer
279 Views
Registered: ‎01-05-2017
Dear @richardhead thank you for the answer. This worked!
0 Kudos