When Always comb and When Continuous Assignment
Welcome to EDAboard.com
Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
- Digital Design and Embedded Programming
- PLD, SPLD, GAL, CPLD, FPGA Design
You should upgrade or use an alternative browser.
difference between always and assign in verilog
- Thread starter vead
- Start date
- Status
- Not open for further replies.
- #1
- Joined
- Nov 27, 2011
- Messages
- 285
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- india
- Activity points
- 3,815
program 1st
Code Verilog - [expand] 1 2 3 4 5 module and2gate (A,B,Y) ; input A,B; output Y; assign Y=A&B; endmodule
program 2st
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 module and2gate (A,B,Y) ; input A,B; output Y reg y always @ (AorB) ; begin Y<=A&B; end endmodule
which program is right please someone explain where we use always and assign syntax
- #2
- #3
- Joined
- Nov 27, 2011
- Messages
- 285
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- india
- Activity points
- 3,815
I think assign is used for combination logic and always is used for sequential logic please clear my doubt
- #4
- Joined
- Dec 15, 2011
- Messages
- 828
- Helped
- 365
- Reputation
- 734
- Reaction score
- 358
- Trophy points
- 1,353
- Location
- Fremont, CA, USA
- Activity points
- 6,967
An always block can readily be used for either. Whether it is combinational or sequential depends on how you trigger the execution of the block, as well as ordering of reads versus writes to variables within the same block and between different blocks. So a single always block could represent both kinds of logic at the same time.
SystemVerilog added three flavors of always blocks: always_comb, always_latch, and always_ff, to specify your intent and to report when what you've modeled doesn't match the intent.
- #5
- Joined
- Nov 27, 2011
- Messages
- 285
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- india
- Activity points
- 3,815
- #6
- Joined
- Oct 31, 2013
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 16
- #7
- Joined
- Dec 15, 2011
- Messages
- 828
- Helped
- 365
- Reputation
- 734
- Reaction score
- 358
- Trophy points
- 1,353
- Location
- Fremont, CA, USA
- Activity points
- 6,967
- #8
- Joined
- Nov 19, 2009
- Messages
- 243
- Helped
- 71
- Reputation
- 142
- Reaction score
- 67
- Trophy points
- 1,308
- Location
- United States
- Activity points
- 3,730
An assign statement within a module is always/continuously made within the module.
If you don't need to qualify your combinational logic with synchronizing to a clock edge or other signal transition, it is generally preferred (to me anyway) to implement the combinational logic with the assign statement.
- #9
Behavioral constructs, either for combinational or registered logic, involve much of the elegance and coding efficiency of Verilog or VHDL.
- Status
- Not open for further replies.
- Digital Design and Embedded Programming
- PLD, SPLD, GAL, CPLD, FPGA Design
- This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Source: https://www.edaboard.com/threads/difference-between-always-and-assign-in-verilog.302176/
0 Response to "When Always comb and When Continuous Assignment"
Post a Comment