In relation to the built-in self-test circuit (BIST circuit) for testing
CAM macros, the present invention is intended to provide a means to
enable reduction in amount of materials as required for wiring channel
region for signal distribution, buffer, FF, etc., and in number of LSI
pins, and further, to facilitate mounting on chips. The data generators
for CAM testing, inserted between the APG for RAMs and CAM macros, create
data to write to the CAM macros by obtaining the address signals directly
or by decoding the same signals. The APG is common to all the memory
macros, and testing proper to each CAM can be carried out by changing
over the operation of the inserted data generators by means of the
control signal. The data generators are arranged in the proximity of the
CAM macros, the circuits to be tested.