mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-17 20:02:53 +08:00
Redesining oh_iddr
-adding separate clock enables -adding internal clock enable for neg edg sample -combining q1/q2 legacy interfae into a single output
This commit is contained in:
parent
fda0f35dd9
commit
c215b48a55
@ -9,32 +9,43 @@ module oh_iddr #(parameter DW = 1 // width of data inputs
|
|||||||
)
|
)
|
||||||
(
|
(
|
||||||
input clk, // clock
|
input clk, // clock
|
||||||
input ce, // clock enable, set to high to clock in data
|
input ce0, // 1st cycle enable
|
||||||
input [DW-1:0] din, // data input sampled on both edges of clock
|
input ce1, // 2nd cycle enable
|
||||||
output reg [DW-1:0] q1, // iddr rising edge sampled data
|
input [DW/2-1:0] din, // data input sampled on both edges of clock
|
||||||
output reg [DW-1:0] q2 // iddr falling edge sampled data
|
output reg [DW-1:0] dout // iddr aligned
|
||||||
);
|
);
|
||||||
|
|
||||||
//regs("sl"=stable low, "sh"=stable high)
|
//regs("sl"=stable low, "sh"=stable high)
|
||||||
reg [DW-1:0] q1_sl;
|
reg [DW/2-1:0] din_sl;
|
||||||
reg [DW-1:0] q2_sh;
|
reg [DW/2-1:0] din_sh;
|
||||||
|
reg ce0_negedge;
|
||||||
|
|
||||||
// rising edge sample
|
//########################
|
||||||
always @ (posedge clk)
|
// Pipeline valid for negedge
|
||||||
if(ce)
|
//########################
|
||||||
q1_sl[DW-1:0] <= din[DW-1:0];
|
|
||||||
|
|
||||||
// falling edge sample
|
|
||||||
always @ (negedge clk)
|
always @ (negedge clk)
|
||||||
q2_sh[DW-1:0] <= din[DW-1:0];
|
ce0_negedge <= ce0;
|
||||||
|
|
||||||
|
//########################
|
||||||
|
// Dual edge sampling
|
||||||
|
//########################
|
||||||
|
|
||||||
// pipeline for alignment
|
|
||||||
always @ (posedge clk)
|
always @ (posedge clk)
|
||||||
begin
|
if(ce0)
|
||||||
q1[DW-1:0] <= q1_sl[DW-1:0];
|
din_sl[DW/2-1:0] <= din[DW/2-1:0];
|
||||||
q2[DW-1:0] <= q2_sh[DW-1:0];
|
always @ (negedge clk)
|
||||||
end
|
if(ce0_negedge)
|
||||||
|
din_sh[DW/2-1:0] <= din[DW/2-1:0];
|
||||||
|
|
||||||
|
//########################
|
||||||
|
// Aign pipeline
|
||||||
|
//########################
|
||||||
|
always @ (posedge clk)
|
||||||
|
if(ce1)
|
||||||
|
dout[DW-1:0] <= {din_sh[DW/2-1:0],
|
||||||
|
din_sl[DW/2-1:0]};
|
||||||
|
|
||||||
endmodule // oh_iddr
|
endmodule // oh_iddr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user