[CS61C FA20] Lecture 15.1 - State, State Machines: Accumulator — Transcript
Full transcript
- 0:00and welcome back now
- 0:03we've seen combinational logic circuits
- 0:05and state circuits as the
- 0:06two kinds of circuits we'll look at so
- 0:08this lecture's going to be about state
- 0:09the next lecture is going to be about
- 0:12combinational logic circuits so let's
- 0:13jump right in
- 0:14let's first start by trying to build an
- 0:15accumulator
- 0:17so here's the idea
- 0:20i've got state circuits they're used to
- 0:22remember values that we have um
- 0:24we're going to use them for registers
- 0:26really fast small and fast
- 0:28or memory which is bigger and a little
- 0:29slower but still the same idea same
- 0:31principle still part of the memory
- 0:32hierarchy
- 0:33and they're going to help control the
- 0:34flow of information between these
- 0:36these combinational logic blocks so
- 0:38let's try to let's see if we can build
- 0:40something without them let's actually
- 0:41try to say i don't need you
- 0:42mr state circuit let's try to build
- 0:44something without them and see what
- 0:46happens and then we'll realize we kind
- 0:47of need them
- 0:48so let's jump in i want to build an
- 0:51accumulator i want to build see this
- 0:52loop this beautiful
- 0:53piece of piece of c code i want to have
- 0:55i mean i'm basically try to do this i
- 0:58want to have
- 0:59s is zero and for i equals
- 1:02zero to you know n minus one
- 1:05s gets gets accumulated by the value of
- 1:08x of i
- 1:09so i've got an array of n numbers
- 1:12and i add them all up that's all i'm
- 1:14trying to do simple stuff it's a one
- 1:15liner
- 1:16you know this is like some of array one
- 1:18liner in python some of this
- 1:20array just some that's all i want i want
- 1:22some array this is how you're going to
- 1:23do this as a loop
- 1:25and i want to be able to build a circuit
- 1:26to do that for me that's the idea
- 1:28so i want to have x of i coming in and
- 1:31some sum magic happens and s is at the
- 1:33output okay
- 1:35and by the way here's how because we
- 1:36know about signals we saw the signals
- 1:38lecture before each
- 1:40x of i is going to be applied in
- 1:41succession one per cycle so here's the
- 1:43first one here's x of zero
- 1:45here's x of one here's x of two x sub
- 1:47two okay
- 1:48and after n cycles in theory the value
- 1:51is done
- 1:52after i've done this n times s now is
- 1:54holding my
- 1:55output and it'd be great actually if all
- 1:57along s we're holding the sum so far
- 1:59we can call this the sum so far in fact
- 2:01s should have been called sum so far for
- 2:02that
- 2:03okay let's try it here we go
- 2:07there's our atom we saw an adder just
- 2:09combinational logic right
- 2:10we saw a nibble adder before we saw an
- 2:12n-bit adder two n-bit adders here's my
- 2:14adder i don't even care how many bits
- 2:15wide this is
- 2:16but you're getting around to just single
- 2:17bit i don't care so
- 2:19does this work i've got i've got come on
- 2:22this looks pretty good right
- 2:23let's look here i've got the input
- 2:24coming in this is my input here
- 2:27and now the output has to be added s
- 2:30right it has to be added to that somehow
- 2:33so i like it this is really good right
- 2:35yeah not so much
- 2:37this by the way we're going to call
- 2:38feedback whenever you have some output
- 2:40feeding back into the input we call that
- 2:42feedback not always bad feedback is like
- 2:44a record
- 2:46that's bad feedback but this is good we
- 2:48actually use feedback
- 2:49all the time in our circuit so feedback
- 2:51is fine
- 2:53this work doesn't work not so much
- 2:56number one
- 2:57how do we control the next iteration how
- 2:59do we tell this circuit that
- 3:01okay now this is x of zero but then
- 3:04now it's x of one how does it even know
- 3:06it's just like this
- 3:07feedback that goes really fast and and
- 3:09two how do we initialize it how do we
- 3:11reset this thing to say all right s is
- 3:14zero initially well no
- 3:15i can't ever give it because it's always
- 3:17a function of this whatever it was and i
- 3:18don't know how to set that so how do i
- 3:19ever set that line
- 3:20how do i ever like assign a value to
- 3:22this line i don't even know how to do
- 3:24that
- 3:24so the two reasons doesn't work this is
- 3:26just the naive way
- 3:28we said we tried to go we tried to go it
- 3:29alone no state devices that ain't going
- 3:32to work so
- 3:33let's actually introduce a circuit that
- 3:35may work
- 3:36we're going to introduce our register
- 3:38and this is a register that has another
- 3:40input we didn't talk about this last
- 3:41time
- 3:42this is going to be a reset line okay
- 3:44when that reset line
- 3:46is asserted or goes one that's gonna
- 3:48reset the register well there's our s
- 3:50equals zero we reset it initially
- 3:52and then this is gonna be the loader
- 3:55that says and by the way this is drawn
- 3:56as the input
- 3:58and the output typically things are
- 4:00drawn
- 4:01signals always go left to right okay
- 4:03unless they're part of the feedback
- 4:04which you should
- 4:05zip right around but we're gonna assume
- 4:06any block comes in either comes in
- 4:08comes in on the left goes out on the
- 4:09right or comes out of the top goes out
- 4:11of the bottom that's gonna that's the
- 4:12flow of like things
- 4:14kind of like how you should play 2048
- 4:16down right down right okay that's how
- 4:17that works
- 4:19so look we've got this here's my loader
- 4:23or clock okay which is only on the
- 4:26rising edge of these clocks going to do
- 4:27something
- 4:28and the rough timing look the rough
- 4:29timing is x is going to have its value
- 4:31of x 0 over time
- 4:33and then x 1 and x remember that's the
- 4:34vector we talked about clustering those
- 4:36signals in that
- 4:37grouping them and the output roughly is
- 4:40here's my cumulator
- 4:41x0 gets initialized somehow and then
- 4:44it's going to have
- 4:45x0 plus x1 and look at it it's actually
- 4:47working
- 4:48x0 plus x1 plus x2 i love this as time
- 4:51goes on
- 4:51so we're going to actually take a deeper
- 4:53dive into this that's the last slide
- 4:54here
- 4:55we're gonna take a deeper dive into
- 4:56actually how this works but we're really
- 4:58close
- 4:58this is actually gonna work we're really
- 5:00excited about that we'll see the next
- 5:01lecture
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 15.1 - State, State Machines: Accumulator by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,088 words across 174 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.