1 |
2 |
lucas.vbal |
--lpm_counter CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" DEVICE_FAMILY="Cyclone IV E" lpm_direction="UP" lpm_modulus=6 lpm_port_updown="PORT_UNUSED" lpm_width=3 clk_en clock q
|
2 |
|
|
--VERSION_BEGIN 17.0 cbx_cycloneii 2017:04:25:18:06:29:SJ cbx_lpm_add_sub 2017:04:25:18:06:29:SJ cbx_lpm_compare 2017:04:25:18:06:29:SJ cbx_lpm_counter 2017:04:25:18:06:29:SJ cbx_lpm_decode 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 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 cmpr_pgc (dataa[2..0], datab[2..0])
|
22 |
|
|
RETURNS ( aeb);
|
23 |
|
|
|
24 |
|
|
--synthesis_resources = lut 3 reg 3
|
25 |
|
|
SUBDESIGN cntr_apf
|
26 |
|
|
(
|
27 |
|
|
clk_en : input;
|
28 |
|
|
clock : input;
|
29 |
|
|
q[2..0] : output;
|
30 |
|
|
)
|
31 |
|
|
VARIABLE
|
32 |
|
|
counter_reg_bit[2..0] : dffe;
|
33 |
|
|
add_sub4_result_int[3..0] : WIRE;
|
34 |
|
|
add_sub4_cout : WIRE;
|
35 |
|
|
add_sub4_dataa[2..0] : WIRE;
|
36 |
|
|
add_sub4_datab[2..0] : WIRE;
|
37 |
|
|
add_sub4_result[2..0] : WIRE;
|
38 |
|
|
cmpr5 : cmpr_pgc;
|
39 |
|
|
aclr_actual : WIRE;
|
40 |
|
|
add_sub_one_w[2..0] : WIRE;
|
41 |
|
|
add_value_w[2..0] : WIRE;
|
42 |
|
|
cnt_en : NODE;
|
43 |
|
|
compare_result : WIRE;
|
44 |
|
|
cout_actual : WIRE;
|
45 |
|
|
current_reg_q_w[2..0] : WIRE;
|
46 |
|
|
custom_cout_w : WIRE;
|
47 |
|
|
modulus_bus[2..0] : WIRE;
|
48 |
|
|
modulus_trigger : WIRE;
|
49 |
|
|
modulus_trigger_value_w[2..0] : WIRE;
|
50 |
|
|
safe_q[2..0] : WIRE;
|
51 |
|
|
time_to_clear : WIRE;
|
52 |
|
|
trigger_mux_w[2..0] : WIRE;
|
53 |
|
|
updown_dir : WIRE;
|
54 |
|
|
|
55 |
|
|
BEGIN
|
56 |
|
|
counter_reg_bit[].clk = clock;
|
57 |
|
|
counter_reg_bit[].clrn = (! aclr_actual);
|
58 |
|
|
counter_reg_bit[].d = trigger_mux_w[];
|
59 |
|
|
counter_reg_bit[].ena = (clk_en & cnt_en);
|
60 |
|
|
add_sub4_result_int[] = (0, add_sub4_dataa[]) + (0, add_sub4_datab[]);
|
61 |
|
|
add_sub4_result[] = add_sub4_result_int[2..0];
|
62 |
|
|
add_sub4_cout = add_sub4_result_int[3];
|
63 |
|
|
add_sub4_dataa[] = current_reg_q_w[];
|
64 |
|
|
add_sub4_datab[] = add_value_w[];
|
65 |
|
|
cmpr5.dataa[] = safe_q[];
|
66 |
|
|
cmpr5.datab[] = modulus_bus[];
|
67 |
|
|
aclr_actual = B"0";
|
68 |
|
|
add_sub_one_w[] = add_sub4_result[];
|
69 |
|
|
add_value_w[] = B"001";
|
70 |
|
|
cnt_en = VCC;
|
71 |
|
|
compare_result = cmpr5.aeb;
|
72 |
|
|
cout_actual = (custom_cout_w # (time_to_clear & updown_dir));
|
73 |
|
|
current_reg_q_w[] = counter_reg_bit[].q;
|
74 |
|
|
custom_cout_w = (add_sub4_cout & add_value_w[0..0]);
|
75 |
|
|
modulus_bus[] = B"101";
|
76 |
|
|
modulus_trigger = cout_actual;
|
77 |
|
|
modulus_trigger_value_w[] = ((! updown_dir) & modulus_bus[]);
|
78 |
|
|
q[] = safe_q[];
|
79 |
|
|
safe_q[] = counter_reg_bit[].q;
|
80 |
|
|
time_to_clear = compare_result;
|
81 |
|
|
trigger_mux_w[] = (((! modulus_trigger) & add_sub_one_w[]) # (modulus_trigger & modulus_trigger_value_w[]));
|
82 |
|
|
updown_dir = B"1";
|
83 |
|
|
END;
|
84 |
|
|
--VALID FILE
|