byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
XilinxUltraScalePlus.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2022 Kristiyan Manev (University of Manchester)
3  *
4  * Licensed under the Apache License, Version 2.0(the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #ifndef XILINXULTRASCALEPLUS_H
18 #define XILINXULTRASCALEPLUS_H
19 
20 #include<cstdint> //uint
21 #include<string>
22 
23 #include "XUSP_Fabric.h"
24 #include "../../CommonDevice2D.h"
25 #include "../XilinxConfigurationAccessPort.h"
26 #include "../../../Common/Endianness.h"
27 #include "../../../Common/Coords.h"
28 
29 
30 
31 class XilinxUltraScalePlus: virtual public CommonDevice2D, public XilinxConfigurationAccessPort<archXUSPtemplate>
32 {
33  public:
35  virtual ~XilinxUltraScalePlus();
36 
37  void blank(std::string);
38 
39  void ensureInitializedBitstreamArrays() override;
40 
41  //Devices.cpp:
42  int getDeviceByIDCODEorThrow(int) override;
43  int getDeviceByNameOrThrow(std::string) override;
44  int getDeviceByIDCODE(int) override;
45  int getDeviceByName(std::string) override;
46  void setDevice(int, std::string = "") override;
47  void setDeviceByPartNameOrThrow() override;
48  void setDeviceByNameOrThrow(std::string) override;
49  void setDeviceByIDCODEOrThrow(int) override;
50 
52  void outputBitstreamGlobalHeaderSequence(std::ofstream&, bool, Endianness) override;
53  void outputBitstreamGlobalFooterSequence(std::ofstream&, bool, Endianness) override;
54 
55  void outputBitstreamSLRHeaderBitstreamSequence(std::ofstream&, int, bool, Endianness) override;
56  void outputBitstreamSLRFooterBitstreamSequence(std::ofstream&, int, bool, Endianness) override;
57  void outputBitstreamSLRHeaderAfterBitstreamSequence(std::ofstream&, int, bool, Endianness) override;
58  void outputBitstreamSLRWrapUpSequence(std::ofstream&, int, bool, Endianness) override;
59 
60  void outputBitstreamEmptySLRHeaderSequence(std::ofstream&, int, bool, Endianness) override;
61  void outputBitstreamEmptySLRWrapUpSequence(std::ofstream&, int, bool, Endianness) override;
62 
63  //Info
64  void deviceHelp();
65 
66  //file IO
67 
68  //merge (relocate)
69  //void ensureRowCompatibility(Coord2D, int, int, Coord2D);
70  //void ensureRegionCompatibility(Rect2D, Coord2D);
71  void merge(XilinxUltraScalePlus*, std::string, Rect2D, Coord2D);
72 
73  void readBitstream(std::string);
74  //The ones below are not needed to be public, but we don't really care
75  void writeBitstream(std::string, std::string, Rect2D);
76 
77  //resource std::string parameters
78  void initializeResourceStringParameters() override;
79 
80  //assembler
81  void assemblerParseHeader(std::ifstream&);
82  void assemblerAsmToBit(std::ifstream&, std::ofstream&);
83  void assemblerAsmToBin(std::ifstream&, std::ofstream&);
84  void assemblerAsmTo(std::ifstream&, std::ofstream&);
85 
86  void disassemblerWriteHeader(std::ofstream&);
87  void disassemblerBitToAsm(std::ifstream&, std::ofstream&);
88  void disassemblerBinToAsm(std::string, std::ifstream&, std::ofstream&);
89  void disassemblerToAsm(std::ifstream&, std::ofstream&);
90 
91  void assembler(std::string, std::string);
92 
93  // Info
94  std::string getFrameType(int, int, int) override;
95 
96  //Test
97  #if !defined(NDEBUG)
98  void test(bool, bool, uint32_t);
99  #endif
100  //change
101  void change(std::string);
102 
103  void initFabric();
104 };
105 
106 #endif // XILINXULTRASCALEPLUS_H
Endianness
< Endianness in byteman is represented not only by big/little endian, but also by potential bit swapp...
Definition: Endianness.h:47
#define XUSP_MAX_SLRS
Definition: XUSP_Fabric.h:22
int getDeviceByNameOrThrow(std::string) override
void outputBitstreamSLRFooterBitstreamSequence(std::ofstream &, int, bool, Endianness) override
Definition: XUSP_Output.cpp:49
std::streamoff slrMagicInstrLocation[4]
int getDeviceByIDCODE(int) override
void disassemblerBinToAsm(std::string, std::ifstream &, std::ofstream &)
void outputBitstreamSLRHeaderAfterBitstreamSequence(std::ofstream &, int, bool, Endianness) override
Definition: XUSP_Output.cpp:74
void assemblerAsmToBit(std::ifstream &, std::ofstream &)
void assembler(std::string, std::string)
void setDeviceByNameOrThrow(std::string) override
void test(bool, bool, uint32_t)
Definition: XUSP_Test.cpp:22
void setDevice(int, std::string="") override
void outputBitstreamEmptySLRHeaderSequence(std::ofstream &, int, bool, Endianness) override
void setDeviceByPartNameOrThrow() override
void blank(std::string)
Definition: XUSP_Blank.cpp:22
void outputBitstreamGlobalHeaderSequence(std::ofstream &, bool, Endianness) override
Written by outputBitstreamSLRHeaderAfterBitstreamSequence(), outputBitstreamEmptySLRHeaderSequence() ...
Definition: XUSP_Output.cpp:29
void assemblerParseHeader(std::ifstream &)
void assemblerAsmTo(std::ifstream &, std::ofstream &)
void initializeResourceStringParameters() override
void change(std::string)
Definition: XUSP_Change.cpp:25
int getDeviceByIDCODEorThrow(int) override
void ensureInitializedBitstreamArrays() override
void writeBitstream(std::string, std::string, Rect2D)
void disassemblerBitToAsm(std::ifstream &, std::ofstream &)
void disassemblerToAsm(std::ifstream &, std::ofstream &)
void setDeviceByIDCODEOrThrow(int) override
int getDeviceByName(std::string) override
void outputBitstreamEmptySLRWrapUpSequence(std::ofstream &, int, bool, Endianness) override
void disassemblerWriteHeader(std::ofstream &)
void assemblerAsmToBin(std::ifstream &, std::ofstream &)
std::string getFrameType(int, int, int) override
void merge(XilinxUltraScalePlus *, std::string, Rect2D, Coord2D)
Definition: XUSP_Merge.cpp:24
void outputBitstreamGlobalFooterSequence(std::ofstream &, bool, Endianness) override
Definition: XUSP_Output.cpp:33
void readBitstream(std::string)
Definition: XUSP_Input.cpp:29
void outputBitstreamSLRWrapUpSequence(std::ofstream &, int, bool, Endianness) override
Definition: XUSP_Output.cpp:88
void outputBitstreamSLRHeaderBitstreamSequence(std::ofstream &, int, bool, Endianness) override
Definition: XUSP_Output.cpp:37
Definition: Coords.h:23
Definition: Coords.h:29