小 (→Processor Chip) |
小 (→Memory Chip) |
||
第4行: | 第4行: | ||
* Multiple digits can be saved in the same memory cell; each cell can contain 2 or 3 digits. | * Multiple digits can be saved in the same memory cell; each cell can contain 2 or 3 digits. | ||
Set a digit with `dst`; get a digit with `dgt`. | Set a digit with `dst`; get a digit with `dgt`. | ||
− | To effectively extract the digits, ideally this should be done in a big chip, by putting the data into | + | To effectively extract the digits, ideally this should be done in a big chip, by putting the data into '''dat''' and repeatedly move it into '''acc'''. |
* Memory chip is also a great accumulator | * Memory chip is also a great accumulator |
2023年6月19日 (一) 02:34的版本
Tricks
Memory Chip
- Multiple digits can be saved in the same memory cell; each cell can contain 2 or 3 digits.
Set a digit with `dst`; get a digit with `dgt`. To effectively extract the digits, ideally this should be done in a big chip, by putting the data into dat and repeatedly move it into acc.
- Memory chip is also a great accumulator
- Memory chip's address port can handle values which are bigger than the max address - it'll wrap around.
So you don't need to say `tgt acc 13; +sub 13`
Processor Chip
- If the range of *acc* is limited, then the extra range can be used to store a bit.
Say if the value is 0 ~ 200, then we can `sub 400` from it to use -400 ~ -200 to represent the bit = 1, and the original range to represent bit = 0.
- An Xbus can be shared by multiple writer; however you should only have 1 reader.
- Sometimes `jmp L` can be omitted by carefully placing +/- on the statements below.
If you have another test statement, though, this becomes harder. The loop statements may be prefixed by loop continuous condition; for example, if we have `teq acc 0; -jmp l`, then we can prefix the statements by '-'. Notice that, however, in the first round, this is decided by the previous comparison, so they may or may not be executed. This can be useful, if you want to skip some statements in the first round, though.