From: stephane Domas Date: Wed, 10 Jan 2018 09:52:39 +0000 (+0100) Subject: modif in VHDLConverter X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/df84660fd98b39737692d57b68c8b2c2d34af0f1?ds=sidebyside;hp=--cc modif in VHDLConverter --- df84660fd98b39737692d57b68c8b2c2d34af0f1 diff --git a/IfacePurposeDelegate.cpp b/IfacePurposeDelegate.cpp new file mode 100644 index 0000000..64bcf76 --- /dev/null +++ b/IfacePurposeDelegate.cpp @@ -0,0 +1,60 @@ +// fichier enregistré en UTF-8 + +#include "IfacePurposeDelegate.h" + +IfacePurposeDelegate::IfacePurposeDelegate(QObject *parent) : QItemDelegate(parent) { + + lstPurpose.append("any"); + lstPurpose.append("data"); + lstPurpose.append("control"); + lstPurpose.append("clock"); + lstPurpose.append("reset"); + lstPurpose.append("wishbone"); +} + +QWidget* IfacePurposeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option , const QModelIndex &index) const { + + int i; + + QComboBox *lst = new QComboBox(parent); + lst->setSizeAdjustPolicy (QComboBox::AdjustToContents); + + for(int i=0;iaddItem(lstPurpose.at(i)); + } + + lst->installEventFilter(const_cast(this)); + lst->adjustSize(); + + return lst; +} + +void IfacePurposeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { + + + int id = lstPurpose.indexOf(index.model()->data(index, Qt::DisplayRole).toString()); + + QComboBox *lst = static_cast(editor); + lst->setCurrentIndex(id); + +} + +void IfacePurposeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { + + int id; + QComboBox *lst = static_cast(editor); + + id = lst->currentIndex(); + cout << "update display" << endl; + model->setData(index, lst->currentText(), Qt::DisplayRole); +} + +void IfacePurposeDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const { + + QSize size = editor->size(); + + QRect rect = option.rect; + rect.setWidth(size.width()); + editor->setGeometry(rect); + +} diff --git a/IfacePurposeDelegate.h b/IfacePurposeDelegate.h new file mode 100644 index 0000000..a3d6d08 --- /dev/null +++ b/IfacePurposeDelegate.h @@ -0,0 +1,38 @@ +// fichier enregistré en UTF-8 + +#ifndef __IFACEPURPOSEDELEGATE_H__ +#define __IFACEPURPOSEDELEGATE_H__ + +#include +#include + +#include +#include +#include + +using namespace std; +using namespace Qt; + + +class IfacePurposeDelegate : public QItemDelegate { + + Q_OBJECT + +public: + + + IfacePurposeDelegate(QObject *parent = 0); + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; + + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; + + void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; + +private : + + QList lstPurpose; +}; + +#endif // __IFACEPURPOSEDELEGATE_H__ diff --git a/blast.creator.user.c8006d6 b/blast.creator.user.c8006d6 new file mode 100755 index 0000000..8b99581 --- /dev/null +++ b/blast.creator.user.c8006d6 @@ -0,0 +1,198 @@ + + + + + + EnvironmentId + {c8006d66-d34f-42be-ad10-d0207752286d} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {2c9bf876-3476-44eb-8065-1f0844704dda} + 0 + 0 + 0 + + /home/sdomas/Projet/Blast/code/blast + + + + all + + false + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Compiler + + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + + + true + Make + + GenericProjectManager.GenericMakeStep + + 1 + Nettoyer + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Défaut + Défaut + GenericProjectManager.GenericBuildConfiguration + + 1 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Déployer localement + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + + %{buildDir} + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/lib/references/rgb32-to-gs.xml b/lib/references/rgb32-to-gs.xml new file mode 100644 index 0000000..dc98d7e --- /dev/null +++ b/lib/references/rgb32-to-gs.xml @@ -0,0 +1,42 @@ + + + + + RGB32 (8 bits/serial) to grayscale + + + + + This block does a conversion of an RGB32 pixel (8 bits/serial) into a grayscale value (8 bits). + + + This block does a conversion of an RGB32 pixel into a grayscale value. + A RGB32 pixel is composed of 4 components: red, green, blue, transparency, each on 8 bits. + They are stored as in little-endian arch. which means that components must enter in the block + in the following order : transparency, blue, green, red. + The block does a simple average over the three values to obtain a grayscale pixel. + It also outputs the transparency component, in case of it should be used after. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rgb3sx8_to_gs.xml b/rgb3sx8_to_gs.xml new file mode 100644 index 0000000..d9583a1 --- /dev/null +++ b/rgb3sx8_to_gs.xml @@ -0,0 +1,27 @@ + + + + rgb3sx8_to_gs + + + vcdsv + vrevgfregaqv + + + + + + + + + + + + + + + + + + + diff --git a/rgb3sx8_to_gs_impl.xml b/rgb3sx8_to_gs_impl.xml new file mode 100644 index 0000000..05708e3 --- /dev/null +++ b/rgb3sx8_to_gs_impl.xml @@ -0,0 +1,86 @@ + + + + + + vcdsv + vrevgfregaqv + + + + + + + + +-- Signals +signal do_mult : std_logic; +signal do_out : std_logic; +signal count : unsigned (2 downto 0); +signal accum : unsigned(dsp_in_width-1 downto 0); +signal result : unsigned(dsp_out_width-1 downto 0); +signal cst_mult : unsigned(dsp_in_width-1 downto 0); -- eq. 87382 to do /3 + +begin + +cst_mult <= to_unsigned(87382, 18); + +accum_process : process (clk, reset) +begin +if reset = '1' then +count <= to_unsigned(0, 3); +accum <= to_unsigned(0, dsp_in_width); +do_mult <= '0'; + +elsif rising_edge(clk) then + +do_mult <= '0'; + +if rgb_in_enb = '1' then + +if count = 0 then +accum <= resize(unsigned(rgb_in), dsp_in_width); +count <= to_unsigned(1, 3); +elsif count = 1 then +accum <= accum + resize(unsigned(rgb_in), dsp_in_width); +count <= to_unsigned(2, 3); +elsif count = 2 then +accum <= accum + resize(unsigned(rgb_in), dsp_in_width); +count <= to_unsigned(0, 3); +do_mult <= '1'; +end if; +end if; +end if; + +end process accum_process; + +mult_process : process (clk, reset) +begin +if reset = '1' then +result <= to_unsigned(0, dsp_out_width); +do_out <= '0'; +elsif rising_edge(clk) then + +do_out <= '0'; +if do_mult = '1' then +result <= accum * cst_mult; +do_out <= '1'; +end if; +end if; +end process mult_process; + +gs_out <= std_logic_vector(result(dsp_in_width+7 downto dsp_in_width)); +gs_out_enb <= do_out; + +end rtl; + + + + + + + + + + + diff --git a/toto.xml b/toto.xml new file mode 100644 index 0000000..90db6c9 --- /dev/null +++ b/toto.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +