From 7ee2caf0798ee4f12c07177e9d97b3bbbdde1d07 Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Tue, 24 May 2022 20:45:47 +0200 Subject: [PATCH] Updateee --- acronym.md | 1 + c.md | 14 +++++++++---- cracker.md | 5 +++++ faq.md | 8 ++++---- logic_circuit.md | 27 ++++++++++++++++++++++++ logic_gate.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 cracker.md create mode 100644 logic_circuit.md create mode 100644 logic_gate.md diff --git a/acronym.md b/acronym.md index 4fd039e..c42fd02 100644 --- a/acronym.md +++ b/acronym.md @@ -199,6 +199,7 @@ Here is a list of some acronyms: - **[LQ](lq.md)** (low quality) - **[LRS](lrs.md)** (less retarded software) - **[LSB](lsb.md)** (least significant bit) +- **[LUT](lut.md)** (lookup table) - **[MBR](mbr.md)** (master boot record) - **[MHZ](mhz.md)** (megahertz) - **[MIB](mib.md)** (mebibyte) diff --git a/c.md b/c.md index 8a78ee5..cfe8367 100644 --- a/c.md +++ b/c.md @@ -44,12 +44,18 @@ So the standard library (libc) is a subject of live debate because while its int - [uclibc](uclibc.md) - [not using](dependency.md) the standard library :) -## Bad Things about C +## Bad Things About C -C isn't perfect, it was one of the first relatively higher level languages and even though it has showed to have been designed extremely well, some things didn't age great, or were simply bad from the start. We still prefer this language as usually the best choice, but it's good to be aware of its downsides or smaller issues, if only for the sake of one day designing a better version of C. - -TODO +C isn't perfect, it was one of the first relatively higher level languages and even though it has showed to have been designed extremely well, some things didn't age great, or were simply bad from the start. We still prefer this language as usually the best choice, but it's good to be aware of its downsides or smaller issues, if only for the sake of one day designing a better version of C. So, let's go: +- C specification (the ISO standard) is [proprietary](proprietary.md) :( The language itself probably can't be copyrighted, nevertheless this may change in the future, and a proprietary specs lowers C's accessibility and moddability (you can't make derivative versions of the spec). +- The specification is also long as fuck. A good, free language should have a simple definition. It could be simplified a lot by simplifying the language itself as well as dropping some truly legacy considerations (like [BCD](bcd.md) systems?) and removing a lot of undefined behavior. +- Some things could be made simpler, e.g. using [reverse polish](reverse_polish.md) notation for expressions, rather than expressions with brackets and operator precedence, would make implementations much simpler, increasing sucklessness. +- Some things like [enums](enum.md) could be dropped entirely, they can easily be replaced with macros. +- The preprocessor isn't exactly elegant, it has completely different syntax and rules from the main language, not very suckless. +- The syntax isn't perfect, e.g. it's pretty weird that the condition after `if` has to be in brackets, it could be designed better. Keywords also might be better being single chars, like `?` instead of `if` or the weird long ass names with spaces like `unsigned long long` could be made nicer. A shorter, natural-language-neutral source code would be probably better. Both line and block comments could be implemented with a single character, e.g. `#` which would end either with a newline or another `#`. +- Some basic things that are part of the standard library or extensions, like fixed with types and binary literals, could be part of the language itself. +- TODO: moar ## Basics diff --git a/cracker.md b/cracker.md new file mode 100644 index 0000000..1d02e1a --- /dev/null +++ b/cracker.md @@ -0,0 +1,5 @@ +# Cracker + +Crackers are the good people who in computer systems, with use of [hacking](hacking.md), remove artificial barriers to obtaining and sharing of [infomration](information.md); for example they help remove [DRM](drm.md) from [games](game.md) or leak data from secret databases. This is normally illegal which makes the effort even more admirable. + +Cracker is also a yummy food. \ No newline at end of file diff --git a/faq.md b/faq.md index 37d30c2..2a1be2d 100644 --- a/faq.md +++ b/faq.md @@ -48,9 +48,9 @@ What we do NOT engage in is political correctness, censorship, offended culture, ### Why do you use the word Nigger so much? -To counter its censorship. The more they censor something, the more I am going to uncensor it. They have to learn that the only way to make me not say that word so often is to stop censoring it, so to their action of censorship I produce a reaction they dislike. That's basically how you train a dog. (Don't ask who "they" are.). +To counter its censorship. The more they censor something, the more I am going to uncensor it. They have to learn that the only way to make me not say that word so often is to stop censoring it, so to their action of censorship I produce a reaction they dislike. That's basically how you train a dog. (Please don't ask who "they" are.). -It also has the nice side effect of making this less likely to be used by corporations. +It also has the nice side effect of making this less likely to be used by corporations and SJWs. ### How can you say you love all living beings and use offensive language at the same time? @@ -60,9 +60,9 @@ The culture of being offended is [bullshit](bullshit.md), it is a [pseudoleftist This is not a question you dummy. Have you even read the title of this page? Anyway, your teacher is stupid, he is, very likely unknowingly, just spreading the capitalist propaganda. He probably believes what he's saying but he's wrong. -### Lol you've got this fact wrong, you've got bugs in code, your writing sucks etc. +### Lol you've got this fact wrong and you misunderstand this and this topic, you've got bugs in code, your writing sucks etc. How dare you write about things you have no clue about? -Again not a question... sure, nothing is perfect, I still believe this can be helpful to someone. You shouldn't take facts from a random website for granted. If you wanna help me correct errors, email me. +I want a public domain encyclopedia that includes topics of new technology. Since this supposedly modern society failed to produce even a single one and since every idiot on this planet wants to keep his copyright on everything he writes, I am forced to write the encyclopedia myself, even for the price of making mistakes. No, US public domain doesn't count as world wide public domain. Blame this society for not allowing even a tiny bit of information to slip into public domain. Writing my own encyclopedia is literally the best I can do in the situation I am in. Nothing is perfect, I still believe this can be helpful to someone. You shouldn't take facts from a random website for granted. If you wanna help me correct errors, email me. ### How can you use [CC0](cc0.md) if you, as anarchists, reject laws and intellectual property? diff --git a/logic_circuit.md b/logic_circuit.md new file mode 100644 index 0000000..375b8c8 --- /dev/null +++ b/logic_circuit.md @@ -0,0 +1,27 @@ +# Logic Circuit + +Logic circuits are circuits made of [logic gates](logic_gate.md) that implement [Boolean functions](bool.md), i.e. they are "schematics to process 1s and 0s". They are used to design [computers](computer.md). Logic circuits are a bit similar to electronic circuits but are a level of [abstraction](abstraction.md) higher: they don't work with continuous [voltages](voltage.md) but rather with [discrete](discrete.md) [binary](binary.md) logic values: 1s and 0s. Logical circuits can be designed and simulated with specialized software and languages such as [VHDL](vhdl.md). + +Generally a logic circuit has *N* input bits and *M* output bits. Then we divide logic circuits into two main categories: + +- **combinational**: The output values only depend on the input values, i.e. the circuit implements a pure mathematical [function](function.md). Behavior of such circuit can be described with a [truth table](truth_table.md), i.e. a table that for any combination of input values list their corresponding output. +- **sequential**: The output values generally depend on the input values and the internal state of the circuit, i.e. the circuit has a kind of [memory](memory.md) (it can be seen as a [finite state machine](finite_state_machine.md)). The internal state is normally implemented with so called [flip-flops](flip_flop.md) (logic gates that take as input their own output). Truth tables can't be used for describing these circuits. These circuits also often work with **[clock](clock.md)** synchronization, i.e. they have a specialized input called *clock* that periodically switches between 1 and 0 which drives the circuit's operation (this is where [overclocking](overclocking.md) comes from). + +With logic circuits it is possible to implement any boolean function; [undecidability](undecidability.md) doesn't apply here as we're not dealing with [Turing machines](turing_machine.md) computations because the output always has a finite, fixed width, the computation can't end up in an infinite loop as there are no repeating steps, just a straightforward propagation of input values to the output. It is always possible to implement any function at least as a [look up table](lut.md) (which can be created with a [multiplexer](multiplexer.md)). + +Once we've designed a logic circuit, we can [optimize](optimization.md) it which usually means making it use fewer logic gates, i.e. make it cheaper to manufacture (but optimization can also aim for other things, e.g. shortening the maximum length from input to output, i.e. minimizing the circuit's [delay](delay.md)). The optimization can be done with a number of techniques such as manual simplification of the circuit's logic expression or with [Karnaugh maps](karnaugh_map.md). + +Some common logic circuits include: + +- **[adder](adder.md)**: Performs addition. It has many parameters such as the bit width, optional carry output etc. +- **[multiplier](multiplier.md)**: Performs multiplication. +- **[multiplexer](multiplexer.md)** (mux): Has *M* address input bits plus another *2^M* data input bits. The output of the gate is the value of *N*th data bit where *N* is the number specified by the address input. I.e. the circuit selects one of its inputs and sends it to the output. This can be used to implement e.g. [memory](memory.md), [look up tables](lut.md), [bus](bus.md) arbiters and many more things. +- **[demultiplexer](demultiplexer.md)** (demux): Does the opposite of multiplexer, i.e. has one *M* address inputs and 1 data input and *2^M* outputs. Depending on the given address, the input is redirected to *N*th output (while other outputs are 0). +- **[decoder](decoder.md)**: Has *M* inputs and *2^M* outputs. It sets *N*th output to 1 (others are 0) where *N* is the binary number on the input. I.e. decoder converts a binary number into one specific signal. It can be implemented as a demultiplexer whose data input is always 1. +- **[encoder](encoder.md)**: Does the opposite of encoder, i.e. has *2^M* inputs and *M* outputs, expects exactly one of the inputs to be 1 and the rest 0s, the output is a binary number representing the input that's 1. +- **[ALU](alu.md)** (arithmetic logic unit): A more complex circuit capable of performing a number of logic and arithmetic operations. It is a part of a [CPU](cpu.md). +- TODO: more + +## Example + +TODO \ No newline at end of file diff --git a/logic_gate.md b/logic_gate.md new file mode 100644 index 0000000..cb15695 --- /dev/null +++ b/logic_gate.md @@ -0,0 +1,53 @@ +# Logic Gate + +Logic gate is a basic element of [logic circuits](logic_circuit.md), a simple device that implements a [Boolean function](bool.md), i.e. it takes a number of [binary](binary.md) (1 or 0) input values and transforms them into an output binary value. Logic gates are kind of "small boxes" that eat 1s and 0s and spit out other 1s and 0s. Strictly speaking a logic gate must implement a mathematical function, so e.g. [flip-flops](flip_flop.md) don't fall under logic gates because they have an internal state/[memory](memory.md). + +Logic gates are to logic circuits kind of what [resistors](resistor.md), [transistors](transistor.md) etc. are for electronic circuits. They implement basic functions that in the realm of boolean logic are equivalents of addition, multiplication etc. + +Behavior of logic gates is, just as with logic circuits, commonly expressed with so called [truth tables](truth_table.md), i.e. a tables that show the gate's output for any possible combination of inputs. But it can also be written as some kind of equation etc. + +There are 2 possible logic gates with one input and one output: + +- **[identity](identity.md) (buffer)**: Output equals the input. This doesn't have any function from the logic perspective but can e.g. be used as a placeholder or to introduce intentional delay in the physical circuit etc. +- **[NOT](not.md)**: Negates the input (0 to 1, 1 to 0). + +There are 16 possible logic gates with two inputs and one output (logic table of 4 rows can have 2^4 possible output values), however only some of them are commonly used and have their own names. These are: + +- **[OR](or.md)**: Gives 1 if at least one input is 1, otherwise 0. +- **[AND](and.md)**: Gives 1 if both inputs are 1, otherwise 0. +- **[XOR](xor.md) (exclusive OR)**: Gives 1 if inputs differ, otherwise 0. +- **[NOR](nor.md)**: Negation of OR. +- **[NAND](nand.md)**: Negation of AND. +- **[XNOR](xnor.md)**: Negative XOR (equality). + +The truth table of these gates is as follows: + +| x | y | x OR y | x AND y | x XOR y | x NOR y | x NAND y | x XNOR y | +|---|---|--------|---------|---------|---------|----------|----------| +| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | +| 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | +| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | +| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | + +``` + ___ ___ _____ _____ + ---\ ''-. ---\ ''-. ---| '. ---| '. + ) )--- ) )O-- | )--- | )O-- + ---/__..-' ---/__..-' ---|_____.' ---|_____.' + OR NOR AND NAND + ___ ___ . . + --\\ ''-. --\\ ''-. ---|'. ---|'. + )) )--- )) )O-- | >--- | >O-- + --//__..-' --//__..-' ---|.' ---|.' + XOR XNOR ' BUFFER ' NOT +``` + +*Traditional symbols for logic gates.* + +Functions NAND and NOR are so called [functionally complete](functional_completeness.md) which means we can implement any other gate with only one of these gates. For example NOT(x) = NAND(x,x), AND(x,y) = NAND(NAND(x,y),NAND(x,y)), OR(x,y) = NAND(NAND(x,x),NAND(y,y)) etc. Similarly NOT(x) = NOR(x,x), OR(x,y) = NOR(NOR(x,y),NOR(x,y)) etc. + +## See Also + +- [logic circuit](logic_circuit.md) +- [quantum gate](quantum_gate.md) +