mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-30 02:32:53 +08:00
126f859908
-Removing the ASIC CFG as well...have to rethink that concept, not really working
31 lines
1.0 KiB
Verilog
31 lines
1.0 KiB
Verilog
//#############################################################################
|
|
//# Function: Rising Edge Sampled Register #
|
|
//#############################################################################
|
|
//# Author: Andreas Olofsson #
|
|
//# License: MIT (see LICENSE file in OH! repository) #
|
|
//#############################################################################
|
|
|
|
module oh_reg1 #(parameter DW = 1 // data width
|
|
)
|
|
( input nreset, //async active low reset
|
|
input clk, // clk
|
|
input en, // write enable
|
|
input [DW-1:0] in, // input data
|
|
output [DW-1:0] out // output data (stable/latched when clk=1)
|
|
);
|
|
|
|
reg [DW-1:0] out_reg;
|
|
always @ (posedge clk or negedge nreset)
|
|
if(!nreset)
|
|
out_reg[DW-1:0] <= 'b0;
|
|
else if(en)
|
|
out_reg[DW-1:0] <= in[DW-1:0];
|
|
assign out[DW-1:0] = out_reg[DW-1:0];
|
|
|
|
endmodule // ohr_reg1
|
|
|
|
|
|
|
|
|
|
|