hi,
1 | library ieee; |
2 | use ieee.std_logic_1164.all; |
3 | use ieee.std_logic_unsigned.all; |
4 | entity req is |
5 | port(fpga_clk: in std_logic; |
6 | evt_pwr_en: in std_logic; |
7 | ifc_we_n : inout std_logic; |
8 | hreset_n : inout std_logic; |
9 | pwr_rst_n : in std_logic; |
10 | ifc_ad8_15 : inout std_logic_vector( 7 downto 0); |
11 | sensevdd_en_n : out std_logic; |
12 | iopwr_en : out std_logic; |
13 | iopwr_en_n : out std_logic; |
14 | ddrpwr_en : out std_logic; |
15 | ddrpwr_en_n : out std_logic; |
16 | vdd_en : out std_logic; |
17 | vdd_en_n : out std_logic; |
18 | vcore_en : out std_logic; |
19 | evt_pwr_ok : out std_logic; |
20 | v3v3_pgood: in std_logic); |
21 | end req; |
22 | architecture power of req is |
23 | signal tier_cnt: std_logic_vector(19 downto 0); |
24 | signal tier_cnt_int:std_logic; |
25 | signal tier : std_logic_vector(3 downto 0); |
26 | signal vcore_en_cnt: std_logic_vector(9 downto 0); |
27 | signal pwr_gd_cnt : std_logic_vector(19 downto 0); |
28 | signal pwr_ok_cnt: std_logic_vector(19 downto 0); |
29 | signal rst_holf_f : std_logic; |
30 | signal req_rst_r : std_logic; |
31 | signal req_cop_trst_r : std_logic; |
32 | signal cfg_egn_use0 : std_logic; |
33 | signal cpu_rst_n : std_logic; |
34 | signal pwr_rst_cnt : std_logic_vector(9 downto 0); |
35 | signal rcw_config_word : std_logic_vector( 7 downto 0); |
36 | begin
|
37 | pon_rst_n <= (pwr_rst_n when pwr_ok_cnt(19) = '1' else '1') when v3v3_pgood and pwr_gd_cnt(19) = '1' else pwr_rst_n; |
38 | |
39 | process(tier_cnt_int) |
40 | begin
|
41 | if(rising_edge(tier_cnt_int)) then |
42 | if(v3v3_pgood = '0') then |
43 | tier_cnt(3 downto 0) <= "1111"; |
44 | else
|
45 | tier(3) <= tier(2); |
46 | tier(2) <= tier(1); |
47 | tier(1) <= tier(0); |
48 | tier(0) <= evt_pwr_en; |
49 | end if; |
50 | end if; |
51 | end process; |
52 | |
53 | process(fpga_clk) |
54 | begin
|
55 | if(rising_edge(fpga_clk)) then |
56 | if(v3v3_pgood = '0') then |
57 | vcore_en_cnt <= (others => '0'); |
58 | else
|
59 | if(vcore_en_cnt > "0110000000") then |
60 | vcore_en_cnt <= "1111111111"; |
61 | else
|
62 | vcore_en_cnt <= vcore_en_cnt + 1; |
63 | end if; |
64 | end if; |
65 | end if; |
66 | end process; |
67 | process(fpga_clk) |
68 | begin
|
69 | if(rising_edge(fpga_clk)) then |
70 | if(v3v3_pgood = '0') then |
71 | pwr_gd_cnt <= (others => '0'); |
72 | else
|
73 | if(pwr_gd_cnt > x"08000") then |
74 | pwr_gd_cnt <= (others => '1'); |
75 | else
|
76 | pwr_gd_cnt <= pwr_gd_cnt + 1; |
77 | end if; |
78 | end if; |
79 | end if; |
80 | end process; |
81 | |
82 | process(fpga_clk) |
83 | begin
|
84 | if(rising_edge (fpga_clk)) then |
85 | if( (not(cpu_rst_n) or (rst_holf_f) or (hreset_n and (not(req_rst_r)) and req_cop_trst_r ))= '1') then |
86 | cfg_egn_use0 <= ifc_we_n; |
87 | end if; |
88 | end if; |
89 | end process; |
90 | |
91 | process(fpga_clk) |
92 | begin
|
93 | if(rising_edge(fpga_clk)) then |
94 | if(pwr_rst_n = '0') then |
95 | rcw_config_word <= ifc_ad8_15; |
96 | end if; |
97 | end if; |
98 | end process; |
99 | end power; |
the code above shows an error like Error (10500): VHDL syntax error at req.vhd(38) near text "when"; expecting ")", or ","
because for when statement there is no (), here is an example: a <= '1' when c = '1' else '0' when d = '1' else '0';
user wrote: > because for when statement there is no (), here is an example: > > a <= '1' when c = '1' else > '0' when d = '1' else > '0'; actually in the above code, pon_rst_n will be pwr_rst_n based on the value of v3v3_pgood and pwr_gd_cnt(19). But before assignment i have to check pwr_rst_n based on the values of pwr_ok_cnt(19).
Hareesh M. wrote: > the code above shows an error like A hint: use your text editor to format and indent your code. Then you see such things very easy...
1 | pon_rst_n <= (pwr_rst_n when pwr_ok_cnt(19) = '1' else |
2 | '1') when v3v3_pgood and pwr_gd_cnt(19) = '1' else |
3 | pwr_rst_n; |
Easy to see: one useless '(' in the first line and one wrong ')' in the second line... And this is almost unreadable:
1 | if( (not(cpu_rst_n) or (rst_holf_f) or (hreset_n and (not(req_rst_r)) and req_cop_trst_r ))= '1') then |
Are you sure it is doing what you want? I could write it this way:
1 | if cpu_rst_n='0' or |
2 | rst_holf_f='1' or |
3 | hreset_n='1' and req_rst_r='0' and req_cop_trst_r='1' then |
In my opinion now everybody recogizes what he will get with one short blink...
:
Edited by Moderator
Lothar M. wrote: > Hareesh M. wrote: >> the code above shows an error like > A hint: use your text editor to format and indent your code. Then you > see such things very easy... >
1 | > pon_rst_n <= (pwr_rst_n when pwr_ok_cnt(19) = '1' else |
2 | > '1') when v3v3_pgood and pwr_gd_cnt(19) = '1' else |
3 | > pwr_rst_n; |
4 | >
|
> > And this is almost unreadable: >
1 | > if( (not(cpu_rst_n) or (rst_holf_f) or (hreset_n and |
2 | > (not(req_rst_r)) and req_cop_trst_r ))= '1') then |
3 | >
|
> Are you sure it is doing what you want? > I could write it this way: >
1 | > if cpu_rst_n='0' or |
2 | > rst_holf_f='1' or |
3 | > hreset_n='1' and req_rst_r='0' and req_cop_trst_r='1' then |
4 | >
|
> In my opinion now everybody recogizes what he will get with one short > blink... i corrected the when else statement error, but now it is showing "v3v3_pgood" does not agree with "boolean" type. and thanks for you help that "if" statement.
Hareesh M. wrote: > i corrected the when else statement error, but now it is showing > "v3v3_pgood" does not agree with "boolean" type. Try this:
1 | pon_rst_n <= pwr_rst_n when pwr_ok_cnt(19)='1' else |
2 | '1' when v3v3_pgood='1' and pwr_gd_cnt(19)='1' else |
3 | pwr_rst_n; |
Hareesh M. wrote: > but now it is showing "v3v3_pgood" does not agree with "boolean" type. Please start thinking for yourself about those messages before posting. Usually such errors are easy to locate... We solved this "problem" about different types (std_logic ist not boolean) a few days ago. Do you remember?
:
Edited by Moderator
hi, i still have some issue with when else statement,
1 | ifc_ad8_15 <= "ZZZZZZZZ" when cpu_rst_n and (not rst_hold_f) and (req_rst_r when (req_md_r = "11") else '1') = '1' |
2 | else rcw_src(0 to 7) when boot_override_r = '1' else "ZZZZZZZZ"; |
showing the same error Error (10500): VHDL syntax error at req.vhd(556) near text "when"; expecting ")", or "," Error (10500): VHDL syntax error at req.vhd(556) near text ")"; expecting ";"
Get all the parenthesis right and correct the logical problems leading to syntax problems, then it will be ok. See, what I wrote in the post before your last (that about "start thinking yourself" and remind the comment about "readability" of code). It will help to solve that problem...
:
Edited by Moderator