# File 'lib/opcodes.rb', line 236definitialize(inst,name,decode_ring_key,field_data)raise"No field '#{name}', needed by #{inst.name}, in Opcodes module"unlessOpcodes::DECODER_RING.key?(decode_ring_key)
@@ -598,12 +598,12 @@
-227
-228
-229
+234
+235
+236
-
# File 'lib/opcodes.rb', line 227
+
# File 'lib/opcodes.rb', line 234defdecode_variable@decode_variable
@@ -641,12 +641,12 @@
-220
-221
-222
+227
+228
+229
-
# File 'lib/opcodes.rb', line 220
+
# File 'lib/opcodes.rb', line 227defname@name
@@ -696,12 +696,12 @@
-302
-303
-304
+309
+310
+311
-
# File 'lib/opcodes.rb', line 302
+
# File 'lib/opcodes.rb', line 309defbits@field_data[:bits].is_a?(Range)?[@field_data[:bits]]:@field_data[:bits]
@@ -748,12 +748,12 @@
-283
-284
-285
+290
+291
+292
-
# File 'lib/opcodes.rb', line 283
+
# File 'lib/opcodes.rb', line 290defeql?(other)@name.eql?(other.name)
@@ -789,13 +789,6 @@
# File 'lib/arch_def.rb', line 1267def<=>(other)raiseArgumentError,"ExtensionVersions are only comparable to other extension versions"unlessother.is_a?(ExtensionVersion)
@@ -784,19 +600,19 @@
# File 'lib/idl/ast.rb', line 1038deftype_check(symtab)
- var.type_check(symtab)
- type_error"#{var.text_value} must be an array or an integral type"unless[:array,:bits].include?(var.type(symtab).kind)
- type_errpr"Assigning to a constant"ifvar.type(symtab).const?
+ @lhs.type_check(symtab)
+ unless[:array,:bits].include?(@lhs.type(symtab).kind)
+ type_error"#{@lhs.text_value} must be an array or an integral type"
+ end
+ type_errpr"Assigning to a constant"if@lhs.type(symtab).const?
- idx.type_check(symtab)
+ @idx.type_check(symtab)
- type_error"Index must be integral"unlessidx.type(symtab).integral?
+ type_error"Index must be integral"unless@idx.type(symtab).integral?begin
- idx_value=idx.value(symtab)
- type_error"Array index (#{idx.text_value} = #{idx_value}) out of range (< #{var.type(symtab).width})"ifidx_value>=var.type(symtab).width
+ idx_value=@idx.value(symtab)
+ type_error"Array index (#{@idx.text_value} = #{idx_value}) out of range (< #{var.type(symtab).width})"ifidx_value>=@lhs.type(symtab).widthrescueValueError# OK, doesn't need to be known
end
- rval.type_check(symtab)
+ @rhs.type_check(symtab)
- casevar.type(symtab).kind
+ case@lhs.type(symtab).kindwhen:array
- unlessrval.type(symtab).convertable_to?(var.type(symtab).sub_type)
+ unless@rhs.type(symtab).convertable_to?(@lhs.type(symtab).sub_type)type_error"Incompatible type in array assignment"endwhen:bits
- unlessrval.type(symtab).convertable_to?(Type.new(:bits,width:1))
+ unless@rhs.type(symtab).convertable_to?(Type.new(:bits,width:1))type_error"Incompatible type in integer slice assignement"endelse
@@ -590,7 +839,7 @@
# File 'lib/idl/ast.rb', line 1018
+
+defto_ast
+ AryElementAssignmentAst.new(input,interval,var.to_ast,idx.to_ast,rval.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/AryRangeAccessAst.html b/docs/ruby/Idl/AryRangeAccessAst.html
index 79e80270f..f3fe3beda 100644
--- a/docs/ruby/Idl/AryRangeAccessAst.html
+++ b/docs/ruby/Idl/AryRangeAccessAst.html
@@ -452,15 +452,15 @@
-887
-888
-889
-890
-891
-892
+899
+900
+901
+902
+903
+904
-
# File 'lib/idl/ast.rb', line 887
+
# File 'lib/idl/ast.rb', line 899definitialize(input,interval,var,msb,lsb)super(input,interval,[var,msb,lsb])
@@ -506,12 +506,12 @@
-885
-886
-887
+897
+898
+899
-
# File 'lib/idl/ast.rb', line 885
+
# File 'lib/idl/ast.rb', line 897deflsb@lsb
@@ -549,12 +549,12 @@
-885
-886
-887
+897
+898
+899
-
# File 'lib/idl/ast.rb', line 885
+
# File 'lib/idl/ast.rb', line 897defmsb@msb
@@ -592,12 +592,12 @@
-885
-886
-887
+897
+898
+899
-
# File 'lib/idl/ast.rb', line 885
+
# File 'lib/idl/ast.rb', line 897defvar@var
@@ -629,15 +629,15 @@
-42
-43
-44
+67
+68
+69
-
# File 'lib/idl/passes/gen_adoc.rb', line 42
+
# File 'lib/idl/passes/gen_adoc.rb', line 67defgen_adoc(indent=0,indent_spaces:2)
- "#{var.gen_adoc(indent,indent_spaces:)}[#{msb.gen_adoc(0,indent_spaces:)}:#{msb.gen_adoc(0,indent_spaces:)}]"
+ "#{var.gen_adoc(indent,indent_spaces:)}[#{msb.gen_adoc(0,indent_spaces:)}:#{lsb.gen_adoc(0,indent_spaces:)}]"end
@@ -659,12 +659,12 @@
-96
-97
-98
+111
+112
+113
-
# File 'lib/idl/passes/prune.rb', line 96
+
# File 'lib/idl/passes/prune.rb', line 111defprune(symtab)AryRangeAccessAst.new(input,interval,@var.prune(symtab),@msb.prune(symtab),@lsb.prune(symtab))
@@ -718,10 +718,10 @@
-940
+952
-
# File 'lib/idl/ast.rb', line 940
+
# File 'lib/idl/ast.rb', line 952defto_idl="#{@var.to_idl}[#{@msb.to_idl}:#{@lsb.to_idl}]"
# File 'lib/idl/ast.rb', line 1792defvalue(symtab)ifop==">>>"
@@ -1565,7 +1567,9 @@
endelsev=eval"lhs.value(symtab) #{op} rhs.value(symtab)",binding,__FILE__,__LINE__
- v&((1<<type(symtab).width)-1)
+ v_trunc=v&((1<<type(symtab).width)-1)
+ warn"WARNING: The value of '#{text_value}' is truncated from #{v} to #{v_trunc} because the result is only #{type(symtab).width} bits"ifv!=v_trunc
+ v_truncendend
@@ -1674,7 +1678,7 @@
diff --git a/docs/ruby/Idl/BinaryExpressionRightAst.html b/docs/ruby/Idl/BinaryExpressionRightSyntaxNode.html
similarity index 62%
rename from docs/ruby/Idl/BinaryExpressionRightAst.html
rename to docs/ruby/Idl/BinaryExpressionRightSyntaxNode.html
index 70d50c4d9..ae8f79dff 100644
--- a/docs/ruby/Idl/BinaryExpressionRightAst.html
+++ b/docs/ruby/Idl/BinaryExpressionRightSyntaxNode.html
@@ -4,7 +4,7 @@
- Class: Idl::BinaryExpressionRightAst
+ Class: Idl::BinaryExpressionRightSyntaxNode
— Documentation by YARD 0.9.36
@@ -15,7 +15,7 @@
@@ -39,7 +39,7 @@
Index (B) »
Idl
»
- BinaryExpressionRightAst
+ BinaryExpressionRightSyntaxNode
# File 'lib/idl/ast.rb', line 1559
-deftype_check(_symtab,_archdef)
- raise"you must have forgotten the make_left pass"
+deftype_check(_symtab)
+ raise"you must have forgotten the to_ast pass"end
# File 'lib/idl/ast.rb', line 2106
+
+defto_ast
+ BuiltinVariableAst.new(input,interval,text_value)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/Compiler.html b/docs/ruby/Idl/Compiler.html
index e6400f9f8..13a459f72 100644
--- a/docs/ruby/Idl/Compiler.html
+++ b/docs/ruby/Idl/Compiler.html
@@ -128,7 +128,7 @@
# File 'lib/idl.rb', line 148
-
-defcompile_inst_operation(operation,symtab:SymbolTable.new,name:nil,parent:nil,input_file:nil,input_line:0)
- @parser.set_input_file(input_file,input_line)
-
- m=@parser.parse(operation,root::instruction_operation)
- ifm.nil?
- raiseSyntaxError,<<~MSG
- While parsing #{input_file}:#{@parser.failure_line}:#{@parser.failure_column}
-
-#{@parser.failure_reason}
- MSG
-end
-
- # fix up left recursion
-ast=m.to_ast
+
# File 'lib/idl.rb', line 171
+deftype_check(ast,symtab,what)# type check
-symtab.push
-
- begin
+ beginast.type_check(symtab)rescueAstNode::TypeError=>e
- ifname&&parent
- warn"In function #{name} of #{parent}:"
- elsifname&&parent.nil?
- warn"In function #{name}:"
- end
+ warn"While type checking #{what}:"warne.what
- warne.backtraceexit1rescueAstNode::InternalError=>e
- ifname&&parent
- warn"In function #{name} of #{parent}:"
- elsifname&&parent.nil?
- warn"In function #{name}:"
- end
+ warn"While type checking #{what}:"warne.whatwarne.backtraceexit1end
- symtab.popastend
# File 'lib/idl/ast.rb', line 2546
+
+defto_ast
+ ConditionalStatementAst.new(a.to_ast,expression.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/CsrFieldReadExpressionAst.html b/docs/ruby/Idl/CsrFieldReadExpressionAst.html
index ede12d9af..600fee921 100644
--- a/docs/ruby/Idl/CsrFieldReadExpressionAst.html
+++ b/docs/ruby/Idl/CsrFieldReadExpressionAst.html
@@ -392,23 +392,23 @@
# File 'lib/idl/ast.rb', line 4099deftype_check(symtab)
- ifidx.is_a?(IntAst)
+ ifidx.is_a?(IntLiteralAst)type_error"No CSR at address #{idx.text_value}"ifcsr_def(symtab).nil?else# idx is a csr name
@@ -868,13 +868,13 @@
-3965
-3966
-3967
-3968
+4156
+4157
+4158
+4159
-
# File 'lib/idl/ast.rb', line 3965
+
# File 'lib/idl/ast.rb', line 4156defvalue(symtab)value_error"'#{csr_name(symtab)}.#{field_name(symtab)}' is not RO"unlessfield_def(symtab).type=="RO"
@@ -986,7 +986,7 @@
# File 'lib/idl/ast.rb', line 4340defcsr_def(symtab)index=
- ifidx.is_a?(IntAst)
+ ifidx.is_a?(IntLiteralAst)# make sure this value is a defined CSR
symtab.archdef.csrs.index{|csr|csr.address==idx.text_value.to_i}else
@@ -390,12 +390,12 @@
-4171
-4172
-4173
+4362
+4363
+4364
-
# File 'lib/idl/ast.rb', line 4171
+
# File 'lib/idl/ast.rb', line 4362defexecute(symtab)value_error"CSR write"
@@ -420,12 +420,12 @@
-4166
-4167
-4168
+4357
+4358
+4359
-
# File 'lib/idl/ast.rb', line 4166
+
# File 'lib/idl/ast.rb', line 4357defname(symtab)csr_def(symtab).name
@@ -479,10 +479,10 @@
-4176
+4367
-
# File 'lib/idl/ast.rb', line 4176
+
# File 'lib/idl/ast.rb', line 4367defto_idl="CSR[#{idx.text_value}]"
@@ -574,12 +574,12 @@
-4162
-4163
-4164
+4353
+4354
+4355
-
# File 'lib/idl/ast.rb', line 4162
+
# File 'lib/idl/ast.rb', line 4353deftype(symtab)CsrType.new(csr_def(symtab))
@@ -669,24 +669,24 @@
# File 'lib/idl/ast.rb', line 4327deftype_check(symtab)
- ifidx.is_a?(IntAst)
+ ifidx.is_a?(IntLiteralAst)# make sure this value is a defined CSR
index=symtab.archdef.csrs.index{|csr|csr.address==idx.value(symtab)}type_error"No csr number '#{idx.value(symtab)}' was found"ifindex.nil?
@@ -707,7 +707,7 @@
Symbol table at the scope that the symbol(s) will be inserted
+
+
+
+
+
+
+
Raises:
+
+
+
+
+
+ (NotImplementedError)
+
+
+
+
+
+
+
+
+
+
+
+
+
+416
+
+
+
# File 'lib/idl/ast.rb', line 416
+
+defadd_symbol(symtab)=raiseNotImplementedError,"#{self.class.name} must implment add_symbol"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/DontCareLvalueAst.html b/docs/ruby/Idl/DontCareLvalueAst.html
index 6a08c0755..d1547d37d 100644
--- a/docs/ruby/Idl/DontCareLvalueAst.html
+++ b/docs/ruby/Idl/DontCareLvalueAst.html
@@ -276,10 +276,10 @@
-2492
+2650
-
# File 'lib/idl/ast.rb', line 2492
+
# File 'lib/idl/ast.rb', line 2650defto_idl="-"
@@ -351,12 +351,12 @@
-2485
-2486
-2487
+2643
+2644
+2645
-
# File 'lib/idl/ast.rb', line 2485
+
# File 'lib/idl/ast.rb', line 2643deftype(_symtab,_archdef)Type.new(:dontcare)
@@ -381,12 +381,12 @@
-2480
-2481
-2482
+2638
+2639
+2640
-
# File 'lib/idl/ast.rb', line 2480
+
# File 'lib/idl/ast.rb', line 2638deftype_check(_symtab)# nothing to do!
@@ -492,10 +492,10 @@
-2490
+2648
-
# File 'lib/idl/ast.rb', line 2490
+
# File 'lib/idl/ast.rb', line 2648defvalue(_symtab,_archdef)=internal_error"Why are you calling value for an lval?"
# File 'lib/idl/ast.rb', line 3878
+
+deftype_check(symtab)
+ @cond.type_check(symtab)
+ unless@cond.type(symtab).convertable_to?(:boolean)
+ type_error"'#{@cond.text_value}' is not boolean"
+ end
+
+ begin
+ # only type check the body if it is reachable
+if@cond.value(symtab)==true
+ @body.type_check(symtab)
+ return# don't bother with the rest
+end
+ rescueValueError
+ # condition isn't compile-time-known; have to check the body
+@body.type_check(symtab)
+ end
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/EnumDefinitionAst.html b/docs/ruby/Idl/EnumDefinitionAst.html
index 9adbc011e..5b9c16bb7 100644
--- a/docs/ruby/Idl/EnumDefinitionAst.html
+++ b/docs/ruby/Idl/EnumDefinitionAst.html
@@ -397,13 +397,13 @@
-616
-617
-618
-619
+628
+629
+630
+631
-
# File 'lib/idl/ast.rb', line 616
+
# File 'lib/idl/ast.rb', line 628defadd_symbol(symtab)et=EnumerationType.new(user_type_name.text_value,element_names,element_values)
@@ -458,14 +458,14 @@
-576
-577
-578
-579
-580
+588
+589
+590
+591
+592
-
# File 'lib/idl/ast.rb', line 576
+
# File 'lib/idl/ast.rb', line 588defelement_namesreturn@element_namesunless@element_names.nil?
@@ -521,27 +521,27 @@
# File 'lib/idl/ast.rb', line 2266deftype_check(symtab)
- enum_def_type=symtab.get(enum_class.text_value)
- type_error"No symbol #{enum_class.text_value} has been defined"ifenum_def_type.nil?
+ enum_def_type=symtab.get(@enum_class_name)
+ type_error"No symbol #{@enum_class_name} has been defined"ifenum_def_type.nil?
- type_error"#{enum_class.text_value} is not an enum type"unlessenum_def_type.is_a?(EnumerationType)
+ type_error"#{@enum_class_name} is not an enum type"unlessenum_def_type.is_a?(EnumerationType)
+ type_error"#{@enum_class_name} has no member '#{@member_name}'"ifenum_def_type.value(@member_name).nil?end
# File 'lib/idl/ast.rb', line 2242
+
+defto_ast
+ EnumRefAst.new(input,interval,enum_class.text_value,member.text_value)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/EnumerationType.html b/docs/ruby/Idl/EnumerationType.html
index 394bd0a0c..038c1a08a 100644
--- a/docs/ruby/Idl/EnumerationType.html
+++ b/docs/ruby/Idl/EnumerationType.html
@@ -551,9 +551,9 @@
defvalue(element_name)i=@element_names.index(element_name)
- raise"Could not find #{element_name} in enumeration #{@name}"ifi.nil?
+ returnnilifi.nil?
- return@element_values[i]
+ @element_values[i]end
@@ -565,7 +565,7 @@
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/FunctionBodyAst.html b/docs/ruby/Idl/FunctionBodyAst.html
index 87b39c408..5ee2614a7 100644
--- a/docs/ruby/Idl/FunctionBodyAst.html
+++ b/docs/ruby/Idl/FunctionBodyAst.html
@@ -150,7 +150,7 @@
# File 'lib/idl/ast.rb', line 3320defreturn_value(symtab)internal_error"Function bodies should be at global + 1 scope"unlesssymtab.levels==2
@@ -678,35 +682,35 @@
# File 'lib/idl/ast.rb', line 3338defreturn_values(symtab)internal_error"Function bodies should be at global + 1 scope"unlesssymtab.levels==2
@@ -754,12 +758,12 @@
-3121
-3122
-3123
+3289
+3290
+3291
-
# File 'lib/idl/ast.rb', line 3121
+
# File 'lib/idl/ast.rb', line 3289defstatements@stmts
@@ -784,17 +788,17 @@
-3197
-3198
-3199
-3200
-3201
-3202
-3203
-3204
+3365
+3366
+3367
+3368
+3369
+3370
+3371
+3372
-
# File 'lib/idl/ast.rb', line 3197
+
# File 'lib/idl/ast.rb', line 3365defto_idlresult=""
@@ -889,34 +893,34 @@
# File 'lib/idl/ast.rb', line 3294deftype_check(symtab)
- internal_error"Function bodies should be at global + 1 scope"unlesssymtab.levels==2
+ internal_error"Function bodies should be at global + 1 scope (at #{symtab.levels})"unlesssymtab.levels==2return_value_might_be_known=true
@@ -947,7 +951,7 @@
# File 'lib/idl/ast.rb', line 3275
+
+defto_ast
+ FunctionBodyAst.new(input,interval,func_stmt_list.elements.map(&:choice).map(&:to_ast))
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/FunctionCallExpressionAst.html b/docs/ruby/Idl/FunctionCallExpressionAst.html
index 8874ba4e1..297324a5c 100644
--- a/docs/ruby/Idl/FunctionCallExpressionAst.html
+++ b/docs/ruby/Idl/FunctionCallExpressionAst.html
@@ -104,7 +104,7 @@
# File 'lib/idl/ast.rb', line 3109deftype_check(symtab)level=symtab.levels
- func_def_type=symtab.get(name)
- type_error"No symbol #{name}"iffunc_def_type.nil?
+ func_def_type=symtab.get(@name)
+ type_error"No symbol #{@name}"iffunc_def_type.nil?unlessfunc_def_type.is_a?(FunctionType)
- type_error"#{name} is not a function (it's a #{func_def_type.class.name})"
+ type_error"#{@name} is not a function (it's a #{func_def_type.class.name})"end
- type_error"Missing template arguments in call to #{name}"iftemplate?&&func_def_type.template_names.empty?
+ type_error"Missing template arguments in call to #{@name}"iftemplate?&&func_def_type.template_names.empty?
- type_error"Template arguments provided in call to non-template function #{name}"if!template?&&!func_def_type.template_names.empty?
+ type_error"Template arguments provided in call to non-template function #{@name}"if!template?&&!func_def_type.template_names.empty?iftemplate?num_targs=template_arg_nodes.size
@@ -1029,7 +1175,7 @@
iffunc_def_type.num_args!=num_argstype_error"Wrong number of arguments to '#{name}' function call. Expecting #{func_def_type.num_args}, got #{num_args}"end
- arg_nodes.each_with_indexdo|a,idx|
+ arg_nodes.eachdo|a|a.type_check(symtab)endarg_nodes.each_with_indexdo|a,idx|
@@ -1079,32 +1225,30 @@
# File 'lib/idl/ast.rb', line 3168defvalue(symtab)func_def_type=symtab.get(name)
@@ -1112,19 +1256,17 @@
iffunc_def_type.builtin?ifname=="implemented?"extname_ref=arg_nodes[0]
- type_error"First argument should be a ExtensionName"unlessextname_ref.type(symtab).kind==:enum_ref&&extname_ref.type(symtab).enum_class.name=="ExtensionName"
+ type_error"First argument should be a ExtensionName"unlessextname_ref.type(symtab).kind==:enum_ref&&extname_ref.class_name=="ExtensionName"
- returnsymtab.archdef.ext?(arg_nodes[0].text_value.split(":").last)
+ returnsymtab.archdef.ext?(arg_nodes[0].member_name)elsevalue_error"value of builtin function cannot be known"endendtemplate_values=[]
- template_arg_nodes.each_with_indexdo|targ,idx|
- # targ_name = func_def_type.template_names[idx]
-# targ_type = func_def_type.template_types[idx]
-template_values<<targ.value(symtab)
+ template_arg_nodes.eachdo|targ|
+ template_values<<targ.value(symtab)endfunc_def_type.return_value(template_values,arg_nodes,symtab)
@@ -1235,7 +1377,7 @@
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/FunctionDefAst.html b/docs/ruby/Idl/FunctionDefAst.html
index 98c968814..0b7bbe6d8 100644
--- a/docs/ruby/Idl/FunctionDefAst.html
+++ b/docs/ruby/Idl/FunctionDefAst.html
@@ -639,19 +639,19 @@
# File 'lib/idl/ast.rb', line 3548deftemplate_types(symtab)return[]unlesstemplated?
@@ -1384,12 +1384,12 @@
-3212
-3213
-3214
+3380
+3381
+3382
-
# File 'lib/idl/ast.rb', line 3212
+
# File 'lib/idl/ast.rb', line 3380deftemplated?!targs.empty?
@@ -1479,17 +1479,17 @@
-3346
-3347
-3348
-3349
-3350
-3351
-3352
-3353
+3514
+3515
+3516
+3517
+3518
+3519
+3520
+3521
-
# File 'lib/idl/ast.rb', line 3346
+
# File 'lib/idl/ast.rb', line 3514deftype_check(symtab)internal_error"Functions must be declared at global scope (at #{symtab.levels})"unlesssymtab.levels==1
@@ -1519,32 +1519,32 @@
# File 'lib/idl/ast.rb', line 3500deftype_check_from_call(symtab)internal_error"Function definitions should be at global + 1 scope"unlesssymtab.levels==2
@@ -1692,25 +1692,25 @@
# File 'lib/idl/ast.rb', line 3483deftype_check_template_instance(symtab)internal_error"Function definitions should be at global + 1 scope"unlesssymtab.levels==2
@@ -1893,7 +1893,7 @@
-
- #to_idl ⇒ String
-
-
-
-
-
-
- Originally defined in module
- AstNodeFuncs
-
-
-
-
-
- This method is abstract.
-
-
-
-
Return valid IDL representation of the node (and its subtree)
-
-
-
-
-
-
-
Returns:
-
-
-
-
-
- (String)
-
-
-
- —
-
-
IDL code for the node
-
-
-
-
-
-
Raises:
-
-
-
-
-
- (NotImplementedError)
-
-
-
-
-
-
-
-
-
-
-
-
-
- #type_check(symtab) ⇒ void
-
-
-
-
-
-
- Originally defined in module
- AstNodeFuncs
-
-
-
-
-
- This method is abstract.
-
-
-
This method returns an undefined value.
-
type check this node and all children
-
-
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
-
-
\ No newline at end of file
diff --git a/docs/ruby/Idl/FunctionType.html b/docs/ruby/Idl/FunctionType.html
index 41747fc80..553492205 100644
--- a/docs/ruby/Idl/FunctionType.html
+++ b/docs/ruby/Idl/FunctionType.html
@@ -1240,7 +1240,7 @@
# File 'lib/idl/passes/gen_adoc.rb', line 57
+
+defgen_adoc(indent=0,indent_spaces:2)
+ text_value
+end
+
+
+
+
+
+
+
#name ⇒ String
@@ -342,12 +469,12 @@
-428
+440
-
# File 'lib/idl/ast.rb', line 428
+
# File 'lib/idl/ast.rb', line 440
-defname=text_value
+defname=@name
@@ -397,12 +524,12 @@
-449
+461
-
# File 'lib/idl/ast.rb', line 449
+
# File 'lib/idl/ast.rb', line 461
-defto_idl=text_value
+defto_idl=@name
@@ -423,19 +550,19 @@
-431
-432
-433
-434
-435
+443
+444
+445
+446
+447
-
# File 'lib/idl/ast.rb', line 431
+
# File 'lib/idl/ast.rb', line 443deftype(symtab)
- internal_error"Symbol not found (should have called type_check)"ifsymtab.get(text_value).nil?
+ internal_error"Symbol '#{@name}' not found (should have called type_check)"ifsymtab.get(@name).nil?
- symtab.get(text_value).type
+ symtab.get(@name).typeend
@@ -522,15 +649,15 @@
-423
-424
-425
+435
+436
+437
-
# File 'lib/idl/ast.rb', line 423
+
# File 'lib/idl/ast.rb', line 435deftype_check(symtab)
- type_error"no symbol named '#{text_value}' on line #{lineno}"ifsymtab.get(text_value).nil?
+ type_error"no symbol named '#{@name}' on line #{lineno}"ifsymtab.get(@name).nil?end
@@ -552,25 +679,25 @@
-438
-439
-440
-441
-442
-443
-444
-445
-446
+450
+451
+452
+453
+454
+455
+456
+457
+458
-
# File 'lib/idl/ast.rb', line 438
+
# File 'lib/idl/ast.rb', line 450defvalue(symtab)
- var=symtab.get(text_value)
+ var=symtab.get(@name)
- internal_error"Var was not found, call type_check first!"ifvar.nil?
+ type_error"Variable '#{@name}' was not found"ifvar.nil?
- value_error"Value of '#{text_value}' not known"ifvar.value.nil?
+ value_error"Value of '#{@name}' not known"ifvar.value.nil?var.valueend
# File 'lib/idl/ast.rb', line 420
+
+defto_ast=IdAst.new(input,interval,text_value)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/IfAst.html b/docs/ruby/Idl/IfAst.html
index c1fe1d525..ea5d47b28 100644
--- a/docs/ruby/Idl/IfAst.html
+++ b/docs/ruby/Idl/IfAst.html
@@ -502,30 +502,30 @@
# File 'lib/idl/ast.rb', line 3830
+
+defreturn_values(symtab)
+ values=[]
+ symtab.push
+ begin
+ @stmts.eachdo|s|
+ ifs.is_a?(Returns)
+ begin
+ v=s.return_value(symtab)
+ returnvalues.push(v).uniqunlessv.nil?
+ rescueValueError
+ values+=s.return_values(symtab)
+ end
+ else
+ s.execute(symtab)
+ end
+ end
+ ensure
+ symtab.pop
+ end
+
+ values.uniq
+end
+
+
+
+
+
+
+
+
+ #to_idl ⇒ String
+
+
+
+
+
+
+
+
+
Return valid IDL representation of the node (and its subtree)
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
+ (String)
+
+
+
+ —
+
+
IDL code for the node
+
+
+
+
+
+
+
+
+
+
+
+
+3861
+3862
+3863
+
+
+
# File 'lib/idl/ast.rb', line 3861
+
+defto_idl
+ stmts.map(&:to_idl).join("")
+end
+
+
+
+
+
+
+
+
+ #type_check(symtab) ⇒ void
+
+
+
+
+
+
+
+
This method returns an undefined value.
+
type check this node and all children
+
+
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
# File 'lib/idl/ast.rb', line 3915
+
+defto_ast
+ if_body_stmts=[]
+ if_body.elements.eachdo|e|
+ if_body_stmts<<e.e.to_ast
+ end
+ eifs=[]
+ unlesselseifs.empty?
+ elseifs.elements.eachdo|eif|
+ stmts=[]
+ eif.body.elements.eachdo|e|
+ stmts<<e.e.to_ast
+ end
+ eifs<<ElseIfAst.new(eif.expression.to_ast,stmts)
+ end
+ end
+ final_else_stmts=[]
+ unlessfinal_else.empty?
+ final_else.body.elements.eachdo|e|
+ final_else_stmts<<e.e.to_ast
+ end
+ end
+ if_body_ast=IfBodyAst.new(if_body_stmts)
+ final_else_ast=IfBodyAst.new(final_else_stmts)
+ ast=IfAst.new(if_cond.to_ast,if_body_ast,eifs,final_else_ast)
+ ast.parent=parent
+ if_body_ast.parent=ast
+ eifs.each{|eif|eif.parent=ast}
+ final_else_ast.parent=ast
+ ast
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/InstructionOperationAst.html b/docs/ruby/Idl/InstructionOperationAst.html
index 36f8c45c1..2c0c5ea2b 100644
--- a/docs/ruby/Idl/InstructionOperationAst.html
+++ b/docs/ruby/Idl/InstructionOperationAst.html
@@ -223,14 +223,14 @@
-3096
-3097
-3098
-3099
-3100
+3264
+3265
+3266
+3267
+3268
-
# File 'lib/idl/ast.rb', line 3096
+
# File 'lib/idl/ast.rb', line 3264defexecute(symtab)op_stmt_list.elements.eachdo|e|
@@ -257,10 +257,10 @@
-3102
+3270
-
# File 'lib/idl/ast.rb', line 3102
+
# File 'lib/idl/ast.rb', line 3270defto_idl=op_stmt_list.elements.map{|e|e.choice.to_idl}.join("")
@@ -348,14 +348,14 @@
-3090
-3091
-3092
-3093
-3094
+3258
+3259
+3260
+3261
+3262
-
# File 'lib/idl/ast.rb', line 3090
+
# File 'lib/idl/ast.rb', line 3258deftype_check(symtab)op_stmt_list.elements.eachdo|e|
@@ -372,7 +372,7 @@
# File 'lib/idl/ast.rb', line 2775
-
-deftype(symtab)
- text_value_no_underscores=text_value.delete("_")
- iftext_value_no_underscores=~/([0-9]+)?'(s?)([bodh]?)(.*)/
- width=::Regexp.last_match(1)
- signed=::Regexp.last_match(2)
- radix_id=::Regexp.last_match(3)
- value=::Regexp.last_match(4)
-
- ifwidth.nil?
- archdef=symtab.archdef
- width=archdef.config_params["XLEN"]ifwidth.nil?
- end
- radix_id="d"ifradix_id.empty?
-
- # ensure we actually have enough bits to represent the value
-caseradix_id
- when"b"
- @value=value.to_i(2)
- type_error("#{value} cannot be represented in #{width} bits")if@value.bit_length>width.to_i
- when"o"
- @value=value.to_i(8)
- type_error("#{value} cannot be represented in #{width} bits")if@value.bit_length>width.to_i
- when"d"
- @value=value.to_i(10)
- type_error("#{value} cannot be represented in #{width} bits")if@value.bit_length>width.to_i
- when"h"
- @value=value.to_i(16)
- type_error("#{value} cannot be represented in #{width} bits")if@value.bit_length>width.to_i
- end
-
- qualifiers=signed=="s"?[:signed,:const]:[:const]
- @type=Type.new(:bits,width:width.to_i,qualifiers:)
- elsiftext_value_no_underscores=~/0([bdx]?)([0-9a-fA-F]*)(s?)/
- radix_id=::Regexp.last_match(1)
- value=::Regexp.last_match(2)
- signed=::Regexp.last_match(3)
-
- radix_id="o"ifradix_id.empty?
-
- caseradix_id
- when"b"
- @value=value.to_i(2)
- when"o"
- @value=value.to_i(8)
- when"d"
- @value=value.to_i(10)
- when"x"
- @value=value.to_i(16)
- end
-
- qualifiers=signed=="s"?[:signed,:const]:[:const]
- width=signed=="s"?@value.bit_length+1:@value.bit_length
- width=1ifwidth.zero?# happens when the literal is '0'
-@type=Type.new(:bits,width:,qualifiers:)
- elsiftext_value_no_underscores=~/([0-9]*)(s?)/
- value=::Regexp.last_match(1)
- signed=::Regexp.last_match(2)
-
- @value=value.to_i(10)
-
- qualifiers=signed=="s"?[:signed,:const]:[:const]
- width=signed=="s"?@value.bit_length+1:@value.bit_length
- width=1ifwidth.zero?# happens when the literal is '0'
-@type=Type.new(:bits,width:,qualifiers:)
- else
- internal_error"Unhandled int value"
- end
- type_error(text_value)if@value.nil?
-
- return@type
-end
-
-
-
-
-
-
-
-
- #type_check(symtab) ⇒ void
-
-
-
-
-
-
-
-
This method returns an undefined value.
-
type check this node and all children
-
-
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
# File 'lib/idl/ast.rb', line 2885
+
+deftype_check(symtab)
+ iftext_value.delete("_")=~/([0-9]+)?'(s?)([bodh]?)(.*)/
+ # verilog-style literal
+width=::Regexp.last_match(1)
+ value_text=::Regexp.last_match(4)
+
+ ifwidth.nil?
+ width=symtab.archdef.config_params["XLEN"]
+ memoize=false
+ end
+
+ # ensure we actually have enough bits to represent the value
+type_error("#{value_text} cannot be represented in #{width} bits")ifunsigned_value.bit_length>width.to_i
+ end
+end
+
+
+
+
+
+
+
+
+ #type_error(reason) ⇒ Object
+
+
+
+
+
+
+ Originally defined in module
+ AstNodeFuncs
+
+
+
# File 'lib/idl/ast.rb', line 2871
+
+defto_ast
+ IntLiteralAst.new(input,interval)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/IsaAst.html b/docs/ruby/Idl/IsaAst.html
index eaf927884..52b9bc1ed 100644
--- a/docs/ruby/Idl/IsaAst.html
+++ b/docs/ruby/Idl/IsaAst.html
@@ -315,18 +315,18 @@
-522
-523
-524
-525
-526
-527
-528
-529
-530
+534
+535
+536
+537
+538
+539
+540
+541
+542
-
# File 'lib/idl/ast.rb', line 522
+
# File 'lib/idl/ast.rb', line 534defbitfieldsreturn@bitfieldsunless@bitfields.nil?
@@ -357,12 +357,12 @@
-495
-496
-497
+507
+508
+509
-
# File 'lib/idl/ast.rb', line 495
+
# File 'lib/idl/ast.rb', line 507defchildrenenums+bitfields+functions+globals
@@ -398,19 +398,19 @@
-511
-512
-513
-514
-515
-516
-517
-518
-519
-520
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
-
# File 'lib/idl/ast.rb', line 511
+
# File 'lib/idl/ast.rb', line 523defenumsreturn@enumsunless@enums.nil?
@@ -442,19 +442,19 @@
-532
-533
-534
-535
-536
-537
-538
-539
-540
-541
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
-
# File 'lib/idl/ast.rb', line 532
+
# File 'lib/idl/ast.rb', line 544deffunctionsreturn@functionsunless@functions.nil?
@@ -486,19 +486,19 @@
-499
-500
-501
-502
-503
-504
-505
-506
-507
-508
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
-
# File 'lib/idl/ast.rb', line 499
+
# File 'lib/idl/ast.rb', line 511defglobalsreturn@globalsunless@globals.nil?
@@ -530,18 +530,18 @@
-552
-553
-554
-555
-556
-557
-558
-559
-560
+564
+565
+566
+567
+568
+569
+570
+571
+572
-
# File 'lib/idl/ast.rb', line 552
+
# File 'lib/idl/ast.rb', line 564definstructionsreturn@instructionsunless@instructions.nil?
@@ -572,17 +572,17 @@
-543
-544
-545
-546
-547
-548
-549
-550
+555
+556
+557
+558
+559
+560
+561
+562
-
# File 'lib/idl/ast.rb', line 543
+
# File 'lib/idl/ast.rb', line 555deftype_check(symtab)definitions.elements.eachdo|e|
@@ -602,7 +602,7 @@
# File 'lib/idl/ast.rb', line 1347defadd_symbol(symtab)var_names.eachdo|vname|
@@ -362,10 +362,10 @@
-1328
+1354
-
# File 'lib/idl/ast.rb', line 1328
+
# File 'lib/idl/ast.rb', line 1354defto_idl="#{type.to_idl}#{var_names.map(&:to_idl).join(', ')}"
@@ -453,16 +453,16 @@
-1312
-1313
-1314
-1315
-1316
-1317
-1318
+1338
+1339
+1340
+1341
+1342
+1343
+1344
-
# File 'lib/idl/ast.rb', line 1312
+
# File 'lib/idl/ast.rb', line 1338deftype_check(symtab)type_error"No type named '#{type_name.text_value}' on line #{lineno}"iftype.nil?
@@ -520,19 +520,19 @@
if the type is dependent on symtab, and type_check was not called first
+
ValueError if some part of the statement cannot be executed at compile time
@@ -344,16 +338,38 @@
-2665
-2666
-2667
+2504
-
# File 'lib/idl/ast.rb', line 2665
+
# File 'lib/idl/ast.rb', line 2504
-deftype(symtab)
- Type.new(:bits,width:i.value(symtab).to_i)
-end
+defexecute(symtab);end
+
+
+
+
+
+
+
+
+ #to_idl ⇒ Object
+
+
+
+
+
+
+
+
+
+
+
+2507
+
+
+
# File 'lib/idl/ast.rb', line 2507
+
+defto_idl=""
@@ -373,7 +389,7 @@
This method returns an undefined value.
type check this node and all children
-
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
+
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
# File 'lib/idl/ast.rb', line 2501
-deftype_check(symtab)
- i.type_check(symtab)
-
- begin
- i.value(symtab)
- rescueValueError
- type_error"Bit width is not compile-time known"
- end
- type_error"Bit widht must be integral"unlessi.type(symtab).integral?
-end
# File 'lib/idl/ast.rb', line 1911
+
+defto_ast
+ ParenExpressionAst.new(input,interval,e.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/PostDecrementExpressionAst.html b/docs/ruby/Idl/PostDecrementExpressionAst.html
index f09bff11b..8b869756a 100644
--- a/docs/ruby/Idl/PostDecrementExpressionAst.html
+++ b/docs/ruby/Idl/PostDecrementExpressionAst.html
@@ -310,20 +310,24 @@
-2002
-2003
-2004
-2005
-2006
-2007
+2093
+2094
+2095
+2096
+2097
+2098
+2099
+2100
-
# File 'lib/idl/ast.rb', line 2002
+
# File 'lib/idl/ast.rb', line 2093defexecute(symtab)var=symtab.get(rval.text_value)internal_error"No symbol #{rval.text_value}"ifvar.nil?
+ value_error"value of variable '#{rval.text_value}' not know"ifvar.value.nil?
+
var.value=var.value-1end
@@ -346,10 +350,10 @@
-2009
+2102
-
# File 'lib/idl/ast.rb', line 2009
+
# File 'lib/idl/ast.rb', line 2102defto_idl="#{rval.to_idl}--"
@@ -372,12 +376,12 @@
-1997
-1998
-1999
+2088
+2089
+2090
-
# File 'lib/idl/ast.rb', line 1997
+
# File 'lib/idl/ast.rb', line 2088deftype(symtab)rval.type(symtab)
@@ -402,13 +406,13 @@
-1992
-1993
-1994
-1995
+2083
+2084
+2085
+2086
-
# File 'lib/idl/ast.rb', line 1992
+
# File 'lib/idl/ast.rb', line 2083deftype_check(symtab)rval.type_check(symtab)
@@ -424,7 +428,7 @@
# File 'lib/idl/ast.rb', line 2159defexecute(symtab)var=symtab.get(rval.text_value)
@@ -381,10 +381,10 @@
-2039
+2167
-
# File 'lib/idl/ast.rb', line 2039
+
# File 'lib/idl/ast.rb', line 2167defto_idl="#{rval.to_idl}++"
@@ -476,12 +476,12 @@
-2026
-2027
-2028
+2154
+2155
+2156
-
# File 'lib/idl/ast.rb', line 2026
+
# File 'lib/idl/ast.rb', line 2154deftype(symtab)rval.type(symtab)
@@ -571,17 +571,19 @@
-2020
-2021
-2022
-2023
+2147
+2148
+2149
+2150
+2151
-
# File 'lib/idl/ast.rb', line 2020
+
# File 'lib/idl/ast.rb', line 2147deftype_check(symtab)rval.type_check(symtab)var=symtab.get(rval.text_value)
+ type_error"Post increment variable must be integral"unlessvar.type.integral?end
# File 'lib/idl/ast.rb', line 2024
+
+defto_ast
+ ReplicationExpressionAst.new(input,interval,n.to_ast,v.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/ReturnStatementAst.html b/docs/ruby/Idl/ReturnStatementAst.html
index 65f2955a8..70abffc00 100644
--- a/docs/ruby/Idl/ReturnStatementAst.html
+++ b/docs/ruby/Idl/ReturnStatementAst.html
@@ -428,12 +428,12 @@
-2590
-2591
-2592
+2747
+2748
+2749
-
# File 'lib/idl/ast.rb', line 2590
+
# File 'lib/idl/ast.rb', line 2747defenclosing_functionfind_ancestor(FunctionDefAst)
@@ -487,35 +487,35 @@
# File 'lib/idl/ast.rb', line 1565
+
+defto_ast
+ SignCastAst.new(input,interval,expression.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/StatementAst.html b/docs/ruby/Idl/StatementAst.html
index 826c73788..8ad01faa3 100644
--- a/docs/ruby/Idl/StatementAst.html
+++ b/docs/ruby/Idl/StatementAst.html
@@ -359,13 +359,13 @@
-2373
-2374
-2375
-2376
+2521
+2522
+2523
+2524
-
# File 'lib/idl/ast.rb', line 2373
+
# File 'lib/idl/ast.rb', line 2521definitialize(action)super(action.input,action.interval,[action])
@@ -409,12 +409,12 @@
-2371
-2372
-2373
+2519
+2520
+2521
-
# File 'lib/idl/ast.rb', line 2371
+
# File 'lib/idl/ast.rb', line 2519defaction@action
@@ -495,17 +495,17 @@
-2384
-2385
-2386
-2387
-2388
-2389
-2390
-2391
+2532
+2533
+2534
+2535
+2536
+2537
+2538
+2539
-
# File 'lib/idl/ast.rb', line 2384
+
# File 'lib/idl/ast.rb', line 2532defexecute(symtab)if@action.is_a?(Declaration)
@@ -535,12 +535,12 @@
-66
-67
-68
+146
+147
+148
-
# File 'lib/idl/passes/gen_adoc.rb', line 66
+
# File 'lib/idl/passes/gen_adoc.rb', line 146defgen_adoc(indent=0,indent_spaces:2)"#{''*indent}#{action.gen_adoc(0,indent_spaces:)};"
@@ -565,37 +565,37 @@
# File 'lib/idl/ast.rb', line 2490
+
+defto_ast
+ StatementAst.new(a.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/SymbolTable.html b/docs/ruby/Idl/SymbolTable.html
index e1df427f2..b554b1e26 100644
--- a/docs/ruby/Idl/SymbolTable.html
+++ b/docs/ruby/Idl/SymbolTable.html
@@ -1798,7 +1798,7 @@
# File 'lib/idl/type.rb', line 530
-
-deftemplate_types
- @template_types
-end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/ruby/Idl/TernaryOperatorExpressionAst.html b/docs/ruby/Idl/TernaryOperatorExpressionAst.html
index 050c7a9ad..2ba060938 100644
--- a/docs/ruby/Idl/TernaryOperatorExpressionAst.html
+++ b/docs/ruby/Idl/TernaryOperatorExpressionAst.html
@@ -103,7 +103,9 @@
# File 'lib/idl/ast.rb', line 2393deftype_check(symtab)
- p9_binary_expression.type_check(symtab)
+ @condition.type_check(symtab)
+ type_error"ternary selector must be bool"unless@condition.type(symtab).kind==:boolean
+
begin
- cond=p9_binary_expression.value(symtab)
+ cond=@condition.value(symtab)# if the condition is compile-time-known, only check the used field
if(cond)
- t.type_check(symtab)
+ @true_expression.type_check(symtab)else
- f.type_check(symtab)
+ @false_expression.type_check(symtab)endrescueValueError
- t.type_check(symtab)
- f.type_check(symtab)
+ @true_expression.type_check(symtab)
+ @false_expression.type_check(symtab)
- unlesst.type(symtab).equal_to?(f.type(symtab))
+ unless@true_expression.type(symtab).equal_to?(@false_expression.type(symtab))# we'll allow dissimilar if they are both bits type
-unlesst.type(symtab).kind==:bits&&f.type(symtab).kind==:bits
- type_error"True and false options must be same type (have #{t.type(symtab)} and #{f.type(symtab)})"
+ unless@true_expression.type(symtab).kind==:bits&&@false_expression.type(symtab).kind==:bits
+ type_error"True and false options must be same type (have #{@true_expression.type(symtab)} and #{@false_expression.type(symtab)})"endendend
-
- type_error"ternary selector must be bool"unlessp9_binary_expression.type(symtab).kind==:boolean
-
-
end
@@ -784,15 +983,15 @@
-2291
-2292
-2293
+2439
+2440
+2441
-
# File 'lib/idl/ast.rb', line 2291
+
# File 'lib/idl/ast.rb', line 2439defvalue(symtab)
- condition.value(symtab)?t.value(symtab):f.value(symtab)
+ @condition.value(symtab)?@true_expression.value(symtab):@false_expression.value(symtab)end
# File 'lib/idl/ast.rb', line 2369
+
+defto_ast
+ TernaryOperatorExpressionAst.new(input,interval,p9_binary_expression.to_ast,t.to_ast,f.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/Type.html b/docs/ruby/Idl/Type.html
index 81b7218c4..9a90007ac 100644
--- a/docs/ruby/Idl/Type.html
+++ b/docs/ruby/Idl/Type.html
@@ -2525,7 +2525,7 @@
# File 'lib/idl/ast.rb', line 2314deftype_check(symtab)exp.type_check(symtab)
@@ -714,8 +768,8 @@
type_error"#{exp.type(symtab)} does not support unary #{op} operator"end
- type_error"Unary minus only works on signed values"unlessexp.type(symtab).signed?
- when"~"
+ # type_error "Unary minus only works on signed values" unless exp.type(symtab).signed?
+when"~"unless[:bits,:bitfield].include?(exp.type(symtab).kind)type_error"#{exp.type(symtab)} does not support unary #{op} operator"end
@@ -758,37 +812,39 @@
# File 'lib/idl/ast.rb', line 2338defvalue(symtab)
- val=eval("#{op}#{exp.value(symtab)}",binding,__FILE__,__LINE__)
- iftype(symtab).integral?&&type(symtab).width>val.bit_length
- # need to truncate
-val&=((1<<type(symtab).width)-1)
- iftype(symtab).signed?&&((((val>>(type(symtab).width-1)))&1)==1)
+ val=val_trunc=eval("#{op}#{exp.value(symtab)}",binding,__FILE__,__LINE__)
+ iftype(symtab).integral?
+ val_trunc=val&((1<<type(symtab).width)-1)
+ iftype(symtab).signed?&&((((val_trunc>>(type(symtab).width-1)))&1)==1)# need to make this negative!
# take the twos compliment
-val=-((1<<type(symtab).width)-val)
+ val_trunc=-((1<<type(symtab).width)-val_trunc)endend
- val
+ warn"#{text_value} is truncated due to insufficient bit width (from #{val} to #{val_trunc})"ifval_trunc!=val
+
+ val_truncend
Return a complete list of possible compile-time-known values of the node, or raise a ValueError if the full list cannot be determined.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Instance Method Details
-
-
-
-
-
- #to_idl ⇒ String
-
-
-
-
-
-
-
-
-
Return valid IDL representation of the node (and its subtree)
-
-
-
-
-
-
-
Returns:
-
-
-
-
-
- (String)
-
-
-
- —
-
-
IDL code for the node
-
-
-
-
-
-
-
-
-
-
-
-
-2337
-
-
-
# File 'lib/idl/ast.rb', line 2337
-
-defto_idl=text_value
-
-
-
-
-
-
-
-
- #type(symtab) ⇒ Object
-
-
-
-
-
-
-
-
-
-
-
-2319
-2320
-2321
-2322
-2323
-
-
-
# File 'lib/idl/ast.rb', line 2319
-
-deftype(symtab)
- internal_error"While checking VarRead type, no symbol '#{text_value}' found"ifsymtab.get(text_value).nil?
-
- symtab.get(text_value).type
-end
-
-
-
-
-
-
-
-
- #type_check(symtab) ⇒ void
-
-
-
-
-
-
-
-
This method returns an undefined value.
-
type check this node and all children
-
-
Calls to #type and/or #value may depend on type_check being called first with the same symtab. If not, those functions may raise an AstNode::InternalError
if there is an internal compiler error during type check
-
-
-
-
-
-
-
-
-
-
-
-
-2310
-2311
-2312
-2313
-2314
-2315
-2316
-
-
-
# File 'lib/idl/ast.rb', line 2310
-
-deftype_check(symtab)
- var=symtab.get(text_value)
-
- type_error"No symbol named '#{text_value}'"ifvar.nil?
-
- type_error"'#{text_value}' is not a variable"unlessvar.is_a?(Var)
-end
if the list of values is not knowable at compile time
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/ruby/Idl/VariableAssignmentAst.html b/docs/ruby/Idl/VariableAssignmentAst.html
index 195cdc959..ca3a3902f 100644
--- a/docs/ruby/Idl/VariableAssignmentAst.html
+++ b/docs/ruby/Idl/VariableAssignmentAst.html
@@ -69,7 +69,7 @@
# File 'lib/idl/ast.rb', line 1014
-defto_idl="#{var.to_idl} = #{rval.to_idl}"
+defto_idl="#{@lhs.to_idl} = #{@rhs.to_idl}"
@@ -565,22 +684,22 @@
-967
-968
-969
-970
-971
-972
-973
+993
+994
+995
+996
+997
+998
+999
-
# File 'lib/idl/ast.rb', line 967
+
# File 'lib/idl/ast.rb', line 993deftype_check(symtab)
- var.type_check(symtab)
- rval.type_check(symtab)
- unlessrval.type(symtab).convertable_to?(var.type(symtab))
- type_error"Incompatible type in assignment (#{var.type(symtab)}, #{rval.type(symtab)}) on line #{lineno}"
+ @lhs.type_check(symtab)
+ @rhs.type_check(symtab)
+ unless@rhs.type(symtab).convertable_to?(@lhs.type(symtab))
+ type_error"Incompatible type in assignment (#{@lhs.type(symtab)}, #{@rhs.type(symtab)})"endend
# File 'lib/idl/ast.rb', line 973
+
+defto_ast
+ VariableAssignmentAst.new(input,interval,var.to_ast,rval.to_ast)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/VariableDeclarationAst.html b/docs/ruby/Idl/VariableDeclarationAst.html
index 13953ff20..7eb66a2f8 100644
--- a/docs/ruby/Idl/VariableDeclarationAst.html
+++ b/docs/ruby/Idl/VariableDeclarationAst.html
@@ -103,7 +103,9 @@
# File 'lib/idl/ast.rb', line 1389deftype_check(symtab)type_name.type_check(symtab)
@@ -563,7 +617,7 @@
unlessary_size.empty?ary_size.expression.type_check(symtab)begin
- ary_size_value=ary_size.expression.value(symtab)
+ ary_size.expression.value(symtab)rescueValueErrortype_error"Array size must be known at compile time"end
@@ -583,7 +637,7 @@
# File 'lib/idl/ast.rb', line 1459
-defrhs
- # if rhs is nil, this is the non-initializing variant
-returnnilunlessrespond_to?(:rval)
+deflhs_type(symtab)
+ decl_type=type_name.type(symtab).clone
+ type_error"No type '#{type_name.text_value}' on line #{lineno}"ifdecl_type.nil?
- returnrvalifrval.is_a?(Rvalue)
+ decl_type=Type.new(:enum_ref,enum_class:decl_type)ifdecl_type.kind==:enum
+
+ # decl_type = decl_type.clone.qualify(q.text_value.to_sym) unless q.empty?
+
+ if@lhs.text_value[0].upcase==@lhs.text_value[0]
+ decl_type.make_const
+ end
- internal_error"unexpected #{rval.inspect}"unlessrval.is_a?(MemoryRValAst)
+ unless@ary_size.nil?
+ begin
+ decl_type=Type.new(:array,sub_type:decl_type,width:@ary_size.value(symtab))
+ rescueValueError
+ type_error"Array size must be known at compile time"
+ end
+ if@lhs.text_value[0].upcase==@lhs.text_value[0]
+ decl_type.make_const
+ end
+ end
- rval
+ decl_typeend
@@ -633,12 +916,24 @@
-1487
+1529
+1530
+1531
+1532
+1533
+1534
+1535
-
# File 'lib/idl/ast.rb', line 1487
+
# File 'lib/idl/ast.rb', line 1529
-defto_idl="#{type_name.to_idl}#{var_write.to_idl} = #{rval.to_idl}"
# File 'lib/idl/ast.rb', line 1486deftype_check(symtab)
- rval.type_check(symtab)
+ @rhs.type_check(symtab)
- type_name.type_check(symtab)
+ @type_name.type_check(symtab)
- decl_type=lhs_type(symtab)
+ @ary_size&.type_check(symtab)
- unlessary_size.empty?
- ary_size.expression.type_check(symtab)
- begin
- ary_size_value=ary_size.expression.value(symtab)
- rescueValueError
- type_error"Array size must be known at compile time"
- end
+ decl_type=lhs_type(symtab)
- decl_type=Type.new(:array,width:ary_size_value,sub_type:decl_type)
- end
- if(var_write.text_value==var_write.text_value.upcase)&&ary_size.empty?
+ ifdecl_type.const?# this is a constant; ensure we are assigning a constant value
begin
- symtab.add(var_write.text_value,Var.new(var_write.text_value,decl_type.clone.make_const,rval.value(symtab)))
+ symtab.add(@lhs.text_value,Var.new(@lhs.text_value,decl_type.clone,@rhs.value(symtab)))rescueValueError=>etype_error"Declaring constant with a non-constant value (#{e})"endelse
- symtab.add(var_write.text_value,Var.new(var_write.text_value,decl_type.clone))
+ symtab.add(@lhs.text_value,Var.new(@lhs.text_value,decl_type.clone))end
- var_write.type_check(symtab)
+ @lhs.type_check(symtab)# now check that the assignment is compatible
-returnifrval.type(symtab).convertable_to?(decl_type)
+ returnif@rhs.type(symtab).convertable_to?(decl_type)
- type_error"Incompatible type (#{decl_type}, #{rval.type(symtab)}) in assignment"
+ type_error"Incompatible type (#{decl_type}, #{@rhs.type(symtab)}) in assignment"end
+
+
\ No newline at end of file
diff --git a/docs/ruby/Idl/XregType.html b/docs/ruby/Idl/XregType.html
index aeb74a243..db833fb34 100644
--- a/docs/ruby/Idl/XregType.html
+++ b/docs/ruby/Idl/XregType.html
@@ -318,7 +318,7 @@
# File 'lib/arch_def.rb', line 1134
+
+defdefined_by?(*args)
+ ifargs.size==1
+ raiseArgumentError,"Parameter must be an ExtensionVersion"unlessargs[0].is_a?(ExtensionVersion)
+
+ extension_requirements.any?do|r|
+ r.satisfied_by?(args[0])
+ end
+ elsifargs.size==2
+ raiseArgumentError,"First parameter must be an extension name"unlessargs[0].respond_to?(:to_s)
+ raiseArgumentError,"Second parameter must be an extension version"unlessargs[0].respond_to?(:to_s)
+
+ extension_requirements.any?do|r|
+ r.satisfied_by?(args[0].to_s,args[1].to_s)
+ end
+ end
+end
# File 'lib/arch_def.rb', line 1158
+
+defexcluded_by?(*args)
+ ifargs.size==1
+ raiseArgumentError,"Parameter must be an ExtensionVersion"unlessargs[0].is_a?(ExtensionVersion)
+
+ extension_exclusions.any?do|r|
+ r.satisfied_by?(args[0])
+ end
+ elsifargs.size==2
+ raiseArgumentError,"First parameter must be an extension name"unlessargs[0].respond_to?(:to_s)
+ raiseArgumentError,"Second parameter must be an extension version"unlessargs[0].respond_to?(:to_s)
-
-
Instance Attribute Details
+ extension_exclusions.any?do|r|
+ r.satisfied_by?(args[0].to_s,args[1].to_s)
+ end
+ end
+end
+
# File 'lib/arch_def.rb', line 1104
-defaccess_detail?
- @data.key?("access_detail")
+defextension_exclusions
+ return@extension_exclusionsunless@extension_excludions.nil?
+
+ @extension_exclusions=[]
+ if@data.key?("excludedBy")
+ if@data["exludedBy"].is_a?(Array)
+ # could be either a single extension with exclusion, or a list of exclusions
+ifextension_exclusion?(@data["definedBy"][0])
+ @extension_exclusions<<to_extension_requirement(@data["excludedBy"][0])
+ else
+ # this is a list
+@data["excludeddBy"].eachdo|r|
+ @extension_exclusions<<to_extension_exclusion(r)
+ end
+ end
+ else
+ @extension_exclusions<<to_extension_requirement(@data["excludedBy"])
+ end
+ end
+
+ @extension_exclusionsend
# File 'lib/arch_def.rb', line 1080
+
+defextension_requirements
+ return@extension_requirementsunless@extension_requirements.nil?
+
+ @extension_requirements=[]
+ if@data["definedBy"].is_a?(Array)
+ # could be either a single extension with requirement, or a list of requirements
+ifextension_requirement?(@data["definedBy"][0])
+ @extension_requirements<<to_extension_requirement(@data["definedBy"][0])
+ else
+ # this is a list
+@data["definedBy"].eachdo|r|
+ @extension_requirements<<to_extension_requirement(r)
+ end
+ end
+ else
+ @extension_requirements<<to_extension_requirement(@data["definedBy"])
+ end
-defdecode_variables(base)
- @encodings[base].decode_variables
+ raise"empty requirements"if@extension_requirements.empty?
+
+ @extension_requirementsend
# File 'lib/idl/tests/helpers.rb', line 6
+
+definitialize(name)
+ @name=name
+end
+
+
+
+
+
+
+
+
+
Instance Attribute Details
+
+
+
+
+
+
+ #name ⇒ Object(readonly)
+
+
+
+
+
+
+
+
+
Returns the value of attribute name.
+
+
+
+
+
+
+
+
+
+
+
+
+
+5
+6
+7
+
+
+
# File 'lib/idl/tests/helpers.rb', line 5
+
+defname
+ @name
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ruby/Opcodes.html b/docs/ruby/Opcodes.html
index 3c63f19e2..8699c1e95 100644
--- a/docs/ruby/Opcodes.html
+++ b/docs/ruby/Opcodes.html
@@ -408,16 +408,16 @@
-607
-608
-609
-610
-611
-612
-613
+614
+615
+616
+617
+618
+619
+620
-
# File 'lib/opcodes.rb', line 607
+
# File 'lib/opcodes.rb', line 614defself.insn_tablereturn@insn_tableunless@insn_table.nil?
@@ -436,7 +436,7 @@
+
+
\ No newline at end of file
diff --git a/docs/ruby/Treetop.html b/docs/ruby/Treetop.html
index e30fd1d4f..8a88384f5 100644
--- a/docs/ruby/Treetop.html
+++ b/docs/ruby/Treetop.html
@@ -118,7 +118,7 @@