OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [actel/] [ordb1a3pe1500/] [rtl/] [verilog/] [sdc_controller/] [sd_clock_divider.v] - Blame information for rev 544

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 544 julius
`include "sd_defines.v"//nononw
2
module sd_clock_divider (
3
  input wire CLK,
4
  input  [7:0] DIVIDER,
5
  input wire RST,
6
  output  SD_CLK
7
  );
8
 
9
  reg [7:0] ClockDiv;
10
  reg SD_CLK_O;
11
`ifdef SYN
12
  `ifdef ACTEL
13
  CLKINT CLKA
14
  (.A (SD_CLK_O),
15
   .Y (SD_CLK)
16
   );
17
  `else
18
 
19
   assign SD_CLK = SDC_CLK_O;
20
 
21
  `endif
22
 
23
 `endif
24
 
25
 `ifdef SIM
26
   assign SD_CLK = SD_CLK_O;
27
`endif
28
 
29
always @ (posedge CLK or posedge RST)
30
begin
31
 if (RST) begin
32
    ClockDiv <=8'b0000_0000;
33
    SD_CLK_O  <= 0;
34
 end
35
 else if (ClockDiv == DIVIDER )begin
36
    ClockDiv  <= 0;
37
    SD_CLK_O <=  ~SD_CLK_O;
38
 end else begin
39
    ClockDiv  <= ClockDiv + 1;
40
    SD_CLK_O <=  SD_CLK_O;
41
end
42
 
43
end
44
 endmodule
45
 
46
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.