Report
Report
Report
v
module REPORT
(
input CLOCK_50,
input [0:0] KEY,
input [9:0] SW,
output [7:0] HEX0,
output [7:0] HEX1,
output [7:0] HEX2,
output [7:0] HEX3,
output [9:0] LEDR,
output [7:0] HEX4,
output [7:0] HEX5
);
system nios_system(
.clk_clk
(CLOCK_50),
.reset_reset_n (KEY[0]),
.hex0_external_connection_export ({8'b0,HEX0}),
.hex1_external_connection_export ({8'b0,HEX1}),
.hex2_external_connection_export ({8'b0,HEX2}),
.hex3_external_connection_export ({8'b0,HEX3}),
.hex4_external_connection_export ({8'b0,HEX4}),
.switch_external_connection_export ({16'd0, SW}),
.led_external_connection_export ({16'd0, LEDR}),
.hex5_external_connection_export ({8'b0,HEX5})
);
if (reset1 == 1){
hours = 0;
minutes = 0;
seconds = 0;
counter = 0;
}
*led_pt = led_value;
int sec_0 = seconds % 10;
int sec_1 = seconds / 10;
int min_0 = minutes % 10;
int min_1 = minutes / 10;
int hour_0 = hours % 10;
int hour_1 = hours / 10;
int sec0 = (IORD(SWITCH_BASE,0) >> 2)& 0x1;
int sec1 = (IORD(SWITCH_BASE,0) >> 3)& 0x1;
int min0 = (IORD(SWITCH_BASE,0) >> 4)& 0x1;
int min1= (IORD(SWITCH_BASE,0) >> 5)& 0x1;
int hour0= (IORD(SWITCH_BASE,0) >> 6)& 0x1;
if (sec0 ==1){
counter++;
}
if (sec1 == 1){
counter +=10;
}
if (min0 ==1){
counter +=60;
}
if (min1 ==1){
counter +=600;
}
if (hour0 ==1){
counter +=3600;
}
IOWR(HEX0_BASE, 0, segment_decode[sec_0]);
IOWR(HEX1_BASE, 0, segment_decode[sec_1]);
IOWR(HEX2_BASE, 0, segment_decode[min_0]);
IOWR(HEX3_BASE, 0, segment_decode[min_1]);
IOWR(HEX4_BASE, 0, segment_decode[hour_0]);
IOWR(HEX5_BASE, 0, segment_decode[hour_1]);