#28 casex vs casez in verilog | Explained with verilog code

  Рет қаралды 14,313

Component Byte

Component Byte

Күн бұрын

Пікірлер: 39
@abhilash29130
@abhilash29130 Жыл бұрын
at 10:24 , Sir u have said XX can be 1X, 0X, X0. So according to it when a=0X then b should be equal to 1 instead of 0 ?
@ComponentByte
@ComponentByte Жыл бұрын
For casex When a=0X b=0 When a=XX b=1
@abhilash29130
@abhilash29130 Жыл бұрын
As u have said in 1st example of casex, 2'b1X = 2'b10, 2'b11, 2'b1X, 2'b1Z and 1 should be fix and X should change So, why in testbench code in casex 2'b1X as, a=XX is taken? Will here 1 is not fixed ? [I mean how XX is inside casex ?] Please clarify..
@ComponentByte
@ComponentByte Жыл бұрын
Xx can be 1x,0x,x1,x0,00,01,10,11 and few others for casex only and not case. So when a=xx it results b=1 as here xx can be 1x also
@abhilash29130
@abhilash29130 Жыл бұрын
Sir then why, When a=0X b=0 It should be b=1 right ? I am bit confused in this!! Please clarify..
@ComponentByte
@ComponentByte Жыл бұрын
When a=0X Here second bit is fixed that is 0 and can't be changed and 1st bit is X so can be 0,1,Z So 0x can't be 1x For 1X , we get b=1 for 10,11,1x,1z and for rest we get 0
@ujwalkumarbcj9362
@ujwalkumarbcj9362 10 ай бұрын
Hi sir, at 10:25 you took case expression as 2'bxx (i.e a = 2'bxx) and we have case item as 2'b1x, you said that it will match the case statement, so the b became 1. When I tried from my side for the below code I am getting Matched for case items: 00 ,01,0x,0z,x0,x1,xz,xx,z0,z1,zx,zz Not Matched for case items: 10,11,1x,1z module tb; reg [0:0] a=2'bxx,b; initial begin casex(a) 2'b1x: $display("Matched"); default: $display("Not Matched"); endcase end endmodule my doubt is as we are giving case expression as 2'bxx , then it should match the case items (10,11,1x,1z also). But here it is not happening. Could you please give me clarification regarding this?
@ujwalkumarbcj9362
@ujwalkumarbcj9362 10 ай бұрын
It’s now resolved sir, I did a mistake while declaring varibales it should be reg [1:0] a,b; Now for all the values i am getting b = 1 . Thank you for the explanation sir
@jitubaba5450
@jitubaba5450 4 жыл бұрын
Thank you for sharing. Always love learning your verilog tutorial.
@circuitsanalytica4348
@circuitsanalytica4348 3 жыл бұрын
Yes Jitu, really nice videos.....
@teketinikhilkumar7905
@teketinikhilkumar7905 2 жыл бұрын
sir In 1st example , given encoding =10xz it can be 101z right so in the third case(xx1x = 101z) so cant we write next state=1
@ComponentByte
@ComponentByte 2 жыл бұрын
It's decided by simulator. If input=10xz then simulator will first check 1st case : if it matches then it will give 1st case output, if no matches it will go to next state. Thus 10xz matches 1st case 1xxx so simulator stops there and gives corresponding output .
@teketinikhilkumar7905
@teketinikhilkumar7905 2 жыл бұрын
@@ComponentByte thank you sir
@rajsambhav665
@rajsambhav665 2 жыл бұрын
Great explanation. what if there are multiple ones in the input. e.g for an input encoding = 4'b011x which next state will be executed ?
@ComponentByte
@ComponentByte 2 жыл бұрын
Thank you. It is decided by simulator. 011x equals 0110 and 0111 so next can be 8,9,10.... so 1xxx is enough for 8 to 15
@Deadpie_speaking
@Deadpie_speaking 3 жыл бұрын
Sir in case statement eg. Case( s1, s2) =case(s1, s2) are same ????
@ComponentByte
@ComponentByte 3 жыл бұрын
No.They are different. 'case' is case sensitive(If I have written somewhere then it's just an example and definitely it's not in program)
@muhammedsayedm8174
@muhammedsayedm8174 10 ай бұрын
In case of casex why xz=zx compilation is not coming
@prasannan2084
@prasannan2084 2 жыл бұрын
In casex 2'bzz also possible right?
@ComponentByte
@ComponentByte 2 жыл бұрын
Yes, possible. 2'bzz , here zz is considered as 2 don't care. zz can be 00,01,10,11
@digambarbhole9467
@digambarbhole9467 Жыл бұрын
sir, what is the physical significance of caseX and caseZ statements? can you please clear it?
@ComponentByte
@ComponentByte Жыл бұрын
This is a tool dependent construct means it generates a piece of different hardware as described in a synthesis tool. It generates mostly MUX based hardware.
@digambarbhole9467
@digambarbhole9467 Жыл бұрын
Ok thank you sir
@darageorgieva3203
@darageorgieva3203 Жыл бұрын
Imagine we are in casex and we have 3'b1xz as in the first slide of the presentation. Aren't the possible options: 3'b1xz, 3'b1zx, 3'b1zz, 3'b1xx, 3'b100, 3'b101, 3'b110 and 3'b111?
@ComponentByte
@ComponentByte Жыл бұрын
Yes, you are absolutely correct.
@vishal_moladiya_music
@vishal_moladiya_music 3 жыл бұрын
Nice explanation: But in the last example When a=xx then I think b=1 and c=1 or 0 in c value I confused because in verilog casex has value of x is 0 1 x and z! But in simulation x take only value of 0 and 1 ? Is this r8?
@ComponentByte
@ComponentByte 3 жыл бұрын
In casex X value can be 0 or 1 and Z value can be 0 or 1. X is 0,1,X Z is 0,1,Z
@hulkmania9487
@hulkmania9487 2 жыл бұрын
@@ComponentByte so why in starting u have taken 2'b1Z (first example in casex)
@ComponentByte
@ComponentByte 2 жыл бұрын
You mean why 2'b1X = 2'b1Z ? If it's your query then in casex all X and Z can be considered as don't care so X can be 0,1,X,Z So 2'b1x = 2'b10,11,1x,1z Don't care means your output doesn't depend on those input bits. If it's not your query then please let me know.
@hulkmania9487
@hulkmania9487 2 жыл бұрын
@@ComponentByte cleared 👌
@SebJames55
@SebJames55 3 жыл бұрын
Thank you 😁
@ComponentByte
@ComponentByte 3 жыл бұрын
Happy learning.
@circuitsanalytica4348
@circuitsanalytica4348 3 жыл бұрын
Yes, really nice video, isn't it....
@shivammahato163
@shivammahato163 Жыл бұрын
what is casee instl ?
@ComponentByte
@ComponentByte Жыл бұрын
casee is module name (in module casee() )and inst1 is the name of module instatitaion.it can be any name you wish to write.
@shivammahato163
@shivammahato163 Жыл бұрын
@@ComponentByte thank you
@sarathchandra5305
@sarathchandra5305 4 жыл бұрын
can you tell me where do we use the casez in real time?
@ComponentByte
@ComponentByte 4 жыл бұрын
It can be used to design multiplexer if resources are available. Casez is used for testing the RTL code. During verification process code coverage is done to test every lines of code to check whether every lines of code is executed with valid input or not. In casez Z means if input is souriously 1 or 0 then the output should not be propagated and must be filtered out. Hope it helps.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
FPGA #16 - Verilog case, casez, and casex
59:06
John's Basement
Рет қаралды 626
Why Java Is So Hard To Learn
4:13
Coding with John
Рет қаралды 159 М.
If-else and Case statement in verilog
10:24
VLSI-LEARNINGS
Рет қаралды 6 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН