- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is it possible to load a counter dynamically(run time). The no. of bits to be counted is fixed (16 bit). so Is it possible to change the counter max. value on fly that can lie with in 16 bits. Thank youLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
module my_counter(
input clk,
input reset_n,
input load,
input new_count,
output reg event
)
reg count_val;
reg counter;
always @(posedge clk)
if(load) count_val <= new_count;
always @(posedge clk or negedge reset_n)
if(!reset_n) counter <= 16'd0;
else if(!counter) counter <= count_val;
else counter <= counter - 16'd1;
endmodule

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page