mod according to code comment

This commit is contained in:
treelin611 2026-05-19 14:30:31 +08:00
parent 56f4b976d5
commit 3c5ba1337e
7 changed files with 40 additions and 13945 deletions

View File

@ -1,9 +1,8 @@
# cell lib generation
# cell lib generation
techlibs/rapidflex/alkaidC/cell_sim_pcnt.v: techlibs/rapidflex/util/pcnt_cell_sim_gen.py
$(P) mkdir -p $(dir $@) && $(PYTHON_EXECUTABLE) $^ --file $@
CXXFLAGS += -Itechlibs/rapidflex/src/
OBJS += techlibs/rapidflex/src/pugixml.o
OBJS += techlibs/rapidflex/src/synth_rapidflex.o
OBJS += techlibs/rapidflex/src/clock_buffer_cmd.o
@ -26,7 +25,6 @@ $(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/
$(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/cell_sim_arith.v))
$(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/cell_sim_ccb.v))
$(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/cell_sim_ff.v))
$(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/cell_sim_pcnt.v))
$(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/cell_sim.v))
$(eval $(call add_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/dff_map.v))
$(eval $(call add_gen_share_file,share/rapidflex/alkaidC,techlibs/rapidflex/alkaidC/cell_sim_pcnt.v))

1
techlibs/rapidflex/alkaidC/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/cell_sim_pcnt.v

View File

@ -1,4 +1,4 @@
#include <algorithm>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
@ -10,7 +10,6 @@
#include "kernel/rtlil.h"
#include "kernel/sigtools.h"
#include "kernel/yosys.h"
#include "pugixml.hpp"
USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN
@ -223,12 +222,41 @@ struct InsertClockBuffer : public Pass {
}
}
static std::string xml_escape(const std::string &s) {
std::string out;
out.reserve(s.size());
for (char c : s) {
switch (c) {
case '&':
out += "&amp;";
break;
case '"':
out += "&quot;";
break;
case '<':
out += "&lt;";
break;
case '>':
out += "&gt;";
break;
default:
out += c;
break;
}
}
return out;
}
/*This function is for generating cell map file*/
void generate_cell_map(const char *fname,
const std::set<std::string> &ckbuf_info,
const std::map<std::string, std::string> &ckbuf_type) {
pugi::xml_document out_xml;
pugi::xml_node root_node = out_xml.append_child("ckbuf_cell_map");
FILE *f = fopen(fname, "w");
if (f == nullptr)
log_error("Can't open file `%s` for writing.\n", fname);
fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(f, "<ckbuf_cell_map>\n");
for (const std::string &ckbuf : ckbuf_info) {
std::string in = ckbuf;
std::string out = ckbuf + "_ckbuf";
@ -241,12 +269,12 @@ struct InsertClockBuffer : public Pass {
log_error("No port type defined for ckbuf %s \n", out.c_str());
}
pugi::xml_node ckbuf_node = root_node.append_child("ckbuf");
ckbuf_node.append_attribute("input_net") = in.c_str();
ckbuf_node.append_attribute("cell") = out.c_str();
ckbuf_node.append_attribute("type") = type.c_str();
fprintf(f, " <ckbuf input_net=\"%s\" cell=\"%s\" type=\"%s\"/>\n",
xml_escape(in).c_str(), xml_escape(out).c_str(),
xml_escape(type).c_str());
}
out_xml.save_file(fname);
fprintf(f, "</ckbuf_cell_map>\n");
fclose(f);
log("cell map is stored in file %s \n", fname);
}
void rewire_lut_primitive(RTLIL::Cell *cell,

View File

@ -1,75 +0,0 @@
/**
* pugixml parser - version 1.7
* --------------------------------------------------------
* Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at http://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
#ifndef HEADER_PUGICONFIG_HPP
#define HEADER_PUGICONFIG_HPP
// Uncomment this to enable wchar_t mode
// #define PUGIXML_WCHAR_MODE
// Uncomment this to enable compact mode
// #define PUGIXML_COMPACT
// Uncomment this to disable XPath
// #define PUGIXML_NO_XPATH
// Uncomment this to disable STL
// #define PUGIXML_NO_STL
// Uncomment this to disable exceptions
// #define PUGIXML_NO_EXCEPTIONS
// Set this to control attributes for public classes/functions, i.e.:
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols
// from DLL #define PUGIXML_CLASS __declspec(dllimport) // to import all classes
// from DLL #define PUGIXML_FUNCTION __fastcall // to set calling conventions to
// all public functions to fastcall In absence of PUGIXML_CLASS/PUGIXML_FUNCTION
// definitions PUGIXML_API is used instead
// Tune these constants to adjust memory-related behavior
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
// Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY
// Uncomment this to enable long long support
// #define PUGIXML_HAS_LONG_LONG
#endif
/**
* Copyright (c) 2006-2015 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ error_codes = {"SUCCESS": 0, "ERROR": 1, "FILE_ERROR": 3}
#####################################################################
# Initialize logger
#####################################################################
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.ERROR)
def generate_file_header(f0):