Project

General

Profile

Actions

Developer Request #9472

open

Неочевидные преобразования типов при вычислении выражений

Added by Alexander Protsenko almost 6 years ago. Updated over 1 year ago.

Status:
Open
Priority:
High
Category:
nML Translator
Target version:
Start date:
02/05/2019
Due date:
% Done:

0%

Estimated time:
Published in build:

Description

        trace("store_global: MEM_WORD 1");
        tmp_qword = MEM[mem_index + 1]::MEM[mem_index];
        trace("store_global: MEM_WORD 2 tmp_bit_offset = 0x%x", tmp_bit_offset);
        tmp_qword<tmp_bit_offset + 31..0+tmp_bit_offset> = rs2_op<31..0>;
        trace("store_global: MEM_WORD 3");
        MEM[mem_index + 1]::MEM[mem_index] = tmp_qword;
        trace("store_global: MEM_WORD 4");
Mmu.PreTranslateAddress: satp.mode=0. No translation or protection.
PreTranslateAddress
PreTranslateAddress: read 2
PreTranslateAddress: read 3
store_global: MEM_WORD 2 tmp_bit_offset = 0x28
********************************************************************************
ATTENTION! An unexpected error has occurred:
java.lang.IllegalArgumentException: Assigning 32-bit data to 34-bit location is not allowed.

The program will be terminated. Please contact us at: 
microtesk-support@ispras.ru
We are sorry for the inconvenience.

Exception stack:

java.lang.IllegalArgumentException: Assigning 32-bit data to 34-bit location is not allowed.
    at ru.ispras.microtesk.model.memory.Location.store(ru/ispras/microtesk/model/memory/Location.java:131)
    at ru.ispras.microtesk.model.riscv.op.store_global.action(ru/ispras/microtesk/model/riscv/op/store_global.java:99)
    at ru.ispras.microtesk.model.IsaPrimitive.execute(ru/ispras/microtesk/model/IsaPrimitive.java:183)
    at ru.ispras.microtesk.model.riscv.op.store_rvi.action(ru/ispras/microtesk/model/riscv/op/store_rvi.java:74)
    at ru.ispras.microtesk.model.IsaPrimitive.execute(ru/ispras/microtesk/model/IsaPrimitive.java:183)
    at ru.ispras.microtesk.model.riscv.op.sw.action(ru/ispras/microtesk/model/riscv/op/sw.java:118)
    at ru.ispras.microtesk.model.IsaPrimitive.execute(ru/ispras/microtesk/model/IsaPrimitive.java:183)
    at ru.ispras.microtesk.model.riscv.op.instruction.action(ru/ispras/microtesk/model/riscv/op/instruction.java:77)
    at ru.ispras.microtesk.model.IsaPrimitive.execute(ru/ispras/microtesk/model/IsaPrimitive.java:183)
    at ru.ispras.microtesk.model.InstructionCall.execute(ru/ispras/microtesk/model/InstructionCall.java:68)
    at ru.ispras.microtesk.test.template.ConcreteCall.execute(ru/ispras/microtesk/test/template/ConcreteCall.java:155)
    at ru.ispras.microtesk.test.Executor.executeCall(ru/ispras/microtesk/test/Executor.java:455)
    at ru.ispras.microtesk.test.Executor.executeToBreak(ru/ispras/microtesk/test/Executor.java:348)
    at ru.ispras.microtesk.test.Executor.execute(ru/ispras/microtesk/test/Executor.java:276)
    at ru.ispras.microtesk.test.TemplateProcessor.runExecution(ru/ispras/microtesk/test/TemplateProcessor.java:707)
    at ru.ispras.microtesk.test.TemplateProcessor.runExecutionFromStart(ru/ispras/microtesk/test/TemplateProcessor.java:723)
    at ru.ispras.microtesk.test.TemplateProcessor.finish(ru/ispras/microtesk/test/TemplateProcessor.java:193)
    at ru.ispras.microtesk.test.template.Template.endMainSection(ru/ispras/microtesk/test/template/Template.java:213)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at RUBY.generate(C:/!microtesk/MicroTESK-RISC-V/microtesk-riscv/microtesk-riscv/build/target/lib/ruby/template.rb:1066)
    at RUBY.main(C:\!microtesk\MicroTESK-RISC-V\microtesk-riscv\microtesk-riscv\build\target\lib\ruby\microtesk.rb:33)
    at org.jruby.RubyHash.each(org/jruby/RubyHash.java:1342)
    at RUBY.main(C:\!microtesk\MicroTESK-RISC-V\microtesk-riscv\microtesk-riscv\build\target\lib\ruby\microtesk.rb:29)
    at RUBY.(root)(C:\!microtesk\MicroTESK-RISC-V\microtesk-riscv\microtesk-riscv\build\target\lib\ruby\microtesk.rb:52)
    at ru.ispras.microtesk.RubyRunner.run(ru/ispras/microtesk/RubyRunner.java:62)
    at ru.ispras.microtesk.ScriptRunner.run(ru/ispras/microtesk/ScriptRunner.java:43)
    at ru.ispras.microtesk.test.TestEngine.generate(ru/ispras/microtesk/test/TestEngine.java:172)
    at ru.ispras.microtesk.MicroTESK.generate(ru/ispras/microtesk/MicroTESK.java:284)
    at ru.ispras.microtesk.MicroTESK.runTask(ru/ispras/microtesk/MicroTESK.java:131)
    at ru.ispras.microtesk.MicroTESK.main(ru/ispras/microtesk/MicroTESK.java:79)

********************************************************************************

Возможно стоит выводить больше информации, например имена переменных.

Actions #1

Updated by Alexander Kamkin almost 5 years ago

  • Target version set to 2.5
У меня одно объяснение:
  1. судя по всему, tmp_qword имеет разрядность 64 бита;
  2. значение tmp_bit_offset равно 0x28 = 40.
  3. 40 + 31 = 7 (mod 64);
  4. 40 + 0 = 40 (mod 64);
  5. поле <7..40> имеет разрядность 34.
Actions #2

Updated by Alexander Kamkin almost 5 years ago

  • Category set to ISA Simulator

Немного расширил диагностику.

Actions #3

Updated by Alexander Kamkin almost 5 years ago

  • Status changed from New to Open
Actions #4

Updated by Alexander Kamkin almost 5 years ago

  • Subject changed from Странная ошибка и непонятная диагностика to Неочевидные преобразования типов при вычислении выражений
Actions #5

Updated by Alexander Kamkin almost 5 years ago

Нужно определить, как происходит преобразование типов при вычислении выражений. Сейчас, например, tmp_bit_offset + 31 приведется к типу tmp_bit_offset из-за чего могут потеряться старшие биты.

Actions #6

Updated by Alexander Kamkin almost 5 years ago

  • Priority changed from Normal to High
Actions #7

Updated by Alexander Kamkin almost 5 years ago

  • Category changed from ISA Simulator to nML Translator
  • Assignee changed from Alexander Kamkin to Artem Kotsynyak

Необходимо реализовать правила неявного приведения типов, описанные в https://forge.ispras.ru/projects/microtesk-docs/repository/677/revisions/master/entry/microtesk-2.5/microtesk-2.5-user-guide-ru.adoc

Actions #8

Updated by Alexander Protsenko over 1 year ago

  • Target version changed from 2.5 to 2.6
Actions

Also available in: Atom PDF