Вот verilog, может тут где накосячил?
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:19:44 09/17/2011
// Design Name:
// Module Name: main
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module main( A[2:0],D[7:0],WE,OE,CS,LED,LED_GND,TEST);
input [2:0]A;
inout [7:0]D;
input WE;
input OE;
input CS;
output LED;
output LED_GND;
input TEST;
wire [11:0]Iin;
wire [11:0]Qin;
wire [20:0] Iout_;
wire [20:0]Qout_;
wire [7:0] N;
wire [7:0]state; // 0-busy,1-done 2-TEST,3- 1, 4-dv, 5-rfd 6 - edone
wire [7:0] ctrl; // 0-rst, 1-start, 2-forward, 3-LED 4-clk, 5-forward_inv_we, 6-unload
wire nc;
wire [7:0] Nnc;
wire [7:0] Bnc;
wire [20:0] Qout;
wire [20:0] Iout;
assign LED=ctrl[3];
assign LED_GND=0;
assign state[2]=TEST;
assign state[3]=1;
/*
genvar i;
for (i = 0; i <= 20; i=i+1) begin
assign Iout[i]=Iout_[20-i];
assign Qout[i]=Qout_[20-i];
end
*/
ram_interface ri1(A[2:0],D[7:0],WE,OE,CS,Iin[11:0],Qin[11:0],Iout[20:0],Qout[20:0],N[7:0],state[7:0],ctrl[7:0],Bnc);
xfft_v7_1 fft1 (.clk(ctrl[4]), .sclr(ctrl[0]), .start(ctrl[1]), .unload(ctrl[6]),
.xn_re(Qin[11:0]), .xn_im(Iin[11:0]), .fwd_inv(ctrl[2]), .fwd_inv_we(ctrl[5]),
.rfd(state[5]), .xn_index(Nnc), .busy(state[0]), .edone(state[6]), .done(state[1]),
.dv(state[4]), .xk_index(N[7:0]), .xk_re(Qout), .xk_im(Iout));
// .blk_exp(Bnc));
endmodule
module ram_interface(A[2:0],D[7:0],WE,OE,CS,Iin[11:0],Qin[11:0],Iout[20:0],Qout[20:0],N[7:0],state[7:0],ctrl[7:0],BLK);
input [2:0]A;
inout [7:0]D;
input WE;
input OE;
input CS;
output reg [11:0]Iin;
output reg [11:0]Qin;
input [20:0] Iout;
input [20:0]Qout;
input [7:0] N;
input [7:0]state;
input [7:0] BLK;
output reg[7:0] ctrl;
reg [7:0]data;
reg edge_1;
reg [7:0]test_reg;
assign D=(!OE & !CS)? data : 'bZ;
always @(*)
begin
edge_1<=((WE && OE) || CS);
end
//assign clk=!((A==7)&!WE & !CS);
always @(negedge edge_1)
begin
if (!CS)
begin
if (A==0)
begin
if(!WE & OE) ctrl<=D;
if(!OE & WE) data<=state;
end
if (A==1)
begin
if(!WE & OE) Iin[7:0]<=D;
if(!OE & WE) data<=Iout[7:0];
end
if (A==2)
begin
if(!WE & OE) Iin[11:8]<=D[3:0];
if(!OE & WE) data<=Iout[15:8];
end
if (A==3)
begin
if(!WE & OE) Qin[7:0]<=D;
if(!OE & WE) data<=Qout[7:0];
end
if (A==4)
begin
if(!WE & OE) Qin[11:8]<=D[3:0];
if(!OE & WE) data<=Qout[15:8];
end
if (A==5)
begin
if(!OE & WE) data<=N[7:0];
end
if (A==6)
begin
if(!OE & WE) data<=Iout[20:16];
if(!WE & OE) test_reg<=D;
end
if (A==7)
begin
if(!OE & WE) data<=Qout[20:16];
if(!WE & OE) test_reg<=D;
end
end
end
endmodule |