There are two types of transistors: NPN and PNP. NPN is look like And gate but they aren't the same thing. The transistor is more like 3-state buffers but also they aren't same. Because they have common things but you have to add a resistor. So differents between 3-state buffers and transistors are one of it is a logical thing and other one is a real component and some technical things (voltage and other things). But for PNP it's a PNP transistor and not gate but also they aren't same thing with NAND gate.
Murat_two
Recent community posts
I don't think he will make a big update (at last we waited years for it). In my opinion he's making a new video (Maybe Digital Logic Sim video maybe not). This is his biggest project and all of one person developers make big updates in many years. (For example: Sebastian Lague (Digital Logic Sim), Lukasz Jakowski (Age of History 3), ...)
You can do it with merge and splits. For example if you want to do a 1 shift so first you split 8-bit number to 1-bits then you merge them with on shift. 10110101 -> 1-0-1-1-0-1-0-1 -> 1-0-1-1-0-1-0-1-0. But if you want to make a barrel shift so you have to use MUX ands more shifts. This photo is a example for barrel shift.
You can use barrel shift algorithm for multi-shifting. And bit shifting means add 0's to right side of the number or remove the 0's from the right side. and there are two operators for this: << (shift left) and >> (shift right). For example 10100 >> 2 -> 101 (remove two 0's from the right) and 101 << 2 -> 10100 (add two 0's to right). And for example if we do 101 shift to 1011, barrel shift algorithm says first we split 101 (1 x 4 + 0 x 2 + 1 x 1) and then we do some calculations to our number 1011. 101's first bit is 1 x 4 and we do this shift to 1011 (10110000). Then we can't do a 2 shift because second bit is not 1. In finally there is 1 in the end bit. And it means one more shift and our answer is: 101100000.
But if you want to make it real, RGB display is nonsense. You can make a RAM with so many and gates and not gates. For 2^n bytes. There will be n registers, n not gates and 2n ands. If you make and gates with tri-state buffers, it will be faster. But this will be maybe more complex than version with decoders. I recommend Sebastian's RAM in his latest video.
Sebastian hasn't updated Digital Logic Sim for a long time. So it's up to us, the community, to do mods. And I want you to write any improvements or mods you want in this topic. And if you're already a modder, please make mods in this topic. For me I want transistors, 16-Bit Inputs and optimization modes with auto calculates the clock ticks.
If you put a zero and one in to a bus it will be choose random of this inputs (Not the 3rd black state for zero). And with this you can make some random module. And for example if you have 2 zeros and 3 ones in to a bus, there will be %40 percent of 0 and %60 percent of 1. I think it's a very good feature but also there is a bug. The bug is when you put this randomness module some of them only give 0's or 1's in rising edge of clock. I think it's a bug but also maybe it's a good think because it brokes the simplest, smallest and most accurate randomness module. I want community's opinion of it. These are some patterns of 8-bit randomness modules:
This is the inside of random module:
" SPOTTED BUG! "
This is a random point writer program. And you can see the probability distribation of CPU and it's very strange.
I think this is a bug because of i use a digital logic sim feature that if you connect a zero and one in to a bus it will be random but in this situtation you can see that when there is a rising edge in clock some of this randomness modules gives only 0 or 1.
16-bit inputs, customizable ROM sizes, RGB leds, more keys options (for example Ctrl, Alt, Cmd, Opt, ü, ö, ...), Digital Logic Sim's special file extension with Library/Chip/Project export and import options. Also optimization with multi-proccesing so it can run more quickly. And transistors with built-in modules that convert chip in to PCB/schematic. And the most important one: when I move some things please the wires also move automatically. I tired of moving wires one by one. And tick-rate adjustable clocks, constants and automatically mixing colors (for example if i put in blue and red inputs to a NAND gate it will show up purple automatically), analog wires and sharing with co-authoring.
I made a RISC CPU that have 16 registers. The first 6 are write only registers (First 4 are for screen and other 2 for buzzer) and the register 6 and 7 are outputs, they can use like normal registers or second buzzer (I use them for extra memory, maximum usage can be 64KB ROM and RAM or 16MB ROM and 1/4 KB RAM) . Also the 8th register is for keyboard input, all of possible keys (0-9 and A-Z) have som codes. The CPU also have addition, subtraction, multiplication and division. The multiplication and division is at 1-tick speed (very fast). You can do anything you want with this CPU.
This is the instruction set of it:
- 0000: NOP
- 0001: LOAD Rx ADDR
- 0010: STORE Rx ADDR
- 0011: MOV Rx Imm
- 0100: ADD Rx Ry Rz
- 0101: SUB Rx Ry Rz
- 0110: MUL Rx Ry Rz
- 0111: DIV Rx Ry Rz
- 1000: MOD Rx Ry Rz
- 1001: JMP POS
- 1010: JE POS (First use CMP then use this and CPU only have 1 logic register (1/0) and it can't be directly store in RAM but if you use some CMP, MOV and STORE commands maybe you can)
- 1011: CMP OP Rx Ry (OP means operation code at bottom of instruction set you can find operation codes)
- 1100: AND Rx Ry Rz
- 1101: OR Rx Ry Rz
- 1110: XOR Rx Ry Rz
- 1111: RND Rx
In this instruction set some commands (AND, OR, MUL, MOD, CMP, DIV, ...) have 3 register inputs: Rx, Ry and Rz. The Rx is output, Ry is first term and Rz is the second term. For example: SUB Rx Ry Rz = Rx = Ry - Rz.
Operation code instruction set:
- CMP 0000: FALSE
- CMP 0001: TRUE
- CMP 0010: EQ
- CMP 0011: NEQ
- CMP 0100: GT (Greater Than)
- CMP 0101: GE (GT or EQ)
- CMP 0110: LT (Less Than)
- CMP 0111: LE (LT or EQ)
The other commands (1xxx) are don't do anythings. Also the CPU is unsigned so you can't do anything with negatives but if you wan't so you can use first bit for symbol (+/-) and for CMP you can say if X>01111111 it's negative and other things.
Registers and special commands:
- R0: Screen Position
- R1: Screen Red
- R2: Screen Green
- R3: Screen Blue
- R4: Buzzer Pitch
- R5: Buzzer Volume (In first it can be random so please make it 0 in first)
- R6&7: Extra Outputs
- R8: Keyboard Input
- JMP 0: Reset Screen
- JMP 1: Write Screen
- JMP 2: Refresh Screen
- JMP 3: Empty Position (You can't jump in to here)
- Position 4: Start Position (For some usage it can be 5 or 6 maybe)
I made this chip with that algorithm. First, at left there are NOT gates (with blue outputs) they calculate negative of divider without adding one (that one add with carry input) . And the bottom there are OR and NOT gates (with yellow outputs) they calculate overflow for example 1101 divide by 0011 with 3 shift: 1101-0011000 but that 001 can't be in calculation so if there are any 1's in 001 so it's overflow. It can't be subtract. And if it can be subtract so we subtract for next steps, I do it with MUX. I think it can help you with your project but maybe you can optimize it. Because it works with 1000 ticks per second (In normal mode 250-1000) but maybe in CPU's it can slow down CPU much more.
You can make a divider with multiple subtractions. The method is simple: first you try to subtract dividend by divisor x nth power of 2. In here n is the bit number (4-bit, 8-bit or else) then if you can subtract the first bit of solution is 1 else 0 (1xxx or 0xxx for 4-bit for example). Than if it's 1 you alsa make subtraction else don't do it. At the end decrease n by one by one and do this every time. For example:
4-Bit Divison (15 divided by 3):
- Is 15 can be subtract by 3 x 8: No. Then our answer is 0xxx,
- Is 15 can be subtract by 3 x 4: Yes. Then our answer is 01xx and now 15 goes to 3.
- Is 3 can be subtract by 3 x 2: No. Then it's 010x
- Is 3 can be subtract by 3 x 1: Yes. Then our final answer is 0101 => Decimal 5 and it's true.
I maded a massive 16-bit ALU that has 14 operations includes multiplication. But i will make a v2 of it. v2 will have 16 operations (division and mod). Maybe I will make a CPU for it and CPU will be maybe includes loop's, while's and for's. This is a photo of it and operation set:
- HEX: 0x0, BIN: 0000, ADD: A+B- HEX: 0x1, BIN: 0001, SUB: A-B
- HEX: 0x2, BIN: 0010, AND: A AND B
- HEX: 0x3, BIN: 0011, OR: A OR B
- HEX: 0x4, BIN: 0100, XOR: A XOR B
- HEX: 0x5, BIN: 0101, NOT: !A
- HEX: 0x6, BIN: 0110, SHL: A<<1
- HEX: 0x7, BIN: 0111, SHR: A>>1
- HEX: 0x8, BIN: 1000, MUL: A*B
- HEX: 0x9, BIN: 1001, DIV: A/B (will be added in v2)
- HEX: 0xA, BIN: 1010, NEG: -B (Because of SUB it's not for A, it's for B)
- HEX: 0xB, BIN: 1011, MOD: A%B (will be added in v2)
- HEX: 0xC, BIN: 1100, EQ: A==B
- HEX: 0xD, BIN: 1101, NEQ: A!=B
- HEX: 0xE, BIN: 1110, GT: A>B
- HEX: 0xF, BIN: 1111, LT: A<B
