Blame view

Examples/CircuitRC/Models/CircuitRC.vhd 2.23 KB
f902ce56c   Jean-Marie Gauthier   Commit of projects
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
  library IEEE;
  use IEEE.electrical_systems.all;
  
  
  ---------------- ENTITY DECLARATION Resistor ----------------
  -- @Req1.1 'Requirement2' : The system shall be capable to have a derivator behavior
  ENTITY Resistor IS
  	GENERIC(
  		R : real
  	);
  	PORT(
  		TERMINAL m : Electrical;
  		TERMINAL p : Electrical
  	);
  END ENTITY Resistor;
  
  ---------------- ARCHITECTURE DECLARATION behav OF Resistor ----------------
  ARCHITECTURE behav OF Resistor IS
  	QUANTITY v_in ACROSS i_out THROUGH p TO m;
  	
  
  BEGIN
  	
  	
  	
  	v_in == R * i_out;
  	
  END ARCHITECTURE behav;
  
  
  library IEEE;
  use IEEE.electrical_systems.all;
  
  
  ---------------- ENTITY DECLARATION Condensateur ----------------
  -- @Req1.2 'Requirement3' : The system shall be capable to respond in 2ms
  ENTITY Condensateur IS
  	GENERIC(
  		C : real
  	);
  	PORT(
  		TERMINAL m : Electrical;
  		TERMINAL p : Electrical
  	);
  END ENTITY Condensateur;
  
  ---------------- ARCHITECTURE DECLARATION behav OF Condensateur ----------------
  ARCHITECTURE behav OF Condensateur IS
  	QUANTITY v_in ACROSS i_out THROUGH p TO m;
  	
  
  BEGIN
  	
  	
  	
  	i_out == C * v_in'dot;
  	
  END ARCHITECTURE behav;
  
  
  library IEEE;
  use IEEE.electrical_systems.all;
  
  
  ---------------- ENTITY DECLARATION Generateur ----------------
  ENTITY Generateur IS
  	
  	PORT(
  		TERMINAL m : Electrical;
  		TERMINAL p : Electrical
  	);
  END ENTITY Generateur;
  
  ---------------- ARCHITECTURE DECLARATION behav OF Generateur ----------------
  ARCHITECTURE behav OF Generateur IS
  	CONSTANT v : real := 110.0;
  	QUANTITY v_in ACROSS i_out THROUGH p TO m;
  	
  
  BEGIN
  	
  	
  	
  	v_in == v;
  	
  END ARCHITECTURE behav;
  
  
  library IEEE;
  use IEEE.electrical_systems.all;
  
  library work;
  use work.ALL;
  ---------------- ENTITY DECLARATION Circuit ----------------
  -- @Req1.0 'Requirement1' : The system shall be capable to do a low-pass band filter
  ENTITY Circuit IS
  	
  	
  END ENTITY Circuit;
  
  ---------------- ARCHITECTURE DECLARATION behav OF Circuit ----------------
  ARCHITECTURE behav OF Circuit IS
  	
  	TERMINAL n1 : Electrical;
  	TERMINAL n2 : Electrical;
  
  BEGIN
  	
  	R1 : ENTITY Resistor (behav) 
  			GENERIC MAP (R=>100.0)
  			PORT MAP (p=>n1, m=>n2);
  	C1 : ENTITY Condensateur (behav) 
  			GENERIC MAP (C=>1.0e-6)
  			PORT MAP (p=>n2, m=>ground);
  	SRC : ENTITY Generateur (behav) 
  			PORT MAP (p=>n1, m=>ground);
  	
  	
  END ARCHITECTURE behav;