Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Question about 2x clocking

Hi All,

I have a question about clocking.

I want to achieve "result 2".(see attachment) However i am having problem getting the correct system verilog to work.

I have no idea why it did not as expected. I keep on getting result 1 :(

Need some advice here.Thanks.

I tried the following: both does not work

1st try

task stretch (

input [3:0] value_A ,

input [3:0] value_B );

@(posedge clkB )

begin

module.data = value_A;

end

@(negedge clkB )

begin

module.data = value_B;

end

endtask : stretch

2nd try

task stretch (

input [3:0] value_A ,

input [3:0] value_B );

@(posedge clkA )

begin

module.data = value_A;

# 10ns;

module.data = value_A;

end

@(posedge clkA )

begin

module.data = value_B;

# 10ns;

module.data = value_B;

end

endtask : stretch

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can try

    always @ (posedge clkB)

    dataH <= data_A;

    always @ (nedged clkB)

    dataL <= data_B;

    data <= clkB = 1'b1 ? dataH : dataL;

    However, if you want to synthetize this, it's best to use a ALTDDR block.