필터 지우기
필터 지우기

Request for a MATLAB Code Segment equivalent to "always" construct of Verilog or Verilog-AMS

조회 수: 1 (최근 30일)

I like to have an code segment in MATLAB equivalent to "always" construct in Verilog or Verilog-AMS. I am explaining the idea with the following example.

$$$$$$$$$$$ Verilog-AMS Code Segments $$$$$$$$$$$$$$$$$$$

always @(posedge start)

       begin
       TimeOfStart[NumberOfStart] = $abstime;
       if ((NumberOfStart == 0) && expr)
           begin
             NumberOfStart = NumberOfStart + 1;
             $display("Entered 0th NumberOfStart.\n");
             $display("Delay calculation Initiated %f: \n", TimeOfStart[0]);
             @(cross(($abstime - (TimeOfStart[0] + delay)), +1, TimeTolerance))
             begin
               if(((TimeEndExpr - TimeOfStart[0] ) < 0) || ((TimeEndExpr - TimeOfStart[0]) > delay))
                  begin
                    TimeOfMatch[0] = $abstime;
                    match = 1'b1;
                    $display("match is asserted. \n");
                  end 
             end 
             @(cross(($abstime - (TimeOfMatch[0] + KeepMatchHighTime)), +1, TimeTolerance))
             begin
                match = 1'b0;
             end  
           end  
       end

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Here once the always block is entred after receiving a posedge of start, the code within the begin end executes sequentially. The execution is like a thread as another posedge of start will start another always block. Basically the posedge of the start event triggers the rest of the code segment. How can I implement this kind of stuff in MATLAB?

답변 (1개)

Sean
Sean 2011년 1월 31일
You should look in to using a timer object. A timer can be triggered at a regular period (analogous to a rising clock edge), and can then run a Matlab function. See the following discussion of timers in the Matlab documentation:

카테고리

Help CenterFile Exchange에서 Java Client Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by