SlideShare a Scribd company logo
ENGR. RASHID FARID CHISHTI
LECTURER, DEE, FET, IIUI
CHISHTI@IIU.EDU.PK
WEEK 12
REGULAR EVENT CONTROL
NAMED EVENT CONTROL
EVENT OR CONTROL,
LEVEL-SENSITIVE TIMING CONTROL.
FPGA Based System Design
Sunday, May 17, 2015
1
www.iiu.edu.pk
 An event is the change in the value on a register or a net. Events can be utilized
to trigger execution of a statement or a block of statements.
 There are four types of event-based timing control:
1. Regular event control, 2. Named event control,
3. Event OR control, 4. Level-sensitive timing control.
1. Regular event control: The @ symbol is used to specify an event control.
Statements can be executed on changes in signal value or at a positive or
negative transition of the signal value.
Example: Regular Event Control
@(clock) q = d; // q = d is executed whenever signal clock changes value
@(posedge clock) q = d; // q = d is executed whenever signal clock does
//a positive transition ( 0 to 1,x or z, x to 1, z to 1 )
@(negedge clock) q = d; //q = d is executed whenever signal clock does
// a negative transition ( 1 to 0,x or z,x to 0, z to 0)
q = @(posedge clock) d; // d is evaluated immediately and assigned
// to q at the positive edge of clock
www.iiu.edu.pk Sunday, May 17, 2015
Event-Based Timing Control
2
2. Named event control: Verilog provides the capability to declare an event and
then trigger and recognize the occurrence of that event.
The event does not hold any data. A named event is declared by the keyword
event. An event is triggered by the symbol ->. The triggering of the event is
recognized by the symbol @.
Example: Named Event Control
// using data buffer for storing data after the last packet of data has arrived.
event received_data; // Define an event called received_data
always @(posedge clock) // check at each positive clock edge
begin if (last_data_packet) // If this is the last data packet
-> received_data; // trigger the event received_data
end
always @(received_data) // Await triggering of event received_data
// When event is triggered, store all four packets of received data in data buffer
// use concatenation operator { }
data_buf = {data_pkt[0], data_pkt[1], data_pkt[2], data_pkt[3]};
www.iiu.edu.pk Sunday, May 17, 2015
Event-Based Timing Control
3
3. Event OR Control: A transition on any one of multiple signals or events can
trigger the execution of a statement or a block of statements. This is expressed
as an OR of events or signals. The list of events or signals expressed as an OR
is also known as a sensitivity list. The keyword or is used to specify multiple
triggers,
Example: Event OR Control (Sensitivity List)
// A level-sensitive latch with asynchronous reset
always @( reset or clock or d) // Wait for reset or clock or d to change
begin if (reset) // if reset signal is high, set q to 0.
q = 1'b0;
else if(clock) // if clock is high, latch input
q = d;
end
Sensitivity lists can also be specified using the "," (comma) operator instead of
the or operator. Comma operators can also be applied to sensitivity lists that
have edge-sensitive triggers.
www.iiu.edu.pk Sunday, May 17, 2015
Event-Based Timing Control
4
Example: Sensitivity List with Comma Operator
// A level-sensitive latch with asynchronous reset
always @( reset, clock, d) // Wait for reset or clock or d to change
begin if (reset) // if reset signal is high, set q to 0.
q = 1'b0;
else if (clock) // if clock is high, latch input
q = d; end
// A positive edge triggered D flipflop with asynchronous falling reset can be
// modeled as shown below
always @(posedge clk, negedge reset) // Note use of comma operator
if (!reset) q <=0;
else q <=d;
When the number of input variables to a combination logic block are very large,
sensitivity lists can become very cumbersome to write. Moreover, if an input
variable is missed from the sensitivity list, the block will not behave like a
combinational logic block.
www.iiu.edu.pk Sunday, May 17, 2015
Event-Based Timing Control
5
To solve this problem, Verilog HDL contains two special symbols: @* and @(*).
Both symbols exhibit identical behavior. These special symbols are sensitive to a
change on any signal that may be read by the statement group that follows this
symbol.
Example: Use of @* Operator
// Combination logic block using the or operator Cumbersome to write and it is
// easy to miss one input to the block
always @(a or b or c or d or e or f or g or h or p or m) begin
out1 = a ? b+c : d+e;
out2 = f ? g+h : p+m; end
// Instead of the above method, use @(*) symbol. Alternately, the @* symbol can
// be used. All input variables are automatically included in the sensitivity list.
always @(*) begin
out1 = a ? b+c : d+e;
out2 = f ? g+h : p+m;
end
www.iiu.edu.pk Sunday, May 17, 2015
Event-Based Timing Control
6
4. Level-Sensitive Timing Control: Event control discussed earlier waited for the
change of a signal value or the triggering of an event.
 The symbol @ provided edge-sensitive control.
 Verilog also allows level-sensitive timing control, that is, the ability to wait for a
