Home.Verilog.Digital Design.Digital Basics.Python.RF Basics.
Previous.
Next.
Custom Search

Legal Disclaimer

Chip Designing for ASIC/ FPGA Design engineers and Students
FULLCHIPDESIGN
Digital-logic Design...  Dream for many students… start learning front-end…

Legal Disclaimer

@TYH :- 4G LTE Long Term Evolution Tutorial, CloudComputing
PICS
Verilog Tutorial.
Get Noticed:- Submit your own content to be published on fullchipdesign.com

Send it to fullchip@gmail.com

Digital Basics Tutorial.

Verilog Case construct.

Verilog “case” statements are used to model states in Finite State Machine.

Its also used to generate conditional statements based on value of a register. Case statement implementation is shown below in two examples below.

Another implementation of “case” construct here.

Next Check the counter code and the test bench example.  

 

// Always block to generate synchronous packets in 1fs clock domain

// Implementing counters

always@(posedge clk_1fs or negedge rst_n)

begin

    if (!rst_n) begin

        r_count <= 'b0;  end

    else begin

        r_count <= count + 1 ; end

end

Synchronous Counter Example:
Counters are extensively used in synchronous RTL. In current implementation, its used for keeping track of packets. Check the complete usage of the counter code in the test bench example.  
Home Verilog Initial stmts IF-ELSE Case stms Readmemh Function Testbench Binary to Gray Clock Crossing Half-adder Full-adder Tristate buffer Adder tb Counter_enable Blocking Operators Shift LSR Random Nos Sync RAM Verilog Tutorial
Free running Verilog counters code with asynchronous reset and synchronous reset
IF-ELSE.
Readmemh.
Interview Questions. Main, FPGA, Digital Fundamentals
~\Desktop\verilog_code\casecode2.v.html
        module casecode (
                in_a,
                in_b,
                in_ctrl,
                out_c
        );
        // Define inputs/outputs
        input  in_a;
        input  in_b;
        input  in_ctrl;
        output out_c;
        // Use of case statement. 
        always@(*)
        begin
         case(in_ctrl)
                1 : out_c = in_b;
                default: out_c = in_a;
         endcase
        end
        endmodule
        
>

Verilog case construct above is a simple multiplexor to select one of two inputs and assign it to output c.  Verilog 2001 onwards we can use * operator to list all variables of senstivity list of always block. Also note the use of default statement in verilog case is to avoid inferring of latches. The default statement ensures a known logic value for output at all unknown states.

LTE - Long Term Evolution topics from here

3D draw and render new, 2D, 2D to 3D, ARC, 3D semi-cylindrical,  door,  Edgeing, drawer, colors  and render.

To handle ‘z’ and ‘x’ states, different variations of case statement  are used.

casez : Treats z as don't care.

casex : Treats x and z as don't care.

SystemVerilog case statement construct is similar to verilog.

 

 

5 Steps required to build a functional FPGA load