Jumping, Branching, and Flags - Let's Make a Redstone Computer! #7

  Рет қаралды 5,147

mattbatwings

mattbatwings

Күн бұрын

Пікірлер: 77
@mattbatwings
@mattbatwings 10 сағат бұрын
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/mattbatwings/ You’ll also get 20% off an annual premium subscription.
@AN71717
@AN71717 4 сағат бұрын
so cool!
@SubatomicPlanets
@SubatomicPlanets 4 сағат бұрын
I'm a programmer and game developer and this series is gold! I love understanding such low level topics like CPU architectures but most learning resources are boring or too complicated. But your videos are fun! Explaining it with minecraft really helps too! Thanks for making this series!
@FrightfulMC
@FrightfulMC 4 сағат бұрын
I agree
@doodocina
@doodocina 2 сағат бұрын
what language do you program in?
@The_real_Creepermaster
@The_real_Creepermaster Сағат бұрын
True
@SubatomicPlanets
@SubatomicPlanets Сағат бұрын
@@doodocina Mostly Python, C#, and C++
@doodocina
@doodocina Сағат бұрын
@@SubatomicPlanets you love such low level topics but program in python, c#?...
@the_m_original
@the_m_original 2 сағат бұрын
4:43 quick note from me here: if your program counter is quite literally a counter that you can set to any time, i recommend just setting it to the jmp address -1, so when it increments, it goes to the correct address. (this preproccessing step can be done in hardware, by making an adder that adds 255 to the jmp address and having the result get stored instead of the actual address) 7:06 another way to solve this is, get this, implementing temporary pointers in the assembler (JMP [pointer] -> pointer: \code), which, even if gets more instructions added before the pointer, will move the pointer up.
@mtarek2005
@mtarek2005 52 минут бұрын
or relative jump as a pseudo instruction
@rtyyyyb
@rtyyyyb 10 сағат бұрын
the 3 classic properties of trees: branches. flags. and jumping competitions
@mrseriousv1
@mrseriousv1 3 сағат бұрын
VOTE MATT FOR THE AWARDS
@Benlego2017
@Benlego2017 2 сағат бұрын
typo at 1:10 : you accidentally had the ALU Input B display a 7, not a 3
@altrightz
@altrightz 4 сағат бұрын
Everytime matt uploads, I get smarter
@Purple_Prog
@Purple_Prog Сағат бұрын
😂 me too
@Cinnimin
@Cinnimin 3 сағат бұрын
Parity is also a neat flag to use if you have the space for it. It is only true if the LSB is true (like the opposite of the negative flag) and can be useful in programs like multiplication :D
@kylebowles9820
@kylebowles9820 11 минут бұрын
I love that once the computer is turing complete it becomes about making it super convenient to program ❤
@NK-61
@NK-61 3 сағат бұрын
YESSSSS MATT RELEASED A BRANCHING EPISODE
@Sokar6186
@Sokar6186 Сағат бұрын
Relative jumps also help in the case when your memory is large enough to have addresses larger than instructions themselves. More often than not you need to jump locally for loops rather than across your program, so relative jumps are great for most cases. This way you can quickly and easily do jumps without always needing paging registers.
@henrynagel2658
@henrynagel2658 3 сағат бұрын
I was so excited for this episode, knowing that selection would make this the real deal
@DarmiGames
@DarmiGames 3 сағат бұрын
This is getting more and more complicated. I've had to rewatch and pause the video to understand it. Thank you for this series!
@PSP_24
@PSP_24 2 сағат бұрын
I'm taking an assembly and architecture class at the same time as this series, it's amazing how well you are able to describe every concept better than my prof! Plus it's really cool to see what i'm learning in class be put into minecraft lol
@Sand.
@Sand. 53 минут бұрын
I was having trouble adding flags to my CCA this morning, so this will definitely help!
@MrTurtleWithTophat
@MrTurtleWithTophat 4 сағат бұрын
Man, you posted this right as I was watching the redstone awards trailer.
@EliaxLavrix__
@EliaxLavrix__ 2 сағат бұрын
All my fellas🔥
@whisperSSG8
@whisperSSG8 43 минут бұрын
finally he caught up to my microcontroller engineering 2 module now i can just watch this instead of going to lectures
@SobTim-eu3xu
@SobTim-eu3xu Сағат бұрын
Bro, I respect you
@diggoran
@diggoran 2 сағат бұрын
Interesting seeing the branch conditions not being built into the opcodes. I expected JEQ and JNE to be their own opcodes, but you're able to do a 4 in one with BRH due to using a 10 bit address and having 4 bits left over.
@Harmon-
@Harmon- 3 сағат бұрын
i have absolutely no idea what this means but i love it
@icy_orca9348
@icy_orca9348 49 минут бұрын
This guy has inspired me to study computer science
@MasonAlex-f9p
@MasonAlex-f9p 2 сағат бұрын
you should add an even flag, it could be useful in bitwise operations
@MadocComadrin
@MadocComadrin 42 минут бұрын
It's a bit of interesting pedantry, but it's not actually Turing Complete yet. With only a finite number of finitely-sized registers, we can only decide problems in constant space, i.e. DSPACE(O(1)). But DSPACE(O(1)) is contained within the Regular Languages. Anything this computer could do that halts, a DFA could be made to at least brute-force it. We need memory (in an amount that varies greatly enough with the size of the input) to do better, and we'd need unbounded memory (and a way to access it) to be Turing Complete.
@thebluefroganimation
@thebluefroganimation 4 сағат бұрын
another video. another APSALUTE BANGER
@shailist
@shailist 50 минут бұрын
relative jumps are far superior to absolute jumps when you introduce dynamic code loading and relocations. since this architecture uses a ROM, dynamic code loading and relocations are never a problem. (tho mplementing relative jumps is as easy as plugging the operand into the addition in the program counter)
@gamerguy4551
@gamerguy4551 3 сағат бұрын
Bro wth ur da goat
@lorenzomarconetto
@lorenzomarconetto 4 сағат бұрын
You are the best
@BaldiReycaster
@BaldiReycaster 2 сағат бұрын
Nice.
@banan_guys
@banan_guys 4 сағат бұрын
Good job
@FeriElenatro
@FeriElenatro 3 сағат бұрын
Matt, what about being able to specify the address of a register/memory location as a number from a register? For example, if register 1 stores the number 3, then will do something with register 3
@Purple_Prog
@Purple_Prog Сағат бұрын
you mean like pointers ?
@MrMoon-hy6pn
@MrMoon-hy6pn Сағат бұрын
I imagine once he gets to memory he would implement something like an “ldr”instruction, load from memory address into a register (and set the zero flag?) as well as the complementary store opcode. Then the world’s your oyster.
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
10:15 everyone has made mistakes. Everyone has been on the unexplainable darkness. Glad to hear you're normal now
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
5:46 love how this version of the computer that doesn't have BRH is actually cool, not because it's any powerful or even useful, but because its halting problem is solved.
@Kynatosh
@Kynatosh 3 сағат бұрын
Yeah it is solved because it has no conditionals so you can solve for "does it end or not" in polynomial time: if there is a loop at any time, it won't ever end.
@diggoran
@diggoran 2 сағат бұрын
Zero 7 mentioned
@thesp1r1tdragon55
@thesp1r1tdragon55 31 минут бұрын
If direct jumping is better on the actual hardware why would you ever do relative jumping? Couldn't you just translate all the relative jumping instructions in your code to direct ones during the assembly process?
@Didomate
@Didomate 3 сағат бұрын
Clicked on this on the very first Planck second
@UtkuDeniz123
@UtkuDeniz123 3 сағат бұрын
Im sure that he is programming in assembly.
@mine_blame
@mine_blame 2 сағат бұрын
clownpierce posted at same time lol
@codeflowshai
@codeflowshai 3 сағат бұрын
under 30 minutes?!
@eclipse08271
@eclipse08271 3 сағат бұрын
Hi
@whylookhere
@whylookhere 4 сағат бұрын
hi
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
4:08 OH YEAH BOYS, INTRODUCING *BRH* !!!!! 🎉🎉
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
4:28 those 2 free bits. Maybe they could be used for relative jumps...? Think about it master
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
2:35 nice, you used the congruent simbol :)
@lolmuffen8604
@lolmuffen8604 4 сағат бұрын
Yoooooooo!!!!!!
@ELITE-CHIEF-DRILL-MAN-ko3yp
@ELITE-CHIEF-DRILL-MAN-ko3yp 4 сағат бұрын
YAHOOOOOOOOOOOO
@BEAM-BOTOND
@BEAM-BOTOND 4 сағат бұрын
Yoooooo!!
@YellowBunny
@YellowBunny 3 сағат бұрын
Edit: It's not as obvious as I thought while writing the comment initially, and I would need to think about this some more to come to a definite conclusion on whether the computer would be Turing complete without branching. The computer was already Turing complete without conditional branching or even any branching (if we assume arbitrarily large memory and program memory, which is always needed in some way for Turing completeness). The proof of this is analogous to the one in the paper "mov is Turing-complete", which also proves the Turing completeness of a subset of a programming language that does not contain jump instructions.
@mattbatwings
@mattbatwings 3 сағат бұрын
@@YellowBunny I’m actually not sure that’s true. I’ve looked into that paper a little bit, and it’s referring to x86’s MOV which is much more capable than any pseudo MOV you could’ve made on my cpu. It relies on a lot of lookup tables and switches between different addresses modes as well. I didn’t really read it that much tho so I could be wrong
@YellowBunny
@YellowBunny 2 сағат бұрын
@@mattbatwings Admittedly, it's been a while since I read that paper and I might not have remembered all the details correctly. It's definitely not as obvious as I thought while writing that comment 10 minutes ago :) I'm not sure anymore myself now. I'll add a disclaimer to the original comment.
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
10:38 it technically can be considered bad code to use the to changing flags thing but idc that much so I'll use it hehe
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
Thinking 'bout smth. I'm thinking about making an assembler that supports the normal instructions but also supporting an AVG instruction (average). It would be the same as RSH but the secound parameter may not be set to 0.
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
8:43 ok. But... BUT DID YOU REALLY HAVE TO MAKE RSH NOT UPDATE FLAGS?!!
@Tbgw
@Tbgw 4 сағат бұрын
“Only 300000 views in 2 seconds Bro fell off”
@altrightz
@altrightz 4 сағат бұрын
Yoooooooooooo!!!! 5 min ago!
@rodrigoqteixeira
@rodrigoqteixeira 3 сағат бұрын
5:21 that is so ugly. Just use a damn LSH
@Ghal00xx
@Ghal00xx 4 сағат бұрын
3rd :)
@theguywiththewhiteblanket
@theguywiththewhiteblanket 3 сағат бұрын
46th! also NEEEERD
@deltamico
@deltamico 2 сағат бұрын
not cool
@catto88
@catto88 4 сағат бұрын
Meow!!!! :3
@giovannicesaramorim9adigan961
@giovannicesaramorim9adigan961 4 сағат бұрын
The instruction set seems extremely innefficient, you could probably double the amount of instructions by rearranging and simulating instructions
@mitchratka3661
@mitchratka3661 3 сағат бұрын
Efficiency is like the lowest priority for this series, he said it outright in the beginning, this instruction set is supposed to be the simplest/most readable
@giovannicesaramorim9adigan961
@giovannicesaramorim9adigan961 Сағат бұрын
@@mitchratka3661 not even, no op has no reason to exist, and was only added due to "style", where a whole instruction could be fit. Also, multiple holes are left in the operand part of the instruction set, where it could be filled with another instruction (where if != 0 it is the said instruction).
@Bytzoid
@Bytzoid 4 сағат бұрын
5th lol im early
@dr.cheese1045
@dr.cheese1045 4 сағат бұрын
Obviously haven't watched it but cool vid!
What Researchers Learned from 350,757 Coin Flips
25:46
Another Roof
Рет қаралды 10 М.
The REAL hardcore nether challenge
26:38
BANCLAM
Рет қаралды 283 М.
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
Trapped by the Machine, Saved by Kind Strangers! #shorts
00:21
Fabiosa Best Lifehacks
Рет қаралды 40 МЛН
I Made RGB Tetris with just Redstone!
20:36
mattbatwings
Рет қаралды 189 М.
How Mario Kart 8’s Checkpoints Were Finally Broken
19:53
The Quest To Make Unbreakable Glass
22:23
Veritasium
Рет қаралды 2,9 МЛН
The Strange Physics Principle That Shapes Reality
32:44
Veritasium
Рет қаралды 6 МЛН
Computer Architecture Explained With MINECRAFT
6:47
Codeolences
Рет қаралды 1,1 МЛН
Spy Hard? Just Stab While Invisible, Moron
6:32
shounic
Рет қаралды 61 М.
What Minecraft Looks Like for a Mojang Dev
23:40
EightSidedSquare
Рет қаралды 1,3 МЛН
Instruction Memory - Let's Make a Redstone Computer! #5
15:07
mattbatwings
Рет қаралды 33 М.
I added ur HORRIBLE Minecraft Ideas
13:28
Element X
Рет қаралды 230 М.
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН