uglyduck
Junior Member level 2
pause verilog
Hello all,
Since I'm relatively new to Verilog I would like to ask two questions:
1. About " `timescale " directive: how this directive affects modules ? For the testbenches I know that for example " `timescale 100ns / 1ps " means that 1 time unit = 100ns (i.e. working at 10MHz) with simulator precision of 1ps. Am I wrong ? Ok, but how this directive affects modules ? What if the testbench have one " `timescale " directive and module have different ?
2. I started to implement just a simple thing as a Delay module for Xilinx CPLD XC9572. This module have two inputs - IN, CLOCK and one output - READY. It should work as follows - if IN changes (new input) an internal counter variable (reg type) is loaded with the value of IN. The counter starts counting immediately down to 0. If counter reaches 0, than READY becomes 1, otherwise READY is 0, meaning that the circuit is still working.
I have implemented this using counter and an internal variable of type reg that have the size of IN. It works fine, but I'm not sure that this is the correct way to implement a delay. And this circuit occupies more that 20% of the XC9572 resources ! I'm confused. What will happen if I just use a " #10 " for example, to delay the READY to become 1 after 10 time units ? Is it legal ? And I have no idea how the hardware will louk like in the point of view of the CPLD - I mean how this will be implemented (represented) by the logic in the CPLD.
Please, help me.
I'm very confused with these two problems.
Thank you very much
Hello all,
Since I'm relatively new to Verilog I would like to ask two questions:
1. About " `timescale " directive: how this directive affects modules ? For the testbenches I know that for example " `timescale 100ns / 1ps " means that 1 time unit = 100ns (i.e. working at 10MHz) with simulator precision of 1ps. Am I wrong ? Ok, but how this directive affects modules ? What if the testbench have one " `timescale " directive and module have different ?
2. I started to implement just a simple thing as a Delay module for Xilinx CPLD XC9572. This module have two inputs - IN, CLOCK and one output - READY. It should work as follows - if IN changes (new input) an internal counter variable (reg type) is loaded with the value of IN. The counter starts counting immediately down to 0. If counter reaches 0, than READY becomes 1, otherwise READY is 0, meaning that the circuit is still working.
I have implemented this using counter and an internal variable of type reg that have the size of IN. It works fine, but I'm not sure that this is the correct way to implement a delay. And this circuit occupies more that 20% of the XC9572 resources ! I'm confused. What will happen if I just use a " #10 " for example, to delay the READY to become 1 after 10 time units ? Is it legal ? And I have no idea how the hardware will louk like in the point of view of the CPLD - I mean how this will be implemented (represented) by the logic in the CPLD.
Please, help me.
I'm very confused with these two problems.
Thank you very much