module ex14_top ( CLOCK_50, DAC_SDI, DAC_CS, DAC_LD, DAC_SCK, PWM_OUT, SW, HEX0, HEX1, HEX2, HEX3 ); input CLOCK_50; input [9:0] SW; output DAC_SDI,DAC_CS,DAC_SCK,DAC_LD,PWM_OUT; output [6:0] HEX0,HEX1,HEX2,HEX3; wire CLOCK_DIVIDED; reg [9:0] A; wire [9:0] D; wire [23:0] MULTRESULT; wire [3:0] BCD0,BCD1,BCD2,BCD3; divider_5000 DIV0 (CLOCK_50, CLOCK_DIVIDED); always @ (posedge CLOCK_DIVIDED) begin A <= A + SW; end MULT_accum_u5f MULT10K ( .clock(CLOCK_50), .sload(CLOCK_DIVIDED), .data(SW[9:0]), .result(MULTRESULT) ); bin2bcd_16 BIN0 ( .B(MULTRESULT[23:10]), .BCD_0(BCD0), .BCD_1(BCD1), .BCD_2(BCD2), .BCD_3(BCD3) ); hex_to_7seg SEG0 (.out(HEX0),.in(BCD0)); hex_to_7seg SEG1 (.out(HEX1),.in(BCD1)); hex_to_7seg SEG2 (.out(HEX2),.in(BCD2)); hex_to_7seg SEG3 (.out(HEX3),.in(BCD3)); ROM ROM0 ( .address(A), .clock(CLOCK_DIVIDED), .q(D[9:0]) ); spi2dac SPI0 ( .sysclk(CLOCK_50), .data_in(D[9:0]), .load(CLOCK_DIVIDED), .dac_sdi(DAC_SDI), .dac_cs(DAC_CS), .dac_sck(DAC_SCK), .dac_ld(DAC_LD) ); pwm PWM0 ( .clk(CLOCK_50), .data_in(D[9:0]), .load(CLOCK_DIVIDED), .pwm_out(PWM_OUT) ); endmodule