OpenCores
URL https://opencores.org/ocsvn/2d_game_console/2d_game_console/trunk

Subversion Repositories 2d_game_console

[/] [2d_game_console/] [trunk/] [Processor_Quartus/] [db/] [sign_div_unsign_kqh.tdf] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lucas.vbal
--sign_div_unsign DEN_REPRESENTATION="SIGNED" DEN_WIDTH=16 LPM_PIPELINE=1 MAXIMIZE_SPEED=5 NUM_REPRESENTATION="SIGNED" NUM_WIDTH=16 SKIP_BITS=0 clock denominator numerator quotient remainder
2
--VERSION_BEGIN 17.0 cbx_cycloneii 2017:04:25:18:06:29:SJ cbx_lpm_abs 2017:04:25:18:06:29:SJ cbx_lpm_add_sub 2017:04:25:18:06:29:SJ cbx_lpm_divide 2017:04:25:18:06:29:SJ cbx_mgl 2017:04:25:18:09:28:SJ cbx_nadder 2017:04:25:18:06:30:SJ cbx_stratix 2017:04:25:18:06:30:SJ cbx_stratixii 2017:04:25:18:06:30:SJ cbx_util_mgl 2017:04:25:18:06:30:SJ  VERSION_END
3
 
4
 
5
-- Copyright (C) 2017  Intel Corporation. All rights reserved.
6
--  Your use of Intel Corporation's design tools, logic functions
7
--  and other software and tools, and its AMPP partner logic
8
--  functions, and any output files from any of the foregoing
9
--  (including device programming or simulation files), and any
10
--  associated documentation or information are expressly subject
11
--  to the terms and conditions of the Intel Program License
12
--  Subscription Agreement, the Intel Quartus Prime License Agreement,
13
--  the Intel MegaCore Function License Agreement, or other
14
--  applicable license agreement, including, without limitation,
15
--  that your use is for the sole purpose of programming logic
16
--  devices manufactured by Intel and sold by Intel or its
17
--  authorized distributors.  Please refer to the applicable
18
--  agreement for further details.
19
 
20
 
21
FUNCTION alt_u_div_9kg (clock, denominator[15..0], numerator[15..0])
22
RETURNS ( den_out[15..0], quotient[15..0], remainder[15..0]);
23
 
24
--synthesis_resources = lut 196 reg 66
25
OPTIONS ALTERA_INTERNAL_OPTION = "{-to DFF_q_is_neg} POWER_UP_LEVEL=HIGH";
26
 
27
SUBDESIGN sign_div_unsign_kqh
28
(
29
        clock   :       input;
30
        denominator[15..0]      :       input;
31
        numerator[15..0]        :       input;
32
        quotient[15..0] :       output;
33
        remainder[15..0]        :       output;
34
)
35
VARIABLE
36
        divider : alt_u_div_9kg;
37
        DFF_Num_Sign[0..0] : dffe;
38
        DFF_q_is_neg[0..0] : dffe
39
                WITH (
40
                        power_up = "high"
41
                );
42
        adder_result_int[16..0] :       WIRE;
43
        adder_cin       :       WIRE;
44
        adder_dataa[15..0]      :       WIRE;
45
        adder_datab[15..0]      :       WIRE;
46
        adder_result[15..0]     :       WIRE;
47
        compl_adder1_result_int[16..0]  :       WIRE;
48
        compl_adder1_cin        :       WIRE;
49
        compl_adder1_dataa[15..0]       :       WIRE;
50
        compl_adder1_datab[15..0]       :       WIRE;
51
        compl_adder1_result[15..0]      :       WIRE;
52
        compl_adder_2_result_int[16..0] :       WIRE;
53
        compl_adder_2_cin       :       WIRE;
54
        compl_adder_2_dataa[15..0]      :       WIRE;
55
        compl_adder_2_datab[15..0]      :       WIRE;
56
        compl_adder_2_result[15..0]     :       WIRE;
57
        aclr    : NODE;
58
        adder_out[15..0]        : WIRE;
59
        clken   : NODE;
