# Verilog HDL Notes
###### tags: `verilog`
> This note is about constant division.
[ToC]
## :memo: Why do we need to use this method?
- [x] Because of the operator / in hardware design, it wastes a lot of resources.
- [x] It is better to use **multiplier(*) and shift(>>)** to replace division.
## How to use?
::: success
- We can get value through dividing the divisor by **2^n^**.
- Shift **n** bits to the right.
:::
### Example:
Suppose our divisor is set to 9 and the dividend is represented by M.
> `M / 9`
- According to the rule, we assume n = 14, then divide 9.
> 2^14^ / 9 = 1821
- Next we will multiply the dividend by 1821.
- And we should shift 14 bits to the right.
> ==(M * 1821) >> 14==
:::info
:bulb: **Hint:** You can also use any number to replace 14 which is greater than the divisor, but it depends on the precision of the answer.
:::