mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-17 20:02:53 +08:00
289024fd89
- Creating an arbitrary 'src' directory really doesn't help much... - Goal is to make each folder self contained - Make meta repos and individual repos have the same directory structure
52 lines
1.1 KiB
Verilog
52 lines
1.1 KiB
Verilog
/*WARNING: ONLY SAME EDGE SUPPORTED FOR NOW*/
|
|
//D1,D2 sampled on rising edge of C
|
|
module ODDR (/*AUTOARG*/
|
|
// Outputs
|
|
Q,
|
|
// Inputs
|
|
C, CE, D1, D2, R, S
|
|
);
|
|
|
|
parameter DDR_CLK_EDGE=0; //clock recovery mode
|
|
parameter INIT=0; //Q init value
|
|
parameter SRTYPE=0;//"SYNC", "ASYNC"
|
|
|
|
input C; // Clock input
|
|
input CE; // Clock enable input
|
|
input D1; // Data input1
|
|
input D2; // Data input2
|
|
input R; // Reset (depends on SRTYPE)
|
|
input S; // Active high asynchronous pin
|
|
output Q; // Data Output that connects to the IOB pad
|
|
|
|
reg Q1,Q2;
|
|
reg Q2_reg;
|
|
|
|
//Generate different logic based on parameters
|
|
|
|
//Only doing same edge and async reset for now
|
|
|
|
always @ (posedge C or posedge R)
|
|
if (R)
|
|
Q1 <= 1'b0;
|
|
else
|
|
Q1 <= D1;
|
|
|
|
always @ (posedge C or posedge R)
|
|
if (R)
|
|
Q2 <= 1'b0;
|
|
else
|
|
Q2 <= D2;
|
|
|
|
always @ (negedge C or posedge R)
|
|
if (R)
|
|
Q2_reg <= 1'b0;
|
|
else
|
|
Q2_reg <= Q2;
|
|
|
|
|
|
assign Q = C ? Q1 : Q2_reg;
|
|
|
|
endmodule // ODDR
|
|
|