How to write Synthesizeable RTL

  Рет қаралды 18,550

Adi Teman

Adi Teman

Күн бұрын

Пікірлер: 28
@AdiTeman
@AdiTeman 2 жыл бұрын
Errata: @27:31 and @28:12: There are two (bad :) mistakes on Slide 14 1) (around time 27:31). The assignment to "count_en" is just plain wrong (thanks @juanjosemontessalinero3193 for correcting me on this - twice!). The assignment should, of course, be: assign count_en = (state == CNTUP) | (state == CNTDN); 2) (around time 28:12). The assignments to "next_count" should, of course, be blocking (=) and not non-blocking (
@redditstories2836
@redditstories2836 2 жыл бұрын
does RTL also stand for register transfer level other than just register transfer logic. Also where is that diagram from the one next to Reminder: What is RTL? with next_a and clk in it 1:39 P.S i'm only 19 and am just curious
@akpojotorprincewill4610
@akpojotorprincewill4610 Жыл бұрын
Was just about to point that out
@AdiTeman
@AdiTeman 10 ай бұрын
@@redditstories2836 Sorry for the late reply (I only get new comments highlighted, so I missed this one as it was a reply to a comment). Yes, I guess the L in RTL should more accurately be "Level", but the meaning is the same. Anyway, it's probably one of the worst acronyms I know. I mean, the word "RTL" is great, but does anyone know what "Register-Transfer Level" means? Okay, I do explain the meaning in various lectures, but it took me years to actually comprehend the meaning of this phrase. "Synthesizeable HDL" is a much better name for this type of programming :)
@redditstories2836
@redditstories2836 10 ай бұрын
@@AdiTeman thanks
@avr369
@avr369 2 жыл бұрын
Very straight and detailed presentation. Thank you
@AdiTeman
@AdiTeman 2 жыл бұрын
Thank you!
@ramyosama8088
@ramyosama8088 2 жыл бұрын
Amazing like always sir keep going !
@AdiTeman
@AdiTeman 2 жыл бұрын
Always!
@juanjosemontessalinero3193
@juanjosemontessalinero3193 9 ай бұрын
In time 28:01, when you are showing the counter design. I think you don't need the count_en signal. you are already creating an external enable, saying that next_count = count if the state is not equal to CNTUP or CNTDN. Therefore, count is going to feedback to next_count when you are not in those states, and next_count is not going to change, so the signal count_en is redundant. I guess the synthetizer will mix both enables into one.
@AdiTeman
@AdiTeman 9 ай бұрын
Yes, from a quick look, this indeed looks to be true. That said, the count_en helps gate the flip flops, which could potentially save power. Automatic clock gating should take care of this in any case, but this will explicitly make the synthesizer use an enable flop and/or apply the clock gating. Though most likely this will happen anyway. Good point! Thanks for noticing.
@akpojotorprincewill4610
@akpojotorprincewill4610 Жыл бұрын
Prof. I had an idea listening to you but don’t know if it’s good design practice. @28:35 is it right to directly code the IF ELSE block in always@* into the CASE block of the Next State Decoder logic? Secondly, if my suggestion above is okay it would mean two up counters and two down counter for cases CNTUP and CNTDN. But I could optimize this by performing resource sharing within the cases CNTUP and CNTDN, if I replace the counters with multiplexers then I could use one up counter and one down counter outside the case statement.
@AdiTeman
@AdiTeman Жыл бұрын
If I understand what you are asking then here is my answer. First of all, there are many ways to right the same thing, and as long as they are synthesizeable and functionally correct, then there's no problem to do it. Which way is best? Well, that depends, of course, and the way to find out would be to implement it and measure your metric (such as area, performance, power, etc.). That being said, I don't think there is much of a difference between what you are suggesting and the presented code. They would probably be Boolean equivalent and then the synthesis tool will hopefully find the best gate level representation. The main question is one of clarity. Which one is easier to read, maintain, verify, fix bugs. I like "wasting lines of code" to separate different parts and therefore make things a bit more simple and discrete. But you could put the "next_count" signal in the same CASE as the "next_state" signal and in some cases, or for some people, this would be a clearer solution.
@padmajmanore8886
@padmajmanore8886 2 жыл бұрын
Hello Professor Adi, Thank you so much for posting such knowledgeful videos. I'm very much a beginner in the RTL, so could you suggest some resource where I can learn this more and expand my knowledge.
@AdiTeman
@AdiTeman 2 жыл бұрын
Hi Padmaj, Did you watch the lecture on Verilog (kzbin.info/www/bejne/jpe4gJRorNqXitU)? I think that is the place to start (well before watching this "more advanced" video). And after you've seen it and started to get your hands dirty, I think that Google is really a great resource for this, since many people have written great stuff, from tutorials to example code. Good luck!
@valentingomez4546
@valentingomez4546 Жыл бұрын
Dr Teman are simulation softwares covered on this course? And if not, where can I learn how to use them?
@AdiTeman
@AdiTeman Жыл бұрын
Hi, I do not cover the practical use or the method of operation of logic simulators in the course. In fact, I don't cover any practical usage of tools. Possibly in the future, I will develop such content in collaboration with one or more of the EDA vendors.
@vevasam
@vevasam Жыл бұрын
Just a quick question. @28:35 in the sequential block we don't have an 'else' statement. Are we intentionally inferring a latch here to hold the count value? or do we have to specify an else statement ?? Can you please clarify. Thank you.
@AdiTeman
@AdiTeman Жыл бұрын
Hi Vevasam, No, the problem of "latch inference" is related to combinatorial blocks. In other words, we don't want to accidentally infer a register (usually latch) when we are describing a combinatorial cloud. In this case, as you stated, we are talking about a sequential block, so the "no if without else" rule is not applicable. What we are describing here is a "async reset, load enabled DFF". In other words: - If there is a reset at any time - store the reset value - If there is not a reset then if there is a clock edge, store the D value if and only if the load enable is active What happens if the load enable is inactive? (i.e., what happens on the "else" condition that is not explicitly defined in the code?). Nothing. And nothing means "don't change the value" or "continue storing the previous value". In other words, "retain state" or "infer a register". This is a sequential block so that is exactly what we wanted. And in this case, there should be a standard cell that maps exactly to this description, so all is well.
@akpojotorprincewill4610
@akpojotorprincewill4610 Жыл бұрын
@@AdiTeman perfect explanation! I had concerns too
@ahmadirtisam9593
@ahmadirtisam9593 Жыл бұрын
The diagram at 13:24 showing the finish signal at latch shouldn't it have been start because the latch will enable at start state and the output remains the previous output.
@AdiTeman
@AdiTeman 9 ай бұрын
Yes, I think you're right. Actually, this isn't a great diagram, since basically finished can only be a '1'. Only at startup (or reset...), we don't know what finished was previously and then it should hold the previous output, but this should really provide an 'X' as this is a clear error. But I think that you are correct, my diagram should have driven the latch enable with "state==START"
@juanjosemontessalinero3193
@juanjosemontessalinero3193 10 ай бұрын
I don't comprehend the expression assign count_en = (state == (CNTUP | CNTDN)) , as I see it you are only enabling the counter if the state is equal to the oring of both CNTUP and CNTDN. I think that is not the intended funcionality. I would do assign count_en = (state == CNTUP) | (state == CNTDN).
@AdiTeman
@AdiTeman 10 ай бұрын
Hi Juan, You must pay attention to the entire command, since this is the so-called "ternary operator", which is basically a one-line "if-else" command. The command is asking: "If (the state is either CNTUP or CNTDN), then enable the counter, otherwise don't enable the counter" How? Because the condition is (state==(CNTUP|CNTDN)) --> This will return a '1' if we are in either of those states. If the condition is met, we return the statement that comes after the ?, in other words, return a '1'. Else (both CNTUP and CNTDN are zero), then we return the statement that comes after the :, in other words, return a '0'.
@juanjosemontessalinero3193
@juanjosemontessalinero3193 10 ай бұрын
Hi Adi, thanks for answering. Sorry, but I believe that is not correct. You are first oring CNTUP and CNTDN and only then, you are comparing with state. For example CNTUP == 2'b01 and CNTDN = 2'b10, count_en only will be 1'b1 if state is equal to 2'b11, and the rest of the cases will be 1'b0.@@AdiTeman Moreover ,why would you use a mux with the ternary operator, instead of using directly the output of the comparator?
@AdiTeman
@AdiTeman 10 ай бұрын
@@juanjosemontessalinero3193 Indeed, you are 100% right. I guess I answered your comment too hastily (and I wrote the slide without verifying it :). I have "an excuse", which is that I haven't looked at this slide for a long time :). I guess I read your comment wrong and thought you misunderstood something else and I was actually sure that this was from the code I have run many times in lectures. But following this comment, I see that you perfectly understood what you were writing and that this "fix" (...stick in the wheel...) was something I just "threw on the slide", while preparing this slide deck and not something I changed in the actual code and ran. It should, of course, be exactly as you suggested: assign count_en = (state == CNTUP) | (state == CNTDN); I will put this in the pinned errata. Thanks and sorry for my incorrect answer (and underestimating you!).
@juanjosemontessalinero3193
@juanjosemontessalinero3193 10 ай бұрын
Thanks for the honest response.@@AdiTeman This lectures are a great help for all of us. I just wanted to confirm my understanding was right and help others to understand it. Thanks for your dedication and for you honesty. Kind regards!
@AdiTeman
@AdiTeman 10 ай бұрын
@@juanjosemontessalinero3193 Thanks for pointing this out and insisting on my mistake :)
DVD - Kahoot for Lecture 2: Verilog HDL
29:46
Adi Teman
Рет қаралды 7 М.
DVD - Lecture 2: Verilog
1:20:56
Adi Teman
Рет қаралды 36 М.
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 35 МЛН
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 24 МЛН
4. Assembly Language & Computer Architecture
1:17:35
MIT OpenCourseWare
Рет қаралды 723 М.
DVD - Lecture 1d: The Chip Design Flow
18:01
Adi Teman
Рет қаралды 15 М.
The 3 Laws of Writing Readable Code
5:28
Kantan Coding
Рет қаралды 692 М.
DVD - Lecture 3: Logic Synthesis - Part 1
1:16:27
Adi Teman
Рет қаралды 54 М.
RTL Design - APB Protocol | QuickSilicon | Hardware Design
1:25:31
QuickSilicon
Рет қаралды 37 М.
EEVblog #496 - What Is An FPGA?
37:44
EEVblog
Рет қаралды 768 М.
When you Accidentally Compromise every CPU on Earth
15:59
Daniel Boctor
Рет қаралды 872 М.
DVD - Lecture 1:  Introduction
46:28
Adi Teman
Рет қаралды 73 М.
DVD - Lecture 2e: Coding Style for RTL - part 1
10:57
Adi Teman
Рет қаралды 7 М.
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН