|
|

Do you have a topic you'd like Thorkil to write about? Click
here to send a request. |
|
Number conversion in DACS-80x86
By Thorkil B. Rassmussen
Embedded applications often have the need to present results in hexadecimal notation and in some instances also the ability to enter a hexadecimal value and have it properly converted to a target integer type.
The TEXT_IO.INTEGER_IO generic package allows for printing of hexadecimal values, but the format does not allow to force leading zeroes, it insists on surrounding with 16#...# and negative values use a -16#...# notation.
A convenient way to work with bit patterns is the hexadecimal notation, but if the sign of the value changes the output pattern, as does TEXT_IO, the need is to allow any integer type value to be interpreted as a 1,2,4 or 8 byte unsigned entity, and as such be represented hexadecimally as a 2,4,8 or 16 hex digit value (the 8 byte integer, only when it is available as the LONG_INTEGER).
The traditional way to make conversions is to isolate the low 4 bits of the value (the hex digit), then divide by 16 and repeat the process the appropriate amount of times. Precautions for original sign must be taken, e.g. like this:
In the above sketch the mod operator becomes an efficient AND instruction, because the second operand is 16 (power of 2).
The division by 16, however, takes place in the chosen arithmetic, unless the compiler is helped to realize that the Local value is non-negative, in which case a shift may be applied. For LONG_INTEGER types this division will be a runtime call.
On 80x86 targets divisions are generally 'expensive' instructions involving many clock cycles, so avoiding divisions can have positive impact on the performance of the code.
The following is a complete generic implementation of a package that allows conversion between the generic formal integer type and a string (not just to a string, but also from). It takes advantage of the 80x86 being a little endian processor and employs an array of bytes to overlay the integer type value, as well as array of two hex digits to overlay a byte. The obvious method of interpreting the whole integer type value as an array of hex digits is not used, since this array would be accessed using a dynamic index for a 4 bit entity, generating more code than accessing a dynamic index for a byte sized entity, and subsequently interpreting the byte as an array of two 4 bit values, addressing each with a constant index (1 or 2). The resulting code is compact and efficient and contains no divisions what so ever:
 |
