Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
While you're waiting for x0, there's no way to know if x1-x2-x3 are trying to transmit something.
there are a couples of tricks you can use when you really need to listen to multiples chips:
1: Link everything to the same xbus (the 2 small chips are both linked to x0 of the big one),
that way you can slx x0, and still wait for one of the chip to transmit. the downside, is that if both chips are transmitting, you only get one value (randomly chosen) and the other will be stuck on "write", so that method is good if only one chip at the time will send signals, and you have no idea which one will.
2: if you're sure that both chips will always transmit at the same time, you could
slx x0
doStuff with x0
slx x1
doStuff with x1
since both chips are transmitting at the same time, everything will happen in the same cycle.
Those method can also be combined, link everything to x0 and just
slx x0
do stuff with first value
slx x0
do stuff with 2nd value
Now, onto your solution, there are a bunch of errors:
never use "slp 1" as first line of code unless specifically requested. By sleeping first, you are skipping the entire 1st cycle, than start performing operation on the 2nd one.
First do your stuff, than sleep to the next cycle (almost always slp will be the last command). On the other hand, slx is almost always used as 1st line, since the chip cycle starts only when it gets called.
probably just a typo, but "point" chip teq p0 100 and if true sends 1 to the big chip. Big chip will test if received value is equal to 100 instead of 1, so it will always be false.
"Foul" chip will send -1, but instructions say that a foul is worth -2.
a chip can easily be connected to multiple ports, check one, perform actions, check 2 perform action, and so on till it goes to sleep. No need of using one chip for every single input/output. Sometime if every input/output can be connected to a single chip, that chip could handle the entire system by itself.
the code i wrote is just to explain how slx could work with multiples ports.
in both examples, if you already know that data is coming from a port you don't have to slx twice to read them.
slx x0
doStuff x0
doStuff x1
also, if you need more than 2 xbus but not that many lines of code, the MC4000X is a better choice than the 6000, smaller and equipped with xbus only
Each round check if either one of them has an action required, then do a little nap and do it again next round.
Sure you'll have to power a full cycle when there's nothing to do, but seems efficient enough*.
*I guess you could also have one small chip that listens to both and all it does is send a wakeup to the big chip, I have my doubts you'll get much power efficiency.
After 3 days of trying to do it with 2 small chips and 1 big, I was able to do it in 10 lines of code!
Maybe I'll be able to optimize it to save at least 1 line so that I could fit it on an MC4k....
Thanks you two!!
<3