Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*===================================================
- 16-bits upcounter
- This counter is positive edge triggered
- and will count up to 2^16
- its count reset at on negative edge active low clear
- ====================================================*/
- module counter16bitup (
- input clock, clear,
- output reg [15:0] count);
- initial
- count=4; // start count from 4
- always @ (posedge clock or negedge clear) // trigger at positive-edge clock or negative-edge clear
- if (!clear)
- count=1; // count reset when clear is LOW
- else count=count + 1;
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment