0 Replies Latest reply on Dec 3, 2011 11:38 AM by gautam.das.g

    Tips and Tricks - Reading a verilog component implemented in PSoC 3/5 PLDs by CPU/DMA

    gautam.das.g

      Question: How can CPU/DMA read from a verilog component implemented in PLDs of UDB Blocks.

                                                 
      Answer: 

      There are no hardware registers associated with the PLD based verilog component which would store the values of the signals used inside the component. Hence the CPU/DMA cannot read directly from the component. One way to read from the component is to bring the required signals out through output pins and connect a status register to it.

      A simple example of a 3 bit counter is as follows.

      module Mod3Counter (

            count,

            clock

      );

            output [2:0] count;

            input   clock; 

      //`#start body` -- edit after this line, do not edit this line

      reg [2:0] count; 

      always @(posedge clock)

      begin

            count <= count+1'd1;

      end

      //        Your code goes here

      //`#end` -- edit above this line, do not edit this line

      Endmodule

      As it can be seen ‘count’ has been made an output signal. A status register should be connected to the ‘count’ terminal as shown below.

       

       

       

      The CPU can read the counts by simply reading the status register. The counts can be transferred to another destination using DMA by setting the source address as the address of the status register.