Guest
Hi guys,
Lets say my code has an interrupt status register, how can I implement a clear on read algorithm? Please see my example code below. I can't simply write intr_status<=0; in the second always block, because one register can't be written by two always block.
example code:
always@(posedge clk)
begin
if(user_input==1) //user press a button once a while
intr_status<=1; //intr_status register becomes high
else
intr_status<=intr_status;
end
always@(read_request)
begin
if(read_request==1) //a processor wants to read the interrupt status register
status_output<=intr_status; //status_output is an output port to the processor
//how can I reset the intr_status register?
end
Lets say my code has an interrupt status register, how can I implement a clear on read algorithm? Please see my example code below. I can't simply write intr_status<=0; in the second always block, because one register can't be written by two always block.
example code:
always@(posedge clk)
begin
if(user_input==1) //user press a button once a while
intr_status<=1; //intr_status register becomes high
else
intr_status<=intr_status;
end
always@(read_request)
begin
if(read_request==1) //a processor wants to read the interrupt status register
status_output<=intr_status; //status_output is an output port to the processor
//how can I reset the intr_status register?
end