60
        den_choice[15..0]       : WIRE;
61
        gnd_wire        : WIRE;
62
        neg_num[15..0]  : WIRE;
63
        neg_quot[15..0] : WIRE;
64
        norm_num[15..0] : WIRE;
65
        num_choice[15..0]       : WIRE;
66
        pre_neg_den[15..0]      : WIRE;
67
        pre_neg_quot[15..0]     : WIRE;
68
        pre_quot[15..0] : WIRE;
69
        protect_quotient[15..0] : WIRE;
70
        protect_remainder[15..0]        : WIRE;
71
        q_is_neg        : WIRE;
72
        vcc_wire        : WIRE;
73
        zero_wire[15..0]        : WIRE;
74
        zero_wire_2w[15..0]     : WIRE;
75
 
76
BEGIN
77
        divider.clock = clock;
78
        divider.denominator[] = den_choice[];
79
        divider.numerator[] = norm_num[];
80
        DFF_Num_Sign[].clk = clock;
81
        DFF_Num_Sign[].clrn = (! aclr);
82
        DFF_Num_Sign[].d = ( num_choice[15..15]);
83
        DFF_Num_Sign[].ena = clken;
84
        DFF_q_is_neg[].clk = clock;
85
        DFF_q_is_neg[].d = ( q_is_neg);
86
        DFF_q_is_neg[].ena = clken;
87
        DFF_q_is_neg[].prn = (! aclr);
88
        adder_result_int[] = (adder_dataa[], 0) - (adder_datab[], !adder_cin);
89
        adder_result[] = adder_result_int[16..1];
90
        adder_cin = gnd_wire;
91
        adder_dataa[] = divider.den_out[];
92
        adder_datab[] = protect_remainder[];
93
        compl_adder1_result_int[] = (compl_adder1_dataa[], compl_adder1_cin) + (compl_adder1_datab[], compl_adder1_cin);
94
        compl_adder1_result[] = compl_adder1_result_int[16..1];
95
        compl_adder1_cin = vcc_wire;
96
        compl_adder1_dataa[] = (! denominator[]);
97
        compl_adder1_datab[] = zero_wire[];
98
        compl_adder_2_result_int[] = (compl_adder_2_dataa[], compl_adder_2_cin) + (compl_adder_2_datab[], compl_adder_2_cin);
99
        compl_adder_2_result[] = compl_adder_2_result_int[16..1];
100
        compl_adder_2_cin = vcc_wire;
101
        compl_adder_2_dataa[] = (! pre_quot[]);
102
        compl_adder_2_datab[] = zero_wire_2w[];
103
        aclr = GND;
104
        adder_out[] = adder_result[];
105
        clken = VCC;
106
        den_choice[] = ((denominator[] & (! denominator[15..15])) # (pre_neg_den[] & denominator[15..15]));
107
        gnd_wire = B"0";
108
        neg_num[] = (! num_choice[]);
109
        neg_quot[] = (! protect_quotient[]);
110
        norm_num[] = ((num_choice[] & (! num_choice[15..15])) # (neg_num[] & num_choice[15..15]));
111
        num_choice[] = numerator[];
112
        pre_neg_den[] = compl_adder1_result[];
113
        pre_neg_quot[] = compl_adder_2_result[];
114
        pre_quot[] = ((protect_quotient[] & (! DFF_Num_Sign[0].q)) # (neg_quot[] & DFF_Num_Sign[0].q));
115
        protect_quotient[] = divider.quotient[];
116
        protect_remainder[] = divider.remainder[];
117
        q_is_neg = denominator[15..15];
118
        quotient[] = ((pre_quot[] & (! DFF_q_is_neg[0].q)) # (pre_neg_quot[] & DFF_q_is_neg[0].q));
119
        remainder[] = ((protect_remainder[] & (! DFF_Num_Sign[0].q)) # (adder_out[] & DFF_Num_Sign[0].q));
120
        vcc_wire = B"1";
121
        zero_wire[] = B"0000000000000000";
122
        zero_wire_2w[] = B"0000000000000000";
123
END;
124
--VALID FILE

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.