Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Neural_Spike_Compressor_v1.v
- // Purpose: 1000:1 Data Compression for 5,000+ Channels
- // Architecture: Parallel Delta Modulation + Event-Driven AER (Address-Event Representation)
- module Neural_Spike_Compressor #(
- parameter CHANNELS = 5120, // Optimized for the 5k electrode array
- parameter THRESHOLD = 8'hA0, // Variable threshold for "Blank Space" detection
- parameter BIT_WIDTH = 8
- )(
- input wire clk, // 500MHz System Clock
- input wire rst_n,
- input wire [CHANNELS*BIT_WIDTH-1:0] raw_in, // Raw parallel data from sensors
- output reg [31:0] event_out, // Compressed Event Packet (Address + Timestamp)
- output reg event_valid
- );
- integer i;
- reg [BIT_WIDTH-1:0] prev_state [0:CHANNELS-1];
- // Internal Pipeline for Delta-Detection
- always @(posedge clk or negedge rst_n) begin
- if (!rst_n) begin
- event_valid <= 0;
- for (i = 0; i < CHANNELS; i = i + 1) prev_state[i] <= 0;
- end else begin
- event_valid <= 0;
- for (i = 0; i < CHANNELS; i = i + 1) begin
- // Only trigger if the signal Delta exceeds THRESHOLD
- if (raw_in[(i*BIT_WIDTH)+:BIT_WIDTH] > (prev_state[i] + THRESHOLD)) begin
- // Packet Structure: [Timestamp(16-bit) | Channel_ID(16-bit)]
- event_out <= {16'h0001, i[15:0]};
- event_valid <= 1;
- prev_state[i] <= raw_in[(i*BIT_WIDTH)+:BIT_WIDTH];
- end
- end
- end
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment