Project

General

Profile

Actions

Bug #4806

closed

[generator] Manual specification of initialization code

Added by Alexander Kamkin over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrei Tatarnikov
Category:
-
Target version:
Start date:
04/02/2014
Due date:
04/30/2014
% Done:

100%

Estimated time:
Detected in build:
svn
Platform:
Published in build:
141018

Description

  1. Manual specification of initialization code for access modes
  2. Documentation
Actions #1

Updated by Andrei Tatarnikov over 10 years ago

  • Status changed from New to Open
  • % Done changed from 0 to 20
Actions #2

Updated by Andrei Tatarnikov over 10 years ago

Первая сырая реализация сделана в r1891.

Actions #3

Updated by Andrei Tatarnikov about 10 years ago

  • Status changed from Open to Resolved
  • Target version changed from 2.0 to 2.1
  • % Done changed from 20 to 100

Возможность реализована в рамках тестовых шаблонов (конструкция preparator {...}). Вот код из примера VLIW DEMO (vliw_base.rb) с подробными комментариями:

#
# Rules for writing preparators of initializing instruction sequences:
#
# preparator(:target => '<name>') {
#   comment 'Initializer for <name>'
#   vliw(
#     (lui  target, value(0, 15)),
#     (addi target, target, value(15, 31))
#   )
# }
#
# The above code defines an instruction sequence that writes a value
# to the resource referenced via the <name> addressing mode.
#
# Important features:
#
# - The ':target' attribute specifies the name of the target addressing
#   mode.
# - The 'target' and 'value' methods specify the target addressing mode
#   with all its arguments set and the value passed to the preparator
#   respectively. The arguments of the 'value' method specify which part
#   of the value is used. 
#

#
# The code below specifies an instruction sequence that writes a value
# to the specified general-purpose register (GPR) using the R addressing
# mode.
#
preparator(:target => 'R') {
  comment 'Initializer for R'  
  vliw(
    (lui target, value(16, 31)),
    (addi target, target, value(0, 15))
  )
}

#
# The code below specifies an instruction sequence that writes a value
# to the specified floating-point register (FPR) using the F addressing
# mode. 
#
preparator(:target => 'F') {
  comment 'Initializer for F'
  vliw(
    (lui r(25), value(16, 31)), # GPR[25] holds a temporary value
    (addi r(25), r(25), value(0, 15))
  )
  vliw(
    (mtf r(25), target),
    nop
  )
}
Actions #4

Updated by Andrei Tatarnikov about 10 years ago

  • Status changed from Resolved to Closed
  • Published in build set to 141018
Actions

Also available in: Atom PDF