diff --git a/Quartus/v3/Waveform.vwf b/Quartus/v3/Waveform.vwf index 276db7e..2fed777 100644 --- a/Quartus/v3/Waveform.vwf +++ b/Quartus/v3/Waveform.vwf @@ -7,10 +7,10 @@ vlib work vlog -work work jyh_4490_3.vo vlog -work work Waveform.vwf.vt -vsim -c -t 1ps -L cycloneive_ver -L altera_ver -L altera_mf_ver -L 220model_ver -L sgate_ver -L altera_lnsim_ver work.jyh_4490_3_counter_vlg_vec_tst +vsim -c -t 1ps -L cycloneive_ver -L altera_ver -L altera_mf_ver -L 220model_ver -L sgate_ver -L altera_lnsim_ver work.jyh_4490_3_entry_vlg_vec_tst vcd file -direction jyh_4490_3.msim.vcd -vcd add -internal jyh_4490_3_counter_vlg_vec_tst/* -vcd add -internal jyh_4490_3_counter_vlg_vec_tst/i1/* +vcd add -internal jyh_4490_3_entry_vlg_vec_tst/* +vcd add -internal jyh_4490_3_entry_vlg_vec_tst/i1/* proc simTimestamp {} { echo "Simulation time: $::now ps" if { [string equal running [runStatus]] } { @@ -20,15 +20,20 @@ proc simTimestamp {} { after 2500 simTimestamp run -all quit -f + + + + + onerror {exit -code 1} vlib work vlog -work work jyh_4490_3.vo vlog -work work Waveform.vwf.vt -vsim -novopt -c -t 1ps -L cycloneive_ver -L altera_ver -L altera_mf_ver -L 220model_ver -L sgate_ver -L altera_lnsim_ver work.jyh_4490_3_counter_vlg_vec_tst +vsim -novopt -c -t 1ps -L cycloneive_ver -L altera_ver -L altera_mf_ver -L 220model_ver -L sgate_ver -L altera_lnsim_ver work.jyh_4490_3_entry_vlg_vec_tst vcd file -direction jyh_4490_3.msim.vcd -vcd add -internal jyh_4490_3_counter_vlg_vec_tst/* -vcd add -internal jyh_4490_3_counter_vlg_vec_tst/i1/* +vcd add -internal jyh_4490_3_entry_vlg_vec_tst/* +vcd add -internal jyh_4490_3_entry_vlg_vec_tst/i1/* proc simTimestamp {} { echo "Simulation time: $::now ps" if { [string equal running [runStatus]] } { @@ -38,6 +43,11 @@ proc simTimestamp {} { after 2500 simTimestamp run -all quit -f + + + + + verilog */ @@ -106,7 +116,7 @@ SIGNAL("en") PARENT = ""; } -SIGNAL("in") +SIGNAL("in0") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = BUS; @@ -116,44 +126,94 @@ SIGNAL("in") PARENT = ""; } -SIGNAL("in[3]") +SIGNAL("in0[3]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = INPUT; - PARENT = "in"; + PARENT = "in0"; } -SIGNAL("in[2]") +SIGNAL("in0[2]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = INPUT; - PARENT = "in"; + PARENT = "in0"; } -SIGNAL("in[1]") +SIGNAL("in0[1]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = INPUT; - PARENT = "in"; + PARENT = "in0"; } -SIGNAL("in[0]") +SIGNAL("in0[0]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = INPUT; - PARENT = "in"; + PARENT = "in0"; +} + +SIGNAL("in1") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = BUS; + WIDTH = 4; + LSB_INDEX = 0; + DIRECTION = INPUT; + PARENT = ""; +} + +SIGNAL("in1[3]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = INPUT; + PARENT = "in1"; +} + +SIGNAL("in1[2]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = INPUT; + PARENT = "in1"; +} + +SIGNAL("in1[1]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = INPUT; + PARENT = "in1"; +} + +SIGNAL("in1[0]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = INPUT; + PARENT = "in1"; } SIGNAL("load") @@ -166,7 +226,7 @@ SIGNAL("load") PARENT = ""; } -SIGNAL("out") +SIGNAL("out0") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = BUS; @@ -176,44 +236,94 @@ SIGNAL("out") PARENT = ""; } -SIGNAL("out[3]") +SIGNAL("out0[3]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = OUTPUT; - PARENT = "out"; + PARENT = "out0"; } -SIGNAL("out[2]") +SIGNAL("out0[2]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = OUTPUT; - PARENT = "out"; + PARENT = "out0"; } -SIGNAL("out[1]") +SIGNAL("out0[1]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = OUTPUT; - PARENT = "out"; + PARENT = "out0"; } -SIGNAL("out[0]") +SIGNAL("out0[0]") { VALUE_TYPE = NINE_LEVEL_BIT; SIGNAL_TYPE = SINGLE_BIT; WIDTH = 1; LSB_INDEX = -1; DIRECTION = OUTPUT; - PARENT = "out"; + PARENT = "out0"; +} + +SIGNAL("out1") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = BUS; + WIDTH = 4; + LSB_INDEX = 0; + DIRECTION = OUTPUT; + PARENT = ""; +} + +SIGNAL("out1[3]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "out1"; +} + +SIGNAL("out1[2]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "out1"; +} + +SIGNAL("out1[1]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "out1"; +} + +SIGNAL("out1[0]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "out1"; } SIGNAL("upd") @@ -226,6 +336,136 @@ SIGNAL("upd") PARENT = ""; } +SIGNAL("CO") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = ""; +} + +SIGNAL("clk2") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = INPUT; + PARENT = ""; +} + +SIGNAL("code") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = BUS; + WIDTH = 7; + LSB_INDEX = 0; + DIRECTION = OUTPUT; + PARENT = ""; +} + +SIGNAL("code[6]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("code[5]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("code[4]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("code[3]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("code[2]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("code[1]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("code[0]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "code"; +} + +SIGNAL("seg") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = BUS; + WIDTH = 2; + LSB_INDEX = 0; + DIRECTION = OUTPUT; + PARENT = ""; +} + +SIGNAL("seg[1]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "seg"; +} + +SIGNAL("seg[0]") +{ + VALUE_TYPE = NINE_LEVEL_BIT; + SIGNAL_TYPE = SINGLE_BIT; + WIDTH = 1; + LSB_INDEX = -1; + DIRECTION = OUTPUT; + PARENT = "seg"; +} + TRANSITION_LIST("clk") { NODE @@ -233,11 +473,10 @@ TRANSITION_LIST("clk") REPEAT = 1; NODE { - REPEAT = 33; - LEVEL 0 FOR 15.0; - LEVEL 1 FOR 15.0; + REPEAT = 50; + LEVEL 0 FOR 10.0; + LEVEL 1 FOR 10.0; } - LEVEL 0 FOR 10.0; } } @@ -246,9 +485,9 @@ TRANSITION_LIST("clr") NODE { REPEAT = 1; - LEVEL 1 FOR 590.0; - LEVEL 0 FOR 60.0; - LEVEL 1 FOR 350.0; + LEVEL 1 FOR 370.0; + LEVEL 0 FOR 30.0; + LEVEL 1 FOR 600.0; } } @@ -257,12 +496,12 @@ TRANSITION_LIST("en") NODE { REPEAT = 1; - LEVEL 0 FOR 30.0; - LEVEL 1 FOR 970.0; + LEVEL 0 FOR 20.0; + LEVEL 1 FOR 980.0; } } -TRANSITION_LIST("in[3]") +TRANSITION_LIST("in0[3]") { NODE { @@ -271,7 +510,7 @@ TRANSITION_LIST("in[3]") } } -TRANSITION_LIST("in[2]") +TRANSITION_LIST("in0[2]") { NODE { @@ -280,7 +519,7 @@ TRANSITION_LIST("in[2]") } } -TRANSITION_LIST("in[1]") +TRANSITION_LIST("in0[1]") { NODE { @@ -289,7 +528,43 @@ TRANSITION_LIST("in[1]") } } -TRANSITION_LIST("in[0]") +TRANSITION_LIST("in0[0]") +{ + NODE + { + REPEAT = 1; + LEVEL 1 FOR 1000.0; + } +} + +TRANSITION_LIST("in1[3]") +{ + NODE + { + REPEAT = 1; + LEVEL 0 FOR 1000.0; + } +} + +TRANSITION_LIST("in1[2]") +{ + NODE + { + REPEAT = 1; + LEVEL 1 FOR 1000.0; + } +} + +TRANSITION_LIST("in1[1]") +{ + NODE + { + REPEAT = 1; + LEVEL 0 FOR 1000.0; + } +} + +TRANSITION_LIST("in1[0]") { NODE { @@ -303,13 +578,13 @@ TRANSITION_LIST("load") NODE { REPEAT = 1; - LEVEL 0 FOR 680.0; - LEVEL 1 FOR 30.0; - LEVEL 0 FOR 290.0; + LEVEL 0 FOR 220.0; + LEVEL 1 FOR 50.0; + LEVEL 0 FOR 730.0; } } -TRANSITION_LIST("out[3]") +TRANSITION_LIST("out0[3]") { NODE { @@ -318,7 +593,7 @@ TRANSITION_LIST("out[3]") } } -TRANSITION_LIST("out[2]") +TRANSITION_LIST("out0[2]") { NODE { @@ -327,7 +602,7 @@ TRANSITION_LIST("out[2]") } } -TRANSITION_LIST("out[1]") +TRANSITION_LIST("out0[1]") { NODE { @@ -336,7 +611,43 @@ TRANSITION_LIST("out[1]") } } -TRANSITION_LIST("out[0]") +TRANSITION_LIST("out0[0]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("out1[3]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("out1[2]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("out1[1]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("out1[0]") { NODE { @@ -350,8 +661,112 @@ TRANSITION_LIST("upd") NODE { REPEAT = 1; - LEVEL 0 FOR 400.0; - LEVEL 1 FOR 600.0; + LEVEL 0 FOR 150.0; + LEVEL 1 FOR 850.0; + } +} + +TRANSITION_LIST("CO") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("clk2") +{ + NODE + { + REPEAT = 1; + NODE + { + REPEAT = 100; + LEVEL 0 FOR 5.0; + LEVEL 1 FOR 5.0; + } + } +} + +TRANSITION_LIST("code[6]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("code[5]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("code[4]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("code[3]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("code[2]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("code[1]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("code[0]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("seg[1]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; + } +} + +TRANSITION_LIST("seg[0]") +{ + NODE + { + REPEAT = 1; + LEVEL X FOR 1000.0; } } @@ -366,7 +781,7 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "upd"; + CHANNEL = "clk2"; EXPAND_STATUS = COLLAPSED; RADIX = Binary; TREE_INDEX = 1; @@ -384,7 +799,7 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "en"; + CHANNEL = "upd"; EXPAND_STATUS = COLLAPSED; RADIX = Binary; TREE_INDEX = 3; @@ -393,66 +808,66 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "out"; + CHANNEL = "en"; EXPAND_STATUS = COLLAPSED; - RADIX = Unsigned; + RADIX = Binary; TREE_INDEX = 4; TREE_LEVEL = 0; - CHILDREN = 5, 6, 7, 8; } DISPLAY_LINE { - CHANNEL = "out[3]"; + CHANNEL = "in0"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 5; - TREE_LEVEL = 1; - PARENT = 4; + TREE_LEVEL = 0; + CHILDREN = 6, 7, 8, 9; } DISPLAY_LINE { - CHANNEL = "out[2]"; + CHANNEL = "in0[3]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 6; TREE_LEVEL = 1; - PARENT = 4; + PARENT = 5; } DISPLAY_LINE { - CHANNEL = "out[1]"; + CHANNEL = "in0[2]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 7; TREE_LEVEL = 1; - PARENT = 4; + PARENT = 5; } DISPLAY_LINE { - CHANNEL = "out[0]"; + CHANNEL = "in0[1]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 8; TREE_LEVEL = 1; - PARENT = 4; + PARENT = 5; } DISPLAY_LINE { - CHANNEL = "load"; + CHANNEL = "in0[0]"; EXPAND_STATUS = COLLAPSED; - RADIX = Binary; + RADIX = Unsigned; TREE_INDEX = 9; - TREE_LEVEL = 0; + TREE_LEVEL = 1; + PARENT = 5; } DISPLAY_LINE { - CHANNEL = "in"; + CHANNEL = "in1"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 10; @@ -462,7 +877,7 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "in[3]"; + CHANNEL = "in1[3]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 11; @@ -472,7 +887,7 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "in[2]"; + CHANNEL = "in1[2]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 12; @@ -482,7 +897,7 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "in[1]"; + CHANNEL = "in1[1]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 13; @@ -492,7 +907,7 @@ DISPLAY_LINE DISPLAY_LINE { - CHANNEL = "in[0]"; + CHANNEL = "in1[0]"; EXPAND_STATUS = COLLAPSED; RADIX = Unsigned; TREE_INDEX = 14; @@ -500,6 +915,234 @@ DISPLAY_LINE PARENT = 10; } +DISPLAY_LINE +{ + CHANNEL = "load"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 15; + TREE_LEVEL = 0; +} + +DISPLAY_LINE +{ + CHANNEL = "CO"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 16; + TREE_LEVEL = 0; +} + +DISPLAY_LINE +{ + CHANNEL = "out0"; + EXPAND_STATUS = EXPANDED; + RADIX = Unsigned; + TREE_INDEX = 17; + TREE_LEVEL = 0; + CHILDREN = 18, 19, 20, 21; +} + +DISPLAY_LINE +{ + CHANNEL = "out0[3]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 18; + TREE_LEVEL = 1; + PARENT = 17; +} + +DISPLAY_LINE +{ + CHANNEL = "out0[2]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 19; + TREE_LEVEL = 1; + PARENT = 17; +} + +DISPLAY_LINE +{ + CHANNEL = "out0[1]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 20; + TREE_LEVEL = 1; + PARENT = 17; +} + +DISPLAY_LINE +{ + CHANNEL = "out0[0]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 21; + TREE_LEVEL = 1; + PARENT = 17; +} + +DISPLAY_LINE +{ + CHANNEL = "out1"; + EXPAND_STATUS = EXPANDED; + RADIX = Unsigned; + TREE_INDEX = 22; + TREE_LEVEL = 0; + CHILDREN = 23, 24, 25, 26; +} + +DISPLAY_LINE +{ + CHANNEL = "out1[3]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 23; + TREE_LEVEL = 1; + PARENT = 22; +} + +DISPLAY_LINE +{ + CHANNEL = "out1[2]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 24; + TREE_LEVEL = 1; + PARENT = 22; +} + +DISPLAY_LINE +{ + CHANNEL = "out1[1]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 25; + TREE_LEVEL = 1; + PARENT = 22; +} + +DISPLAY_LINE +{ + CHANNEL = "out1[0]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Unsigned; + TREE_INDEX = 26; + TREE_LEVEL = 1; + PARENT = 22; +} + +DISPLAY_LINE +{ + CHANNEL = "code"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 27; + TREE_LEVEL = 0; + CHILDREN = 28, 29, 30, 31, 32, 33, 34; +} + +DISPLAY_LINE +{ + CHANNEL = "code[6]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 28; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "code[5]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 29; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "code[4]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 30; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "code[3]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 31; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "code[2]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 32; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "code[1]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 33; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "code[0]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 34; + TREE_LEVEL = 1; + PARENT = 27; +} + +DISPLAY_LINE +{ + CHANNEL = "seg"; + EXPAND_STATUS = EXPANDED; + RADIX = Binary; + TREE_INDEX = 35; + TREE_LEVEL = 0; + CHILDREN = 36, 37; +} + +DISPLAY_LINE +{ + CHANNEL = "seg[1]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 36; + TREE_LEVEL = 1; + PARENT = 35; +} + +DISPLAY_LINE +{ + CHANNEL = "seg[0]"; + EXPAND_STATUS = COLLAPSED; + RADIX = Binary; + TREE_INDEX = 37; + TREE_LEVEL = 1; + PARENT = 35; +} + TIME_BAR { TIME = 0; diff --git a/Quartus/v3/jyh_4490_3.qsf b/Quartus/v3/jyh_4490_3.qsf index 4b554b0..5b0e99b 100644 --- a/Quartus/v3/jyh_4490_3.qsf +++ b/Quartus/v3/jyh_4490_3.qsf @@ -39,7 +39,7 @@ set_global_assignment -name FAMILY "Cyclone IV E" set_global_assignment -name DEVICE EP4CE6E22C8 -set_global_assignment -name TOP_LEVEL_ENTITY jyh_4490_3_counter +set_global_assignment -name TOP_LEVEL_ENTITY jyh_4490_3_entry set_global_assignment -name ORIGINAL_QUARTUS_VERSION 21.1.0 set_global_assignment -name PROJECT_CREATION_TIME_DATE "17:56:36 四月 04, 2022" set_global_assignment -name LAST_QUARTUS_VERSION "21.1.0 Lite Edition" @@ -49,11 +49,35 @@ set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85 set_global_assignment -name DEVICE_FILTER_PIN_COUNT 144 set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 1 set_global_assignment -name NOMINAL_CORE_SUPPLY_VOLTAGE 1.2V -set_global_assignment -name VECTOR_WAVEFORM_FILE Waveform.vwf -set_global_assignment -name VERILOG_FILE jyh_4490_3_counter.v set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW" set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)" set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top +set_location_assignment PIN_33 -to load +set_location_assignment PIN_30 -to upd +set_location_assignment PIN_31 -to en +set_location_assignment PIN_24 -to clr +set_location_assignment PIN_89 -to clk +set_location_assignment PIN_43 -to in0[3] +set_location_assignment PIN_44 -to in0[2] +set_location_assignment PIN_42 -to in0[0] +set_location_assignment PIN_39 -to in0[1] +set_location_assignment PIN_54 -to out0[3] +set_location_assignment PIN_46 -to out0[0] +set_location_assignment PIN_50 -to out0[1] +set_location_assignment PIN_52 -to out0[2] +set_location_assignment PIN_49 -to out1[3] +set_location_assignment PIN_51 -to out1[2] +set_location_assignment PIN_53 -to out1[1] +set_location_assignment PIN_58 -to out1[0] +set_location_assignment PIN_142 -to in1[3] +set_location_assignment PIN_10 -to in1[2] +set_location_assignment PIN_11 -to in1[1] +set_location_assignment PIN_7 -to in1[0] +set_location_assignment PIN_144 -to CO +set_global_assignment -name VERILOG_FILE jyh_4490_3_encoder.v +set_global_assignment -name VECTOR_WAVEFORM_FILE Waveform.vwf +set_global_assignment -name VERILOG_FILE jyh_4490_3_counter.v +set_global_assignment -name VERILOG_FILE jyh_4490_3_entry.v set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file diff --git a/Quartus/v3/jyh_4490_3_counter.v b/Quartus/v3/jyh_4490_3_counter.v index 601ea45..ff912e2 100644 --- a/Quartus/v3/jyh_4490_3_counter.v +++ b/Quartus/v3/jyh_4490_3_counter.v @@ -1,8 +1,9 @@ -module jyh_4490_3_counter(out,clk,clr,load,in,en,upd); +module jyh_4490_3_counter(Q,clk,clr,load,in,en,upd,co); input[3:0] in; input en,clk,clr,load,upd; -output reg [3:0] out; +output reg [3:0] Q; +output reg co; always@(posedge clk,negedge clr) @@ -10,32 +11,47 @@ begin //异步清零 if(!clr) - out<=0; + Q<=0; else if(en) begin //同步置数 if(load) - out<=in; + begin + Q<=in; + co<=1'b1; + end //正反计数 else if(upd) begin - if(out>=4'd9) - out=4'd0; + if(Q>=4'd9) + begin + Q<=4'd0; + co<=1'b1; + end else - out <= out+1; + begin + Q <= Q+1; + co<=0; + end end else begin - if(out<=4'd0) - out=4'd9; + if(Q<=4'd0) + begin + Q<=4'd9; + co<=1'b1; + end else - out <= out-1; + begin + Q <= Q-1; + co<=0; + end end end else - out<=0; + Q<=0; end endmodule diff --git a/Quartus/v3/jyh_4490_3_encoder.v b/Quartus/v3/jyh_4490_3_encoder.v new file mode 100644 index 0000000..5d0cfed --- /dev/null +++ b/Quartus/v3/jyh_4490_3_encoder.v @@ -0,0 +1,57 @@ +module jyh_4490_3_encoder(codeout,indec,indec2,clk,seg); + input[3:0] indec,indec2; + input clk; + output reg [1:0] seg=2'b01; + output reg [6:0] codeout; + + reg n = 1; + +always @ (posedge clk) + begin + if(n==1) + begin + n<=2; + if(seg==2'b01) + begin + case (indec) + 4'd0: codeout<=7'b1111110; + 4'd1: codeout<=7'b0110000; + 4'd2: codeout<=7'b1101101; + 4'd3: codeout<=7'b1111001; + 4'd4: codeout<=7'b0110011; + 4'd5: codeout<=7'b1011011; + 4'd6: codeout<=7'b1011111; + 4'd7: codeout<=7'b1110000; + 4'd8: codeout<=7'b1111111; + 4'd9: codeout<=7'b1111011; + default: codeout<=7'bx; + endcase + end + if(seg==2'b10) + begin + case (indec2) + 4'd0: codeout<=7'b1111110; + 4'd1: codeout<=7'b0110000; + 4'd2: codeout<=7'b1101101; + 4'd3: codeout<=7'b1111001; + 4'd4: codeout<=7'b0110011; + 4'd5: codeout<=7'b1011011; + 4'd6: codeout<=7'b1011111; + 4'd7: codeout<=7'b1110000; + 4'd8: codeout<=7'b1111111; + 4'd9: codeout<=7'b1111011; + default: codeout<=7'bx; + endcase + end + end + if(n==2) + begin + n<=1; + codeout<=7'b0; + if(seg==2'b10) + seg<=2'b01; + else if(seg==2'b10) + seg<=2'b01; + end +end +endmodule \ No newline at end of file diff --git a/Quartus/v3/jyh_4490_3_entry.v b/Quartus/v3/jyh_4490_3_entry.v new file mode 100644 index 0000000..cbb034d --- /dev/null +++ b/Quartus/v3/jyh_4490_3_entry.v @@ -0,0 +1,44 @@ +module jyh_4490_3_entry(out1, out0, code, seg, CO, + // 十位输出 个位输出 数码管型码 数码管位码 进/借位标志位 + in1, in0, load, clk, clk2, clr, en, upd); + // 十位装载 个位装载 装载信号 时钟信号 数码管时钟 清零信号 使能信号 正反计数标志位 + +output [3:0] out1; +output [3:0] out0; +output [6:0] code; +output [1:0] seg; +output CO; +input [3:0] in1; +input [3:0] in0; +input clk,load,clr,en,upd,clk2; + +//个位计数器 +jyh_4490_3_counter c0( +.Q(out0), +.clk(clk), +.co(CO), +.clr(clr), +.load(load), +.in(in0), +.en(en), +.upd(upd)); + +//十位计数器 +jyh_4490_3_counter c1( +.Q(out1), +.clk(CO), +.clr(clr), +.load(load), +.in(in1), +.en(en), +.upd(upd)); + +jyh_4490_3_encoder e1( +.codeout(code), +.indec(out0), +.indec2(out1), +.clk(clk2), +.seg(seg) +); + +endmodule