certain condition to be true before a statement or a block of statements is
executed.
 The keyword wait is used for level-sensitive constructs.
always wait (count_enable)
count = count + 1;
 In the above example, the value of count_enable is monitored continuously.
 If count_enable is 0, the statement is not entered.
 If it is logical 1, the statement count = count + 1 is executed.
 If count_enable stays at 1, count will be incremented continuously.
www.iiu.edu.pk Sunday, May 17, 2015
Event-Based Timing Control
7

More Related Content

PPTX
Semaphore
PPT
Lec11 semaphores
PDF
Semaphores
PPT
OS Process Synchronization, semaphore and Monitors
PPT
Programming loop
PPT
PPTX
Loops in c ii
Semaphore
Lec11 semaphores
Semaphores
OS Process Synchronization, semaphore and Monitors
Programming loop
Loops in c ii

What's hot (20)

PPT
Process synchronization(deepa)
PPTX
Looping statements
PPT
Semaphores and Monitors
PPT
Semaphores OS Basics
PPT
Ch7 OS
 
PPTX
Stephan Ewen - Scaling to large State
PPTX
Loop(for, while, do while) condition Presentation
PDF
6 Synchronisation
PPT
Process Synchronization
PPTX
Click-Through Example for Flink’s KafkaConsumer Checkpointing
PDF
Monitors
PPTX
Operating system critical section
PDF
ITFT_Semaphores and bounded buffer
PDF
While loops
PPT
Chapter 6 - Process Synchronization
PPT
Ch7 Process Synchronization galvin
PDF
Device Simulator with Akka
PPTX
SYNCHRONIZATION
Process synchronization(deepa)
Looping statements
Semaphores and Monitors
Semaphores OS Basics
Ch7 OS
 
Stephan Ewen - Scaling to large State
Loop(for, while, do while) condition Presentation
6 Synchronisation
Process Synchronization
Click-Through Example for Flink’s KafkaConsumer Checkpointing
Monitors
Operating system critical section
ITFT_Semaphores and bounded buffer
While loops
Chapter 6 - Process Synchronization
Ch7 Process Synchronization galvin
Device Simulator with Akka
SYNCHRONIZATION
Ad

Similar to Fpga 12-event-control (20)

PDF
Concepts of Behavioral modelling in Verilog HDL
PPTX
PTC(procedure timing control) in verilog hdl language.pptx
PPTX
Lecture-5 Behavioral timing controls.pptx
PPT
Assic 9th Lecture
PPT
Verilog Lecture4 2014
PPT
Behavioral modeling
PDF
Lecture07(DHDNBK)-Behavior-Modelling.pdf
PPT
verilog2_Verilog Module&TEST_BENCH_SEQ.ppt
PPT
PLC Basics programming and easy to learn by yourself
PDF
DLD Chapter-5.pdf
PDF
The Verilog Hardware Description Language Donald E Thomas Philip R Moorby
PPTX
verilog_tutorial1.pptx
PPTX
RTL-Design for beginners
PPTX
System design using HDL - Module 2
PPT
Unit 4 - Features of Verilog HDL (1).ppt
PPTX
Digital Electronics Registers and Counters.pptx
PPT
FSMThe Finite State Machine is an ab.ppt
PPT
Event driven simulator
PPT
VHDLhshdhdbbdbdbdbdbdbdbbdbrbrbrbfbfbbfb_PPT.ppt
PPTX
Lecture 12.pptx
Concepts of Behavioral modelling in Verilog HDL
PTC(procedure timing control) in verilog hdl language.pptx
Lecture-5 Behavioral timing controls.pptx
Assic 9th Lecture
Verilog Lecture4 2014
Behavioral modeling
Lecture07(DHDNBK)-Behavior-Modelling.pdf
verilog2_Verilog Module&TEST_BENCH_SEQ.ppt
PLC Basics programming and easy to learn by yourself
DLD Chapter-5.pdf
The Verilog Hardware Description Language Donald E Thomas Philip R Moorby
verilog_tutorial1.pptx
RTL-Design for beginners
System design using HDL - Module 2
Unit 4 - Features of Verilog HDL (1).ppt
Digital Electronics Registers and Counters.pptx
FSMThe Finite State Machine is an ab.ppt
Event driven simulator
VHDLhshdhdbbdbdbdbdbdbdbbdbrbrbrbfbfbbfb_PPT.ppt
Lecture 12.pptx
Ad