About the Author
Thorkil Bjørn Rassmussen has worked with DDC-I for over 20
years. He has a Master of Science, Computer Science, from
University of Copenhagen. Thorkil has substantial experience
with all of the DACS tools and is the key individual
involved in all FAA certifications for the DACS product
line. Thorkil lives with his wife Jane and two children
Jonas and Tine, just outside of Copenhagen, Denmark.
|
[
Back to Top ]
Welcome to the Wide Open
Spaces!
By Linda Rising
risingl@acm.org
www.lindarising.org
As promised in last month’s article, I’m
going to tell you about an intriguing approach to group interaction
and another story from a fascinating new business book, The CEO and
the Monk [1].
I attended an unusual conference in Vienna a
couple of weeks ago, a gathering of retrospectives’ facilitators.
A small collection of folks from around the world who believe in the
power of retrospectives and also lead them as all or part of the way
they make a living. Internal facilitators were there from HP, Intel,
and Siemens, as well as those of us who are "independent."
Not only are the participants a bit unusual, but the format of the
gathering is, too. I remember the first year I attended. I was
looking for a "program" or "hand-outs" and
"presenters," because we certainly had experts in our
midst and I had questions for them. I anticipated playing a passive
role as a newcomer, and sitting back, prepared to absorb
information. Boy, was I wrong!
The leaders of the kick-off session kept
referring to a collection of flip charts posted on a wall near-by
with what looked like a grid or matrix of the week ahead. A stack of
large index cards lay on the floor surrounded by pens and it seemed
that what we were about to do was to decide the topics we wanted to lead
and write those topics on the index cards and then post them at
appropriate places on the flip chart grid. We were doing "open
space" – whatever that was!
I have topics I want to hear about, but I’m not
the expert! How can I sign up to lead when I don’t know anything?
What if no one shows up? I was dubious, nay, skeptical, that the
whole thing would come together. But, I’m always ready to try! I
wasn’t ready to "lead" a topic, but I watched the flurry
of writers, cards, and pens and followed the postings as they began
to fill up the wall. Someone said, "I’m really interested in
patterns, if I sign up to lead that session, will you attend?"
OK! Now you’re talking! A topic I know something about!
As cards were posted, participants browsed the
topics and signed up to indicate interest. There is no commitment,
just a general idea of the size of the group to decide whether or
not the room assignment is appropriate. There are very few rules in
open space. As a review, the leaders reminded us of the four
principles:
-
Whoever comes are the right people.
-
Whatever happens is the only thing that could
have.
-
When it starts is the right time.
-
When it’s over it's over.
In addition, there is the Law of Two Feet:
If you find yourself in a situation where you
are neither learning nor contributing, move somewhere where you
can.
This unstructured stuff was pretty hard on this
computer scientist, but I was learning fast. What I saw in these
sessions was a "leader" who wasn’t necessarily an
expert, but someone who had "passion" or strong feelings
about some topic and wanted to engage the attendees to find answers
in a true collaborative experiment. It was also the job of the
leader to create a summary of the discussion for those who were
unable to attend.
I actually gave an impromptu
"presentation" on patterns, but most sessions were
exercises, discussions, workshop activities—a host of interesting
and fun times.
"OK," I hear you saying. "Thanks
for the report on the conference, but what’s this got to do with
what happens on Monday morning? Is there any application to the
"real" world here? Yes, yes, you’re right. I need to
focus on my message: how open space techniques apply in daily
business life. Let’s go back to The CEO and the Monk. [By the way,
I received an e-mail from the Monk after my last article. I’m
still amazed at that. What a small world!] Here’s the story as the
former Monk, Kenny Moore, tells it.
I often thought that Catholics were the only
ones with strong beliefs and dogmatic stances. Computer people are
even worse. Their adherence to one technology over another is
cause for inflicting another series of Crusades upon the world.
Those who dare differ with the prevailing beliefs are branded as
heretics and condemned to hell.
Our chief information officer (CIO) was
desperate and called me to assist. "I want the bickering and
fighting to stop," he said. "They need to get beyond
their myopic self-interest or we’ll never meet our financial
commitment." He planned a threat-filled, hour-long department
meeting and offered me a 10-minute slot on the agenda to convince
them of the evil of their ways.
"Just because I was a monk doesn’t mean
that I can perform miracles," I reminded him. Besides, I
doubted if there was anything I could say that would change
things. I believed that the solution resided not with me but with
the employees themselves. I offered the CIO an alternative.
"When you bring them together, why not let them work the
problems out on their own?"
My idea was to host a daylong "Open
Space" event where people would design and attend sessions of
their own choosing, and are individually responsible for running
the event and generating practical solutions.
"Let’s put the focus where it belongs:
on them," I told the CIO. Keep in mind that as a
technologist, he was extremely skeptical of me and my work. That
he came to me at all demonstrated how serious his situation was.
He was intrigued with the concept but wanted some reassurance.
"You’re asking me to invest a lot of
time and money for this event," he said. "Have you ever
done anything like this before?" The truth of the matter was
no. I had read about Open Space. Many who attend bring a mixture
of discouragement and hope for a better future. A select few might
even hope for divine inspiration to find a creative solution. The
facilitator’s role is to serve the needs of the participants.
To me, it sounded a lot like a Catholic Mass. I
had held many of those before, with far more than 400 people.
"Trust me," I said. "I’ve done things like this
before on many occasions. If the employees want it to work, it
will."
We rented the ballroom and conference space in
the Garden City Hotel on Long Island for the day. After the CIO’s
brief introduction, I stepped in front of 400 IT employees.
"The focus of today’s program is on you and how best to
meet the company’s business needs. I’m not in charge of the
day. You are. You will manage yourselves and identify the tasks
that you think need to get accomplished."
Most of the audience looked skeptical. I
plunged ahead anyway. "Anyone may come to the microphone,
state your passion, and sign your name on the list of breakout
rooms to host your session."
I saw 400 heads swiveling around, looking for
some brave soul to step forward. Hundreds of professional people
enveloped in stillness is a rare corporate event. Silence, while
soothing to me, is unnerving to most business folks. As the quiet
intensified, it propelled one courageous employee forward to the
microphone.
"My name is Bill Kearns," he said.
"I’d like to host a session discussing the relocation of
the company’s call center." He signed his name on the list
of conference rooms. Another employee stepped to the microphone.
"I’m Michael Greene, and I want to host a session about
using the Internet to better meet our business needs." He,
too, walked over and signed his name next to a room.
The floodgates opened. Within 20 minutes, 53
employees volunteered to host sessions. Topics ranged from
"Where should we consolidate the data center?" to
"How can we allow more employees to work from their
homes?" As one programmer said at the end of the day, "I
was surprised how the energy in the room shifted once we realized
that we were truly in charge of the day."
Every employee who hosted a session was
responsible for capturing the main recommendations that came out
of the discussion and reporting them back to the group. If someone
didn’t like a particular session, he was free to leave and join
another. A few found none of the sessions satisfactory and created
their own. We underestimated the level of employee involvement and
ran out of conference rooms.
"This is the first time I’ve been at a
corporate meeting that didn’t have an agenda or senior
management telling us what to do," said one of the
supervisors. "I felt like I was personally responsible for
getting our department to work together. I liked that
feeling."
The end result was the generation of over 200
suggestions for engaging employees’ talent and passion to help
the company reach its billion-dollar savings commitment. The event
didn’t magically resolve all conflict, but it did provide the
first real bridges to solidifying the organization into a single,
unified group. The Open Space event transferred ownership of the
business problem from the CIO to his employees.
"I was very surprised how productive all
the chaos was," said the CIO. "They seemed to take
charge of the entire day. And the business solutions were
practical and real." He was able to prioritize the group’s
recommendations and implement a business plan that engaged their
energy and commitment. He told me later that he had become a
believer. I was very flattered and very relived.
I’m a believer, too. As I planned my trip to
Vienna this year. I made a list of the topics I wanted to lead for
our open space gathering. I wasn’t able to find "space"
for all of them, but for the ones I led, and all the others I
attended, I found answers to some questions and uncovered new
questions to ask, as well as new approaches to try and energy to
experiment and, most importantly, support for my struggle from those
who understand where I am as a retrospective facilitator. This is a
powerful way to build a community.
I hope if this subject is new to you, that you’d
like to read more. Here’s a good place to start: http://www.openspaceworld.org/
-- you probably want to click on "English." And, I hope
you decide to order The CEO and the Monk and read the other great
stories about an unusual corporate relationship in a fascinating
company.
References
1. Catell, R.B. and K. Moore with G. Rifkin, The
CEO and the Monk: One Company’s Journey to Profit and Purpose,
John Wiley & Sons, Inc. 2004.
 |
About the Author
http://www.lindarising.org
risingl@acm.org
Linda Rising has a Ph.D. from Arizona
State University in the area of object-based design metrics.
Her background includes university teaching as well as work
in industry in telecommunications, avionics, and strategic
weapons systems. She is the author of numerous articles and
has published three books: Design Patterns in
Communications, The Pattern Almanac 2000, and A Patterns
Handbook. She is currently writing a book with Mary Lynn
Manns: Introducing Patterns (or any Innovation) into
Organizations, to appear in September 2004. |
[
Back to Top ]
|