Class: Idl::CsrSoftwareWriteAst

Inherits:
AstNode
  • Object
show all
Includes:
Executable
Defined in:
lib/idl/ast.rb

Instance Method Summary collapse

Constructor Details

#initialize(input, interval, csr, expression) ⇒ CsrSoftwareWriteAst

Returns a new instance of CsrSoftwareWriteAst.



5950
5951
5952
# File 'lib/idl/ast.rb', line 5950

def initialize(input, interval, csr, expression)
  super(input, interval, [csr, expression])
end

Instance Method Details

#csrObject



5947
# File 'lib/idl/ast.rb', line 5947

def csr = @children[0]

#csr_known?(symtab) ⇒ Boolean

Returns:

  • (Boolean)


5965
5966
5967
# File 'lib/idl/ast.rb', line 5965

def csr_known?(symtab)
  csr.csr_known?(symtab)
end

#csr_name(symtab) ⇒ Object



5969
5970
5971
# File 'lib/idl/ast.rb', line 5969

def csr_name(symtab)
  csr.csr_name(symtab)
end

#execute(_symtab) ⇒ void

This method returns an undefined value.

“execute” the statement by updating the variables in the symbol table

Parameters:

  • symtab (SymbolTable)

    The symbol table for the context

Raises:

  • ValueError if some part of the statement cannot be executed at compile time



5979
# File 'lib/idl/ast.rb', line 5979

def execute(_symtab) = value_error "CSR writes are global"

#execute_unknown(_symtab) ⇒ Object

nothing to do for a function call



5982
# File 'lib/idl/ast.rb', line 5982

def execute_unknown(_symtab); end

#expressionObject



5948
# File 'lib/idl/ast.rb', line 5948

def expression = @children[1]

#to_idlString

Return valid IDL representation of the node (and its subtree)

Returns:

  • (String)

    IDL code for the node



5985
# File 'lib/idl/ast.rb', line 5985

def to_idl = "#{csr.to_idl}.sw_write(#{expression.to_idl})"

#type_check(symtab) ⇒ Object



5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
# File 'lib/idl/ast.rb', line 5954

def type_check(symtab)
  archdef = symtab.archdef

  csr.type_check(symtab)
  expression.type_check(symtab)

  return if expression.type(symtab).kind == :bits && expression.type(symtab).width == symtab.mxlen

  type_error "CSR value must be an XReg"
end

#value(_symtab) ⇒ Object

Return the compile-time-known value of the node



5974
5975
5976
# File 'lib/idl/ast.rb', line 5974

def value(_symtab)
  value_error "CSR writes are global"
end