1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00

Fix datagate bug!

-Was not turned on at all! Alwats on
This commit is contained in:
Andreas.Olofsson 2020-03-04 18:36:38 -05:00
parent 069681ca6a
commit 4f0f81997e

View File

@ -4,9 +4,10 @@
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
module oh_datagate #(parameter DW = 32, // width of data inputs
parameter PS = 3 // min quiet time before shutdown
//
module oh_datagate #(parameter DW = 32, // width of data inputs
parameter N = 3 // min quiet time before shutdown
)
(
input clk, // clock
@ -14,16 +15,15 @@ module oh_datagate #(parameter DW = 32, // width of data inputs
input [DW-1:0] din, // data input
output [DW-1:0] dout // data output
);
reg [PS-1:0] enable_pipe;
wire enable;
reg [N-1:0] enable_pipe;
always @ (posedge clk)
enable_pipe[PS-1:0] <= {enable_pipe[PS-2:0],en};
assign enable = {enable_pipe[PS-1:0],en};
//Mask to 0 if no valid for last N cycles
assign enable = en | (|enable_pipe[N-1:0]);
assign dout[DW-1:0] = {(DW){enable}} & din[DW-1:0];
assign dout[DW-1:0] = {(DW){enable}} & din[DW-1:0];
endmodule // oh_datagate