Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Sequencer (
- output reg interrupt, // causes data to be updated
- output reg wdata, // goes to my consumer
- input clock, // tick counter
- input [7:0] data, // describes the current pulse
- input reset // what it says on the tin
- );
- reg [6:0] counter;
- always @(posedge clock)
- begin
- if (reset)
- begin
- counter <= 0;
- interrupt <= 0;
- wdata <= 0;
- end
- else
- begin
- // This matches both pulses (00-7f) and spaces (80).
- // For a space, the counter will roll over back to zero.
- if (counter == data[6:0])
- begin
- counter <= 0;
- interrupt <= 1;
- wdata <= ~data[7]; // 0x80 means no pulse
- end
- else
- begin
- counter <= counter + 7'b1;
- interrupt <= 0;
- wdata <= 0;
- end
- end
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement