Hi every one
my working is to implement a circuit in FPGA ,i get the admittance
matric of circuit that be multiply it into current vector(value of
current vector changing with control signal state)
when the clock rise(posedge), elements of inverse admittance matric
(G11,G12,G21,G22) multiply into vector of current and when the clock
down(negedge), the vector of current be updated.
the code has been written in verilog.
the problems that ISE gives is that:
Line 29: r1 is not a constant
Line 30: y11 is not a constant
Line 31: y22 is not a constant
Line 21: Module <scircuit> ignored due to previous errors.
1 | `timescale 1ns / 1ps
|
2 | //////////////////////////////////////////////////////////////////////////////////
|
3 | // Company:
|
4 | // Engineer:
|
5 | //
|
6 | // Create Date: 17:21:30 10/24/2014
|
7 | // Design Name:
|
8 | // Module Name: scircuit
|
9 | // Project Name:
|
10 | // Target Devices:
|
11 | // Tool versions:
|
12 | // Description:
|
13 | //
|
14 | // Dependencies:
|
15 | //
|
16 | // Revision:
|
17 | // Revision 0.01 - File Created
|
18 | // Additional Comments:
|
19 | //
|
20 | //////////////////////////////////////////////////////////////////////////////////
|
21 | module scircuit(
|
22 | input control,
|
23 | input clk,
|
24 | input reset,
|
25 | output reg [15:0] v1,v2
|
26 | );
|
27 |
|
28 | reg [15:0] r1=1'b1, G1=1'b1 , R=4'b1010, vdc=8'b100100;
|
29 | reg signed [15:0] y11=(1/r1)+G1 ,y12=-G1 ,y21=-G1 ,y22=R+G1;
|
30 | reg signed [15:0] yy=(1/((y11*y22)-(y12*y21)));
|
31 | reg signed [15:0] G11=(y22/yy) ,G12=(-y12/yy) ,G21=(-y21/yy) ,G22=(y11/yy);
|
32 | reg signed [15:0] j1=0000000000000000;
|
33 | reg signed [15:0] j2=0000000000000000;
|
34 | reg signed [15:0] v11,v22,i1,i2;
|
35 | always @(posedge clk)
|
36 | if (reset == 1)
|
37 | begin
|
38 | v1 <= 16'b0000000000000000;
|
39 | v2 <= 16'b0000000000000000;
|
40 | end //end if(reset ==1)
|
41 | else
|
42 | begin
|
43 | i1 <=(vdc/r1)+j1;
|
44 | i2 <= -j1;
|
45 | v11 <= (G11*i1) + (G12*i2) ;
|
46 | v22 <= (G21*i2) + (G22*i2) ;
|
47 | v1 <= v11;
|
48 | v2 <= v22;
|
49 | end
|
50 | always @(negedge clk)
|
51 | case(control)
|
52 | 1'b1:
|
53 | j1 <=-G1*(v1-v2);
|
54 | 1'b0:
|
55 | j1 <= G1*(v1-v2);
|
56 |
|
57 | endcase
|
58 |
|
59 | endmodule
|