ASML (ASML -2.05%) and Nvidia (NVDA 0.76%) are two very different kinds of companies, but the latter likely wouldn't exist without the former.

ASML, which is based in the Netherlands, is the world's top manufacturer of lithography systems -- which are used to etch circuit patterns onto silicon wafers. The world's top chip foundries -- including Taiwan Semiconductor Manufacturing Company (TSMC), Samsung, and Intel -- all use its top-tier extreme ultraviolet (EUV) systems to manufacture the world's smallest and densest chips.

Nvidia, the American chipmaker that dominates the gaming and data center GPU markets, outsources its chip production to TSMC and Samsung's foundries. In other words, Nvidia can't produce its newest GPUs without ASML's EUV systems.

Semiconductors being manufactured.

Image source: Getty Images.

ASML and Nvidia both profited from the surging demand for new chips across multiple industries over the past few years. But both stocks also stumbled this year as rising inflation and higher interest rates sparked a retreat from pricier tech stocks.

ASML's stock has declined 19% year-to-date, while Nvidia's stock has slumped 24%. Should investors consider accumulating shares of either beaten-down semiconductor stock before the macroeconomic headwinds wane?

Different businesses, similar tailwinds

ASML leads the lithography market and is the world's only manufacturer of EUV systems. These systems, which cost $150 million each and require multiple plans to ship, are required to produce the world's smallest 7nm and 5nm chips. ASML spent the past three decades developing this technology, so it doesn't face any meaningful challengers.

In 2023, ASML will start shipping its first "high-NA" EUV systems, which will enable chipmakers to manufacture even smaller 3nm and 2nm chips. TSMC, Samsung, and Intel are all racing to install more EUV systems and secure orders for high-NA systems, which will enable them to keep pace with each other in the "process race" to create more advanced chips.

ASML shipped 309 lithography systems in 2021, including 42 top-tier EUV systems. But if the secular expansion of the 5G, cloud, data center, artificial intelligence, automotive, gaming, and Internet of Things (IoT) markets sparks a prolonged "super cycle" of chip upgrades over the next four years, ASML believes it could ship a maximum of 452 systems in 2025, including 70 EUV systems and five high-NA systems.

Nvidia will profit from many of the same secular tailwinds. It already controlled 83% of the discrete GPU market in the third quarter of 2021, according to JPR, while AMD held the remaining 17% share.

Nvidia's GPUs are generally more expensive than AMD's, but they consistently deliver more processing power. As a result, Nvidia remains the preferred GPU brand for high-end PC gaming, as well as the calculation of complex machine learning and AI tasks in data centers. Those two markets have accounted for most of Nvidia's growth in recent years.

Nvidia also develops Arm-based CPUs for set-top boxes, gaming consoles, data centers, and other markets. It attempted to expand this smaller business by buying the chip designer Arm from SoftBank for $40 billion, but it will reportedly need to abandon that deal -- which faced heavy opposition from antitrust regulators and other chipmakers -- in the near future.

Which company has a clearer future?

ASML's revenue and earnings jumped 33% and 69%, respectively, in 2021 as the global chip shortage drove a 20% increase in its annual system shipments. ASML's gross margin also expanded from 48.6% to 52.7% as it flexed its pricing power and sold more higher-margin EUV systems.

Analysts expect ASML's revenue and earnings per share (EPS) to grow 19% and 22%, respectively, in 2022 as the global chip shortage drags on. A significant portion of the soaring capex at TSMC, Intel, and Samsung to resolve that shortage will likely flow directly to ASML.

Nvidia's revenue and EPS rose 65% and 132% year-over-year, respectively, in the first nine months of fiscal 2022, which ends on Jan. 30. Analysts expect its revenue and earnings to grow 60% and 74%, respectively, for the full year.

But in fiscal 2023, a few unpredictable headwinds could throttle Nvidia's growth. Its sales of high-end gaming GPUs could decelerate as the stay-at-home tailwinds for the PC market fade. The cryptocurrency market's recent crash could also impact its sales of high-end gaming GPUs and dedicated mining cards, while macro challenges could cause companies to postpone their data center upgrades. Lastly, Nvidia still remains heavily dependent on TSMC and Samsung to successfully navigate the ongoing chip shortage.

Nonetheless, analysts still expect Nvidia's revenue and earnings to grow 19% and 20%, respectively, in fiscal 2023.

Which stock is a better value?

ASML and Nvidia both got a bit overheated during the tech sector's broader rally last year. But both stocks look more reasonably valued today.

ASML trades at 35 times forward earnings, and Nvidia trades at 47 times forward earnings. Both companies pay dividends, but their forward yields are well below 1% and won't attract any serious income investors.

ASML and Nvidia are both still solid long-term investments. But if I had to choose one over the other, I'd stick with ASML for four simple reasons: It's a linchpin of the semiconductor market, its has an impenetrable moat, its long-term growth is more predictable, and its stock is significantly cheaper.