Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Verilog Basics

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use Verilog Basics". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Always Blocks

As its name suggests, the always block executes always, unlike the initial block, which executes only once at the start of the simulation.

The always statement block also has a sensitivity list that tells the always statement block when to execute the code block.

always @ (a or b or sel)begin y = 0; if (sel == 0) begin y = a; end else begin y = b; endend

The @ symbol is followed by the condition triggered by the always statement block. Only variables of type reg can be driven within the always statement block.

The above example is 2:1 mux, inputs a and b; sel is the select input, and y is the mux output.

In any combinational logic, whenever the input changes, the output changes. This means that the code in the always statement block is executed whenever the variables contained in the sensitive list change, i.e. a, b, and sel.

There are two types of sensitivity lists: level sensitive (for combinational circuits) and edge sensitive (for flip flops). The code below is the same 2:1 Mux, but the output y is now the flip flop output.

always @ (posedge clk )if (reset == 0) begin y

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 234

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report