More from Malik Tauqir Hasan (12)

PPT
Fpga 13-task-and-functions
PPT
Fpga 11-sequence-detector-fir-iir-filter
PPT
Fpga 10-bcd-to-excess-3-converter-manchester-encoding
PPT
Fpga 09-behavioral-modeling-moore-machine
PPT
Fpga 08-behavioral-modeling-mealy-machine
PPT
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
PPT
Fpga 06-data-types-system-tasks-compiler-directives
PPT
Fpga 05-verilog-programming
PPT
Fpga 04-verilog-programming
PPT
Fpga 03-cpld-and-fpga
PPT
Fpga 02-memory-and-pl ds
PPT
Fpga 01-digital-logic-design
Fpga 13-task-and-functions
Fpga 11-sequence-detector-fir-iir-filter
Fpga 10-bcd-to-excess-3-converter-manchester-encoding
Fpga 09-behavioral-modeling-moore-machine
Fpga 08-behavioral-modeling-mealy-machine
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 05-verilog-programming
Fpga 04-verilog-programming
Fpga 03-cpld-and-fpga
Fpga 02-memory-and-pl ds
Fpga 01-digital-logic-design

Recently uploaded (20)

PPTX
PROGRAMMING-QUARTER-2-PYTHON.pptxnsnsndn
PDF
Dynamic Checkweighers and Automatic Weighing Machine Solutions
PPTX
Lecture-3-Computer-programming for BS InfoTech
PPT
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
PPTX
code of ethics.pptxdvhwbssssSAssscasascc
PPTX
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
PPTX
title _yeOPC_Poisoning_Presentation.pptx
PPTX
Nanokeyer nano keyekr kano ketkker nano keyer
PPTX
KVL KCL ppt electrical electronics eee tiet
PPTX
sdn_based_controller_for_mobile_network_traffic_management1.pptx
PPTX
Wireless and Mobile Backhaul Market.pptx
DOCX
A PROPOSAL ON IoT climate sensor 2.docx
PPTX
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
PPTX
"Fundamentals of Digital Image Processing: A Visual Approach"
PPTX
material for studying about lift elevators escalation
PPTX
Prograce_Present.....ggation_Simple.pptx
PPTX
了解新西兰毕业证(Wintec毕业证书)怀卡托理工学院毕业证存档可查的
PDF
Layer23-Switch.com The Cisco Catalyst 9300 Series is Cisco’s flagship stackab...
PDF
How NGOs Save Costs with Affordable IT Rentals
PPTX
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
PROGRAMMING-QUARTER-2-PYTHON.pptxnsnsndn
Dynamic Checkweighers and Automatic Weighing Machine Solutions
Lecture-3-Computer-programming for BS InfoTech
chapter_1_a.ppthduushshwhwbshshshsbbsbsbsbsh
code of ethics.pptxdvhwbssssSAssscasascc
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
title _yeOPC_Poisoning_Presentation.pptx
Nanokeyer nano keyekr kano ketkker nano keyer
KVL KCL ppt electrical electronics eee tiet
sdn_based_controller_for_mobile_network_traffic_management1.pptx
Wireless and Mobile Backhaul Market.pptx
A PROPOSAL ON IoT climate sensor 2.docx
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
"Fundamentals of Digital Image Processing: A Visual Approach"
material for studying about lift elevators escalation
Prograce_Present.....ggation_Simple.pptx
了解新西兰毕业证(Wintec毕业证书)怀卡托理工学院毕业证存档可查的
Layer23-Switch.com The Cisco Catalyst 9300 Series is Cisco’s flagship stackab...
How NGOs Save Costs with Affordable IT Rentals
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx

