FPGA 版 FM 音源 (69) -- FPGA 版 EG (13)

EG の本体回路だけでなく、周辺回路も含んで (無印) Cyclone にインプリメントした「op3_EG_cyc()」の Verilog ソースを下に示します。 
モジュール名、ファイル名に含まれる「cyc」は「Cyclone」を意味しています。
"opl3_EG_cyc.v"

// Copyright (C) 1991-2011 Altera Corporation
// Your use of Altera Corporation's design tools, logic functions 
// and other software and tools, and its AMPP partner logic 
// functions, and any output files from any of the foregoing 
// (including device programming or simulation files), and any 
// associated documentation or information are expressly subject 
// to the terms and conditions of the Altera Program License 
// Subscription Agreement, Altera MegaCore Function License 
// Agreement, or other applicable license agreement, including, 
// without limitation, that your use is for the sole purpose of 
// programming logic devices manufactured by Altera and sold by 
// Altera or its authorized distributors.  Please refer to the 
// applicable agreement for further details.

// PROGRAM		"Quartus II"
// VERSION		"Version 11.0 Build 208 07/03/2011 Service Pack 1 SJ Web Edition"
// CREATED		"Fri Feb 10 03:24:20 2017"

module opl3_EG_cyc(
	reset,
	m_clk,
	egt,
	kon0,
	kon1,
	ar,
	dr,
	rof,
	rr,
	sl,
	spdif_tx_out,
	dac_lrck,
	dac_sdat,
	dac_sclk,
	LED1,
	LED2,
	kon0_out,
	mute,
	sdm_out
);


input wire	reset;
input wire	m_clk;
input wire	egt;
input wire	kon0;
input wire	kon1;
input wire	[3:0] ar;
input wire	[3:0] dr;
input wire	[3:0] rof;
input wire	[3:0] rr;
input wire	[3:0] sl;
output wire	spdif_tx_out;
output wire	dac_lrck;
output wire	dac_sdat;
output wire	dac_sclk;
output wire	LED1;
output wire	LED2;
output wire	kon0_out;
output wire	mute;
output wire	sdm_out;

wire	[15:0] da;
wire	[15:0] din;
wire	[11:0] lb;
wire	SYNTHESIZED_WIRE_0;
wire	SYNTHESIZED_WIRE_1;
wire	SYNTHESIZED_WIRE_18;
wire	SYNTHESIZED_WIRE_19;
wire	SYNTHESIZED_WIRE_4;
wire	[8:0] SYNTHESIZED_WIRE_5;
wire	SYNTHESIZED_WIRE_20;
wire	SYNTHESIZED_WIRE_11;
wire	[7:0] SYNTHESIZED_WIRE_12;
wire	SYNTHESIZED_WIRE_14;
wire	SYNTHESIZED_WIRE_15;
wire	SYNTHESIZED_WIRE_16;
wire	SYNTHESIZED_WIRE_17;

assign	kon0_out = SYNTHESIZED_WIRE_1;
assign	mute = SYNTHESIZED_WIRE_4;
assign	SYNTHESIZED_WIRE_11 = 1;
assign	SYNTHESIZED_WIRE_17 = 0;




opl3_EG_clk	b2v_clk(
	.reset(reset),
	.m_clk(m_clk),
	.sob(SYNTHESIZED_WIRE_0),
	.kon0(kon0),
	.kon1(kon1),
	.clk_128fs_en(SYNTHESIZED_WIRE_18),
	.slot_clk_en(SYNTHESIZED_WIRE_20),
	.fs_clk_en(SYNTHESIZED_WIRE_14),
	.lrck(SYNTHESIZED_WIRE_19),
	.kon_rise(SYNTHESIZED_WIRE_15),
	.kon_fall(SYNTHESIZED_WIRE_16),
	.kon0_out(SYNTHESIZED_WIRE_1));
	defparam	b2v_clk.DEBUG = 1'b0;
	defparam	b2v_clk.N_SLOT = 2;

assign	LED1 =  ~SYNTHESIZED_WIRE_1;


sdm1_16	b2v_inst1(
	.reset(reset),
	.m_clk(m_clk),
	.clk_ovs_en(SYNTHESIZED_WIRE_18),
	.fs_clk(SYNTHESIZED_WIRE_19),
	.din(din),
	.daout(sdm_out));


lpm_constant0	b2v_inst13(
	.result(SYNTHESIZED_WIRE_12));


assign	LED2 =  ~SYNTHESIZED_WIRE_4;


assign	din[15:3] = da[12:0];



lpm_constant4	b2v_inst5(
	.result(din[2:0]));

assign	lb[11:3] = SYNTHESIZED_WIRE_5;



lpm_constant1	b2v_inst7(
	.result(lb[2:0]));


i2s_tx	b2v_inst8(
	.reset(reset),
	.m_clk(m_clk),
	.clk_128fs_en(SYNTHESIZED_WIRE_18),
	.lrck(SYNTHESIZED_WIRE_19),
	.da(din),
	.sclk(dac_sclk),
	.sdat(dac_sdat),
	.lrck_out(dac_lrck)
	);


opl3_lb2lin	b2v_lb2lin(
	.reset(reset),
	.m_clk(m_clk),
	.clk_en(SYNTHESIZED_WIRE_20),
	
	.lb(lb),
	.lin_out(da));
	defparam	b2v_lb2lin.SIGNED = 0;


spdif_tx	b2v_spdif(
	.reset(reset),
	.m_clk(m_clk),
	.clk_128fs_en(SYNTHESIZED_WIRE_18),
	.lrck(SYNTHESIZED_WIRE_19),
	.cs_fs48k(SYNTHESIZED_WIRE_11),
	.da(da),
	.da_ext(SYNTHESIZED_WIRE_12),
	
	
	
	.sob(SYNTHESIZED_WIRE_0),
	.tx_out(spdif_tx_out));


opl3_EG_top	b2v_top(
	.reset(reset),
	.m_clk(m_clk),
	.slot_clk_en(SYNTHESIZED_WIRE_20),
	.fs_clk_en(SYNTHESIZED_WIRE_14),
	.kon_rise(SYNTHESIZED_WIRE_15),
	.kon_fall(SYNTHESIZED_WIRE_16),
	.egt(egt),
	.mem_init(SYNTHESIZED_WIRE_17),
	.ar(ar),
	.dr(dr),
	.rof(rof),
	.rr(rr),
	.sl(sl),
	.mute(SYNTHESIZED_WIRE_4),
	.eg_acc_out(SYNTHESIZED_WIRE_5));
	defparam	b2v_top.N_SLOT = 2;


endmodule

これは、2017 年 1 月 28 日付けの記事 (→こちら) の回路図 (opl3_EG_cyc.bdf) を Quartus II の機能を使って単純に機械的Verilog ファイルに変換したものです。
実際には、トップレベルは .bdf ファイルのまま利用しており、上の Verilog ファイル自体は使用していません。 モジュール間の結線状態を「テキスト・ファイル」の形での記述として示したものです。
メガファンクション・ウィザードで作成した「定数」モジュールである lpm_constant の呼び出しが 3 つ含まれていますが、いずれも複数ビットの「0」を出力しているだけなので、その中身については省略します。
「N_SLOT」パラメタについては、「opl3_EG_top()」と「opl3_EG_clk()」との、ふたつのモジュールに対して同じ値を指定する必要があります。