OpenCores

* Amber ARM-compatible core

Issue List
Method to initialize Amber registers for Altera users #30
Closed ccollineau opened this issue almost 9 years ago
ccollineau commented almost 9 years ago

Altera users may have noticed that the synthesizer ignores initialization constructs like:

reg dummy = 1'b1;

Enabling the "NOT gate push back" options doesn't seem to solve that problem either.

Stephen Leary has proposed a nice script that parses the source code and generates "initial" blocks to setup registers.

Another solution to circumvent that problem without modifying the Amber source code is to use the "POWER_UP_LEVEL" directive inside the QSF file. Below is the list of directives I use on my Quartus project. This list is quite minimalist. It may be possible to automate the generation of an exhaustive list with a script based on Stephen's one (http://pastebin.com/WyCJemH8).

List of directives to add in your QSF file (Paths may be updated to your hierarchy - Tested on Quartus 13.1 and 14.1):

set_instance_assignment -name POWER_UP_LEVEL LOW -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_condition0" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_condition1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_condition2" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_condition3" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_pc_sel1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_pc_wen" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_decode_iaccess" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_status_bits_mode0" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_status_bits_mode1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_status_bits_irq_mask" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_status_bits_firq_mask" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_iaddress_sel1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a25_core:u_amber|a25_decode:u_decode|o_daddress_sel1"

set_instance_assignment -name POWER_UP_LEVEL LOW -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_condition0" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_condition1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_condition2" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_condition3" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_pc_sel1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_pc_wen" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_decode_iaccess" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_status_bits_mode0" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_status_bits_mode1" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_status_bits_irq_mask" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_status_bits_firq_mask" set_instance_assignment -name POWER_UP_LEVEL HIGH -to "system:u_system|a23_core:u_amber|a23_decode:u_decode|o_address_sel1"

csantifort commented almost 9 years ago

Point of clarification. Altera correctly handles register initial values like this; reg dummy = 1'b1;

It does not correctly handle values when they are part of a port declaration, and are assigned a high initial value;

module abc ( output reg dummy = 1'd1 )

In that case the register is given an initial value of 0. A simple work around is to use a wire on the port and a register internally;

module abc ( output wire dummy_o ) reg dummy = 1'b1; assign dummy_o = dummy;

Eventually I'll get around to change the Amber source to use that format.

ccollineau commented almost 9 years ago

Indeed. I didn't notice that detail. Thanks for the clarification.

csantifort commented almost 9 years ago

I've made these code changes so should no longer be necessary to make any changes to source or via scripting to get correct initial values in Altera FPGAs. Release 89.

csantifort closed this almost 9 years ago

Assignee
No one
Labels
Idea