Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Modeling to the bit level(Can it be done?)
Modeling to the bit level [message #528974] Thu, 22 April 2010 14:16 Go to next message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
I have what appears to be a fairly simple model. It consists of 64 16-bit words. That is the easy part.

The real trick with this model is that the pertinent data consists of bit fields and individual bits. Some of the bit fields span more than one 16-bit word. There is no consistency. Some words have each bit as an individual piece of data, and some words have bit fields of varying size.

Can EMF be used to model data down to the bit level or bit field level?

Thanks.
Re: Modeling to the bit level [message #529064 is a reply to message #528974] Thu, 22 April 2010 19:09 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 22.04.10 16.16, Herb Miller wrote:
> I have what appears to be a fairly simple model. It consists of 64
> 16-bit words. That is the easy part.
>
> The real trick with this model is that the pertinent data consists of
> bit fields and individual bits. Some of the bit fields span more than
> one 16-bit word. There is no consistency. Some words have each bit as an
> individual piece of data, and some words have bit fields of varying size.

It seems more natural to model what the bits represent, rather than a
particular encoding of them as 64 16 bit words. In addition, you can
model decode and encode operations that move data from and to the
EObject and an array of 64 shorts. Stubs for these methods can will be
generated, and you must implement them by hand.

> Can EMF be used to model data down to the bit level or bit field level?

No, although EMF supports representing a small number of boolean fields
in an internal bit field that EObjects have.

Hallvard
Re: Modeling to the bit level [message #529079 is a reply to message #529064] Thu, 22 April 2010 20:13 Go to previous messageGo to next message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
The encoding is necessary because it represents data in a file that is passed to a radio in order to control different functions of the radio. The bits have to be the right value and in the correct position in order for the radio to function.

The radio has an internal buffer that the 64 16-bit words map directly into.

Too bad. I would love to have been able to use EMF for that kind of a model.

Thanks.

Re: Modeling to the bit level [message #529114 is a reply to message #529079] Fri, 23 April 2010 06:12 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Herb,

Maybe it helps to model your data as a custom EDataType. Then you can
write your own serialization logic in the generated createFromString()
and convertToString() methods of the package factory.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 22.04.2010 22:13, schrieb Herb Miller:
> The encoding is necessary because it represents data in a file that is
> passed to a radio in order to control different functions of the
> radio. The bits have to be the right value and in the correct
> position in order for the radio to function.
>
> The radio has an internal buffer that the 64 16-bit words map directly
> into.
>
> Too bad. I would love to have been able to use EMF for that kind of a
> model.
>
> Thanks.
>
>


Re: Modeling to the bit level [message #529211 is a reply to message #529114] Fri, 23 April 2010 13:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Eike,

Yes, that's what I was going to suggest too. The basic premise is that,
if you can do it by hand, you can do it with EMF as well, so most
certainly it's possible to define an EDataType that's an array of short.


Eike Stepper wrote:
> Hi Herb,
>
> Maybe it helps to model your data as a custom EDataType. Then you can
> write your own serialization logic in the generated createFromString()
> and convertToString() methods of the package factory.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 22.04.2010 22:13, schrieb Herb Miller:
>> The encoding is necessary because it represents data in a file that
>> is passed to a radio in order to control different functions of the
>> radio. The bits have to be the right value and in the correct
>> position in order for the radio to function.
>>
>> The radio has an internal buffer that the 64 16-bit words map
>> directly into.
>>
>> Too bad. I would love to have been able to use EMF for that kind of
>> a model.
>>
>> Thanks.
>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #529644 is a reply to message #529211] Mon, 26 April 2010 15:44 Go to previous messageGo to next message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
The EDataType sounds like a definite possibility. I figured something special would have to be added for serialization.

i am still not too clear on how to model the bit fields.

Let's say the 1st 16-bit short has these bit fields:

Bits 0- 3 = frequency selection
Bits 4- 6 = interference algorithm
Bits 7- 9 = power amp level
Bits 10-13 = noise setting
Bit 14 = squelch on/off
Bit 15 = error log on/off

Are you all suggesting I model each of those bit fields as some other value, say an integer. Then EMF would generate some representation for each of these fields or bits that represent an individual piece of information.

Then all I would have to do is translate the 16-bit short that is read in to these new EMF fields when the model data is fetched, and I would have to translate the EMF represenation into the bit fields when the model data is saved on the way out.

Is that correct?

Thanks.

Re: Modeling to the bit level [message #529658 is a reply to message #529644] Mon, 26 April 2010 16:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Herb,

Comments below.

Herb Miller wrote:
> The EDataType sounds like a definite possibility. I figured something
> special would have to be added for serialization.
>
> i am still not too clear on how to model the bit fields.
I suppose it's not entirely clear either where you need this particular
16-bit short representation. Of course it's always possible to convert
between representations, so you might just model a series boolean
features and write some to code covert them to another representation or
to set them based on that other representation. These might be just
convenience methods.
>
> Let's say the 1st 16-bit short has these bit fields:
>
> Bits 0- 3 = frequency selection
> Bits 4- 6 = interference algorithm
> Bits 7- 9 = power amp level
> Bits 10-13 = noise setting
> Bit 14 = squelch on/off
> Bit 15 = error log on/off
>
> Are you all suggesting I model each of those bit fields as some other
> value, say an integer. Then EMF would generate some representation
> for each of these fields or bits that represent an individual piece of
> information.
There is a GenModel flag you can set that allows you to model these as
boolean features and then EMF will pack them into int flag fields. I
don't know that this directly helps you though.
>
> Then all I would have to do is translate the 16-bit short that is read
> in to these new EMF fields when the model data is fetched, and I would
> have to translate the EMF represenation into the bit fields when the
> model data is saved on the way out.
I think part of the problem in answering your question is it's not
entirely clear where you need the specific representation you describe.
Is this important in the serialized form? Is it important at runtime
when you have the model instance?
>
> Is that correct?
>
> Thanks.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #529699 is a reply to message #529658] Mon, 26 April 2010 19:39 Go to previous messageGo to next message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
Here is the whole thing in a nutshell.

The radio operator can initialize the radio by loading in a file with the correctly formatted set of 16-bit shorts.

However, the operator may need to change a bit field, or even 1 bit, so GUIs will have to be provided for each separate cohesive piece of data whether it be a whole word, a part of a word or even 1 bit of a word (when I say word I mean 16-bit short).

After making changes, the operator may want to save the changes made in a new file.

I was hoping to model the bit fields and bits with EMF, generate, then got to RCP and all of the GUIs and model data would be generated (including serialization).

From what I have gleaned so far, the serialization will have to be customized.

Does this help?


Re: Modeling to the bit level [message #529703 is a reply to message #529699] Mon, 26 April 2010 19:57 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Herb,

Comments below.


Herb Miller wrote:
> Here is the whole thing in a nutshell.
>
> The radio operator can initialize the radio by loading in a file with
> the correctly formatted set of 16-bit shorts.
So this comes down to needing a particular serialization format. It
doesn't sound like the file is XML...
>
> However, the operator may need to change a bit field, or even 1 bit,
> so GUIs will have to be provided for each separate cohesive piece of
> data whether it be a whole word, a part of a word or even 1 bit of a
> word (when I say word I mean 16-bit short).
>
> After making changes, the operator may want to save the changes made
> in a new file.
>
> I was hoping to model the bit fields and bits with EMF, generate, then
> got to RCP and all of the GUIs and model data would be generated
> (including serialization).
The serialization sounds highly custom, i.e., it doesn't sound like it's
XML, but I could be wrong about that. Can you show an example of the
serialization?
>
> From what I have gleaned so far, the serialization will have to be
> customized.
It sounds that way.
>
> Does this help?
If you show me the details of the serialization can can likely better
suggest the best approach for customization.
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #529712 is a reply to message #529703] Mon, 26 April 2010 21:24 Go to previous messageGo to next message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
You are so right. The data in the file is definitely NOT XML. It is a list (64 to be exact) of 16-bit words, so serialization is definitely custom.

It sounds like I will have to serialize the bit fields and bit values into EMF objects when reading the file, and convert EMF objects into the file format when writing the file, correct?

The details of the serialization are similar to what I sent before with the example of the 16-bit short being converted into many fields. Some bit fields are 24-bits in length which would be 1 16-bit short plus a byte from the next 16-bit short.

Thanks.



Re: Modeling to the bit level [message #529720 is a reply to message #529712] Mon, 26 April 2010 22:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Herb,

You could specialize ResourceImpl's doLoad and doSave to read and write
your specialized format. I think you'd model many boolean fields, and
perhaps some enums. You'd encode/decode these to/from your specialized
format.


Herb Miller wrote:
> You are so right. The data in the file is definitely NOT XML. It is
> a list (64 to be exact) of 16-bit words, so serialization is
> definitely custom.
>
> It sounds like I will have to serialize the bit fields and bit values
> into EMF objects when reading the file, and convert EMF objects into
> the file format when writing the file, correct?
>
> The details of the serialization are similar to what I sent before
> with the example of the 16-bit short being converted into many
> fields. Some bit fields are 24-bits in length which would be 1 16-bit
> short plus a byte from the next 16-bit short.
>
> Thanks.
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #622487 is a reply to message #529064] Thu, 22 April 2010 20:13 Go to previous message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
The encoding is necessary because it represents data in a file that is passed to a radio in order to control different functions of the radio. The bits have to be the right value and in the correct position in order for the radio to function.

The radio has an internal buffer that the 64 16-bit words map directly into.

Too bad. I would love to have been able to use EMF for that kind of a model.

Thanks.
Re: Modeling to the bit level [message #622488 is a reply to message #622487] Fri, 23 April 2010 06:12 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Herb,

Maybe it helps to model your data as a custom EDataType. Then you can
write your own serialization logic in the generated createFromString()
and convertToString() methods of the package factory.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 22.04.2010 22:13, schrieb Herb Miller:
> The encoding is necessary because it represents data in a file that is
> passed to a radio in order to control different functions of the
> radio. The bits have to be the right value and in the correct
> position in order for the radio to function.
>
> The radio has an internal buffer that the 64 16-bit words map directly
> into.
>
> Too bad. I would love to have been able to use EMF for that kind of a
> model.
>
> Thanks.
>
>


Re: Modeling to the bit level [message #622490 is a reply to message #529114] Fri, 23 April 2010 13:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Eike,

Yes, that's what I was going to suggest too. The basic premise is that,
if you can do it by hand, you can do it with EMF as well, so most
certainly it's possible to define an EDataType that's an array of short.


Eike Stepper wrote:
> Hi Herb,
>
> Maybe it helps to model your data as a custom EDataType. Then you can
> write your own serialization logic in the generated createFromString()
> and convertToString() methods of the package factory.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 22.04.2010 22:13, schrieb Herb Miller:
>> The encoding is necessary because it represents data in a file that
>> is passed to a radio in order to control different functions of the
>> radio. The bits have to be the right value and in the correct
>> position in order for the radio to function.
>>
>> The radio has an internal buffer that the 64 16-bit words map
>> directly into.
>>
>> Too bad. I would love to have been able to use EMF for that kind of
>> a model.
>>
>> Thanks.
>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #622499 is a reply to message #529211] Mon, 26 April 2010 15:44 Go to previous message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
The EDataType sounds like a definite possibility. I figured something special would have to be added for serialization.

i am still not too clear on how to model the bit fields.

Let's say the 1st 16-bit short has these bit fields:

Bits 0- 3 = frequency selection
Bits 4- 6 = interference algorithm
Bits 7- 9 = power amp level
Bits 10-13 = noise setting
Bit 14 = squelch on/off
Bit 15 = error log on/off

Are you all suggesting I model each of those bit fields as some other value, say an integer. Then EMF would generate some representation for each of these fields or bits that represent an individual piece of information.

Then all I would have to do is translate the 16-bit short that is read in to these new EMF fields when the model data is fetched, and I would have to translate the EMF represenation into the bit fields when the model data is saved on the way out.

Is that correct?

Thanks.
Re: Modeling to the bit level [message #622500 is a reply to message #529644] Mon, 26 April 2010 16:08 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Herb,

Comments below.

Herb Miller wrote:
> The EDataType sounds like a definite possibility. I figured something
> special would have to be added for serialization.
>
> i am still not too clear on how to model the bit fields.
I suppose it's not entirely clear either where you need this particular
16-bit short representation. Of course it's always possible to convert
between representations, so you might just model a series boolean
features and write some to code covert them to another representation or
to set them based on that other representation. These might be just
convenience methods.
>
> Let's say the 1st 16-bit short has these bit fields:
>
> Bits 0- 3 = frequency selection
> Bits 4- 6 = interference algorithm
> Bits 7- 9 = power amp level
> Bits 10-13 = noise setting
> Bit 14 = squelch on/off
> Bit 15 = error log on/off
>
> Are you all suggesting I model each of those bit fields as some other
> value, say an integer. Then EMF would generate some representation
> for each of these fields or bits that represent an individual piece of
> information.
There is a GenModel flag you can set that allows you to model these as
boolean features and then EMF will pack them into int flag fields. I
don't know that this directly helps you though.
>
> Then all I would have to do is translate the 16-bit short that is read
> in to these new EMF fields when the model data is fetched, and I would
> have to translate the EMF represenation into the bit fields when the
> model data is saved on the way out.
I think part of the problem in answering your question is it's not
entirely clear where you need the specific representation you describe.
Is this important in the serialized form? Is it important at runtime
when you have the model instance?
>
> Is that correct?
>
> Thanks.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #622501 is a reply to message #529658] Mon, 26 April 2010 19:39 Go to previous message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
Here is the whole thing in a nutshell.

The radio operator can initialize the radio by loading in a file with the correctly formatted set of 16-bit shorts.

However, the operator may need to change a bit field, or even 1 bit, so GUIs will have to be provided for each separate cohesive piece of data whether it be a whole word, a part of a word or even 1 bit of a word (when I say word I mean 16-bit short).

After making changes, the operator may want to save the changes made in a new file.

I was hoping to model the bit fields and bits with EMF, generate, then got to RCP and all of the GUIs and model data would be generated (including serialization).

From what I have gleaned so far, the serialization will have to be customized.

Does this help?
Re: Modeling to the bit level [message #622502 is a reply to message #529699] Mon, 26 April 2010 19:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Herb,

Comments below.


Herb Miller wrote:
> Here is the whole thing in a nutshell.
>
> The radio operator can initialize the radio by loading in a file with
> the correctly formatted set of 16-bit shorts.
So this comes down to needing a particular serialization format. It
doesn't sound like the file is XML...
>
> However, the operator may need to change a bit field, or even 1 bit,
> so GUIs will have to be provided for each separate cohesive piece of
> data whether it be a whole word, a part of a word or even 1 bit of a
> word (when I say word I mean 16-bit short).
>
> After making changes, the operator may want to save the changes made
> in a new file.
>
> I was hoping to model the bit fields and bits with EMF, generate, then
> got to RCP and all of the GUIs and model data would be generated
> (including serialization).
The serialization sounds highly custom, i.e., it doesn't sound like it's
XML, but I could be wrong about that. Can you show an example of the
serialization?
>
> From what I have gleaned so far, the serialization will have to be
> customized.
It sounds that way.
>
> Does this help?
If you show me the details of the serialization can can likely better
suggest the best approach for customization.
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Modeling to the bit level [message #622505 is a reply to message #529703] Mon, 26 April 2010 21:24 Go to previous message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
You are so right. The data in the file is definitely NOT XML. It is a list (64 to be exact) of 16-bit words, so serialization is definitely custom.

It sounds like I will have to serialize the bit fields and bit values into EMF objects when reading the file, and convert EMF objects into the file format when writing the file, correct?

The details of the serialization are similar to what I sent before with the example of the 16-bit short being converted into many fields. Some bit fields are 24-bits in length which would be 1 16-bit short plus a byte from the next 16-bit short.

Thanks.
Re: Modeling to the bit level [message #622506 is a reply to message #529712] Mon, 26 April 2010 22:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Herb,

You could specialize ResourceImpl's doLoad and doSave to read and write
your specialized format. I think you'd model many boolean fields, and
perhaps some enums. You'd encode/decode these to/from your specialized
format.


Herb Miller wrote:
> You are so right. The data in the file is definitely NOT XML. It is
> a list (64 to be exact) of 16-bit words, so serialization is
> definitely custom.
>
> It sounds like I will have to serialize the bit fields and bit values
> into EMF objects when reading the file, and convert EMF objects into
> the file format when writing the file, correct?
>
> The details of the serialization are similar to what I sent before
> with the example of the 16-bit short being converted into many
> fields. Some bit fields are 24-bits in length which would be 1 16-bit
> short plus a byte from the next 16-bit short.
>
> Thanks.
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMFT] The EMF Facet proposal
Next Topic:[EMFT] The EMF Facet proposal
Goto Forum:
  


Current Time: Thu Apr 25 17:39:19 GMT 2024

Powered by FUDForum. Page generated in 0.04508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top