From 7d5bfac5526528e32f5f44b9bea0bbdfee21a589 Mon Sep 17 00:00:00 2001 From: "T. Meissner" Date: Tue, 9 Feb 2021 07:31:00 +0100 Subject: Add support for PSL onehot/onehot0 functions (#1633) * vhdl: parse PSL onehot/onehot0 builtin calls. For #662 * update pyGHDL bindings * Synthesis of PSL built-in onehot/onehot0 function. * testsuite/synth: add tests of PSL built-in functions onehot()/onehot0() for #662 * doc: add info about PSL built-in functions onehot()/onehot0() for #662 * synth: refactor synthesis of onehot/onehot0 functions Co-authored-by: eine --- pyGHDL/libghdl/vhdl/nodes.py | 236 +++++++++++++++++++++--------------------- pyGHDL/libghdl/vhdl/tokens.py | 2 + 2 files changed, 122 insertions(+), 116 deletions(-) (limited to 'pyGHDL/libghdl/vhdl') diff --git a/pyGHDL/libghdl/vhdl/nodes.py b/pyGHDL/libghdl/vhdl/nodes.py index 976cc4457..a9acc450a 100644 --- a/pyGHDL/libghdl/vhdl/nodes.py +++ b/pyGHDL/libghdl/vhdl/nodes.py @@ -215,122 +215,124 @@ class Iir_Kind: Psl_Stable = 196 Psl_Rose = 197 Psl_Fell = 198 - Psl_Expression = 199 - Sensitized_Process_Statement = 200 - Process_Statement = 201 - Concurrent_Simple_Signal_Assignment = 202 - Concurrent_Conditional_Signal_Assignment = 203 - Concurrent_Selected_Signal_Assignment = 204 - Concurrent_Assertion_Statement = 205 - Concurrent_Procedure_Call_Statement = 206 - Concurrent_Break_Statement = 207 - Psl_Assert_Directive = 208 - Psl_Assume_Directive = 209 - Psl_Cover_Directive = 210 - Psl_Restrict_Directive = 211 - Block_Statement = 212 - If_Generate_Statement = 213 - Case_Generate_Statement = 214 - For_Generate_Statement = 215 - Component_Instantiation_Statement = 216 - Psl_Default_Clock = 217 - Generate_Statement_Body = 218 - If_Generate_Else_Clause = 219 - Simple_Simultaneous_Statement = 220 - Simultaneous_Null_Statement = 221 - Simultaneous_Procedural_Statement = 222 - Simultaneous_Case_Statement = 223 - Simultaneous_If_Statement = 224 - Simultaneous_Elsif = 225 - Simple_Signal_Assignment_Statement = 226 - Conditional_Signal_Assignment_Statement = 227 - Selected_Waveform_Assignment_Statement = 228 - Signal_Force_Assignment_Statement = 229 - Signal_Release_Assignment_Statement = 230 - Null_Statement = 231 - Assertion_Statement = 232 - Report_Statement = 233 - Wait_Statement = 234 - Variable_Assignment_Statement = 235 - Conditional_Variable_Assignment_Statement = 236 - Return_Statement = 237 - For_Loop_Statement = 238 - While_Loop_Statement = 239 - Next_Statement = 240 - Exit_Statement = 241 - Case_Statement = 242 - Procedure_Call_Statement = 243 - Break_Statement = 244 - If_Statement = 245 - Elsif = 246 - Character_Literal = 247 - Simple_Name = 248 - Selected_Name = 249 - Operator_Symbol = 250 - Reference_Name = 251 - External_Constant_Name = 252 - External_Signal_Name = 253 - External_Variable_Name = 254 - Selected_By_All_Name = 255 - Parenthesis_Name = 256 - Package_Pathname = 257 - Absolute_Pathname = 258 - Relative_Pathname = 259 - Pathname_Element = 260 - Base_Attribute = 261 - Subtype_Attribute = 262 - Element_Attribute = 263 - Across_Attribute = 264 - Through_Attribute = 265 - Nature_Reference_Attribute = 266 - Left_Type_Attribute = 267 - Right_Type_Attribute = 268 - High_Type_Attribute = 269 - Low_Type_Attribute = 270 - Ascending_Type_Attribute = 271 - Image_Attribute = 272 - Value_Attribute = 273 - Pos_Attribute = 274 - Val_Attribute = 275 - Succ_Attribute = 276 - Pred_Attribute = 277 - Leftof_Attribute = 278 - Rightof_Attribute = 279 - Signal_Slew_Attribute = 280 - Quantity_Slew_Attribute = 281 - Ramp_Attribute = 282 - Zoh_Attribute = 283 - Ltf_Attribute = 284 - Ztf_Attribute = 285 - Dot_Attribute = 286 - Integ_Attribute = 287 - Above_Attribute = 288 - Quantity_Delayed_Attribute = 289 - Delayed_Attribute = 290 - Stable_Attribute = 291 - Quiet_Attribute = 292 - Transaction_Attribute = 293 - Event_Attribute = 294 - Active_Attribute = 295 - Last_Event_Attribute = 296 - Last_Active_Attribute = 297 - Last_Value_Attribute = 298 - Driving_Attribute = 299 - Driving_Value_Attribute = 300 - Behavior_Attribute = 301 - Structure_Attribute = 302 - Simple_Name_Attribute = 303 - Instance_Name_Attribute = 304 - Path_Name_Attribute = 305 - Left_Array_Attribute = 306 - Right_Array_Attribute = 307 - High_Array_Attribute = 308 - Low_Array_Attribute = 309 - Length_Array_Attribute = 310 - Ascending_Array_Attribute = 311 - Range_Array_Attribute = 312 - Reverse_Range_Array_Attribute = 313 - Attribute_Name = 314 + Psl_Onehot = 199 + Psl_Onehot0 = 200 + Psl_Expression = 201 + Sensitized_Process_Statement = 202 + Process_Statement = 203 + Concurrent_Simple_Signal_Assignment = 204 + Concurrent_Conditional_Signal_Assignment = 205 + Concurrent_Selected_Signal_Assignment = 206 + Concurrent_Assertion_Statement = 207 + Concurrent_Procedure_Call_Statement = 208 + Concurrent_Break_Statement = 209 + Psl_Assert_Directive = 210 + Psl_Assume_Directive = 211 + Psl_Cover_Directive = 212 + Psl_Restrict_Directive = 213 + Block_Statement = 214 + If_Generate_Statement = 215 + Case_Generate_Statement = 216 + For_Generate_Statement = 217 + Component_Instantiation_Statement = 218 + Psl_Default_Clock = 219 + Generate_Statement_Body = 220 + If_Generate_Else_Clause = 221 + Simple_Simultaneous_Statement = 222 + Simultaneous_Null_Statement = 223 + Simultaneous_Procedural_Statement = 224 + Simultaneous_Case_Statement = 225 + Simultaneous_If_Statement = 226 + Simultaneous_Elsif = 227 + Simple_Signal_Assignment_Statement = 228 + Conditional_Signal_Assignment_Statement = 229 + Selected_Waveform_Assignment_Statement = 230 + Signal_Force_Assignment_Statement = 231 + Signal_Release_Assignment_Statement = 232 + Null_Statement = 233 + Assertion_Statement = 234 + Report_Statement = 235 + Wait_Statement = 236 + Variable_Assignment_Statement = 237 + Conditional_Variable_Assignment_Statement = 238 + Return_Statement = 239 + For_Loop_Statement = 240 + While_Loop_Statement = 241 + Next_Statement = 242 + Exit_Statement = 243 + Case_Statement = 244 + Procedure_Call_Statement = 245 + Break_Statement = 246 + If_Statement = 247 + Elsif = 248 + Character_Literal = 249 + Simple_Name = 250 + Selected_Name = 251 + Operator_Symbol = 252 + Reference_Name = 253 + External_Constant_Name = 254 + External_Signal_Name = 255 + External_Variable_Name = 256 + Selected_By_All_Name = 257 + Parenthesis_Name = 258 + Package_Pathname = 259 + Absolute_Pathname = 260 + Relative_Pathname = 261 + Pathname_Element = 262 + Base_Attribute = 263 + Subtype_Attribute = 264 + Element_Attribute = 265 + Across_Attribute = 266 + Through_Attribute = 267 + Nature_Reference_Attribute = 268 + Left_Type_Attribute = 269 + Right_Type_Attribute = 270 + High_Type_Attribute = 271 + Low_Type_Attribute = 272 + Ascending_Type_Attribute = 273 + Image_Attribute = 274 + Value_Attribute = 275 + Pos_Attribute = 276 + Val_Attribute = 277 + Succ_Attribute = 278 + Pred_Attribute = 279 + Leftof_Attribute = 280 + Rightof_Attribute = 281 + Signal_Slew_Attribute = 282 + Quantity_Slew_Attribute = 283 + Ramp_Attribute = 284 + Zoh_Attribute = 285 + Ltf_Attribute = 286 + Ztf_Attribute = 287 + Dot_Attribute = 288 + Integ_Attribute = 289 + Above_Attribute = 290 + Quantity_Delayed_Attribute = 291 + Delayed_Attribute = 292 + Stable_Attribute = 293 + Quiet_Attribute = 294 + Transaction_Attribute = 295 + Event_Attribute = 296 + Active_Attribute = 297 + Last_Event_Attribute = 298 + Last_Active_Attribute = 299 + Last_Value_Attribute = 300 + Driving_Attribute = 301 + Driving_Value_Attribute = 302 + Behavior_Attribute = 303 + Structure_Attribute = 304 + Simple_Name_Attribute = 305 + Instance_Name_Attribute = 306 + Path_Name_Attribute = 307 + Left_Array_Attribute = 308 + Right_Array_Attribute = 309 + High_Array_Attribute = 310 + Low_Array_Attribute = 311 + Length_Array_Attribute = 312 + Ascending_Array_Attribute = 313 + Range_Array_Attribute = 314 + Reverse_Range_Array_Attribute = 315 + Attribute_Name = 316 @export @@ -565,6 +567,8 @@ class Iir_Kinds: Iir_Kind.Psl_Stable, Iir_Kind.Psl_Rose, Iir_Kind.Psl_Fell, + Iir_Kind.Psl_Onehot, + Iir_Kind.Psl_Onehot0, ] Functions_And_Literals = [ diff --git a/pyGHDL/libghdl/vhdl/tokens.py b/pyGHDL/libghdl/vhdl/tokens.py index a846ea623..54c1d0ef9 100644 --- a/pyGHDL/libghdl/vhdl/tokens.py +++ b/pyGHDL/libghdl/vhdl/tokens.py @@ -227,3 +227,5 @@ class Tok: Stable = 218 Fell = 219 Rose = 220 + Onehot = 221 + Onehot0 = 222 -- cgit v1.2.3