Fpga 12-event-control

  • 1. ENGR. RASHID FARID CHISHTI LECTURER, DEE, FET, IIUI CHISHTI@IIU.EDU.PK WEEK 12 REGULAR EVENT CONTROL NAMED EVENT CONTROL EVENT OR CONTROL, LEVEL-SENSITIVE TIMING CONTROL. FPGA Based System Design Sunday, May 17, 2015 1 www.iiu.edu.pk
  • 2.  An event is the change in the value on a register or a net. Events can be utilized to trigger execution of a statement or a block of statements.  There are four types of event-based timing control: 1. Regular event control, 2. Named event control, 3. Event OR control, 4. Level-sensitive timing control. 1. Regular event control: The @ symbol is used to specify an event control. Statements can be executed on changes in signal value or at a positive or negative transition of the signal value. Example: Regular Event Control @(clock) q = d; // q = d is executed whenever signal clock changes value @(posedge clock) q = d; // q = d is executed whenever signal clock does //a positive transition ( 0 to 1,x or z, x to 1, z to 1 ) @(negedge clock) q = d; //q = d is executed whenever signal clock does // a negative transition ( 1 to 0,x or z,x to 0, z to 0) q = @(posedge clock) d; // d is evaluated immediately and assigned // to q at the positive edge of clock www.iiu.edu.pk Sunday, May 17, 2015 Event-Based Timing Control 2
  • 3. 2. Named event control: Verilog provides the capability to declare an event and then trigger and recognize the occurrence of that event. The event does not hold any data. A named event is declared by the keyword event. An event is triggered by the symbol ->. The triggering of the event is recognized by the symbol @. Example: Named Event Control // using data buffer for storing data after the last packet of data has arrived. event received_data; // Define an event called received_data always @(posedge clock) // check at each positive clock edge begin if (last_data_packet) // If this is the last data packet -> received_data; // trigger the event received_data end always @(received_data) // Await triggering of event received_data // When event is triggered, store all four packets of received data in data buffer // use concatenation operator { } data_buf = {data_pkt[0], data_pkt[1], data_pkt[2], data_pkt[3]}; www.iiu.edu.pk Sunday, May 17, 2015 Event-Based Timing Control 3
  • 4. 3. Event OR Control: A transition on any one of multiple signals or events can trigger the execution of a statement or a block of statements. This is expressed as an OR of events or signals. The list of events or signals expressed as an OR is also known as a sensitivity list. The keyword or is used to specify multiple triggers, Example: Event OR Control (Sensitivity List) // A level-sensitive latch with asynchronous reset always @( reset or clock or d) // Wait for reset or clock or d to change begin if (reset) // if reset signal is high, set q to 0. q = 1'b0; else if(clock) // if clock is high, latch input q = d; end Sensitivity lists can also be specified using the "," (comma) operator instead of the or operator. Comma operators can also be applied to sensitivity lists that have edge-sensitive triggers. www.iiu.edu.pk Sunday, May 17, 2015 Event-Based Timing Control 4
  • 5. Example: Sensitivity List with Comma Operator // A level-sensitive latch with asynchronous reset always @( reset, clock, d) // Wait for reset or clock or d to change begin if (reset) // if reset signal is high, set q to 0. q = 1'b0; else if (clock) // if clock is high, latch input q = d; end // A positive edge triggered D flipflop with asynchronous falling reset can be // modeled as shown below always @(posedge clk, negedge reset) // Note use of comma operator if (!reset) q <=0; else q <=d; When the number of input variables to a combination logic block are very large, sensitivity lists can become very cumbersome to write. Moreover, if an input variable is missed from the sensitivity list, the block will not behave like a combinational logic block. www.iiu.edu.pk Sunday, May 17, 2015 Event-Based Timing Control 5
  • 6. To solve this problem, Verilog HDL contains two special symbols: @* and @(*). Both symbols exhibit identical behavior. These special symbols are sensitive to a change on any signal that may be read by the statement group that follows this symbol. Example: Use of @* Operator // Combination logic block using the or operator Cumbersome to write and it is // easy to miss one input to the block always @(a or b or c or d or e or f or g or h or p or m) begin out1 = a ? b+c : d+e; out2 = f ? g+h : p+m; end // Instead of the above method, use @(*) symbol. Alternately, the @* symbol can // be used. All input variables are automatically included in the sensitivity list. always @(*) begin out1 = a ? b+c : d+e; out2 = f ? g+h : p+m; end www.iiu.edu.pk Sunday, May 17, 2015 Event-Based Timing Control 6
  • 7. 4. Level-Sensitive Timing Control: Event control discussed earlier waited for the change of a signal value or the triggering of an event.  The symbol @ provided edge-sensitive control.  Verilog also allows level-sensitive timing control, that is, the ability to wait for a certain condition to be true before a statement or a block of statements is executed.  The keyword wait is used for level-sensitive constructs. always wait (count_enable) count = count + 1;  In the above example, the value of count_enable is monitored continuously.  If count_enable is 0, the statement is not entered.  If it is logical 1, the statement count = count + 1 is executed.  If count_enable stays at 1, count will be incremented continuously. www.iiu.edu.pk Sunday, May 17, 2015 Event-Based Timing Control 7