RISC-V и реализация функций работы с тритами

Уравновешенная троичная система счисления - форум переехал с http://ternary.info

Moderator: haqreu

User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

TODO
Emulator-Setun-1958-Assembler ver.0.10

### 3.7. Операции над троичными числами TRS_t

```
TRS_t tests(...) :
a0=0xAAAA, a1=0xBBBB; clean_trs(a0,a1)->0 0
ts1=0x1, ts0=0x1,pos=0; get_trit(ts1,ts0,pos)->1
ts1=0x0, ts0=0x1,pos=0; get_trit(ts1,ts0,pos)->-1
ts1=0x0, ts0=0x0,pos=0; get_trit(ts1,ts0,pos)->0
ts1=0x4, ts0=0x4,pos=2; get_trit(ts1,ts0,pos)->1
ts1=0x0, ts0=0x4,pos=2; get_trit(ts1,ts0,pos)->-1
ts1=0x0, ts0=0x0,pos=2; get_trit(ts1,ts0,pos)->0
ts1=0x0000, ts0=0x0000, pos=5, val=-1; set_trit(ts1,ts0,pos,val)->32 0
ts1=0x0000, ts0=0x0000, pos=5, val=0; set_trit(ts1,ts0,pos,val)->0 0
ts1=0x0000, ts0=0x0000, pos=5, val=+1; set_trit(ts1,ts0,pos,val)->32 32
ts1=0x0080, ts0=0x0080, shift=+2; shift_trs_t11(ts1,ts0, shift)->128 128
ts1=0x0080, ts0=0x0080, shift=-3; shift_trs_t11(ts1,ts0, shift)->16 16
```
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

TODO
Emulator-Setun-1958-Assembler ver.0.11

### 3.7. Операции над троичными числами TRS_t

```
TRS_t tests(...) :
a0=0xAAAA, a1=0xBBBB; clean_trs(a0,a1)->0 0
ts1=0x1, ts0=0x1,pos=0; get_trit(ts1,ts0,pos)->1
ts1=0x0, ts0=0x1,pos=0; get_trit(ts1,ts0,pos)->-1
ts1=0x0, ts0=0x0,pos=0; get_trit(ts1,ts0,pos)->0
ts1=0x4, ts0=0x4,pos=2; get_trit(ts1,ts0,pos)->1
ts1=0x0, ts0=0x4,pos=2; get_trit(ts1,ts0,pos)->-1
ts1=0x0, ts0=0x0,pos=2; get_trit(ts1,ts0,pos)->0
ts1=0x0000, ts0=0x0000, pos=5, val=-1; set_trit(ts1,ts0,pos,val)->32 0
ts1=0x0000, ts0=0x0000, pos=5, val=0; set_trit(ts1,ts0,pos,val)->0 0
ts1=0x0000, ts0=0x0000, pos=5, val=+1; set_trit(ts1,ts0,pos,val)->32 32
ts1=0x0080, ts0=0x0080, shift=+2; shift_trs(ts1,ts0, shift)->128 128
ts1=0x0080, ts0=0x0080, shift=-3; shift_trs(ts1,ts0, shift)->16 16
ts1=0x0100, ts0=0x0100, pos1=8,pos2=4; slice_trs ($ts1,$ts0,$pos1,$pos2)->16 16
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x00FF, tryte2.0=0xFFFF; and_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x0000, tryte2.0=0x0000; and_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x00FF, tryte2.0=0xFFFF; or_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x0000, tryte2.0=0x0000; or_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x00FF, tryte2.0=0xFFFF; xor_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 0
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x0000, tryte2.0=0x0000; xor_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 0
```
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

Re: RISC-V и реализация функций работы с тритами
TODO
Emulator-Setun-1958-Assembler ver.0.12
## 10.03.2024 ver.0.12
-[Х] FIX ERROR операция с тритами sum_t.
-[Х] FIX ERROR операция с тритами sum_half_t.
-[Х] Добавлен операции над трайтами add_trs, sub_trs, inc_trs, dec_trs.
-[Х] TEST:
-[ ] ERROR add_trs(...)
-[ ] ERROR sub_trs(...)
-[ ] ERROR inc_trs(...)
-[ ] ERROR dec_trs(...)

### 3.7. Операции над троичными числами TRS_t

