Two of Japan's largest electronics groups, NEC Corp. and Hitachi Ltd., said yesterday they will step up production of semiconductors at their U.S. plants and may export some of the output to Europe and Japan.

The announcements offered new evidence that the persistent U.S. trade deficit could be headed down as foreign companies shift more production here, in part to take advantage of the drastic fall of the dollar since 1985.

Japanese companies control more than 60 percent of the U.S. market for memory chips, tiny electronic circuits that are used on a mass scale in computers and a wide variety of consumer electronic products. Most of their chips are now imported from Japan.

NEC said yesterday that it will increase output of certain high-capacity memory chips at its Roseville, Calif., plant from 3.5 million units a month to 5 million.

Explaining the decision, an NEC spokesmen in Tokyo cited growing U.S. demand and the fact that the falling dollar had made production costs in Japan and the United States virtually equal. The company assumes it will eventually export some U.S.-made chips to Japan and Europe, officials said.

John Marck, general manager of the memory products division of NEC Electronics Inc., a U.S. chip affiliate, said the higher output will be made possible by new production methods. In addition, the production changes will result in a greater percentage of high-efficiency chips and better profitability, he said, effects he cited as additional reasons for the company's decision.

Marck predicted that the changes would reduce NEC's direct imports from Japan. He also said it would result in new workers being hired at the plant, which now employs about 650 people.

Hitachi, meanwhile, said it will upgrade a 200-employee plant in Irving, Tex., to handle the start-to-finish production of chips. At present, the facility, operated by U.S. affiliate Hitachi Semiconductor (America) Inc., only assembles and tests chips using components imported from Japan. It will be adding about 100 workers, spokesman Sam Nishikawa said.

Hitachi said that the dust-free production rooms to be added would be ready by December 1988, with work starting in them by May 1989. Initially, Nishikawa said, it will make 1.3 million memory chips for sale in the United States, but may later export to Europe from the plant.

Hitachi said the main reason for the move, which was planned in 1985 but canceled because of a recession in chip sales, was to be closer to customers. A contributing factor, it said, was the elimination of production cost advantages in Japan because of the cheap dollar.