I have already searched for related issues, but all of them are related to dcache. I can't think of a way to determine the characteristics of L1 icache.
Are you talking about x86? Because then you just need to parse the cpuid instruction. See here. Note the bits indicating whether it's an instruction, data, or unified cache.
You may also be interested in Google's cpu_features library in particular its GetX86CacheInfo() function. It supports other architectures, too, but not usually with cache info.
GetX86CacheInfo()function. It supports other architectures, too, but not usually with cache info.