```
TRS_t tests(...) :
a0=0xAAAA, a1=0xBBBB; clean_trs(a0,a1)->0 0
ts1=0x1, ts0=0x1,pos=0; get_trit(ts1,ts0,pos)->1
ts1=0x0, ts0=0x1,pos=0; get_trit(ts1,ts0,pos)->-1
ts1=0x0, ts0=0x0,pos=0; get_trit(ts1,ts0,pos)->0
ts1=0x4, ts0=0x4,pos=2; get_trit(ts1,ts0,pos)->1
ts1=0x0, ts0=0x4,pos=2; get_trit(ts1,ts0,pos)->-1
ts1=0x0, ts0=0x0,pos=2; get_trit(ts1,ts0,pos)->0
ts1=0x0000, ts0=0x0000, pos=5, val=-1; set_trit(ts1,ts0,pos,val)->32 0
ts1=0x0000, ts0=0x0000, pos=5, val=0; set_trit(ts1,ts0,pos,val)->0 0
ts1=0x0000, ts0=0x0000, pos=5, val=+1; set_trit(ts1,ts0,pos,val)->32 32
ts1=0x0080, ts0=0x0080, shift=+2; shift_trs(ts1,ts0, shift)->128 128
ts1=0x0080, ts0=0x0080, shift=-3; shift_trs(ts1,ts0, shift)->16 16
ts1=0x0100, ts0=0x0100, pos1=8,pos2=4; slice_trs ($ts1,$ts0,$pos1,$pos2)->16 16
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x00FF, tryte2.0=0xFFFF; and_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x0000, tryte2.0=0x0000; and_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x00FF, tryte2.0=0xFFFF; or_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x0000, tryte2.0=0x0000; or_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 32
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x00FF, tryte2.0=0xFFFF; xor_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 0
tryte1.1=0xFF00, tryte1.0=0xFFFF, tryte2.1=0x0000, tryte2.0=0x0000; xor_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->32 0
tryte1.1=0x0000, tryte1.0=0x00FF; not_trs ($tryte1_1,$tryte1_0)->255 -1
tryte1.1=0x0001, tryte1.0=0x0001, tryte2.1=0x0001, tryte2.0=0x0001; add_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->3 2
tryte1.1=0x0000, tryte1.0=0x0001, tryte2.1=0x0000, tryte2.0=0x0001; add_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->1 1
tryte1.1=0x0002, tryte1.0=0x0002, tryte2.1=0x0001, tryte2.0=0x0001; sub_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->3 0
tryte1.1=0x0000, tryte1.0=0x0001, tryte2.1=0x0000, tryte2.0=0x0001; sub_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->0 0
tryte1.1=0x0000, tryte1.0=0x0001, tryte2.1=0x0000, tryte2.0=0x0001; sub_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->1 1
tryte1.1=0x0000, tryte1.0=0x0001, tryte2.1=0x0000, tryte2.0=0x0001; sub_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->1 0
```
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

Эмулятор троичной машины 'СЕТУНЬ' SETUN-1958 VM на языке Assembler

Ссылка: https://github.com/askfind/Emulator-Set ... embler.git

Emulator-Setun-1958-Assembler ver.0.13

TEST Ok'

Макросы работы с полем тритов:
TRITS-32 = [t31...t0] - обозначение позиции тритов в числе

Операции с тритами:
  • and_t
    or_t
    xor_t
    not_t
    sum_half_t
    sum_t

Операции с трайтами:
  • get_trit
    set_trit
    shift_trs
    slice_trs
    and_trs
    or_trs
    xor_trs
    not_trs
    add_trs
    sub_trs
    inc_trs
    dec_trs
You do not have the required permissions to view the files attached to this post.
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

Re: RISC-V и реализация функций работы с тритами
TODO
Emulator-Setun-1958-Assembler ver.0.14

Вывод троичного числа в тестах.

Code: Select all

tryte1.1=0x0001, tryte1.0=0x0001, tryte2.1=0x0001, tryte2.0=0x0001;  add_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->trs : [000000000000000000000000000000+-]
 tryte1.1=0x0000, tryte1.0=0x0001, tryte2.1=0x0000, tryte2.0=0x0001;  add_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->trs : [000000000000000000000000000000-+]
 tryte1.1=0x0002, tryte1.0=0x0002, tryte2.1=0x0001, tryte2.0=0x0001;  sub_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->trs : [000000000000000000000000000000--]
 tryte1.1=0x0000, tryte1.0=0x0001, tryte2.1=0x0000, tryte2.0=0x0001;  sub_trs ($tryte1_1,$tryte1_0,$tryte2_1,$tryte2_0)->trs : [00000000000000000000000000000000]
 tryte1.1=0x0004, tryte1.0=0x0004;  inc_trs ($tryte1_1,$tryte1_0)->trs : [00000000000000000000000000000-0+]
 tryte1.1=0x0004, tryte1.0=0x0004;  dec_trs ($tryte1_1,$tryte1_0)->trs : [00000000000000000000000000000-0-]
 SETUN_trs tests(...) :
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

Re: RISC-V и реализация функций работы с тритами
TODO

Emulator-Setun-1958-Assembler ver.0.15
## 11.03.2024 ver.0.15
-[X] FIX ERROR inc_trs(...)
-[X] FIX ERROR dec_trs(...)
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
User avatar
askfind
Devil
Posts: 822
Joined: 04 Jan 2016 09:15
Location: Russia, S.- Peterburg

Re: RISC-V и реализация функций работы с тритами

Post by askfind »

ОНЛАЙН ТРАНСЛЯЦИЯ в группе Telegram "SETUN"

Доклад на тему:

"Троичные операции на ассемблере для архитектуре RISC-V. Эмуляция троичной машины "СЕТУНЬ".


Место: г.С-Петербург, Failover Bar (4-ая Советская, д. 7)
Дата: 6 апреля 2024 года.
Время: 17-00 мск.

Докладчик:
Владимир Васильев.

Приглашение от мобильных разработчиков:

Ссылка: Канал с анонсами — https://t.me/mobile_broadcast_news
По вопросам сообщества: @packovv, @CLTanuki
You do not have the required permissions to view the files attached to this post.
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)