![Lattice Semiconductor LatticeMico32 Hardware Developer User Manual Download Page 116](http://html1.mh-extra.com/html/lattice-semiconductor/latticemico32/latticemico32_hardware-developer-user-manual_3843852116.webp)
C
REATING
C
USTOM
C
OMPONENTS
IN
L
ATTICE
M
ICO
S
YSTEM
:
Custom Component Example
110
LatticeMico32 Hardware Developer User Guide
Figure 62 shows the steps required for adding the CLK_MHZ parameter
for the component that will receive the platform’s WISHBONE clock-
frequency from MSB when instantiated a platform. This parameter will not
be visible for configuration.
When importing a new component, you should always check the SIZE
parameter. The default value for the SIZE parameter determines the
default address-decode space for the component. Although you can
change it when you instantiate it in the platform, it is always a good idea to
make sure that the default value is sufficient to cover the entire
addressable space (for example, the space for registers, memory, or I/Os)
that is provided for the component being imported. The custom
component example has three registers—that is, a total decode space of
12 bytes—so the default value of 32 for the SIZE parameter is adequate.
The example custom component requires a data structure like that shown
in Figure 63.
Figure 62: Specifying the Platform’s WISHBONE Clock Frequency RTL Parameter
Figure 63: Data Structure Required for Creating Custom Component
typedef
struct
st_reg_device {
unsigned
int
reg_08_value;
unsigned
int
b_addr;
} reg_device;