OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [tools/] [src/] [wigen/] [generator.h] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 ring0_mipt
/*
2
 * Copyright (c) 2016 by Alex I. Kuznetsov.
3
 *
4
 * Part of the LXP32 CPU IP core.
5
 *
6
 * This module defines the Generator class which generates
7
 * WISHBONE interconnect VHDL description based on provided
8
 * parameters.
9
 */
10
 
11
#ifndef GENERATOR_H_INCLUDED
12
#define GENERATOR_H_INCLUDED
13
 
14
#include "range.h"
15
 
16
#include <iostream>
17
#include <string>
18
 
19
class Generator {
20
        int _masters;
21
        int _slaves;
22
        int _addrWidth;
23
        int _slaveAddrWidth;
24
        int _portSize;
25
        int _portGranularity;
26
 
27
        std::string _entityName;
28
        bool _pipelinedArbiter;
29
        bool _registeredFeedback;
30
        bool _unsafeDecoder;
31
 
32
        Range _mastersRange;
33
        Range _slavesRange;
34
        Range _addrRange;
35
        Range _slaveAddrRange;
36
        Range _slaveDecoderRange;
37
        Range _dataRange;
38
        Range _selRange;
39
 
40
        bool _fallbackSlave;
41
 
42
public:
43
        Generator();
44
 
45
        void setMasters(int i);
46
        void setSlaves(int i);
47
        void setAddrWidth(int i);
48
        void setSlaveAddrWidth(int i);
49
        void setPortSize(int i);
50
        void setPortGranularity(int i);
51
        void setEntityName(const std::string &str);
52
        void setPipelinedArbiter(bool b);
53
        void setRegisteredFeedback(bool b);
54
        void setUnsafeDecoder(bool b);
55
 
56
        int masters() const;
57
        int slaves() const;
58
        int addrWidth() const;
59
        int slaveAddrWidth() const;
60
        int portSize() const;
61
        int portGranularity() const;
62
        std::string entityName() const;
63
        bool pipelinedArbiter() const;
64
        bool registeredFeedback() const;
65
        bool unsafeDecoder() const;
66
 
67
        void generate(const std::string &filename);
68
 
69
private:
70
        void prepare();
71
        void writeBanner(std::ostream &os);
72
        void writePreamble(std::ostream &os);
73
        void writeEntity(std::ostream &os);
74
        void writeArchitecture(std::ostream &os);
75
 
76
        void writeArbiter(std::ostream &os);
77
        void writeMasterMux(std::ostream &os);
78
        void writeMasterDemux(std::ostream &os);
79
        void writeSlaveMux(std::ostream &os);
80
        void writeSlaveDemux(std::ostream &os);
81
 
82
        static std::string binaryLiteral(int value,int n);
83
        static std::string decodedLiteral(int value,int n);
84
};
85
 
86
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.