[verilog] change from [email protected] to assign

  • Thread starter hoheiho
  • Start date
  • #1
47
0

Homework Statement


Halo, I have written a [email protected] (code i,pic1) which can output what I want but the result is delayed 1 clock cycle, therefore I have changed it to assign (code ii,pic2)and try to output the recover signal immediately when pcreg_1 is changed. But waveform is not what I wanted. Did I miss somethings in (code ii)? The recover is high in 2 clock cycle and I cannot get 0.

code i
Code:
always @(posedge clk)
begin
  if (store)
      if (m2==pcreg_1)
        recover = 0;
      else
        recover = 1;
  else
      if (m1==pcreg_1)
        recover = 0;
      else
        recover = 1;     
end

code ii
Code:
assign recover = (store && (m2==pcreg_1))? 1'b0:1'b1;
assign recover = (!store && (m1==pcreg_1))? 1'b0:1'b1;

Could anyone give me a hand for me :(?

Thank you very much for help
Ivan
 

Attachments

  • pic1.jpg
    pic1.jpg
    11.1 KB · Views: 472
  • pic2.jpg
    pic2.jpg
    10.6 KB · Views: 456

Answers and Replies

  • #2
47
0
Did anyone can see whats the problem :(?
 

Related Threads on [verilog] change from [email protected] to assign

Replies
6
Views
8K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
0
Views
1K
  • Last Post
Replies
1
Views
13K
Replies
13
Views
4K
Replies
1
Views
454
Top