Implemented features: ball moving, platform moving, showing scores on digital table, game reset.
88 lines
3.9 KiB
Text
88 lines
3.9 KiB
Text
--abs_divider DEN_REPRESENTATION="SIGNED" LPM_PIPELINE=0 MAXIMIZE_SPEED=5 NUM_REPRESENTATION="SIGNED" SKIP_BITS=0 WIDTH_D=5 WIDTH_N=32 denominator numerator quotient remainder
|
|
--VERSION_BEGIN 9.1 cbx_cycloneii 2009:10:21:21:22:16:SJ cbx_lpm_abs 2009:10:21:21:22:16:SJ cbx_lpm_add_sub 2009:10:21:21:22:16:SJ cbx_lpm_divide 2009:10:21:21:22:16:SJ cbx_mgl 2009:10:21:21:37:49:SJ cbx_stratix 2009:10:21:21:22:16:SJ cbx_stratixii 2009:10:21:21:22:16:SJ cbx_util_mgl 2009:10:21:21:22:16:SJ VERSION_END
|
|
|
|
|
|
-- Copyright (C) 1991-2009 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.
|
|
|
|
|
|
FUNCTION alt_u_div_k2f (denominator[4..0], numerator[31..0])
|
|
RETURNS ( quotient[31..0], remainder[4..0]);
|
|
FUNCTION lpm_abs_gq9 (data[4..0])
|
|
RETURNS ( overflow, result[4..0]);
|
|
FUNCTION lpm_abs_0s9 (data[31..0])
|
|
RETURNS ( result[31..0]);
|
|
|
|
--synthesis_resources = lut 246
|
|
SUBDESIGN abs_divider_kbg
|
|
(
|
|
denominator[4..0] : input;
|
|
numerator[31..0] : input;
|
|
quotient[31..0] : output;
|
|
remainder[4..0] : output;
|
|
)
|
|
VARIABLE
|
|
divider : alt_u_div_k2f;
|
|
my_abs_den : lpm_abs_gq9;
|
|
my_abs_num : lpm_abs_0s9;
|
|
compl_add_quot_result_int[32..0] : WIRE;
|
|
compl_add_quot_cin : WIRE;
|
|
compl_add_quot_dataa[31..0] : WIRE;
|
|
compl_add_quot_datab[31..0] : WIRE;
|
|
compl_add_quot_result[31..0] : WIRE;
|
|
compl_add_rem_result_int[5..0] : WIRE;
|
|
compl_add_rem_cin : WIRE;
|
|
compl_add_rem_dataa[4..0] : WIRE;
|
|
compl_add_rem_datab[4..0] : WIRE;
|
|
compl_add_rem_result[4..0] : WIRE;
|
|
diff_signs : WIRE;
|
|
gnd_wire : WIRE;
|
|
neg_quot[31..0] : WIRE;
|
|
neg_rem[4..0] : WIRE;
|
|
norm_den[4..0] : WIRE;
|
|
norm_num[31..0] : WIRE;
|
|
num_sign : WIRE;
|
|
protect_quotient[31..0] : WIRE;
|
|
protect_remainder[4..0] : WIRE;
|
|
vcc_wire : WIRE;
|
|
|
|
BEGIN
|
|
divider.denominator[] = norm_den[];
|
|
divider.numerator[] = norm_num[];
|
|
my_abs_den.data[] = denominator[];
|
|
my_abs_num.data[] = numerator[];
|
|
compl_add_quot_result_int[] = (compl_add_quot_dataa[], compl_add_quot_cin) + (compl_add_quot_datab[], compl_add_quot_cin);
|
|
compl_add_quot_result[] = compl_add_quot_result_int[32..1];
|
|
compl_add_quot_cin = vcc_wire;
|
|
compl_add_quot_dataa[] = (! protect_quotient[]);
|
|
compl_add_quot_datab[] = ( gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire);
|
|
compl_add_rem_result_int[] = (compl_add_rem_dataa[], compl_add_rem_cin) + (compl_add_rem_datab[], compl_add_rem_cin);
|
|
compl_add_rem_result[] = compl_add_rem_result_int[5..1];
|
|
compl_add_rem_cin = vcc_wire;
|
|
compl_add_rem_dataa[] = (! protect_remainder[]);
|
|
compl_add_rem_datab[] = ( gnd_wire, gnd_wire, gnd_wire, gnd_wire, gnd_wire);
|
|
diff_signs = (numerator[31..31] $ denominator[4..4]);
|
|
gnd_wire = B"0";
|
|
neg_quot[] = compl_add_quot_result[];
|
|
neg_rem[] = compl_add_rem_result[];
|
|
norm_den[] = my_abs_den.result[];
|
|
norm_num[] = my_abs_num.result[];
|
|
num_sign = numerator[31..31];
|
|
protect_quotient[] = divider.quotient[];
|
|
protect_remainder[] = divider.remainder[];
|
|
quotient[] = ((protect_quotient[] & (! diff_signs)) # (neg_quot[] & diff_signs));
|
|
remainder[] = ((protect_remainder[] & (! num_sign)) # (neg_rem[] & num_sign));
|
|
vcc_wire = B"1";
|
|
END;
|
|
--VALID FILE
|