The semiconductor industry is having a mixed year. On one hand, there's a level of exuberance among investors for stocks like Nvidia (NVDA -2.48%) because the company is dominating the data center space, especially as it relates to chips used in artificial intelligence (AI) applications.

On the other hand, weak economic conditions are crushing consumer segments like personal computing and gaming, which means many semiconductor companies saw a decline in revenue this year.

In any case, evidence is building that this down cycle could be coming to an end, which is why the following two stocks might look like bargains when investors reflect back on this moment in the future.

1. Micron Technology

When it comes to semiconductor stocks, investors' attention is focused on big names like Nvidia and Advanced Micro Devices (AMD -1.81%) because of their role in producing chips for AI applications. Micron Technology (MU -0.94%) hasn't enjoyed that spotlight, despite being a world leader in memory (DRAM) and storage (NAND) chips, which are also a key factor in AI development.

Nvidia CEO Jensen Huang recently said there was $1 trillion in data center infrastructure that needs upgrading to support accelerated computing and AI. In the fiscal 2023 second quarter (ended March 2), Micron told investors that AI servers can have up to eight times the DRAM content of a regular server, and three times the NAND storage requirements. Therefore, the company's opportunity in this space is undeniable. 

But Micron is facing short-term challenges in its consumer segments thanks to the weak economic climate. It suffered from an inventory glut over the last couple of quarters, which impacted its pricing power and caused its revenue to shrink 52% year over year in Q2.

Despite the poor result, investors have sent Micron stock surging 34% in 2023 so far, fueled by optimism for the company's strategy moving forward. It's slashing operating costs, which includes a 15% reduction to its workforce, and it's also planning to cut capital expenditures by 40% to reduce the supply of new units, selling down its remaining inventory instead. The company says it believes inventories have now peaked, which bodes well for a stronger second half of fiscal 2023. 

The semiconductor sector is cyclical in nature, which means when the business cycle turns higher once again, companies will continue upgrading their product portfolios and investing in digital infrastructure. When that time comes, Micron will be running a much leaner enterprise because of the adjustments it's making to its cost structure right now, which could supercharge its financial results.

Given Micron stock remains 27% below its all-time high, this might be a great opportunity for investors to buy in. 

2. Cohu

Cohu (COHU -1.47%) isn't like Micron, Nvidia, or AMD, because it doesn't produce any chips at all. Instead, it's a semiconductor service company that provides testing and handling equipment to the world's largest chip producers. These hardware products (and the software that goes with them) are critical to the quality control process, ensuring end users receive chips free from structural defects.

Semiconductors need to be smaller than ever to fit inside mobile devices and even tight spaces within cars, yet they still need to deliver higher output than the generation that came before them. As a result, testing and handling processes are growing increasingly complex -- manufacturers need to be able to keep production moving while also ensuring appropriate inspections are completed. 

Cohu's Neon system can handle chips as small as 0.2 millimeters by 0.4 millimeters at scale. The company also uses artificial intelligence algorithms on the software side to help distinguish harmless cosmetic scratches from structural defects, even when they're as small as 5 micrometers (or 93% thinner than a human hair). Cohu is also a leader in thermal handlers for high-performance data center CPU and GPU chips used in AI applications, which regulate temperatures under test conditions. 

Like Micron, Cohu is also feeling the effects of the weak economy. It delivered $179.4 million in revenue during the first quarter of 2023 (ended March 31), which met its prior guidance but was down 9.3% year over year. On a more positive note, the company maintained profitability thanks to stringent cost management.

Wall Street analysts expect Cohu to deliver $695 million in revenue in 2023, which would be a 14% drop from 2022. But the company has told investors it expects to generate an average of $1 billion in annual revenue over the next three to five years, which means a significant ramp-up might be on the horizon.

Cohu stock is down 30% from its all-time high right now, so this might be a good time to buy ahead of that next growth spurt.