10 changed files with 627 additions and 430 deletions
-
66led_test.pds
-
14source/src/config.v
-
245source/src/output/ttl_output.v
-
86source/src/spi_reg_bus.v
-
460source/src/top.v
-
3source/src/zutils/zsimple_pll.v
-
47source/src/zutils/zutils_bus32_multi_to_one.v
-
2source/src/zutils/zutils_clk_parser.v
-
87source/src/zutils/zutils_freq_detector_v2.v
-
47source/src/zutils/zutils_multiplexer_8t1.v
@ -0,0 +1,14 @@ |
|||||
|
`define REGADDOFF__FPGA_INFO 16'h0020 |
||||
|
`define REGADDOFF__TTLIN 16'h0100 |
||||
|
`define REGADDOFF__TIMECODE_IN 16'h0120 |
||||
|
`define REGADDOFF__GENLOCK_IN 16'h0130 |
||||
|
`define REGADDOFF__INTERNAL_TIMECODE 16'h0300 |
||||
|
`define REGADDOFF__INTERNAL_GENLOCK 16'h0310 |
||||
|
`define REGADDOFF__INTERNAL_CLOCK 16'h0320 |
||||
|
`define REGADDOFF__TTLOUT1 16'h0200 |
||||
|
`define REGADDOFF__TTLOUT2 16'h0210 |
||||
|
`define REGADDOFF__TTLOUT3 16'h0220 |
||||
|
`define REGADDOFF__TTLOUT4 16'h0230 |
||||
|
`define REGADDOFF__TIMECODE_OUT 16'h0240 |
||||
|
`define REGADDOFF__GENLOCK_OUT 16'h0250 |
||||
|
`define REGADDOFF__CAMERA_SYNC_OUT 16'h0260 |
@ -0,0 +1,86 @@ |
|||||
|
`include "config.v" |
||||
|
module spi_reg_bus ( |
||||
|
input clk, //clock input |
||||
|
input rst_n, //asynchronous reset input, low active |
||||
|
|
||||
|
//regbus interface |
||||
|
output [31:0] addr, |
||||
|
output [31:0] wr_data, |
||||
|
output wr_en, |
||||
|
// |
||||
|
input wire spi_cs_pin, // |
||||
|
input wire spi_clk_pin, // |
||||
|
input wire spi_rx_pin, // |
||||
|
output wire spi_tx_pin, |
||||
|
|
||||
|
input [31:0] rd_data_module_fpga_info, |
||||
|
input [31:0] rd_data_module_ttlin, |
||||
|
input [31:0] rd_data_module_timecode_in, |
||||
|
input [31:0] rd_data_module_genlock_in, |
||||
|
input [31:0] rd_data_module_internal_timecode, |
||||
|
input [31:0] rd_data_module_internal_genlock, |
||||
|
input [31:0] rd_data_module_internal_clock, |
||||
|
input [31:0] rd_data_module_ttlout1, |
||||
|
input [31:0] rd_data_module_ttlout2, |
||||
|
input [31:0] rd_data_module_ttlout3, |
||||
|
input [31:0] rd_data_module_ttlout4, |
||||
|
input [31:0] rd_data_module_timecode_out, |
||||
|
input [31:0] rd_data_module_genlock_out, |
||||
|
input [31:0] rd_data_module_camera_sync_out |
||||
|
); |
||||
|
|
||||
|
reg [31:0] rd_data; |
||||
|
|
||||
|
spi_reg_reader spi_reg_reader_inst ( |
||||
|
.clk (clk), |
||||
|
.rst_n (rst_n), |
||||
|
.addr (addr), |
||||
|
.wr_data (wr_data), |
||||
|
.wr_en (wr_en), |
||||
|
.rd_data (rd_data), |
||||
|
.spi_cs_pin (spi_cs_pin), |
||||
|
.spi_clk_pin(spi_clk_pin), |
||||
|
.spi_rx_pin (spi_rx_pin), |
||||
|
.spi_tx_pin (spi_tx_pin) |
||||
|
); |
||||
|
|
||||
|
// 数据路由 |
||||
|
wire [31:0] addr_group; |
||||
|
assign addr_group = addr & 31'hFFFF_FFF0; |
||||
|
always @(*) begin |
||||
|
case (addr_group) |
||||
|
`REGADDOFF__FPGA_INFO: |
||||
|
rd_data <= rd_data_module_fpga_info; |
||||
|
`REGADDOFF__TTLIN: |
||||
|
rd_data <= rd_data_module_ttlin; |
||||
|
`REGADDOFF__TIMECODE_IN: |
||||
|
rd_data <= rd_data_module_timecode_in; |
||||
|
`REGADDOFF__GENLOCK_IN: |
||||
|
rd_data <= rd_data_module_genlock_in; |
||||
|
`REGADDOFF__INTERNAL_TIMECODE: |
||||
|
rd_data <= rd_data_module_internal_timecode; |
||||
|
`REGADDOFF__INTERNAL_GENLOCK: |
||||
|
rd_data <= rd_data_module_internal_genlock; |
||||
|
`REGADDOFF__INTERNAL_CLOCK: |
||||
|
rd_data <= rd_data_module_internal_clock; |
||||
|
`REGADDOFF__TTLOUT1: |
||||
|
rd_data <= rd_data_module_ttlout1; |
||||
|
`REGADDOFF__TTLOUT2: |
||||
|
rd_data <= rd_data_module_ttlout2; |
||||
|
`REGADDOFF__TTLOUT3: |
||||
|
rd_data <= rd_data_module_ttlout3; |
||||
|
`REGADDOFF__TTLOUT4: |
||||
|
rd_data <= rd_data_module_ttlout4; |
||||
|
`REGADDOFF__TIMECODE_OUT: |
||||
|
rd_data <= rd_data_module_timecode_out; |
||||
|
`REGADDOFF__GENLOCK_OUT: |
||||
|
rd_data <= rd_data_module_genlock_out; |
||||
|
`REGADDOFF__CAMERA_SYNC_OUT: |
||||
|
rd_data <= rd_data_module_camera_sync_out; |
||||
|
default: |
||||
|
rd_data <= 0; |
||||
|
endcase |
||||
|
end |
||||
|
|
||||
|
|
||||
|
endmodule |
@ -0,0 +1,47 @@ |
|||||
|
module zutils_multiplexer_8t1 ( |
||||
|
input [31:0] chooseindex, |
||||
|
input wire signal0, |
||||
|
input wire signal1, |
||||
|
input wire signal2, |
||||
|
input wire signal3, |
||||
|
input wire signal4, |
||||
|
input wire signal5, |
||||
|
input wire signal6, |
||||
|
input wire signal7, |
||||
|
input wire signal8, |
||||
|
output reg signalout |
||||
|
); |
||||
|
|
||||
|
|
||||
|
always @(*) begin |
||||
|
case (chooseindex) |
||||
|
0: begin |
||||
|
signalout = signal0; |
||||
|
end |
||||
|
1: begin |
||||
|
signalout = signal1; |
||||
|
end |
||||
|
2: begin |
||||
|
signalout = signal2; |
||||
|
end |
||||
|
3: begin |
||||
|
signalout = signal3; |
||||
|
end |
||||
|
4: begin |
||||
|
signalout = signal4; |
||||
|
end |
||||
|
5: begin |
||||
|
signalout = signal5; |
||||
|
end |
||||
|
6: begin |
||||
|
signalout = signal6; |
||||
|
end |
||||
|
7: begin |
||||
|
signalout = signal7; |
||||
|
end |
||||
|
default: begin |
||||
|
signalout = 0; |
||||
|
end |
||||
|
endcase |
||||
|
end |
||||
|
endmodule |
@ -0,0 +1,47 @@ |
|||||
|
module zutils_multiplexer_8t1 ( |
||||
|
input [31:0] chooseindex, |
||||
|
input wire signal0, |
||||
|
input wire signal1, |
||||
|
input wire signal2, |
||||
|
input wire signal3, |
||||
|
input wire signal4, |
||||
|
input wire signal5, |
||||
|
input wire signal6, |
||||
|
input wire signal7, |
||||
|
input wire signal8, |
||||
|
output reg signalout |
||||
|
); |
||||
|
|
||||
|
|
||||
|
always @(*) begin |
||||
|
case (chooseindex) |
||||
|
0: begin |
||||
|
signalout = signal0; |
||||
|
end |
||||
|
1: begin |
||||
|
signalout = signal1; |
||||
|
end |
||||
|
2: begin |
||||
|
signalout = signal2; |
||||
|
end |
||||
|
3: begin |
||||
|
signalout = signal3; |
||||
|
end |
||||
|
4: begin |
||||
|
signalout = signal4; |
||||
|
end |
||||
|
5: begin |
||||
|
signalout = signal5; |
||||
|
end |
||||
|
6: begin |
||||
|
signalout = signal6; |
||||
|
end |
||||
|
7: begin |
||||
|
signalout = signal7; |
||||
|
end |
||||
|
default: begin |
||||
|
signalout = 0; |
||||
|
end |
||||
|
endcase |
||||
|
end |
||||
|
endmodule |
Write
Preview
Loading…
Cancel
Save
Reference in new issue