Entity: oh_clockdiv

Diagram

N SYN LATCH_TYPE CLOCKMUX_TYPE clk nreset clkchange clken [7:0] clkdiv [15:0] clkphase0 [15:0] clkphase1 clkout0 clkrise0 clkfall0 clkout1 clkrise1 clkfall1 clkstable

Description

#############################################################################

Purpose: Clock divider with 2 outputs

      Secondary clock must be multiple of first clock                  #

#############################################################################

Author: Andreas Olofsson

License: MIT (see LICENSE file in OH! repository)

#############################################################################

Generics

Generic name Type Value Description
N 2 data width
SYN "TRUE" synthesizable (or not)
LATCH_TYPE "DEFAULT" implementation type
CLOCKMUX_TYPE "DEFAULT" implementation type

Ports

Port name Direction Type Description
clk input main clock
nreset input async active low reset (from oh_rsync)
clkchange input indicates a parameter change
clken input clock enable
clkdiv input [7:0] [7:0]=period (0==bypass, 1=div/2, 2=div/3, etc)
clkphase0 input [15:0] [7:0]=rising,[15:8]=falling
clkphase1 input [15:0] [7:0]=rising,[15:8]=falling
clkout0 output primary output clock
clkrise0 output rising edge match
clkfall0 output falling edge match
clkout1 output secondary output clock
clkrise1 output rising edge match
clkfall1 output falling edge match
clkstable output clock is guaranteed to be stable

Signals

Name Type Description
counter reg [7:0] regs
clkout0_reg reg
clkout1_reg reg
clkout1_shift reg
period reg [2:0]
period_match wire
clk1_sel wire [3:0]
clk1_sel_sh wire [3:0]
clk0_sel wire [1:0]
clk0_sel_sh wire [1:0]

Processes

Type: always

Description
########################################### # CHANGE DETECT (count 8 periods) ###########################################

Type: always

Description
########################################### # CYCLE COUNTER ###########################################

Type: always

Description
########################################### # CLKOUT0 ###########################################

Type: always

Description
########################################### # CLKOUT1 ###########################################

Type: always

Description
creating divide by 2 shifted clock with negedge

Instantiations

Description
clock select needs to be stable high

Description
all others
clock select needs to be stable high

Description
all others