Method: HDLRuby::High::Std#rst_req_ack

Defined in:
lib/HDLRuby/std/task.rb

#rst_req_ack(clk_e, rst, req, ack, port) ⇒ Object

Encapsulate a task for integrating a control with simple reset (+rst+), request and acknowledge (+ack+) signals, synchronised on +clk_e+. +port+ is assumed to return a TaskPortSA. If +clk_e+ is nil, work in asynchronous mode. If +rst+ is nil, no reset is handled.



814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
# File 'lib/HDLRuby/std/task.rb', line 814

def rst_req_ack(clk_e,rst,req,ack,port)
    if clk_e then
        # Ensures clk_e is an event.
        clk_e = clk_e.posedge unless clk_e.is_a?(Event)
        par(clk_e) do
            # Handle the reset.
            hif(rst) { port.reset } if rst
            ack <= 0
            # Control the start of the task.
            hif(req) { port.run }
            # Control the end of the task: set ack to 1.
            port.finish { ack <= 1 }
        end
    else
        par do
            # Handle the reset
            hif(rst) { port.reset } if rst
            # Control the start of the task.
            hif(req) { port.run }
            ack <= 0
            # Control the end of the task: set ack to 1.
            port.finish { ack <= 1 }
        end
    end
end