Project

General

Profile

Actions

Bug #4014

closed

Concatenation in left hand side expressions

Added by Andrei Tatarnikov about 11 years ago. Updated almost 8 years ago.

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

100%

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

Description

Логика выражений типа M [0] :: M [1] = R [4] некорректна. Она должна означать:

M [0] = R [4];
M [1] = R [4]

Вот что написано в драфте Фредерикса:

<<<<<<<<<<<<<<<<<<<<<<
4.10 Concatenation of Values

The :: operator allows the concatenation of arbitrary expressions; it is de ned on the left side of
assignments, too (if the expressions denote memory locations only, of course). For example,
M [0] :: M [1] = R [4]
assigns the value of R [4] to the locations M [0] and M [1]. The order is the same as used in sequences
of locations, i.e., essentially unde ned.

Нужно найти решение.

Actions #1

Updated by Andrei Tatarnikov about 11 years ago

  • Assignee set to Andrei Tatarnikov
Actions #2

Updated by Alexander Kamkin about 11 years ago

Andrey Tatarnikov wrote:

Логика выражений типа M [0] :: M [1] = R [4] некорректна. Она должна означать:

M [0] = R [4];
M [1] = R [4]

Запись x1::x2 = value нужно интерпретировать следующим образом. Если суммарная разрядность x1 и x2 равна разрядности value. Часть значения записывается в x1, а часть - в x2. Если разрядности не совпадают, нужно начинать с младших бит, а дальше - либо обрезать, либо заполнять нулями.

Все конструкции с недоопределенной семантикой нужно документировать в руководстве по языку (нужно в wiki завести соответствующий раздел).

Actions #3

Updated by Andrei Tatarnikov about 11 years ago

Сейчас так и делается, как ты написал. В модели ARM есть вот такие конструкции:

carry::ALU_OUT = GPR[src2] + src3;

Нужно подумать как их правильно интерпретировать. Левая часть заведомо больше на carry (некий флаг).

Actions #4

Updated by Alexander Kamkin almost 10 years ago

  • Due date set to 04/30/2014
  • Target version set to 2.0

Что с этой задачей?

Actions #5

Updated by Andrei Tatarnikov over 9 years ago

Сейчас для присваивания используется BitVector.assign. Он копирует все данные. Если остаётся место - заполняет его нулями, если что-то не вмещается - данные обрезаются.

Вообще этот код нуждается в Review и я над ним сейчас работаю.

Actions #6

Updated by Andrei Tatarnikov over 9 years ago

Тут же ещё и sign extension возможен.

Actions #7

Updated by Alexander Kamkin over 9 years ago

  • Target version changed from 2.0 to 2.1
Actions #8

Updated by Alexander Kamkin about 9 years ago

  • Subject changed from [translator] Concatenation in left hand side expressions to Concatenation in left hand side expressions
  • Category set to 40
Actions #9

Updated by Alexander Kamkin almost 9 years ago

  • Target version changed from 2.1 to 2.2
Actions #10

Updated by Alexander Kamkin almost 9 years ago

Has the issue been resolved?

Actions #11

Updated by Andrei Tatarnikov almost 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

In the current implementation, both sides of an assignment expression must have the same size. Otherwise, it will cause a type error.

So, in M[0]::M[1]=R[4], data one half of R[4] is copied into M[0] and another is copied into M[1]. If sizes of left and right sides mismatch, a translation error will occur.

Actions #12

Updated by Andrei Tatarnikov almost 8 years ago

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

Also available in: Atom PDF