Skip to content

Commit 0675410

Browse files
committedAug 30, 2017
Merge branch 'master' of https://github.com/cliffordwolf/yosys into counter-extraction
2 parents 634f18b + c0034f5 commit 0675410

File tree

3 files changed

+54
-34
lines changed

3 files changed

+54
-34
lines changed
 

Diff for: ‎kernel/rtlil.cc

+16
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,22 @@ pool<string> RTLIL::AttrObject::get_strpool_attribute(RTLIL::IdString id) const
234234
return data;
235235
}
236236

237+
void RTLIL::AttrObject::set_src_attribute(const std::string &src)
238+
{
239+
if (src.empty())
240+
attributes.erase("\\src");
241+
else
242+
attributes["\\src"] = src;
243+
}
244+
245+
std::string RTLIL::AttrObject::get_src_attribute() const
246+
{
247+
std::string src;
248+
if (attributes.count("\\src"))
249+
src = attributes.at("\\src").decode_string();
250+
return src;
251+
}
252+
237253
bool RTLIL::Selection::selected_module(RTLIL::IdString mod_name) const
238254
{
239255
if (full_selection)

Diff for: ‎kernel/rtlil.h

+4
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,13 @@ struct RTLIL::AttrObject
505505

506506
void set_bool_attribute(RTLIL::IdString id);
507507
bool get_bool_attribute(RTLIL::IdString id) const;
508+
508509
void set_strpool_attribute(RTLIL::IdString id, const pool<string> &data);
509510
void add_strpool_attribute(RTLIL::IdString id, const pool<string> &data);
510511
pool<string> get_strpool_attribute(RTLIL::IdString id) const;
512+
513+
void set_src_attribute(const std::string &src);
514+
std::string get_src_attribute() const;
511515
};
512516

513517
struct RTLIL::SigChunk

Diff for: ‎techlibs/greenpak4/cells_sim_digital.v

+34-34
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
147147
"RISING": begin
148148
always @(posedge CLK, posedge RST) begin
149149

150-
if(KEEP) begin
150+
//Resets
151+
if(RST) begin
152+
if(RESET_VALUE == "ZERO")
153+
count <= 0;
154+
else
155+
count <= COUNT_TO;
156+
end
157+
158+
else if(KEEP) begin
151159
end
152160
else if(UP) begin
153161
count <= count + 1'd1;
@@ -161,21 +169,21 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
161169
count <= COUNT_TO;
162170
end
163171

172+
end
173+
end
174+
175+
"FALLING": begin
176+
always @(posedge CLK, negedge RST) begin
177+
164178
//Resets
165-
if(RST) begin
179+
if(!RST) begin
166180
if(RESET_VALUE == "ZERO")
167181
count <= 0;
168182
else
169183
count <= COUNT_TO;
170184
end
171185

172-
end
173-
end
174-
175-
"FALLING": begin
176-
always @(posedge CLK, negedge RST) begin
177-
178-
if(KEEP) begin
186+
else if(KEEP) begin
179187
end
180188
else if(UP) begin
181189
count <= count + 1'd1;
@@ -189,14 +197,6 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
189197
count <= COUNT_TO;
190198
end
191199

192-
//Resets
193-
if(!RST) begin
194-
if(RESET_VALUE == "ZERO")
195-
count <= 0;
196-
else
197-
count <= COUNT_TO;
198-
end
199-
200200
end
201201
end
202202

@@ -286,8 +286,16 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
286286
"RISING": begin
287287
always @(posedge CLK, posedge RST) begin
288288

289+
//Resets
290+
if(RST) begin
291+
if(RESET_VALUE == "ZERO")
292+
count <= 0;
293+
else
294+
count <= COUNT_TO;
295+
end
296+
289297
//Main counter
290-
if(KEEP) begin
298+
else if(KEEP) begin
291299
end
292300
else if(UP) begin
293301
count <= count + 1'd1;
@@ -301,22 +309,22 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
301309
count <= COUNT_TO;
302310
end
303311

312+
end
313+
end
314+
315+
"FALLING": begin
316+
always @(posedge CLK, negedge RST) begin
317+
304318
//Resets
305-
if(RST) begin
319+
if(!RST) begin
306320
if(RESET_VALUE == "ZERO")
307321
count <= 0;
308322
else
309323
count <= COUNT_TO;
310324
end
311325

312-
end
313-
end
314-
315-
"FALLING": begin
316-
always @(posedge CLK, negedge RST) begin
317-
318326
//Main counter
319-
if(KEEP) begin
327+
else if(KEEP) begin
320328
end
321329
else if(UP) begin
322330
count <= count + 1'd1;
@@ -330,14 +338,6 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
330338
count <= COUNT_TO;
331339
end
332340

333-
//Resets
334-
if(!RST) begin
335-
if(RESET_VALUE == "ZERO")
336-
count <= 0;
337-
else
338-
count <= COUNT_TO;
339-
end
340-
341341
end
342342
end
343343

0 commit comments

Comments
 (0)
Please sign in to comment.