-- Extended locations for iir nodes -- Copyright (C) 2017 Tristan Gingold -- -- GHDL is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 2, or (at your option) any later -- version. -- -- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GHDL; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Tables; with Vhdl.Nodes_Priv; with Vhdl.Elocations_Meta; use Vhdl.Elocations_Meta; package body Vhdl.Elocations is -- Format of a node. type Format_Type is ( Format_None, Format_L1, Format_L2, Format_L3, Format_L4, Format_L5, Format_L6 ); -- Common fields are: -- Fields of Format_None: -- Fields of Format_L1: -- Field1 : Location_Type -- Fields of Format_L2: -- Field1 : Location_Type -- Field2 : Location_Type -- Fields of Format_L3: -- Field1 : Location_Type -- Field2 : Location_Type -- Field3 : Location_Type -- Fields of Format_L4: -- Field1 : Location_Type -- Field2 : Location_Type -- Field3 : Location_Type -- Field4 : Location_Type -- Fields of Format_L5: -- Field1 : Location_Type -- Field2 : Location_Type -- Field3 : Location_Type -- Field4 : Location_Type -- Field5 : Location_Type -- Fields of Format_L6: -- Field1 : Location_Type -- Field2 : Location_Type -- Field3 : Location_Type -- Field4 : Location_Type -- Field5 : Location_Type -- Field6 : Location_Type function Get_Format (Kind : Iir_Kind) return Format_Type; type Location_Index_Type is new Types.Nat32; No_Location_Index : constant Location_Index_Type := 0; package Elocations_Index_Table is new Tables (Table_Component_Type => Location_Index_Type, Table_Index_Type => Iir, Table_Low_Bound => 2, Table_Initial => 1024); package Elocations_Table is new Tables (Table_Component_Type => Location_Type, Table_Index_Type => Location_Index_Type, Table_Low_Bound => 2, Table_Initial => 1024); procedure Create_Elocations (N : Iir) is use Vhdl.Nodes_Priv; Format : constant Format_Type := Get_Format (Get_Kind (N)); El : constant Iir := Elocations_Index_Table.Last; Len : Location_Index_Type; Idx : Location_Index_Type; begin pragma Assert (Format /= Format_None); if El < N then Elocations_Index_Table.Set_Last (N); Elocations_Index_Table.Table (El + 1 .. N) := (others => No_Location_Index); end if; -- Must be called once. pragma Assert (Elocations_Index_Table.Table (N) = No_Location_Index); case Format is when Format_None => raise Program_Error; when Format_L1 => Len := 1; when Format_L2 => Len := 2; when Format_L3 => Len := 3; when Format_L4 => Len := 4; when Format_L5 => Len := 5; when Format_L6 => Len := 6; end case; Idx := Elocations_Table.Last + 1; Elocations_Index_Table.Table (N) := Idx; Elocations_Table.Set_Last (Idx + Len - 1); Elocations_Table.Table (Idx .. Idx + Len - 1) := (others => No_Location); end Create_Elocations; procedure Delete_Elocations (N : Iir) is use Vhdl.Nodes_Priv; Old : Location_Index_Type; begin -- Cannot delete an already deleted location. if N > Elocations_Index_Table.Last then return; end if; Old := Elocations_Index_Table.Table (N); if Old = No_Location_Index then return; end if; -- Clear the corresponding index. Elocations_Index_Table.Table (N) := No_Location_Index; -- FIXME: keep free slots in chained list ? end Delete_Elocations; procedure Free_Hook (N : Iir) is begin Delete_Elocations (N); end Free_Hook; generic Off : Location_Index_Type; function Get_F
/*
The MIT License (MIT)

Copyright (c) 2016 Fred Sundvik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#ifndef TMK_VISUALIZER_LED_TEST_H_
#define TMK_VISUALIZER_LED_TEST_H_

#include "visualizer.h"

bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_fade_out_all_leds(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_mirror_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_normal_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state);

extern keyframe_animation_t led_test_animation;


#endif /* TMK_VISUALIZER_LED_TEST_H_ */
| Iir_Kind_Low_Array_Attribute | Iir_Kind_Length_Array_Attribute | Iir_Kind_Ascending_Array_Attribute | Iir_Kind_Range_Array_Attribute | Iir_Kind_Reverse_Range_Array_Attribute | Iir_Kind_Attribute_Name => return Format_None; when Iir_Kind_Library_Clause | Iir_Kind_Association_Element_By_Expression | Iir_Kind_Association_Element_By_Individual | Iir_Kind_Association_Element_Open | Iir_Kind_Association_Element_Package | Iir_Kind_Association_Element_Type | Iir_Kind_Association_Element_Subprogram | Iir_Kind_Attribute_Specification | Iir_Kind_Anonymous_Type_Declaration | Iir_Kind_Attribute_Declaration | Iir_Kind_Group_Template_Declaration | Iir_Kind_Group_Declaration | Iir_Kind_Function_Declaration | Iir_Kind_Procedure_Declaration | Iir_Kind_Object_Alias_Declaration | Iir_Kind_File_Declaration | Iir_Kind_Signal_Declaration | Iir_Kind_Variable_Declaration | Iir_Kind_Constant_Declaration | Iir_Kind_Iterator_Declaration | Iir_Kind_Interface_Type_Declaration | Iir_Kind_Interface_Package_Declaration | Iir_Kind_Parenthesis_Expression | Iir_Kind_Concurrent_Simple_Signal_Assignment | Iir_Kind_Concurrent_Conditional_Signal_Assignment | Iir_Kind_Concurrent_Selected_Signal_Assignment => return Format_L1; when Iir_Kind_Protected_Type_Declaration | Iir_Kind_Record_Type_Definition | Iir_Kind_Protected_Type_Body | Iir_Kind_Configuration_Declaration | Iir_Kind_Context_Declaration | Iir_Kind_Package_Declaration | Iir_Kind_Package_Body | Iir_Kind_Case_Statement => return Format_L2; when Iir_Kind_Package_Instantiation_Declaration | Iir_Kind_Interface_Constant_Declaration | Iir_Kind_Interface_Variable_Declaration | Iir_Kind_Interface_Signal_Declaration | Iir_Kind_Interface_File_Declaration | Iir_Kind_If_Generate_Statement | Iir_Kind_For_Generate_Statement | Iir_Kind_Component_Instantiation_Statement | Iir_Kind_Generate_Statement_Body | Iir_Kind_If_Generate_Else_Clause | Iir_Kind_For_Loop_Statement | Iir_Kind_While_Loop_Statement | Iir_Kind_If_Statement | Iir_Kind_Elsif => return Format_L3; when Iir_Kind_Type_Declaration | Iir_Kind_Subtype_Declaration | Iir_Kind_Architecture_Body | Iir_Kind_Function_Body | Iir_Kind_Procedure_Body | Iir_Kind_Sensitized_Process_Statement | Iir_Kind_Process_Statement | Iir_Kind_Block_Statement => return Format_L4; when Iir_Kind_Package_Header => return Format_L5; when Iir_Kind_Block_Header | Iir_Kind_Entity_Declaration | Iir_Kind_Component_Declaration => return Format_L6; end case; end Get_Format; function Get_Start_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Start_Location (Get_Kind (N)), "no field Start_Location"); return Get_Field1 (N); end Get_Start_Location; procedure Set_Start_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Start_Location (Get_Kind (N)), "no field Start_Location"); Set_Field1 (N, Loc); end Set_Start_Location; function Get_Right_Paren_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Right_Paren_Location (Get_Kind (N)), "no field Right_Paren_Location"); return Get_Field1 (N); end Get_Right_Paren_Location; procedure Set_Right_Paren_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Right_Paren_Location (Get_Kind (N)), "no field Right_Paren_Location"); Set_Field1 (N, Loc); end Set_Right_Paren_Location; function Get_End_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_End_Location (Get_Kind (N)), "no field End_Location"); return Get_Field2 (N); end Get_End_Location; procedure Set_End_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_End_Location (Get_Kind (N)), "no field End_Location"); Set_Field2 (N, Loc); end Set_End_Location; function Get_Is_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Is_Location (Get_Kind (N)), "no field Is_Location"); return Get_Field4 (N); end Get_Is_Location; procedure Set_Is_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Is_Location (Get_Kind (N)), "no field Is_Location"); Set_Field4 (N, Loc); end Set_Is_Location; function Get_Begin_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Begin_Location (Get_Kind (N)), "no field Begin_Location"); return Get_Field3 (N); end Get_Begin_Location; procedure Set_Begin_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Begin_Location (Get_Kind (N)), "no field Begin_Location"); Set_Field3 (N, Loc); end Set_Begin_Location; function Get_Then_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Then_Location (Get_Kind (N)), "no field Then_Location"); return Get_Field3 (N); end Get_Then_Location; procedure Set_Then_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Then_Location (Get_Kind (N)), "no field Then_Location"); Set_Field3 (N, Loc); end Set_Then_Location; function Get_Loop_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Loop_Location (Get_Kind (N)), "no field Loop_Location"); return Get_Field3 (N); end Get_Loop_Location; procedure Set_Loop_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Loop_Location (Get_Kind (N)), "no field Loop_Location"); Set_Field3 (N, Loc); end Set_Loop_Location; function Get_Generate_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Generate_Location (Get_Kind (N)), "no field Generate_Location"); return Get_Field3 (N); end Get_Generate_Location; procedure Set_Generate_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Generate_Location (Get_Kind (N)), "no field Generate_Location"); Set_Field3 (N, Loc); end Set_Generate_Location; function Get_Generic_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Generic_Location (Get_Kind (N)), "no field Generic_Location"); return Get_Field5 (N); end Get_Generic_Location; procedure Set_Generic_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Generic_Location (Get_Kind (N)), "no field Generic_Location"); Set_Field5 (N, Loc); end Set_Generic_Location; function Get_Port_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Port_Location (Get_Kind (N)), "no field Port_Location"); return Get_Field6 (N); end Get_Port_Location; procedure Set_Port_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Port_Location (Get_Kind (N)), "no field Port_Location"); Set_Field6 (N, Loc); end Set_Port_Location; function Get_Generic_Map_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Generic_Map_Location (Get_Kind (N)), "no field Generic_Map_Location"); return Get_Field3 (N); end Get_Generic_Map_Location; procedure Set_Generic_Map_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Generic_Map_Location (Get_Kind (N)), "no field Generic_Map_Location"); Set_Field3 (N, Loc); end Set_Generic_Map_Location; function Get_Port_Map_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Port_Map_Location (Get_Kind (N)), "no field Port_Map_Location"); return Get_Field2 (N); end Get_Port_Map_Location; procedure Set_Port_Map_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Port_Map_Location (Get_Kind (N)), "no field Port_Map_Location"); Set_Field2 (N, Loc); end Set_Port_Map_Location; function Get_Arrow_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Arrow_Location (Get_Kind (N)), "no field Arrow_Location"); return Get_Field1 (N); end Get_Arrow_Location; procedure Set_Arrow_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Arrow_Location (Get_Kind (N)), "no field Arrow_Location"); Set_Field1 (N, Loc); end Set_Arrow_Location; function Get_Colon_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Colon_Location (Get_Kind (N)), "no field Colon_Location"); return Get_Field2 (N); end Get_Colon_Location; procedure Set_Colon_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Colon_Location (Get_Kind (N)), "no field Colon_Location"); Set_Field2 (N, Loc); end Set_Colon_Location; function Get_Assign_Location (N : Iir) return Location_Type is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Assign_Location (Get_Kind (N)), "no field Assign_Location"); return Get_Field3 (N); end Get_Assign_Location; procedure Set_Assign_Location (N : Iir; Loc : Location_Type) is begin pragma Assert (N /= Null_Iir); pragma Assert (Has_Assign_Location (Get_Kind (N)), "no field Assign_Location"); Set_Field3 (N, Loc); end Set_Assign_Location; begin Vhdl.Nodes.Register_Free_Hook (Free_Hook'Access); end Vhdl.Elocations;