16 changed files with 517 additions and 30 deletions
-
2.gitignore
-
BINoutput_file_1.jic
-
11output_file_1.map
-
59run_led.eda.rpt
-
2run_led.jdi
-
10run_led.pin
-
BINrun_led.pof
-
10run_led.qsf
-
BINrun_led.sof
-
60run_led.sta.summary
-
142source/light_ctrl_pluse_generator.v
-
44source/shutter_pulse_generator.v
-
92source/top_module.v
-
49source/zutils_edge_detecter.v
-
49source/zutils_pluse_width_detecter.v
-
17source/zutils_reset_sig_gen.v
@ -0,0 +1,11 @@ |
|||
BLOCK START ADDRESS END ADDRESS |
|||
|
|||
Page_0 0x00000000 0x00059D8A |
|||
|
|||
|
|||
|
|||
Notes: |
|||
|
|||
- Data checksum for this conversion is 0x1A5E0C9C |
|||
|
|||
- All the addresses in this file are byte addresses |
@ -0,0 +1,59 @@ |
|||
EDA Netlist Writer report for run_led |
|||
Wed Feb 21 21:37:07 2024 |
|||
Quartus II 64-Bit Version 13.1.0 Build 162 10/23/2013 SJ Full Version |
|||
|
|||
|
|||
--------------------- |
|||
; Table of Contents ; |
|||
--------------------- |
|||
1. Legal Notice |
|||
2. EDA Netlist Writer Summary |
|||
3. EDA Netlist Writer Messages |
|||
|
|||
|
|||
|
|||
---------------- |
|||
; Legal Notice ; |
|||
---------------- |
|||
Copyright (C) 1991-2013 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. |
|||
|
|||
|
|||
|
|||
+----------------------------------------------------------------------------------+ |
|||
; EDA Netlist Writer Summary ; |
|||
+---------------------------+------------------------------------------------------+ |
|||
; EDA Netlist Writer Status ; No Output Files Generated - Wed Feb 21 21:37:07 2024 ; |
|||
; Revision Name ; run_led ; |
|||
; Top-level Entity Name ; top_module ; |
|||
; Family ; Cyclone IV E ; |
|||
+---------------------------+------------------------------------------------------+ |
|||
|
|||
|
|||
+-----------------------------+ |
|||
; EDA Netlist Writer Messages ; |
|||
+-----------------------------+ |
|||
Info: ******************************************************************* |
|||
Info: Running Quartus II 64-Bit EDA Netlist Writer |
|||
Info: Version 13.1.0 Build 162 10/23/2013 SJ Full Version |
|||
Info: Processing started: Wed Feb 21 21:37:06 2024 |
|||
Info: Command: quartus_eda --read_settings_files=on --write_settings_files=off run_led -c run_led |
|||
Warning (199027): Can't generate output files. Specify command-line options to generate output files, or update EDA tool settings using GUI or Tcl script. |
|||
Info: Quartus II 64-Bit EDA Netlist Writer was successful. 0 errors, 1 warning |
|||
Info: Peak virtual memory: 4556 megabytes |
|||
Info: Processing ended: Wed Feb 21 21:37:07 2024 |
|||
Info: Elapsed time: 00:00:01 |
|||
Info: Total CPU time (on all processors): 00:00:00 |
|||
|
|||
|
@ -0,0 +1,142 @@ |
|||
|
|||
module light_ctrl_pluse_generator ( |
|||
input clk, |
|||
input rst_n, |
|||
|
|||
input wire [31:0] pluse_width, |
|||
input wire [31:0] pluse_interval, |
|||
|
|||
// 触发输入引脚 |
|||
input trigger, //触发输入 |
|||
|
|||
output reg output_1, //指示灯通断控制输出 |
|||
output reg output_2, //指示灯通断控制输出 |
|||
output reg output_3, //指示灯通断控制输出 |
|||
output reg output_4 //指示灯通断控制输出 |
|||
|
|||
); |
|||
|
|||
wire trigger_r_edge; |
|||
wire trigger_f_edge; |
|||
|
|||
zutils_edge_detecter tigger_signal_in ( |
|||
.clk(clk), |
|||
.rst_n(rst_n), |
|||
.in_signal(trigger), |
|||
.in_signal_rising_edge(trigger_r_edge), |
|||
.in_signal_falling_edge(trigger_f_edge) |
|||
); |
|||
|
|||
reg [31:0] state; |
|||
reg [31:0] pluse_width_cache; |
|||
reg [31:0] pluse_interval_cache; |
|||
reg [31:0] cnt; |
|||
|
|||
always @(posedge clk or negedge rst_n) begin |
|||
if (!rst_n) begin |
|||
state <= 0; |
|||
output_1 <= 0; |
|||
output_2 <= 0; |
|||
output_3 <= 0; |
|||
output_4 <= 0; |
|||
end else begin |
|||
case (state) |
|||
0: begin |
|||
if (trigger_r_edge) begin |
|||
|
|||
if (pluse_width <= 250) begin // 100ns |
|||
pluse_width_cache <= 250; // 100ns |
|||
end else begin |
|||
pluse_width_cache <= pluse_width; // |
|||
end |
|||
|
|||
if (pluse_interval <= 5) begin // 100ns |
|||
pluse_interval_cache <= 5; // 100ns |
|||
end else begin |
|||
pluse_interval_cache <= pluse_interval; // |
|||
end |
|||
|
|||
state <= 1; |
|||
output_1 <= 1; |
|||
cnt <= 0; |
|||
end |
|||
end |
|||
1: begin |
|||
if (cnt >= pluse_width_cache) begin |
|||
output_1 <= 0; |
|||
state <= 2; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
2: begin |
|||
if (cnt >= pluse_interval_cache) begin |
|||
output_2 <= 1; |
|||
state <= 3; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
|
|||
3: begin |
|||
if (cnt >= pluse_width_cache) begin |
|||
output_2 <= 0; |
|||
state <= 4; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
|
|||
4: begin |
|||
if (cnt >= pluse_interval_cache) begin |
|||
output_3 <= 1; |
|||
state <= 5; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
|
|||
5: begin |
|||
if (cnt >= pluse_width_cache) begin |
|||
output_3 <= 0; |
|||
state <= 6; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
|
|||
6: begin |
|||
if (cnt >= pluse_interval_cache) begin |
|||
output_4 <= 1; |
|||
state <= 7; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
|
|||
7: begin |
|||
if (cnt >= pluse_width_cache) begin |
|||
output_4 <= 0; |
|||
state <= 0; |
|||
cnt <= 0; |
|||
end else begin |
|||
cnt <= cnt + 1; |
|||
end |
|||
end |
|||
|
|||
default: begin |
|||
state <= 0; |
|||
end |
|||
|
|||
endcase |
|||
end |
|||
end |
|||
|
|||
|
|||
endmodule |
@ -0,0 +1,44 @@ |
|||
|
|||
module shutter_pulse_generator ( |
|||
input clk, |
|||
input rst_n, |
|||
|
|||
input wire [31:0] pluse_width, |
|||
// 触发输入引脚 |
|||
input trigger, //触发输入 |
|||
output wire output_sig //指示灯通断控制输出 |
|||
); |
|||
|
|||
reg [31:0] cnt; |
|||
reg output_sig_0; |
|||
reg [31:0] pluse_width_cache; |
|||
|
|||
always @(posedge clk or negedge rst_n) begin |
|||
if (!rst_n) begin |
|||
cnt <= 0; |
|||
output_sig_0 <= 0; |
|||
end else begin |
|||
if (trigger) begin |
|||
if (cnt == 0) begin |
|||
cnt <= cnt + 1; |
|||
pluse_width_cache <= pluse_width; |
|||
output_sig_0 <= 0; |
|||
end else begin |
|||
if (cnt <= pluse_width_cache) begin |
|||
cnt <= cnt + 1; |
|||
output_sig_0 <= 0; |
|||
end else begin |
|||
cnt <= cnt; |
|||
output_sig_0 <= 1; |
|||
end |
|||
end |
|||
end else begin |
|||
cnt <= 0; |
|||
output_sig_0 <= 0; |
|||
end |
|||
end |
|||
end |
|||
|
|||
assign output_sig = output_sig_0 & trigger; |
|||
|
|||
endmodule |
@ -0,0 +1,49 @@ |
|||
module zutils_edge_detecter ( |
|||
input clk, //clock input |
|||
input rst_n, //asynchronous reset input, low active |
|||
input wire in_signal, |
|||
output reg in_signal_last, |
|||
output reg in_signal_rising_edge, |
|||
output reg in_signal_falling_edge, |
|||
output reg in_signal_edge |
|||
); |
|||
|
|||
// initial begin |
|||
// in_signal_last = 0; |
|||
// in_signal_rising_edge = 0; |
|||
// in_signal_falling_edge = 0; |
|||
// in_signal_edge = 0; |
|||
// end |
|||
|
|||
|
|||
|
|||
always @(posedge clk or negedge rst_n) begin |
|||
if (!rst_n) begin |
|||
in_signal_last <= 0; |
|||
end else begin |
|||
in_signal_last <= in_signal; |
|||
end |
|||
end |
|||
|
|||
always @(posedge clk or negedge rst_n) begin |
|||
if (!rst_n) begin |
|||
in_signal_rising_edge <= 0; |
|||
in_signal_falling_edge <= 0; |
|||
in_signal_edge <= 0; |
|||
end else begin |
|||
if (in_signal_last == 0 && in_signal == 1) begin |
|||
in_signal_rising_edge <= 1; |
|||
in_signal_falling_edge <= 0; |
|||
in_signal_edge <= 1; |
|||
end else if (in_signal_last == 1 && in_signal == 0) begin |
|||
in_signal_rising_edge <= 0; |
|||
in_signal_falling_edge <= 1; |
|||
in_signal_edge <= 1; |
|||
end else begin |
|||
in_signal_rising_edge <= 0; |
|||
in_signal_falling_edge <= 0; |
|||
in_signal_edge <= 0; |
|||
end |
|||
end |
|||
end |
|||
endmodule |
@ -0,0 +1,49 @@ |
|||
module zutils_pluse_width_detecter ( |
|||
input clk, //clock input |
|||
input rst_n, //asynchronous reset input, low active |
|||
input wire in_signal, |
|||
output reg [31:0] in_signal_pluse_width |
|||
); |
|||
|
|||
wire rising_edge; |
|||
wire falling_edge; |
|||
|
|||
zutils_edge_detecter _signal_in ( |
|||
.clk(CLK), |
|||
.rst_n(RSTn), |
|||
.in_signal(in_signal), |
|||
.in_signal_rising_edge(rising_edge), |
|||
.in_signal_falling_edge(falling_edge) |
|||
); |
|||
|
|||
reg [31:0] pluse_width_cnt; |
|||
reg state; |
|||
|
|||
always @(posedge CLK or negedge RSTn) begin |
|||
if (!RSTn) begin |
|||
in_signal_pluse_width <= 1; |
|||
pluse_width_cnt <= 1; |
|||
state <= 0; |
|||
end else begin |
|||
|
|||
if (!state) begin |
|||
if (rising_edge) begin |
|||
pluse_width_cnt <= 0; |
|||
state <= 1; |
|||
end |
|||
end else begin |
|||
pluse_width_cnt <= pluse_width_cnt + 1; |
|||
if (falling_edge) begin |
|||
in_signal_pluse_width <= pluse_width_cnt; |
|||
state <= 0; |
|||
end |
|||
end |
|||
|
|||
end |
|||
end |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
endmodule |
@ -0,0 +1,17 @@ |
|||
module zutils_reset_sig_gen ( |
|||
input clk, //clock input |
|||
output reg rst_n_out |
|||
); |
|||
|
|||
reg [31:0] counter = 0; |
|||
always @(posedge clk) begin |
|||
if (counter < 31'd1000000) begin |
|||
rst_n_out <= 0; |
|||
counter <= counter + 1; |
|||
end else begin |
|||
counter <= counter; |
|||
rst_n_out <= 1; |
|||
end |
|||
end |
|||
|
|||
endmodule |
Write
Preview
Loading…
Cancel
Save
Reference in new issue