[Oberon] FPGA - SET initialisation

Tomas Kral thomas.kral at email.cz
Sun Apr 30 12:35:02 CEST 2017


Ah yes, sily me.

But how to best initialise a SET variable with an arbitrary byte /
integer?

TYPE ii = POINTER TO iidsc;
iidsc = STRUCT i: INTEGER END; 

i := b; SYSTEM.PUT(ii,i); SYSTEM.GET(ii,s); (* initialise a set with
a byte *)
SYSTEM.PUT(ii,i); SYSTEM.GET(ii,s); (* initialise a set with an integer
*)

Tomas

On Sun, 30 Apr 2017 12:59:22 +0300
Alexander Ilin <ajsoft at yandex.ru> wrote:

> s := { 10 }; makes a SET with 10th bit => s = 0x0400
> 
> So, I don't think s := { i } does what you think it would.
> 
> 30.04.2017, 12:44, "Tomas Kral" <thomas.kral at email.cz>:
> > Hi,
> >
> > Reading `SET - neglected data type',
> > I was wondering, how I could best initialise a SET variable.
> >
> > VAR b: BYTE, i: INTEGER, s: SET;
> > ...
> > SYTEM.GET(adr, s); (* reading 4 bytes from adr, easiest but adr MOD
> > 4! *)
> > ...
> > SYTEM.GET(adr, i); s := {i}; (* same result as above? *)
> > ...
> > (* provided adr MOD = 0 *)
> > SYTEM.GET(adr+0, b); s := {b}; (* same result as above? *)
> > SYTEM.GET(adr+1, b); ASL(s,8); s := s + {b};
> > SYTEM.GET(adr+2, b); ASL(s,8); s := s + {b};
> > SYTEM.GET(adr+3, b); ASL(s,8); s := s + {b};
> >
> > Tomas
> > --
> > Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related
> > systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
> 
> ---=====--- 
>  Александр
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related
> systems https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list