
In other words, in the spreadsheet, cell B1 should be equal to one minus whatever is in cell A1: 1 minus 0 is 1, whereas 1 minus 1 is 0. The simplest is to write this as the simple formula: Now all you have to do is put the right formula into cell B1, so it’s always the opposite of A1, and you’re done.įor the inverter in Figure 1, if the input is a 0, then the output is a 1, and if the input is 1, then the output is 0 (you have to use 0 and 1, because it won’t work if you try to use H and L or True and False instead). There’s nothing magic about these two cells, as you could use any two cells in the spreadsheet. Simply label them A1 and B1, and right away, you get the idea: Just use cell A1 in the spreadsheet for the input and cell B1 for the output. Looking at an inverter - such as a 7404 - in the TTL manual, you’ll often see the inputs and outputs labelled as In and Out, or perhaps A and B.

The Inverterįigure 1 shows the basic idea. For the examples that follow, I'll use Excel. It doesn’t have to be an expensive or powerful spreadsheet program. Here's an interesting and simple technique for simulating these circuits on a computer using a spreadsheet program. Short of actually building these (and other digital) circuits, it’s sometimes hard to check that they do what they claim to do. Here's some example code that will do the job.I recently read two articles about linear-feedback shift registers, which are shift registers with some of their outputs fed back to the input for generating cyclic redundancy check (CRC) bits or random numbers. To obfuscate a series of byte values, you might find it easier to extract just 8 bits at each iteration. Just XOR these values with your data to obfuscate it, and repeat the process using the same sequence of numbers to retrieve the original data. Obfuscating data with an LFSR:Īs long as your LSFR initially contains a non-zero value, it will step through a sequence of 65535 (2 16–1) pseudorandom values at every iteration. The list of 16-bit LFSRs has 2048 entries. This page contains lists of feedback constants that work with LFSRs of different lengths. (Note: There is no XOR gate feeding into bit 16 because there is no input from bit 17.) Other LFSRs: The quickest way of doing this is by calculating the XOR product of the 16-bit shift register with 0xB400, which has all of these bits set (1011010000000000 in binary). When this bit is zero, this has no effect, but when it is 1, all these bits are flipped.


The least significant bit extracted from the end of the shift register is fed back by XOR-ing it with bits 16, 14, 13 and 11. The Wikipedia article you got this from has an illustration that explains what the code is doing:
