I have an interesting logic problem for yous guys
given a list of addresses (with some no-care bits) like this:
build vhdl logic to generate chip selects
that go true when the address bus matches the pattern
efficiently of course
I'll do the first one
no, you gotta do the whole set
is the problem to do "common subexpression elimination", so that the 4th and subsequent lines share the same logic for "first two bits are zero"?
what's chris morley's id?
the key to efficiency is recognizing common chunks and only decoding them once
although you'd want to share logic for all the bits that are common, not just the first two
I offer to let someone else do it
I keep thinking there ought to be a python string function that returns N such that "the first N chars of these two strings match"
seems like a very simple loop to write...
the "first N match" thing?
but I don't want to re-invent the wheel - py seems to have lots of good string processing already
besides, I'm not entirely sure thats the function I need
lets see.... each output (one per line) will be one LUT, thats unavoidable
a LUT can do any function of 4 bits
so if I need 1010001xx, I can say "output true when the three bits right before the xx are 001, and a fourth bit (cascade from higher order decode) is 1
or I can have it compare two bits, and two cascades
jmkasunich: is this something like what you were looking for? http://pastebin.ca/513828
output on your sample set of chip selects: http://pastebin.ca/513831
I doubt I got the vhdl syntax right though
er, hm -- something's missing from there
second try: http://pastebin.ca/513850
alex_joni, u there?
cradek, u there?
jepler: you go to bed too early, and wake up too early
your solution is significantly shorter than mine
it relies more on the synthesis software for optimization though - some of your selects are cascades of many levels
if I trusted the synth software thats probably actually the right approach
my version uses no more than three levels of logic, and no level has more than 4 inputs (so it maps to an FPGA LUT)
jmkasunich, how much do you know about the EMC NML messages?
next to nothing
I don't do NML
not the NML part, the EMC part
I don't do NML
is alex the expert?
the real experts are Fred and Will at NIST, but alex is probalby the closest we have
I don't think NML itself is that bad, but the way EMC uses it looks pretty ugly
I see lots of stuff that appears to be duplicate functionality, way too many mesages that should be a single message
and the status reporting looks a bit strange
there are a bunch of sub status data that is agregated, but each of the sub-status is declared as an NML message instead of just a simple struct
it makes me wonder if they aren't sent by themselves sometimes, and sent agregated at other times
maybe it was done to encapsulate the update() method
petev: I am now
got a few NML questions
hope I can answer them
first, I can't seem to find any messages dealing with RS274 params/variables
do you know if there are any?
what kind of params?
there aren't any
you talking about #5xxx ?
I don't think the interp uses NML at all
if you mean to get/set the values of #1234
there aren't any
task calls interp, interp returns canonicals
ok, that answers that
only when the canonicals get invoked does NML get into the picture
I think there are some cases where you might want to set RS274 params from a GUI, especially with future functionality in mind
next question is regarding the status reporting
that might be pretty hard to do
think about order of interpreting/execution
I don't see the issue
do you want to set the param before the program gets interpreted/run? that might still make sense
you can set with mdi commands
if you change a param during the run, the interpreter might already have passed what you need
jepler, I guess thats a good work around
you can get (kinda) with special comments (DEBUG,#1234)
alex_joni, I wasn't thinking for use with a running program
petev: I know.. just trying to think of possible problems here
many commercial controls set certain behavior based on parameter values, I was thinking more along these lines
regarding the status, I see an aggregated status block being reported
but the sub-status blocks are also NML messages
are they ever sent by themselves?
was this done just for the update() method?
petev: not that I know of
ok, I'll have to dig into the code some more
for data encapsulation, and modularity
also, there appears to be much duplicated functionality and too many messages that could be easily handled by one
alex_joni, I don't mind the su-status, I'm wondering why they are NML messages
petev: my guess is that they were done with the java codegen
for instance, why do we have so many msgs for spindle control?
alex_joni, oh, that would explain it
do we want to clean up some of the messages?
petev: I started to
its also a real pain to have separate messages for on/off
but then I realized there's not much point for it
it's not a big waste of memory/data
at a minimum those should be a single message
and the overhead for programmers is not that hard either
but it's ugly to interface too
look at the spindle messages
at best we would decrease the number by half
there are so many that appear to be redundant
but break backwards compatibility
I'm not sure that's a better situation
petev: trust me, I felt exactly the same way as you do now
when I started looking at this
hmm, it makes it difficult for a new programmer to understand the NML interface
I'm not so sure less messages would make it easier
it would certainly make it more clear which is the correct message to use
yes.. and no :P
which should be used for spindle control? On, Off, Forward, Reverse, Halt, Disable... ?
at lest in my experience I very seldom was able to understand what message I should use
only by looking at the name
petev: most of those aren't for the user anyway
aslo, why is there a base class for each msg type that usually does nothing and there is only one derived class?
they are generated by task (based on the interp) and get sent to the io controller
petev: codegen is my guess
what I do agree we should have
is a separation
of user and internal ?
in the NML files, have the UI part separately from the internal stuff
yes, that would be a very good start
and use separate header files
we can probably do that without changing anything
than internal stuff could change at will
separate headers will be a bit of a problem because of those derived stuff
gotta run for a while (half an hour), still doing some post-wedding stuff
but I'll be back soon, and we can continue this (it's going into a nice direction :D)
let me look at it some more, if I can figure out which ones are internal vs user, then we can understand the impact better
petev: let me give you a link
I have to run too, will be back later tonight
* alex_joni is digging
[17:57:52] <alex_joni> http://www.robcon.ro/emc/nml/NML%20messages%20usage%20desc.csv
might be a tiny bit old
openoffice should open it just fine
some NML analysis I did a while ago
btw, wedding was great.. had the president to wish us all the best :D
so you are married now?
yeap.. since last night :)
what are you doing on here?
you are going to be in the dog house quickly ;-)
aren't you having a wedding today?
had it yesterday
and it was pretty nice too :)
is that a typo or on purpose?
I noticed skunkworks said the same thing
its a common typo
oh, ok then :D
"congradulations on your gratuation from school" ;-)
well.. the strangest thing happend last night :)
not that !!
I should hope that happened too
had the president drive by our wedding, and he stopped and wished us all the best
yeah ;) not quite the most common thing
our president wouldn't do that
our's is like that
but he's usually in our capital.. about 400 miles away
he was here for a soccer final
and he stayed at a hotel near the place
yay, stuart says his homing is now working
that's nice to see
two thoughts: 1, a GPL notice should be added to gcode.html. 2, let's include that file with emc if the translator will GPL it